I'm trying to programmatically load a PDB-file, using chempy.io.pdb, then run an energy minimization with tinker. The problem is that the tinker-wrapper stores files to the tinker xyz-format, which requires that the numeric_type or text_type attribute is set correctly. PDB.fromFile() doesn't seem to set these attributes at all.
Is there a simple way of getting around this problem or setting the numeric_type correctly? Currently, loading PDB-files with chempy.io.pdb.fromFile() keeps the default numeric_type -9999, and the text_type '??', which ends up raising a KeyError trying to find the matching numeric_type when storing the xyz-format input file to tinker. I'm using PyMOL 0.90-1 on Debian unstable where running the attached testscript yields the following stacktrace: Traceback (most recent call last): File "tinkertestsnippet.py", line 13, in ? s.minimize() File "/usr/lib/python2.3/site-packages/chempy/tinker/state.py", line 105, in minimize io.xyz.toFile(self.model,self.prefix+"_inp.xyz") File "/usr/lib/python2.3/site-packages/chempy/__init__.py", line 186, in toFile result = fp.writelines(apply(self.toList,(indexed,),params)) File "/usr/lib/python2.3/site-packages/chempy/xyz.py", line 83, in toList n_type = mapping[a.text_type] KeyError: '??' -- Truls - kerfue+pymol-us...@herocamp.org
import chempy.io from chempy.tinker.state import * modelFile = "test.pdb" model = io.pdb.fromFile(modelFile) s = State() s.model = model s.minimize()
test.pdb
Description: test data for use with tinkertestsnippet.py