7.11. AMBER coordinate/restart files in MDAnalysis — MDAnalysis.coordinates.INPCRD

AMBER can write ASCII restart (“inpcrd”) and binary restart (“ncrst”) coordinate files. MDAnalysis supports reading of both file formats.

Units

AMBER restart files are assumed to be in the following units:

  • length in Angstrom (Å)

  • time in ps

  • velocity (NCRST only) in Å / ps

  • force (NCRST only) in kcal / (mol * Å)

7.11.1. ASCII INPCRD restart files

ASCII AMBER INPCRD coordinate files (as defined in AMBER INPCRD FORMAT) are handled by the INPReader.

AMBER ASICC restart files are recognised by the suffix ‘.inpcrd’, ‘.restrt’, or ‘.rst7’

class MDAnalysis.coordinates.INPCRD.INPReader(filename, convert_units=True, n_atoms=None, **kwargs)[source]

Reader for Amber restart files.

Limitations

  • Box information is not read (or checked for).

  • Velocities are currently not supported.

static parse_n_atoms(filename, **kwargs)[source]

Read the coordinate file and deduce the number of atoms

Returns:

n_atoms – the number of atoms in the coordinate file

Return type:

int

Raises:

NotImplementedError – when the number of atoms can’t be deduced

units = {'length': 'Angstrom'}

dict with units of of time and length (and velocity, force, … for formats that support it)

7.11.2. Binary NetCDF restart files

The AMBER netcdf restart format makes use of NetCDF (Network Common Data Form) format. Such binary restart files are recognised in MDAnalysis by the suffix ‘.ncrst’, ‘.ncrestrt’ or ‘.ncrst7’ and read by the NCRSTReader.

Binary restart files can also contain velocity and force information, and can record the simulation time step. Whilst the AMBER netcdf format details default unit values of ångström and picoseconds, these can in theory occupy any unit type. However, at the moment MDAnalysis only supports the default types and will raise a NotImplementedError if anything else is detected.

class MDAnalysis.coordinates.INPCRD.NCRSTReader(filename, n_atoms=None, convert_units=None, mmap=None, **kwargs)[source]

Reader for AMBER NETCDF format (version 1.0 rev C) restart files.

This reader is a SingleFrameReaderBase adaptation of the NCDFReader AMBER NETCDF trajectory reader.

AMBER binary restart files are automatically recognised by the file extensions “.ncrst”, “.ncrestrt”, and “.ncrst7”.

The number of atoms (n_atoms) does not have to be provided as it can be read from the input NETCDF file.

Current simulation time is autodetected and if available is read into the Timestep.time attribute.

Velocities are autodetected and read into the Timestep._velocities attribute.

Forces are autodetected and read into the Timestep._forces attribute.

Periodic unit cell information is detected and used to populate the Timestep.dimensions attribute. (If no unit cell is available in the restart file, then Timestep.dimensions will return [0,0,0,0,0,0]).

Support for the mmap keyword is available as detailed in NCDFReader and scipy.io.netcdf.netcdf_file. The use of mmap=True leads to around a 2x read speed improvement in a ~ 1 million atom system (AMBER STMV benchmark). As per the NCDFReader, the default behaviour is mmap=None, which means that the default behaviour of scipy.io.netcdf.netcdf_file prevails.

The NCRST reader also uses a custom Timestep object with C-style memory mapping in order to match the NCDFReader.

Limitations

  • Only NCRST files with time in ps, lengths in Angstroem and angles in degree are processed.

  • Restart files without coordinate information are not supported.

  • Replica exchange variables are not supported.

static parse_n_atoms(filename, **kwargs)[source]

Read the coordinate file and deduce the number of atoms

Returns:

n_atoms – the number of atoms in the coordinate file

Return type:

int

Raises:

NotImplementedError – when the number of atoms can’t be deduced

units = {'force': 'kcal/(mol*Angstrom)', 'length': 'Angstrom', 'time': 'ps', 'velocity': 'Angstrom/ps'}

dict with units of of time and length (and velocity, force, … for formats that support it)