5.7. GRO file format — MDAnalysis.coordinates.GRO

Classes to read and write Gromacs GRO coordinate files; see the notes on the GRO format which includes a conversion routine for the box.

class MDAnalysis.coordinates.GRO.GROReader(filename, convert_units=None, **kwargs)[source]

Reader for the Gromacs GRO structure format.

Changed in version 0.11.0: Frames now 0-based instead of 1-based

Writer(filename, **kwargs)[source]

Returns a CRDWriter for filename.

Arguments:
filename

filename of the output GRO file

Returns:

GROWriter

class MDAnalysis.coordinates.GRO.GROWriter(filename, convert_units=None, **kwargs)[source]

GRO Writer that conforms to the Trajectory API.

Note

The precision is hard coded to three decimal places and velocities are not written (yet).

Changed in version 0.11.0: Frames now 0-based instead of 1-based

Set up a GROWriter with a precision of 3 decimal places.

Arguments:
filename

output filename

convert_dimensions_to_unitcell(ts)[source]

Read dimensions from timestep ts and return appropriate unitcell

fmt = {'box_orthorhombic': '%10.5f%10.5f%10.5f\n', 'box_triclinic': '%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f\n', 'n_atoms': '%5d\n', 'xyz': '%5s%-5s%5s%5s%8.3f%8.3f%8.3f\n', 'xyz_v': '%5s%-5s%5s%5s%8.3f%8.3f%8.3f%8.4f%8.4f%8.4f\n'}

format strings for the GRO file (all include newline); precision of 3 decimal places is hard-coded here.

write(selection, frame=None)[source]

Write selection at current trajectory frame to file.

Arguments:
selection

MDAnalysis AtomGroup (selection or Universe.atoms) or also Universe

Keywords:
frame

optionally move to frame number frame

The GRO format only allows 5 digits for resid and atom number. If these number become larger than 99,999 then this routine will chop off the leading digits.

Changed in version 0.7.6: resName and atomName are truncated to a maximum of 5 characters