parmed.charmm.charmmcrds module

Provides a class for parsing CHARMM-style coordinate files, namely CHARMM .crd (coordinate) files and CHARMM .rst (restart) file. Uses CharmmFile class in _charmmfile.py for reading files

Author: Jason Deckman Contributors: Jason Swails Date: June 19, 2015

class parmed.charmm.charmmcrds.CharmmCrdFile(fname)[source]

Bases: object

Reads and parses a CHARMM coordinate file (.crd) into its components, namely the coordinates, CHARMM atom types, resid, resname, etc.

Parameters:

fname : str

Name of the restart file to parse

Attributes

positions Atomic coordinates with units attached to them with the shape (natom, 3)
natom (int) Number of atoms in the system
resname (list of str) List of all residue names in the system
coordinates (np.ndarray with shape (1, natom, 3)) Atomic coordinates in a numpy array

Methods

id_format(filename) Identifies the file type as a CHARMM coordinate file
write(struct, dest) Writes a CHARMM coordinate file from a structure
box
coordinates
static id_format(filename)[source]

Identifies the file type as a CHARMM coordinate file

Parameters:

filename : str

Name of the file to check format for

Returns:

is_fmt : bool

True if it is a CHARMM coordinate file

positions

Atomic coordinates with units attached to them with the shape (natom, 3)

static write(struct, dest)[source]

Writes a CHARMM coordinate file from a structure

Parameters:

struct : parmed.structure.Structure

The input structure to write the CHARMM coordinate file from

dest : str or file-like object

The file name or file object to write the coordinate file to

class parmed.charmm.charmmcrds.CharmmRstFile(fname)[source]

Bases: object

Reads and parses data, velocities and coordinates from a CHARMM restart file (.rst) of file name ‘fname’ into class attributes

Parameters:

fname : str

Name of the restart file to parse

Attributes

velocities Atomic velocities in Angstroms/picoseconds
positions Atomic positions with units
positionsold Old atomic positions with units
natom (int) Number of atoms in the system
resname (list of str) Names of all residues in the system
coordinates (np.ndarray shape(1, natom, 3)) List of all coordinates in the format [x1, y1, z1, x2, y2, z2, ...]
coordinatesold (np.ndarray shape(1, natom, 3)) List of all old coordinates in the format [x1, y1, z1, x2, y2, z2, ...]

Methods

id_format(filename) Identifies the file type as a CHARMM restart file
scan(handle, str[, r])
box
coordinates
coordinatesold
static id_format(filename)[source]

Identifies the file type as a CHARMM restart file

Parameters:

filename : str

Name of the file to check format for

Returns:

is_fmt : bool

True if it is a CHARMM restart file

positions

Atomic positions with units

positionsold

Old atomic positions with units

scan(handle, str, r=0)[source]
velocities

Atomic velocities in Angstroms/picoseconds