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:
AnalysisBaseDetermines 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
mobileas the reference. (Sub-)structures of both themobileandreferencetrajectories can be selected for the analysis using standard MDAnalysis selection language. The selectedAtomGroupis centered before the optimal rotations are calculated, which are collected in theresults.orientationsattribute 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:
- mobile
AtomGrouporUniverse Trajectory along which the orientations are to be computed.
- reference
AtomGrouporUniverse, optional The reference structure.
- select
strortupleordict, 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 bothmobileandreference. To apply different selections, specify a 2-tupleof selection strings; the first string is applied tomobile, the second toreference. Alternatively, specify a dictionary with the keys ‘mobile’ and ‘reference’ mapped to selection strings formobileandreference. After the selection has been applied, there must be a one-to-one correspondence of atoms inmobileto atoms inreference.- weights
Noneor ‘mass’ orarray_like, default: ‘mass’ Weights to be used for determining the orientations. If
None, use equal weights. If ‘mass’, use the atom masses defined inreference(default). Use custom weights by providing anarray_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
Noneor ‘mass’ orarray_like, default: ‘weights’ Weights to be used for centering. If ‘weights’, the same weights are used as specified in the
weightsoption (default). Otherwise, custom weights can be specified (seeweightsoption). 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
mobileandreferencebased on the residue names and atom masses usingMDAnalysis.analysis.align.get_matching_atoms().- tol_mass
float, default: 0.1 Tolerance in mass for identifying identical atoms. Only used if
verify_matchis set toTrue.- strictbool, default:
True Only used if verify_match is set to
True. IfTrue, raise an error if a residue is missing an atom. IfFalse, ignore residues with missing atoms in the analysis.- verbosebool, default:
False Show detailed progress if set to
True.
- mobile
- Attributes:
- results.orientations
ndarray, shape (n_frames, 3, 3) Orientations represented as an array of rotation matrices.
- results.orientations
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:
- start
int, optional Start frame of analysis.
- stop
int, optional Stop frame of analysis.
- step
int, optional Number of frames to skip between each analysed frame.
- framesarray_like, optional
Array of integers or booleans to slice trajectory;
framescan only be used instead ofstart,stop, andstep. Setting bothframesand at least one ofstart,stop,stepto a non-default value will raise aValueError.- verbosebool, optional
Turn on verbosity.
- progressbar_kwargs
dict, optional ProgressBar keywords with custom parameters regarding progress bar position, etc; see
MDAnalysis.lib.log.ProgressBarfor full list.- backend
stror subclass ofBackendBase, default ‘serial’ Backend to be used for analysis. Supported backends are listed in the
parallelizableproperty of theOrientationsclass. Otherwise, a custom backend that is a subclass ofBackendBasemay be provided, but then theunsupported_backendflag must be set.- n_workers
int 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_parts
int, 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
Trueto run with a custom backend.
- start