5.6. 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
(grofilename, convert_units=None, **kwargs)[source]¶ Now reads in velocities as well, if available.
-
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).
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', 'numatoms': '%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