Classes to read and write LAMMPS DCD binary trajectories. Trajectories can be read regardless of system-endianness as this is auto-detected.
LAMMPS can write DCD trajectories but unlike a CHARMM trajectory (which is often called a DCD even though CHARMM itself calls them “trj”) the time unit is not fixed to be the AKMA time unit (20 AKMA is 0.978 picoseconds or 1 AKMA = 4.888821e-14 s) but can depend on settings in LAMMPS. The most common case appears to be that the time step is actually recorded in picoseconds. Other cases are unit-less Lennard-Jones time units.
This presents a problem for MDAnalysis because it cannot autodetect the unit from the file. By default we are assuming that the unit for length is the ångström and for the time is the picosecond. If this is not true then the user should supply the appropriate units in the as keywords timeunit and/or lengthunit to DCDWriter and DCDReader.
Note
Lennard-Jones units are not implemented. See MDAnalysis.core.units for other recognized values.
LAMMPS trajectory time step
Make a new Timestep containing a subset of the original Timestep.
ts.copy_slice(slice(start, stop, skip)) ts.copy_slice([list of indices])
Returns: | A Timestep object of the same type containing all header information and all atom information relevent to the selection. |
---|
Note
The selection must be a 0 based slice or array of the atom indices in this Timestep
New in version 0.8.
unitcell dimensions (A, B, C, alpha, beta, gamma)
lengths a, b, c are in the MDAnalysis length unit (Å), and angles are in degrees.
dimensions is read-only because it transforms the actual format of the unitcell (which differs between different trajectory formats) to the representation described here, which is used everywhere in MDAnalysis.
volume of the unitcell
Read a LAMMPS DCD trajectory.
The units can be set from the constructor with the keyword arguments timeunit and lengthunit. The defaults are “ps” and “Angstrom”. See MDAnalysis.core.units for other recognized values.
Returns a writer appropriate for filename.
Sets the default keywords start, step and delta (if available). numatoms is always set from Reader.numatoms.
See also
Reader.Writer() and MDAnalysis.Writer()
Returns a DCDWriter for filename with the same parameters as this DCD.
All values can be changed through keyword arguments.
Arguments: |
|
---|---|
Keywords: |
|
Returns: |
Note
The keyword arguments set the low-level attributes of the DCD according to the CHARMM format. The time between two frames would be delta * step !
Specific implementation of trajectory closing.
In-place conversion of forces array force from native units to base units.
By default, the input force is modified in place and also returned.
New in version 0.7.7.
In-place conversion of force array force from base units to native units.
By default, the input force is modified in place and also returned.
New in version 0.7.7.
In-place conversion of coordinate array x from native units to base units.
By default, the input x is modified in place and also returned.
Changed in version 0.7.5: Keyword inplace can be set to False so that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
Conversion of coordinate array x from base units to native units.
By default, the input x is modified in place and also returned.
Changed in version 0.7.5: Keyword inplace can be set to False so that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
Convert time t from native units to base units.
By default, the input t is modified in place and also returned (although note that scalar values t are passed by value in Python and hence an in-place modification has no effect on the caller.)
Changed in version 0.7.5: Keyword inplace can be set to False so that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
Convert time t from base units to native units.
By default, the input t is modified in place and also returned. (Also note that scalar values t are passed by value in Python and hence an in-place modification has no effect on the caller.)
Changed in version 0.7.5: Keyword inplace can be set to False so that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
In-place conversion of velocities array v from native units to base units.
By default, the input v is modified in place and also returned.
New in version 0.7.5.
In-place conversion of coordinate array v from base units to native units.
By default, the input v is modified in place and also returned.
New in version 0.7.5.
Populate a TimeseriesCollection object with timeseries computed from the trajectory
Arguments: |
|
---|
Time between two trajectory frames in picoseconds.
Frame number of the current time step.
This is a simple short cut to Timestep.frame.
Forward one step to next frame.
Position at beginning of trajectory
Time of the current frame in MDAnalysis time units (typically ps).
time = Timestep.frame * Reader.dt
Return a subset of coordinate data for an AtomGroup
Arguments: |
|
---|
Total length of the trajectory numframes * dt.
Write a LAMMPS DCD trajectory.
The units can be set from the constructor with the keyword arguments timeunit and lengthunit. The defaults are “ps” and “Angstrom”. See MDAnalysis.core.units for other recognized values.
Close trajectory and flush buffers.
Specific implementation of trajectory closing.
Read dimensions from timestep ts and return appropriate unitcell as [A,alpha,B,beta,gamma,C]
In-place conversion of forces array force from native units to base units.
By default, the input force is modified in place and also returned.
New in version 0.7.7.
In-place conversion of force array force from base units to native units.
By default, the input force is modified in place and also returned.
New in version 0.7.7.
In-place conversion of coordinate array x from native units to base units.
By default, the input x is modified in place and also returned.
Changed in version 0.7.5: Keyword inplace can be set to False so that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
Conversion of coordinate array x from base units to native units.
By default, the input x is modified in place and also returned.
Changed in version 0.7.5: Keyword inplace can be set to False so that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
Convert time t from native units to base units.
By default, the input t is modified in place and also returned (although note that scalar values t are passed by value in Python and hence an in-place modification has no effect on the caller.)
Changed in version 0.7.5: Keyword inplace can be set to False so that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
Convert time t from base units to native units.
By default, the input t is modified in place and also returned. (Also note that scalar values t are passed by value in Python and hence an in-place modification has no effect on the caller.)
Changed in version 0.7.5: Keyword inplace can be set to False so that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
In-place conversion of velocities array v from native units to base units.
By default, the input v is modified in place and also returned.
New in version 0.7.5.
In-place conversion of coordinate array v from base units to native units.
By default, the input v is modified in place and also returned.
New in version 0.7.5.
Returns True if all values are within limit values of their formats.
Due to rounding, the test is asymmetric (and min is supposed to be negative):
min < x <= max
Arguments: |
|
---|---|
Returns: | boolean |
Write current timestep, using the supplied obj.
The argument should be a AtomGroup or a Universe or a Timestep instance.
Note
The size of the obj must be the same as the number of atom provided when setting up the trajectory.
write a new timestep to the dcd file
ts - timestep object containing coordinates to be written to dcd file
Changed in version 0.7.5: Raises ValueError instead of generic Exception if wrong number of atoms supplied and NoDataError if no coordinates to be written.