[MMTK] adding pdb file to universe

Naomi Fox fox at cs.umass.edu
Wed Feb 1 19:58:38 UTC 2012


There's some bug with handling whitespace in the filename for the database
entry in MMTK/Database.py

If you change line 51 from:

                full_name = os.path.join(os.path.join(p, directory),
filename)

to:

                full_name = os.path.join(os.path.join(p, directory),
filename).strip()

you get a little further.  But then you bump into another error.

On Wed, Feb 1, 2012 at 8:02 AM, Ivan Vyalov <vyalov at mis.mpg.de> wrote:

> **
> Dear all,
>
> I'd like to read PDB file with configuration of my system and then to
> treat it by means of MMTK. To achieve this, as far as I understand, one
> should read the PDB file and create MMTK objects which then must be passed
> to universe. However, I have encountered the following problem: MMTK does
> not recognize atom types when I want to create a universe from PDB. Another
> option is that I'm completely missing something. Could someone help me with
> an advice? Here is the code:
>
> #!/usr/bin/env python
> import pdb,sys,MMTK
> from MMTK import *
> from MMTK.PDB import PDBConfiguration
> from MMTK.ForceFields import Amber99ForceField
> import MMTK.Database
>
> L = 53.86
> volume=L**3
>
> universe = CubicPeriodicUniverse(L*Units.Ang, \
>     Amber99ForceField(lj_options=12*Units.Ang))
>
> config = PDBConfiguration('fluorine.pdb')
>
>
> # MMTK can find the database in general:
> print MMTK.Atom("F")
>
> # but not when we want create objects from PDBConfiguration
> config.createAll()
>
> *****************************************************************
>
> I get the following traceback
>
>
> /usr/bin/python makePDBuniverse.py
> Atom fluorine
> Traceback (most recent call last):
>   File "makePDBuniverse.py", line 21, in <module>
>     a = config.createAll()
>   File "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/PDB.py",
> line 428, in createAll
>     molecules = self.createMolecules(molecule_names, permit_undefined)
>   File "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/PDB.py",
> line 379, in createMolecules
>     a = ChemicalObjects.Atom(element, name = aname)
>   File
> "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/ChemicalObjects.py",
> line 529, in __init__
>     ChemicalObject.__init__(self, atom_spec, _memo)
>   File
> "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/ChemicalObjects.py",
> line 34, in __init__
>     blueprint = self.blueprintclass(blueprint)
>   File
> "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/Database.py",
> line 448, in __init__
>     BlueprintObject.__init__(self, type, atom_types, memo)
>   File
> "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/Database.py",
> line 423, in __init__
>     original = database.findType(original)
>   File
> "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/Database.py",
> line 90, in findType
>     filename = databasePath(name, self.directory, False)
>   File
> "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/Database.py",
> line 58, in databasePath
>     raise IOError("Database entry %s/%s not found" % (directory, filename))
> IOError: Database entry Atoms/f  not found
>
> shell returned 1
>
>
>
> *********************************************************************************************
> The PDB file looks like this:
>
>
> ATOM      1 F            0      18.459  26.301  39.652  1.00  1.00
> F   0.0000
> ATOM      2 F            0      30.495  15.275  21.179  1.00  1.00
> F   0.0000
> ATOM      3 F            0      18.702  45.771  11.991  1.00  1.00
> F   0.0000
> ATOM      4 F            0       9.142  43.718  48.240  1.00  1.00
> F   0.0000
> ATOM      5 F            0      48.026  34.727  30.959  1.00  1.00
> F   0.0000
> ATOM      6 F            0      16.627  23.149   9.484  1.00  1.00
> F   0.0000
> ATOM      7 F            0       5.848  28.479  31.704  1.00  1.00
> F   0.0000
> ATOM      8 F            0      26.702  12.069   4.357  1.00  1.00
> F   0.0000
> ATOM      9 F            0      35.755  21.043  46.845  1.00  1.00
> F   0.0000
> ATOM     10 F            0       8.523  46.952  40.823  1.00  1.00
> F   0.0000
>
>
> thanks!
>
>
>
>
> _______________________________________________
> mmtk maillist  -  mmtk at starship.python.net
> http://starship.python.net/mailman/listinfo/mmtk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://starship.python.net/pipermail/mmtk/attachments/20120201/0ac10a7c/attachment.html>


More information about the mmtk mailing list