Rotations¶
Classes¶
-
class
Rotations.Rotations(data, sel1, sel2, tMax=100, step=1, dPhi=0.5, axis='z', nbrTimeOri=20)¶ This class defines methods to compute rotational relaxation and orientation probabilities.
Some plotting methods are also available to quicly check the results.
Parameters: - data – a Dataset class instance containing trajectories data
- sel1 – first selection corresponding to one end of each vector
- sel2 – second selection for vectors, should be of same size as sel1
- tMax – maximum number of frames to be used
- step – time interval between each computed vectors
- dPhi – angular bin size for orientational probability (in degrees)
- axis – reference axis for orientation probabilities
- nbrTimeOri – number of time origins to be averaged over (optional, default 25)
-
compOrientationalProb()¶ Compute the probability for the vector between sel1 and sel2 to be in a particular orientation. The angle is computed with respect to a given axis. Averaging is performed for each frame between 0 and tMax with given step.
-
compRotationalRelaxation()¶ For each frame in the range of tMax with gieven step, computes the distance vector between sel1 and sel2 and performs scalar product between the first one and all other one. This is averaged over multiple time origins and the obtained correlation is stored in self.rotRelax variable.
References:
- Yu-ling Yeh and Chung-Yuan Mou (1999). Orientational Relaxation Dynamics of Liquid Water Studied by Molecular Dynamics Simulation, J. Phys. Chem. B 1999, 103, 3699-3705.
-
plotOrientationalProb()¶ Used to quickly plot orientational probability
-
plotRotationalRelaxation()¶ Used to quickly plot rotational relaxation function
-
class
Rotations.WaterAtProtSurface(data, protSel='protein', minR=0, maxR=5, maxN=5, frames=None, watVec='D', nbrVox=200, gaussianFiltSize=-1)¶ This class provides way to compute water molecules orientation relative to protein surface.
Basically, for each selected water molecule, approximately 3-7 nearest atoms from protein are selected, their geometric center is computed and the vector between water oxygen and this center defines the normal to protein surface. The dipole moment vector of water molecule is dotted with this normal vector to determine the orientation.
Parameters: - data – a Dataset class instance containing trajectories data
- protSel – selection of protein atoms to be used for calculation
- minR – minimum distance from protein surface for water molecules selection
- maxR – maximum distance from protein surface for water molecules selection
- maxN – maximum number of protein atoms to be used to compute normal to surface
- frames – frames to be used to average orientations
- watVec – vector on water molecule to be used to compute orientation, can be ‘D’ for electric dipole moment, ‘H1’ for O-H1 vector or ‘H2’ for O-H2 vetor.
- nbrVox – number of voxels to be used in each dimensions to generate the volumetric map.
- gaussianFiltSize – possibility to use a gaussian filter on
volumetric map. This calls the
scipy.ndimage.gaussian_filtermethod with default parameter and this argument given for sigma argument. Set it to 1 to not use it.
-
compOrientations()¶ Computes, for all selected water oxygens, the orientation of the dipole moment vector relative to protein surface.
This generates a volumetric dataset of size nbrVox x nbrVox x nbrVox, in which each voxel carries a value corresponding to the angle.
-
generateVolMap(align=False)¶ Generates a volumetric map with water orientations relative to protein surface.
First, if align keyword is set to True, protein structures are aligned for all frames. Else, only center of mass are aligned.
Then water molecules are moved based on periodic boundary conditions applied on distance between water oxygen and closest protein atom, such that the volumetric map corresponds to the positions computed with :py:meth:compOrientations .
Eventually, for each voxel, orientation of water molecules present in the voxel limits is averaged over all frames.
Using
writeVolMap(), a .pdb file and a .dx file are created and can be directly imported into VMD to visualize average orientation for each voxel.
-
getAutoCorr(dr=0.2, nbrBins=100)¶ Computes the autocorrelation function of water orientation distribution as a function of the distance r. The bins are given by taking the range between minR and maxR with step dr. The distributions \(\rho(r)\) are computed for all waters whose distance lie within the given bin edges. Then autocorrelation is computed as:
\[C(\Delta r) = \frac{\sum_{angles} \rho(r_{0}) \rho(r_{0} + \Delta r)} {\sum_{angles} \rho(r_{0})\rho(r_{0})}\]Parameters: dr – distance step to be used between each distribution \(\rho(r)\) :arg nbrBins: number of bins to use to compute orientation distributions
Returns: a tuple containing an array of bin edges, and an array of correlations
-
getDistEntropy(dr=0.2, nbrBins=100)¶ Computes the entropy of water orientation distribution as a function of the distance r. The bins are given by taking the range between minR and maxR with step dr. The distributions \(\rho(r)\) are computed for all waters whose distance lie within the given bin edges. Then entropy is computed using scipy entropy routine.
Parameters: - dr – distance step to be used between each distribution \(\rho(r)\)
- nbrBins – number of bins to use to compute orientation distributions
Returns: a tuple containing an array of bin edges, and an array of entropies
-
getOrientations(nbrBins=100, frames=None)¶ Computes the distribution of orientations between -1 and 1 given the number of nbrBins and for given frames.
Parameters: - nbrBins – number of bins to use
- frames – frames to be used (either None for all frames, or slice/range/list)
Returns: a tuple containing the bin edges and the orientation density
-
plotAutoCorr(dr=0.2, nbrBins=100)¶ Plot the auto-correlation function of water orientation distribution as a function of distance r. This calls the
getAutoCorr()method with given arguments.
-
plotDistEntropy(dr=0.2, nbrBins=100)¶ Plot the entropy of water orientation distribution as a function of distance r. This calls the
getDistEntropy()method with given arguments.
-
plotOrientations(nbrBins=100, frames=None, kwargs={'lw': 1})¶ Plots orientations of water molecule, within the range (minR, maxR) for given frame.
Parameters: - nbrBins – number of bins to use
- frames – frames to be used (either None for all frames, or slice/range/list)
- kwargs – additional keywords arguments to give to matplotlib plot and fill_between functions
-
writeVolMap(fileName=None, frame=0, pFrames=None)¶ Write the volumetric map containing averaged water orientations relative to protein surface.
The file is in the APBS .dx format style, so that it can be imported directly into VMD. Moreover, a pdb file is also generated containing frame averaged coordinates for aligned protein.
Parameters: - fileName – file name for .pdb and .dx files. If none, the name of the loaded .psf file is used.
- frame – frame to be used to generate the pdb file
- pFrames – if not None, this will be used instead for protein frame selection and the resulting coordinates will be an average over all selected frames