### Navigation

- index
- modules |
- next |
- previous |
- MDAnalysis 0.7.7 documentation »
- 5. Coordinates modules »

# 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`(grofilename, convert_units=None, **kwargs)

  Now reads in velocities as well, if available.

  `Writer`(filename, **kwargs)

    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)

  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)

    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)

    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

### Navigation

- index
- modules |
- next |
- previous |
- MDAnalysis 0.7.7 documentation »
- 5. Coordinates modules »