pwtools.crys.rmsd¶
- pwtools.crys.rmsd(traj, ref_idx=0)[source]¶
Root mean square distance over an MD trajectory.
The normalization constant is the number of atoms. Takes the RMS of the difference of cartesian coords at each time step. Only meaningful if
tr.coords
are not pbc-wrapped.- Parameters:
traj (Trajectory object)
ref_idx (int, optional) – time index of the reference structure (i.e. 0 to compare with the start structure, -1 for the last along axis).
- Returns:
rmsd
- Return type:
1d array (traj.nstep,)
Examples
>>> # We only need traj.{coords,nstep,timeaxis}, no symbols, cell, ... >>> traj = crys.Trajectory(coords=rand(500,10,3)) >>> # The RMSD w.r.t. the start structure. See when the structure starts to >>> # "converge" to a stable mean configuration during an MD. >>> rmsd(traj, ref_idx=0) >>> # For a relaxation run, the RMSD w.r.t. the final converged structure. The >>> # RMSD should converge to zero here. >>> rmsd(traj, ref_idx=-1)