rd.Orientations#

class RotationalDiffusion.orientations.Orientations(mobile, reference=None, select='all', weights='mass', center=True, centering_weights='weights', unwrap=True, verify_match=True, tol_mass=0.1, strict=True, verbose=False)[source]#

Bases: AnalysisBase

Determines the orientation of a molecular structure along the trajectory.

This class calculates the optimal rotations that minimize the RMSD between each trajectory frame and a reference structure after removing translation. If the reference structure is not explicitly specified, the analysis will use the current trajectory frame of mobile as the reference. (Sub-)structures of both the mobile and reference trajectories can be selected for the analysis using standard MDAnalysis selection language. The selected AtomGroup is centered before the optimal rotations are calculated, which are collected in the results.orientations attribute of this class. Centering may be turned off to speed up the calculation, but therefore the trajectories must already be centered.

Prior to the main analysis step, periodic boundary conditions are treated by unwrapping the trajectory. The analysis is significangly faster when unwrapping is turned off, but therefore the trajectories must already be unwrapped.

Parameters:
mobileAtomGroup or Universe

Trajectory along which the orientations are to be computed.

referenceAtomGroup or Universe, optional

The reference structure.

selectstr or tuple or dict, default: ‘all’

Selection string(s) defining the AtomGroup(s) to be used for the analysis. The string(s) must follow the MDAnalysis selection syntax . If a single string is provided, it is applied to both mobile and reference. To apply different selections, specify a 2-tuple of selection strings; the first string is applied to mobile, the second to reference. Alternatively, specify a dictionary with the keys ‘mobile’ and ‘reference’ mapped to selection strings for mobile and reference. After the selection has been applied, there must be a one-to-one correspondence of atoms in mobile to atoms in reference.

weightsNone or ‘mass’ or array_like, default: ‘mass’

Weights to be used for determining the orientations. If None, use equal weights. If ‘mass’, use the atom masses defined in reference (default). Use custom weights by providing an array_like, which must contain one weight for each selected atom.

centerbool, default: True

Center molecules. Only deactivate if molecules are already centered.

centering_weights‘weights’ or None or ‘mass’ or array_like, default: ‘weights’

Weights to be used for centering. If ‘weights’, the same weights are used as specified in the weights option (default). Otherwise, custom weights can be specified (see weights option). If masses are used for centering, the obtained orientations describe rotations around the center-of-mass. Similarly, if equal weights are used here, the orientations describe rotations around the center-of-geometry.

unwrapbool, default: True

Unwrap molecules to repair broken structures due to periodic boundary conditions. Only deactivate if molecules are already whole.

verify_matchbool, default: True

Whether to verify the one-to-one atom mapping of mobile and reference based on the residue names and atom masses using MDAnalysis.analysis.align.get_matching_atoms().

tol_massfloat, default: 0.1

Tolerance in mass for identifying identical atoms. Only used if verify_match is set to True.

strictbool, default: True

Only used if verify_match is set to True. If True, raise an error if a residue is missing an atom. If False, ignore residues with missing atoms in the analysis.

verbosebool, default: False

Show detailed progress if set to True.

Attributes:
results.orientationsndarray, shape (n_frames, 3, 3)

Orientations represented as an array of rotation matrices.

Methods

run(**kwargs)

Perform the calculation.

Notes

This class uses the machinery of MDAnalysis. In each frame, Theobald’s QCP method is used to determine the orientation, i.e., the rotation matrix that minimizes the RMSD between mobile and reference after removing translational motion. [1][2]

Follows loosely the AlignTraj class and RMSD class implementations in MDAnalysis 2.7.

References

run(**kwargs)[source]#

Perform the calculation.

Parameters:
startint, optional

Start frame of analysis.

stopint, optional

Stop frame of analysis.

stepint, optional

Number of frames to skip between each analysed frame.

framesarray_like, optional

Array of integers or booleans to slice trajectory; frames can only be used instead of start, stop, and step. Setting both frames and at least one of start, stop, step to a non-default value will raise a ValueError.

verbosebool, optional

Turn on verbosity.

progressbar_kwargsdict, optional

ProgressBar keywords with custom parameters regarding progress bar position, etc; see MDAnalysis.lib.log.ProgressBar for full list.

backendstr or subclass of BackendBase , default ‘serial’

Backend to be used for analysis. Supported backends are listed in the parallelizable property of the Orientations class. Otherwise, a custom backend that is a subclass of BackendBase may be provided, but then the unsupported_backend flag must be set.

n_workersint

Positive integer with number of workers (processes, in case of built-in backends) to split the work between. Only available for backends other than ‘serial’.

n_partsint, optional

Number of parts to split computations across. Can be more than number of workers. Only available for backends other than ‘serial’.

unsupported_backendbool, default False

Must be set to True to run with a custom backend.