parmed.gromacs.gromacsgro module

This module contains functionality relevant to loading and parsing GROMACS GRO (coordinate) files and building a stripped-down Structure from it

class parmed.gromacs.gromacsgro.GromacsGroFile[source]

Bases: object

Parses and writes Gromacs GRO files

Methods

id_format(filename)

Identifies the file as a GROMACS GRO file

parse(filename[, skip_bonds])

Parses a Gromacs GRO file

write(struct, dest[, precision, nobox, combine])

Write a Gromacs Topology File from a Structure

static id_format(filename)[source]

Identifies the file as a GROMACS GRO file

Parameters
filenamestr

Name of the file to check if it is a Gromacs GRO file

Returns
is_fmtbool

If it is identified as a Gromacs GRO file, return True. False otherwise

static parse(filename, skip_bonds=False)[source]

Parses a Gromacs GRO file

Parameters
filenamestr or file-like

Name of the file or the GRO file object

skip_bondsbool, optional

If True, skip trying to assign bonds. This can save substantial time when parsing large files with non-standard residue names. However, no bonds are assigned. This is OK if, for instance, the GRO file is being parsed simply for its coordinates. This will also reduce the accuracy of assigned atomic numbers for typical ions. Default is False.

Returns
structStructure

The Structure instance instantiated with just residues and atoms populated (with coordinates)

static write(struct, dest, precision=3, nobox=False, combine=False)[source]

Write a Gromacs Topology File from a Structure

Parameters
structStructure

The structure to write to a Gromacs GRO file (must have coordinates)

deststr or file-like

The name of a file or a file object to write the Gromacs topology to

precisionint, optional

The number of decimal places to print in the coordinates. Default 3

noboxbool, optional

If the system does not have a periodic box defined, and this option is True, no box will be written. If False, the periodic box will be defined to enclose the solute with 0.5 nm clearance on all sides. If periodic box dimensions are defined, this variable has no effect.

combine‘all’, None, or list of iterables, optional

Equivalent to the combine argument of the GromacsTopologyFile.write method. If None, system atom order may be changed to meet the need for contiguously bonded groups of atoms to be part of a single moleculetype. All other values leave the atom order unchanged. Default is None.