Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion package/MDAnalysis/analysis/msd.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,34 @@

In MDAnalysis you can use the
:class:`~MDAnalysis.transformations.nojump.NoJump`
transformation.
transformation to unwrap coordinates on-the-fly.

A minimal example:

.. code-block:: python

import MDAnalysis as mda
from MDAnalysis.transformations import NoJump

u = mda.Universe(TOP, TRAJ)

# Apply NoJump transformation to unwrap coordinates
u.trajectory.add_transformations(NoJump(u))

# Now the trajectory is unwrapped and MSD can be computed normally:
from MDAnalysis.analysis.msd import EinsteinMSD
MSD = EinsteinMSD(u, select="all", msd_type="xyz")
MSD.run()

This example assumes that the trajectory contains periodic box
dimensions. If no periodic boundary information is present, box
dimensions must be defined before applying ``NoJump``, which can
be accomplished by applying the
:class:`~MDAnalysis.transformations.boxdimensions.set_dimensions`
transformation *before* the
:class:`~MDAnalysis.transformations.nojump.NoJump` transformation.

This replaces the need to preprocess trajectories externally.

In GROMACS, for example, this can be done using `gmx trjconv`_ with the
``-pbc nojump`` flag.
Expand Down
Loading