Classes to read and write CHARMM/LAMMPS DCD binary
trajectories. Trajectories can be read regardless of system-endianness
as this is auto-detected.
The classes in this module are the reference implementations for the
Trajectory API.
-
class MDAnalysis.coordinates.DCD.DCDReader(dcdfilename, **kwargs)[source]
Reads from a DCD file
Data: |
- ts
Timestep object
containing coordinates of current frame
|
Methods: |
- dcd = DCD(dcdfilename)
open dcd file and read header
- len(dcd)
return number of frames in dcd
- for ts in dcd:
iterate through trajectory
- for ts in dcd[start:stop:skip]:
iterate through a trajectory
- dcd[i]
random access into the trajectory (i corresponds to frame number)
- data = dcd.timeseries(...)
retrieve a subset of coordinate information for a group of atoms
- data = dcd.correl(...)
populate a MDAnalysis.core.Timeseries.Collection object with computed timeseries
|
-
Writer(filename, **kwargs)[source]
Returns a DCDWriter for filename with the same parameters as this DCD.
All values can be changed through keyword arguments.
Arguments: |
- filename
filename of the output DCD trajectory
|
Keywords: |
- numatoms
number of atoms
- start
number of the first recorded MD step
- step
indicate that step MD steps (!) make up one trajectory frame
- delta
MD integrator time step (!), in AKMA units
- remarks
string that is stored in the DCD header [XXX – max length?]
|
Returns: | DCDWriter
|
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 !
-
correl(timeseries, start=0, stop=-1, skip=1)[source]
Populate a TimeseriesCollection object with timeseries computed from the trajectory
-
timeseries(asel, start=0, stop=-1, skip=1, format='afc')[source]
Return a subset of coordinate data for an AtomGroup
Arguments: |
- asel
AtomGroup object
- start, stop, skip
range of trajectory to access, start and stop are inclusive
- format
the order/shape of the return data array, corresponding
to (a)tom, (f)rame, (c)oordinates all six combinations
of ‘a’, ‘f’, ‘c’ are allowed ie “fac” - return array
where the shape is (frame, number of atoms,
coordinates)
|
-
class MDAnalysis.coordinates.DCD.DCDWriter(filename, numatoms, start=0, step=1, delta=1.0, remarks='Created by DCDWriter', convert_units=None)[source]
Writes to a DCD file
Methods: | d = DCDWriter(dcdfilename, numatoms, start, step, delta, remarks) |
Create a new DCDWriter
Arguments: |
- filename
name of output file
- numatoms
number of atoms in dcd file
- start
starting timestep
- step
skip between subsequent timesteps
- delta
timestep
- remarks
comments to annotate dcd file
- convert_units
units are converted to the MDAnalysis base format; None selects
the value of MDAnalysis.core.flags [‘convert_gromacs_lengths’].
(see Flags)
|
-
close()[source]
Close trajectory and flush buffers.
-
convert_dimensions_to_unitcell(ts, _ts_order=[0, 3, 1, 4, 5, 2])[source]
Read dimensions from timestep ts and return appropriate unitcell
as [A,alpha,B,beta,gamma,C]
-
write_next_timestep(ts=None)[source]
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.