mdgo.msd module

This module implements functions for calculating meen square displacement (MSD).

mdgo.msd.total_msd(nvt_run, start, stop, select='all', msd_type='xyz', fft=True)[source]

From a MD Universe, calculates the MSD array of a group of atoms defined by select.

Parameters
  • nvt_run (Universe) – An MDAnalysis Universe containing unwrapped trajectory.

  • start (int) – Start frame of analysis.

  • stop (int) – End frame of analysis.

  • select (str) – A selection string. Defaults to “all” in which case all atoms are selected.

  • msd_type (str) – Desired dimensions to be included in the MSD. Defaults to ‘xyz’.

  • fft (bool) – Whether to use FFT to accelerate the calculation. Default to True.

Return type

numpy.ndarray

Warning

To correctly compute the MSD using this analysis module, you must supply coordinates in the unwrapped convention. That is, when atoms pass the periodic boundary, they must not be wrapped back into the primary simulation cell.

Note

The built in FFT method is under construction.

Return type

ndarray

Returns

An array of calculated MSD.

Parameters
  • nvt_run (MDAnalysis.Universe) –

  • start (int) –

  • stop (int) –

  • select (str) –

  • msd_type (str) –

  • fft (bool) –

mdgo.msd.msd_from_frags(coord_list, largest)[source]

Calculates the MSD using a list of fragments of trajectory with the conventional algorithm.

Parameters
  • coord_list (List[ndarray]) – A list of trajectory.

  • largest (int) – The largest interval of time frame for calculating MSD.

Return type

ndarray

Returns

The MSD series.

mdgo.msd.states_coord_array(nvt_run, atom, select_dict, distance, run_start, run_end, binding_site='anion')[source]

Cuts the trajectory of an atom into fragments. Each fragment contains consecutive timesteps of coordinates of the atom in either attached or free state. The Attached state is when the atom coordinates with the binding_site species (distance < distance), and vice versa for the free state. TODO: check if need wrapped trj

Parameters
  • nvt_run (Universe) – An MDAnalysis Universe containing unwrapped trajectory.

  • atom (Atom) – The Atom object to analyze.

  • select_dict (Dict[str, str]) – A dictionary of atom species selection, where each atom species name is a key and the corresponding values are the selection language.

  • distance (float) – The coordination cutoff distance.

  • run_start (int) – Start frame of analysis.

  • run_end (int) – End frame of analysis.

  • binding_site (str) – The species the atom coordinates to.

Return type

Tuple[List[ndarray], List[ndarray]]

Returns

Two list of coordinates arrays containing where each coordinates array is a consecutive trajectory fragment of atom in a certain state. One for the attached state, the other for the free state.

mdgo.msd.partial_msd(nvt_run, atoms, largest, select_dict, distance, run_start, run_end, binding_site='anion')[source]

Calculates the mean square displacement (MSD) of the atoms according to coordination states. The returned free_data include the MSD when atoms are not coordinated to binding_site. The attach_data includes the MSD of atoms are not coordinated to binding_site.

Parameters
  • nvt_run (Universe) – An MDAnalysis Universe containing unwrapped trajectory.

  • atoms (AtomGroup) – The AtomGroup for

  • largest (int) – The largest interval of time frame for calculating MSD.

  • select_dict (Dict[str, str]) – A dictionary of atom species selection, where each atom species name is a key and the corresponding values are the selection language.

  • distance (float) – The coordination cutoff distance between

  • run_start (int) – Start frame of analysis.

  • run_end (int) – End frame of analysis.

  • binding_site (str) – The species the atoms coordinates to.

Return type

Tuple[Optional[List[ndarray]], Optional[List[ndarray]]]

Returns

Two arrays of MSD in the trajectory