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
fnamestr

Name of the restart file to parse

Attributes
natomint

Number of atoms in the system

resnamelist of str

List of all residue names in the system

coordinatesnp.ndarray with shape (1, natom, 3)

Atomic coordinates in a numpy array

positionsnatom x 3 distance Quantity

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

Methods

id_format(filename)

Identifies the file type as a CHARMM coordinate file

write(struct, dest)

Writes a CHARMM coordinate file from a structure

property box
property coordinates
static id_format(filename)[source]

Identifies the file type as a CHARMM coordinate file

Parameters
filenamestr

Name of the file to check format for

Returns
is_fmtbool

True if it is a CHARMM coordinate file

property 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
structparmed.structure.Structure

The input structure to write the CHARMM coordinate file from

deststr 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
fnamestr

Name of the restart file to parse

Attributes
natomint

Number of atoms in the system

resnamelist of str

Names of all residues in the system

coordinatesnp.ndarray shape(1, natom, 3)

List of all coordinates in the format [x1, y1, z1, x2, y2, z2, …]

coordinatesoldnp.ndarray shape(1, natom, 3)

List of all old coordinates in the format [x1, y1, z1, x2, y2, z2, …]

velocitiesnp.ndarray shape(1, natom, 3)

Atomic velocities in Angstroms/picoseconds

positionsnatom x 3 distance Quantity

Atomic positions with units

positionsoldnatom x 3 distance Quantity

Old atomic positions with units

Methods

id_format(filename)

Identifies the file type as a CHARMM restart file

scan

property box
property coordinates
property coordinatesold
static id_format(filename)[source]

Identifies the file type as a CHARMM restart file

Parameters
filenamestr

Name of the file to check format for

Returns
is_fmtbool

True if it is a CHARMM restart file

property positions

Atomic positions with units

property positionsold

Old atomic positions with units

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

Atomic velocities in Angstroms/picoseconds