9.1.3. Compute observable timeseries from trajectories — MDAnalysis.core.Timeseries
¶
Deprecated since version 0.16.2: The Timeseries functionality (in particular correl) will be removed in the
0.17 release. See issue #1372 for more details.
To extract coordinates efficiently one can use
MDAnalysis.analysis.base.AnalysisFromFunction
as shown in
Creating an in-memory trajectory with AnalysisFromFunction.
The collection of timeseries (such as Atom
, Bond
,
Dihedral
…) can be computed from a trajectory in one go, foregoing
the need to iterate through the trajectory frame by frame in python. Inspired
by CHARMM’s correl command.
The disadvantage is that the timeseries ‘plugins’ must be implemented
in C-code. Hence not all trajectory readers (see MDAnalysis.coordinates
)
support them.
9.1.3.1. Basic classes¶
-
class
MDAnalysis.core.Timeseries.
Timeseries
(*args, **kwds)[source]¶ Base timeseries class - define subclasses for specific timeseries computations.
Deprecated since version 0.16.2: The Timeseries functionality (in particular correl) will be removed in the 0.17 release. See issue #1372 for more details. Use
MDAnalysis.analysis.base.AnalysisFromFunction
instead.__init__ is deprecated! This class will be removed in 0.17
-
shape
¶ shape tuple of the underlying numpy array
-
-
class
MDAnalysis.core.Timeseries.
TimeseriesCollection
(*args, **kwds)[source]¶ A collection of timeseries objects.
The collection of timeseries (such as Atom, Bond, Dihedral…) can be computed from a trajectory in one go, foregoing the need to iterate through the trajectory frame by frame in python. Inspired by CHARMM’s correl command.
The disadvantage is that the timeseries ‘plugins’ must be implemented in C-code.
collection = TimeseriesCollection() collection.addTimeseries(Timeseries.Atom(...)) - add a new Timeseries object collection.compute(...) - compute the collection of timeseries from the trajectory collection.clear() - clear the collection collection[i] - access the i'th timeseries len(collection) - return the number of Timeseries added to the collection
Deprecated since version 0.16.2: The Timeseries functionality (in particular correl) will be removed in the 0.17 release. See issue #1372 for more details. Use
MDAnalysis.analysis.base.AnalysisFromFunction
instead.__init__ is deprecated! This class will be removed in 0.17
-
compute
(trj, start=None, stop=None, skip=None, step=None)[source]¶ Iterate through the trajectory trj and compute the time series.
- trj
- dcd trajectory object (i.e.
Universe.trajectory
) - start
- First frame of trajectory to analyse, Default: None becomes 0.
- stop
- Frame index to stop analysis. Default: None becomes n_frames. Iteration stops before this frame number, which means that the trajectory would be read until the end.
- step
- Step between frames to analyse, Default: None becomes 1.
- Deprecated
- Skip is deprecated in favor of step.
-
9.1.3.2. Timeseries of observables¶
-
class
MDAnalysis.core.Timeseries.
Atom
(*args, **kwds)[source]¶ Create a timeseries that returns coordinate data for an atom or group of atoms
t = Atom(code, atoms) *code* is one of 'x', 'y', 'z', or 'v' ('vector', which returns all three dimensions) *atoms* can be a single :class:`~MDAnalysis.core.groups.Atom` object, a list of :class:`~MDAnalysis.core.groups.Atom` objects, or an :class:`~MDAnalysis.core.groups.AtomGroup`
Deprecated since version 0.16.2: The Timeseries functionality (in particular correl) will be removed in the 0.17 release. See issue #1372 for more details. Use
MDAnalysis.analysis.base.AnalysisFromFunction
instead.__init__ is deprecated! This class will be removed in 0.17
-
class
MDAnalysis.core.Timeseries.
Bond
(*args, **kwds)[source]¶ Create a timeseries that returns a timeseries for a bond
t = Bond(atoms)atoms must contain 2
Atom
instances, either as a list or anAtomGroup
Deprecated since version 0.16.2: The Timeseries functionality (in particular correl) will be removed in the 0.17 release. See issue #1372 for more details. Use
MDAnalysis.analysis.base.AnalysisFromFunction
instead.__init__ is deprecated! This class will be removed in 0.17
-
class
MDAnalysis.core.Timeseries.
Angle
(*args, **kwds)[source]¶ Create a timeseries that returns a timeseries for an angle
t = Angle(atoms)atoms must contain 3
Atom
instances, either as a list or anAtomGroup
Deprecated since version 0.16.2: The Timeseries functionality (in particular correl) will be removed in the 0.17 release. See issue #1372 for more details. Use
MDAnalysis.analysis.base.AnalysisFromFunction
instead.__init__ is deprecated! This class will be removed in 0.17
-
class
MDAnalysis.core.Timeseries.
Dihedral
(*args, **kwds)[source]¶ Create a timeseries that returns a timeseries for a dihedral angle
t = Dihedral(atoms)atoms must contain 4
Atom
objects, either as a list or anAtomGroup
Deprecated since version 0.16.2: The Timeseries functionality (in particular correl) will be removed in the 0.17 release. See issue #1372 for more details. Use
MDAnalysis.analysis.base.AnalysisFromFunction
instead.__init__ is deprecated! This class will be removed in 0.17
-
class
MDAnalysis.core.Timeseries.
Distance
(*args, **kwds)[source]¶ Create a timeseries that returns distances between 2 atoms
t = Distance(code, atoms)code is one of ‘d’ (distance vector), or ‘r’ (scalar distance) atoms must contain 2
Atom
objects, either as a list or anAtomGroup
Deprecated since version 0.16.2: The Timeseries functionality (in particular correl) will be removed in the 0.17 release. See issue #1372 for more details. Use
MDAnalysis.analysis.base.AnalysisFromFunction
instead.__init__ is deprecated! This class will be removed in 0.17
-
class
MDAnalysis.core.Timeseries.
CenterOfGeometry
(*args, **kwds)[source]¶ Create a timeseries that returns the center of geometry of a group of atoms
t = CenterOfGeometry(atoms)atoms can be a list of
Atom
objects, or aAtomGroup
Deprecated since version 0.16.2: The Timeseries functionality (in particular correl) will be removed in the 0.17 release. See issue #1372 for more details. Use
MDAnalysis.analysis.base.AnalysisFromFunction
instead.__init__ is deprecated! This class will be removed in 0.17
-
class
MDAnalysis.core.Timeseries.
CenterOfMass
(*args, **kwds)[source]¶ Create a timeseries that returns the center of mass of a group of atoms
t = CenterOfMass(atoms)atoms can be a list of
Atom
objects or aAtomGroup
Deprecated since version 0.16.2: The Timeseries functionality (in particular correl) will be removed in the 0.17 release. See issue #1372 for more details. Use
MDAnalysis.analysis.base.AnalysisFromFunction
instead.__init__ is deprecated! This class will be removed in 0.17
-
class
MDAnalysis.core.Timeseries.
WaterDipole
(*args, **kwds)[source]¶ Create a Timeseries that returns a timeseries for the bisector vector of a 3-site water
d = WaterDipole(atoms)atoms must contain 3
Atom
objects, either as a list or anAtomGroup
; the first one must be the oxygen, the other two are the hydrogens.The vector
d
, multiplied by the partial charge on the oxygen atom (e.g. q = -0.0.834 for TIP3P water), gives the actual dipole moment.The vector is calculated from the positions of the oxygen atom (\(\mathbf{x}_{\text{O}}\)) and the two hydrogen atoms (\(\mathbf{x}_{\text{H}_1}\), \(\mathbf{x}_{\text{H}_2}\)) as
\[\mathbf{d} = \mathbf{x}_{\text{O}} - \frac{1}{2}(\mathbf{x}_{\text{H}_1} + \mathbf{x}_{\text{H}_2})\]and the dipole moment vector is
\[\boldsymbol{\mu} = q_{\text{O}} \mathbf{d}\]Note
This will only work for water models that have half of the oxygen charge on each hydrogen. The vector \(\mathbf{d}\) has the opposite direction of the dipole moment; multiplying with the oxygen charge (\(q_{\text{O}}<0\)) will flip the direction and produce the correct orientation.
There are no sanity checks; if the first atom in a water molecule is not oxygen then results will be wrong.
Deprecated since version 0.16.2: The Timeseries functionality (in particular correl) will be removed in the 0.17 release. See issue #1372 for more details. Use
MDAnalysis.analysis.base.AnalysisFromFunction
instead.__init__ is deprecated! This class will be removed in 0.17