discrete_pos

Create a discrete position trajectory.

Discretize the positions of compounds of a MDAnalysis AtomGroup in a given spatial direction.

Todo

Options

-f

Trajectory file. See supported coordinate formats of MDAnalysis.

-s

Topology file. See supported topology formats of MDAnalysis.

-o

Output filename for the discrete trajectory. The discrete trajectory is written as binary dtrj.npy file in a a compressed .npz archive of the given filename. The discrete trajectory is stored as numpy.ndarray of dtype numpy.uint32 and shape (n, f), where n is the number of reference compounds and f is the number of frames. The elements of the discrete trajectory are the states in which a given compound resides at a given frame.

--bins-out

Output filename for the bin edges (optional). If provided, the (average) bin edges used for creating the discrete trajectory are written to a text file of the given filename.

-b

First frame to read from the trajectory. Frame numbering starts at zero. Default: 0.

-e

Last frame to read from the trajectory. This is exclusive, i.e. the last frame read is actually END - 1. A value of -1 means to read the very last frame. Default: -1.

--every

Read every n-th frame from the trajectory. Default: 1.

-sel

Selection string to select a group of atoms for the analysis. See MDAnalysis’ selection syntax for possible choices.

--cmp

{‘group’, ‘segments’, ‘residues’, ‘fragments’, ‘atoms’}

The compounds of the selection group whose center of mass positions should be discretized. Compounds can be ‘group’ (the entire selection group), ‘segments’, ‘residues’, ‘fragments’, or ‘atoms’. Refer to the MDAnalysis’ user guide for an explanation of these terms. Compounds are made whole before calculating their centers of mass. The centers of mass are wrapped back into the primary unit cell before discretizing their positions. Note that in any case, even if CMP is e.g. ‘residues’, only the atoms belonging to the selection group are taken into account, even if the compound might comprise additional atoms that are not contained in the selection group. Default: 'atoms'.

-d

{‘x’, ‘y’, ‘z’}

Direction. The spatial direction in which to bin the positions of the reference compounds. Default: 'z'.

--bin-start

Point (in Angstrom) on the chosen spatial direction to start binning. Note that binning naturally starts at zero (origin of the simulation box). If parsing a start value greater than zero, the first bin interval will be [0, START). In this way you can determine the width of the first bin independently from the other bins. Note that START must lie within the simulation box obtained from the first frame read and it must be smaller than STOP. Default: 0

--bin-end

Point (in Angstrom) on the chosen spatial direction to stop binning. Note that binning naturally ends at lbox + tol (length of the simulation box in the given spatial direction plus a small tolerance to account for the right-open bin interval). If parsing a value less than lbox, the last bin interval will be [STOP, lbox+tol). In this way you can determine the width of the last bin independently from the other bins. Note that STOP must lie within the simulation box obtained from the first frame read and it must be greater than START. Default: lbox + tol.

--bin-num

Number of equidistant bins (not bin edges!) to use for discretizing the given spatial direction between START and STOP. Note that two additional bins, [0, START) and [STOP, lbox+tol), are created if START is not zero and STOP is not lbox. Default: 10.

--bins

Text file containing custom bin edges (in Angstrom). Bin edges are read from the first column, characters following a ‘#’ are ignored. Bins do not need to be equidistant. All bin edges must lie within the simulation box as obtained from the first frame read. The given bin edges are sorted in ascending order and and duplicate bin edges are removed. If --bins is given, it takes precedence over all other --bin* flags.

--tol

The tolerance value added to lbox to account for the right-open bin interval of the last bin. Default: 1e-6.

--debug

Run in debug mode.

See also

mdtools.structure.discrete_pos_trj()

Function that creates a discrete position trajectory

scripts.discretization.plot_discrete_pos_trj

Plot in which discrete position bin a compounds resides as function of time

Notes

This script simply calls mdtools.structure.discrete_pos_trj() and writes its output to disk.

The simulation box must be orthogonal, otherwise the discretization of the center of mass positions of the reference compounds does not work. For more details about the discretization see the Notes section of mdtools.structure.discrete_pos_trj().