# Knot complexity scripts¶

A set of small utilities to analyze knot complexity

knotAnalysis.getKnotNumber(data, evalAt=-1.1)[source]

A wrapper to code which gets knotting number of a polymer

Parameters: data : an (nx3) or (3xn) array of points evalAt : float A number to evaluate Alexanders(x) * Alexandrs(1/x) You can use -1 or -1.1 - these are classics
knotAnalysis.expandPolymerRing(data, mode='auto', steps=20)[source]

Expands polymer ring or chain using OpenMM.

Parameters: data : Nx3 or 3xN array of coordinates Input coordinates of the polymer mode : str, optional “ring”, or “chain”, default - autodetect
knotAnalysis.analyzeKnot(data, useOpenmm=False, simplify=True, evalAt=-1.1, lock=None, offset=0, stepMult=1)[source]

Takes a polymer ring or chain, and analyzes knot number

Parameters: data : (nx3) or (3xn) array Input data to analyze useOpenmm : bool If True, first simplify the polymer with OpenMM. Note that this may unfold chains a little bit. evalAt : float Evaluate A(x) * A(1/x). Use x=-1, or x=-1.1 lock : lock object Lock object to prevent concurrent use of OpenMM Use this if you use multithreading I prefer multiprocessing.Pool.map, and multiprocessing.Manager.Lock() offset : int (optional) OpenMM is usually adjusted to kick in only for sufficiently complex knots. OpenMM would not start for knots which simplify to less than 250 monomers. However, sometimes knot calculation may take longer than expected. This is, for example, relevant for very knotted short polymers. Then you can set offset to a negative number to let OpenMM kick in earlier. Or set it to a positive number to let it kick in later. If offset is -100, then OpenMM will start working when a polymer is simplified only to 150 monomers, not to 250. stepMult : float (optional) Multiplies the number of steps which OpenMm will do. OpenMM is run for some time. If you want to reduce or increase this time, You can use this flag. The main purpose would be to trigger OpenMM early, but let it run for less. Setting stepMult to 0.25 will do four times less OpenMM. Setting it to 2 would make twice the amount of OpenMM

#### Previous topic

Building contactmaps

Analysis scripts