AMBER can write ASCII trajectories (“traj”) and binary trajectories (“netcdf”). MDAnalysis supports reading of both formats and writing for the binary trajectories.
Note
Support for AMBER is experimental and feedback and contributions are highly appreciated. Use the Issue Tracker or get in touch on the MDAnalysis mailinglist.
Units
AMBER trajectory coordinate frames are based on a Timestep object.
AMBER trajectory Timestep.
The Timestep can be initialized with arg being
coordinates of the atoms as a numpy.ndarray of shape (numatoms, 3)
velocities of the atoms as a numpy.ndarray of shape (numatoms, 3); only available if the trajectory contains velocities or if the velocities = True keyword has been supplied.
unitcell dimensions (A, B, C, alpha, beta, gamma)
Note
A ASCII AMBER trajectory only contains box lengths A,B,C; we assume an orthorhombic box and set all angles to 90º.
ASCII AMBER TRJ coordinate files (as defined in AMBER TRJ format) are handled by the TRJReader. It is also possible to directly read bzip2 or gzip compressed files.
AMBER ASCII trajectories are recognised by the suffix ‘.trj’ or ‘.mdcrd’ (possibly with an additional ‘.gz’ or ‘.bz2’).
Limitations
AMBER trajectory reader.
Reads the ASCII formatted AMBER TRJ format. Periodic box information is auto-detected.
The number of atoms in a timestep must be provided in the numatoms keyword because it is not stored in the trajectory header and cannot be reliably autodetected. The constructor raises a ValueError if numatoms is left at its default value of None.
The length of a timestep is not stored in the trajectory itself but can be set by passing the delta keyword argument to the constructor; it is assumed to be in ps. The default value is 1 ps.
Functionality is currently limited to simple iteration over the trajectory.
Close trj trajectory file if it was open.
Number of frames (obtained from reading the whole trajectory).
Open the trajectory for reading and load first frame.
Reposition at the beginning of the trajectory
The AMBER netcdf format make use of NetCDF (Network Common Data Form) format. Such binary trajectories are recognized in MDAnalysis by the ‘.ncdf’ suffix and read by the NCDFReader.
Binary trajectories can also contain velocities and can record the exact time step. In principle, the trajectories can be in different units than the AMBER defaults of ångström and picoseconds but at the moment MDAnalysis only supports those and will raise a NotImplementedError if anything else is detected.
Reader for AMBER NETCDF format (version 1.0).
AMBER binary trajectories are automatically recognised by the file extension ”.ncdf”.
The number of atoms (numatoms) does not have to be provided as it can be read from the trajectory. The trajectory reader can randomly access frames and therefore supports direct indexing (with 0-based frame indices) and full-feature trajectory iteration, including slicing.
Velocities are autodetected and read into the Timestep._velocities attribute.
Periodic unit cell information is detected and used to populate the Timestep.dimensions attribute. (If no unit cell is available in the trajectory, then Timestep.dimensions will return [0,0,0,0,0,0].)
Current limitations:
See also
Return the Timestep corresponding to frame.
If frame is a integer then the corresponding frame is returned. Negative numbers are counted from the end.
If frame is a slice then an iterator is returned that allows iteration over that part of the trajectory.
Note
frame is a 0-based frame index.
Iterate over the whole trajectory
Returns a NCDFWriter for filename with the same parameters as this NCDF.
All values can be changed through keyword arguments.
Arguments : |
|
---|---|
Keywords : |
|
Returns : |
Close trajectory; any further access will raise an IOError
Writer for AMBER NETCDF format (version 1.0).
AMBER binary trajectories are automatically recognised by the file extension ”.ncdf”.
Velocities are written out if they are detected in the input Timestep. The trajectories are always written with ångström for the lengths and picoseconds for the time (and hence Å/ps for velocities).
Unit cell information is written if available.
See also
Create a new NCDFWriter
Arguments : |
|
---|---|
Keywords : |
|