Project

General

Profile

Bug #709

MODEL numbers produced by trjconv inconsistent with PDB standard

Added by Martyn Winn over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
analysis tools
Target version:
Affected version - extra info:
4.5.3 and all before
Affected version:
Difficulty:
uncategorized
Close

Description

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:

MODEL 0

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;
else
model_nr++;
write_pdbfile(out,title,&useatoms,frout.x,
frout.ePBC,frout.box,' ',model_nr,gc,TRUE);

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....

Martyn

Associated revisions

Revision c3926efa (diff)
Added by Berk Hess over 8 years ago

pdb model numbers now start at 1

The general pdb writing code and trjconv could write pdb files
with 0 as the first model number. The minimum been changed to 1.
This fixes #709

History

#1 Updated by Berk Hess over 8 years ago

  • Category set to analysis tools
  • Status changed from New to Closed
  • Assignee set to Berk Hess
  • Target version set to 4.5.4
  • Affected version - extra info set to 4.5.3 and all before
  • Affected version set to 3.2.1

All fixed.

Also available in: Atom PDF