Table Of Contents

Previous topic

7.3. Atom selection Hierarchy — MDAnalysis.core.Selection

Next topic

7.5. Fast distance array computation — MDAnalysis.core.distances

This Page

7.4. Compute observable timeseries from trajectories — MDAnalysis.core.Timeseries

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.

7.4.1. Basic classes

class MDAnalysis.core.Timeseries.Timeseries(code, atoms, dsize)

Base timeseries class - define subclasses for specific timeseries computations

shape

shape tuple of the underlying numpy array

class MDAnalysis.core.Timeseries.TimeseriesCollection

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
addTimeseries(ts)

add a Timeseries object to the collection

clear()

clear the timeseries collection

compute(trj, start=0, stop=-1, skip=1)

trj - dcd trajectory object (ie universe.dcd) start, stop, skip and self explanatory, although it is important to note that start and stop are inclusive

7.4.2. Timeseries of observables

class MDAnalysis.core.Timeseries.Atom(code, atoms)

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 Atom object, a list of Atom objects, or an AtomGroup

class MDAnalysis.core.Timeseries.Bond(atoms)

Create a timeseries that returns a timeseries for a bond

t = Bond(atoms)

atoms must contain 2 Atoms, either as a list or an AtomGroup

class MDAnalysis.core.Timeseries.Angle(atoms)

Create a timeseries that returns a timeseries for an angle

t = Angle(atoms)

atoms must contain 3 Atoms, either as a list or an AtomGroup

class MDAnalysis.core.Timeseries.Dihedral(atoms)

Create a timeseries that returns a timeseries for a dihedral angle

t = Dihedral(atoms)

atoms must contain 4 Atoms, either as a list or an AtomGroup

class MDAnalysis.core.Timeseries.Distance(code, atoms)

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 Atoms, either as a list or an AtomGroup

class MDAnalysis.core.Timeseries.CenterOfGeometry(atoms)

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 an AtomGroup

class MDAnalysis.core.Timeseries.CenterOfMass(atoms)

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 an AtomGroup

class MDAnalysis.core.Timeseries.PrincipleAxis(atoms)

Create a timeseries that returns the principle axis for a group of atoms

t = principleAxis(atoms)

atoms can be a list of Atom objects, or an AtomGroup

class MDAnalysis.core.Timeseries.WaterDipole(atoms)

Create a Timeseries that returns a timeseries for the dipole vector of a 3-site water

t = WaterDipole(atoms)

atoms must contain 3 Atoms, either as a list or an AtomGroup; the first one MUST be the oxygen, the other two are the hydrogens. The vector is calculated as

d = xO + (xH1 - xH2)/2