openmm / pdbfixer

PDBFixer fixes problems in PDB files
Other
461 stars 115 forks source link

how to write pdb when resnum indices overflow the field width? #164

Closed nitroamos closed 6 years ago

nitroamos commented 6 years ago

I've been playing with building a membrane on file 4yay (issue #163 ). It did work one time, and I've attached the output, which looks pretty weird (water bonds spanning the membrane) but that's probably due to overflowing the resnum width (which in turn scrambles the CONECT records). It doesn't look like PDBFile.writeFile can write to other file formats or is there some other approach you'd recommend to solve this problem?

> grep -C 2 " HOH C9999" output.pdb 
HETATM94576  H1  HOH C9998     -12.091  28.784  25.662  1.00  0.00           H  
HETATM94577  H2  HOH C9998     -10.706  28.175  25.630  1.00  0.00           H  
HETATM94578  O   HOH C9999     -56.359   6.795 -28.077  1.00  0.00           O  
HETATM94579  H1  HOH C9999     -57.198   6.334 -28.072  1.00  0.00           H  
HETATM94580  H2  HOH C9999     -56.070   6.776 -27.165  1.00  0.00           H  
HETATM94581  O   HOH C   0      30.173 -33.330  34.729  1.00  0.00           O  
HETATM94582  H1  HOH C   0      30.842 -34.008  34.826  1.00  0.00           H  

output.pdb.gz

peastman commented 6 years ago

You could use PDBxFile.writeFile() to write to a PDBx/mmCIF file. That's the modern replacement for PDB, and it doesn't put any limit on the number of atoms.

nitroamos commented 6 years ago

Thanks. I've now bookmarked OpenMM's Python API so I can more easily figure things out w/o asking. :-)

You might consider having PDBFile.writeFile throw an exception if this happens.