MODEL numbers produced by trjconv inconsistent with PDB standard
When producing a PDB file from one frame of a trajectory, e.g. "trjconv -s foo.tpr -f foo.trr -o foo_t999.pdb -dump 999" trjconv produces a PDB file with the record:
According to the PDB format http://www.wwpdb.org/documentation/format32/sect9.html, the "numbering of models is sequential, beginning with 1".
Most software doesn't care. However, the MMDB coordinate library used by some CCP4 applications and by the molecular graphics viewer Coot does care, and won't read these files (until this record is hand-edited to have MODEL 1).
A simple fix in tools/gmx_trjconv.c is to initialise model_nr with 0 instead of -1. This works for my case,
/* if reading from pdb, we want to keep the original
model numbering else we write the output frame
number plus one, because model 0 is not allowed in pdb */
if (ftpin==efPDB && fr.bStep && fr.step > model_nr)
model_nr = fr.step;
which is the "else" alternative here. I haven't tested the "if" case, but I presume that would still work since fr.step must be > 0. This snippet also shows that the issue is known about (but I couldn't find a relevant entry in redmine).
There is also a check on model number in src/gmxlib/pdbio.c which might need to be changed:
fprintf(out,"MODEL %8d\n",model_nr>=0 ? model_nr : 1);
This issue is minor since most software doesn't follow the standard so closely. But I did find one thread on gmx-developers that suggested
there was a wish to follow standards....