g87 file format

Main Table of Contents VERSION 4.6
GROMACS homepage Sat 19 Jan 2013

This is a simple ASCII format:
TITLE
x(i) (10f8.3)
box(m) (10f8.8)
The number of atoms is not stored, neither is there any indication of whether a box is present. The box is stored only for constant pressure simulations. So, you simply have to remember this stuff.
http://www.gromacs.org