<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 02/01/2012 08:58 PM, Naomi Fox wrote:
    <blockquote
cite="mid:CACHbiH_9MQY1Me2WteNUhec_jvP8uGDTXdEtj05M3g1-EZyoUA@mail.gmail.com"
      type="cite">There's some bug with handling whitespace in the
      filename for the database entry in <span style="font-family:
        monospace;">MMTK/</span><span style="font-family: monospace;">Database.py</span>
      <div><font face="monospace"><br>
        </font></div>
      <div>
        <div>If you change line 51 from:</div>
        <div><br>
        </div>
        <div>
          <div>                full_name = os.path.join(os.path.join(p,
            directory), filename)</div>
        </div>
        <div><br>
        </div>
        <div>to:</div>
        <div><br>
        </div>
        <div>
          <div>
                            full_name = os.path.join(os.path.join(p,
            directory), filename).strip()</div>
        </div>
        <div><br>
        </div>
        <div>you get a little further.  But then you bump into another
          error.</div>
        <div><br>
        </div>
        <div>
          <div class="gmail_quote">
            On Wed, Feb 1, 2012 at 8:02 AM, Ivan Vyalov <span dir="ltr"><<a
                moz-do-not-send="true" href="mailto:vyalov@mis.mpg.de">vyalov@mis.mpg.de</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
              0.8ex; border-left: 1px solid rgb(204, 204, 204);
              padding-left: 1ex;">
              <div bgcolor="#ffffff" text="#000000"> Dear all,<br>
                <br>
                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:<br>
                <code><br>
                  #!/usr/bin/env python<br>
                  import pdb,sys,MMTK<br>
                  from MMTK import *<br>
                  from MMTK.PDB import PDBConfiguration<br>
                  from MMTK.ForceFields import Amber99ForceField<br>
                  import MMTK.Database<br>
                  <br>
                  L = 53.86<br>
                  volume=L**3<br>
                  <br>
                  universe = CubicPeriodicUniverse(L*Units.Ang, \<br>
                      Amber99ForceField(lj_options=12*Units.Ang))<br>
                  <br>
                  config = PDBConfiguration('fluorine.pdb')<br>
                  <br>
                  <br>
                  # MMTK can find the database in general:<br>
                  print MMTK.Atom("F")<br>
                  <br>
                  # but not when we want create objects from
                  PDBConfiguration<br>
                  config.createAll()</code><br>
                <br>
*****************************************************************<br>
                <br>
                I get the following traceback<br>
                <br>
                <code><br>
                  /usr/bin/python makePDBuniverse.py<br>
                  Atom fluorine<br>
                  Traceback (most recent call last):<br>
                    File "makePDBuniverse.py", line 21, in
                  <module><br>
                      a = config.createAll()<br>
                    File
                  "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/PDB.py",
                  line 428, in createAll<br>
                      molecules = self.createMolecules(molecule_names,
                  permit_undefined)<br>
                    File
                  "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/PDB.py",
                  line 379, in createMolecules<br>
                      a = ChemicalObjects.Atom(element, name = aname)<br>
                    File
                  "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/ChemicalObjects.py",

                  line 529, in __init__<br>
                      ChemicalObject.__init__(self, atom_spec, _memo)<br>
                    File
                  "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/ChemicalObjects.py",

                  line 34, in __init__<br>
                      blueprint = self.blueprintclass(blueprint)<br>
                    File
                  "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/Database.py",
                  line 448, in __init__<br>
                      BlueprintObject.__init__(self, type, atom_types,
                  memo)<br>
                    File
                  "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/Database.py",
                  line 423, in __init__<br>
                      original = database.findType(original)<br>
                    File
                  "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/Database.py",
                  line 90, in findType<br>
                      filename = databasePath(name, self.directory,
                  False)<br>
                    File
                  "/usr/people/vyalov/local/lib/python2.6/site-packages/MMTK/Database.py",
                  line 58, in databasePath<br>
                      raise IOError("Database entry %s/%s not found" %
                  (directory, filename))<br>
                  IOError: Database entry Atoms/f  not found<br>
                  <br>
                  shell returned 1 </code><br>
                <br>
                <br>
*********************************************************************************************<br>
                The PDB file looks like this:<br>
                <br>
                <br>
                <code>ATOM      1 F            0      18.459  26.301 
                  39.652  1.00  1.00         F   0.0000<br>
                  ATOM      2 F            0      30.495  15.275 
                  21.179  1.00  1.00         F   0.0000<br>
                  ATOM      3 F            0      18.702  45.771 
                  11.991  1.00  1.00         F   0.0000<br>
                  ATOM      4 F            0       9.142  43.718 
                  48.240  1.00  1.00         F   0.0000<br>
                  ATOM      5 F            0      48.026  34.727 
                  30.959  1.00  1.00         F   0.0000<br>
                  ATOM      6 F            0      16.627  23.149  
                  9.484  1.00  1.00         F   0.0000<br>
                  ATOM      7 F            0       5.848  28.479 
                  31.704  1.00  1.00         F   0.0000<br>
                  ATOM      8 F            0      26.702  12.069  
                  4.357  1.00  1.00         F   0.0000<br>
                  ATOM      9 F            0      35.755  21.043 
                  46.845  1.00  1.00         F   0.0000<br>
                  ATOM     10 F            0       8.523  46.952 
                  40.823  1.00  1.00         F   0.0000</code><br>
                <br>
                <br>
                thanks!<br>
                <br>
                <br>
                <br>
              </div>
              <br>
              _______________________________________________<br>
              mmtk maillist  -  <a moz-do-not-send="true"
                href="mailto:mmtk@starship.python.net">mmtk@starship.python.net</a><br>
              <a moz-do-not-send="true"
                href="http://starship.python.net/mailman/listinfo/mmtk"
                target="_blank">http://starship.python.net/mailman/listinfo/mmtk</a><br>
              <br>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    <br>
    Oh, thanks! If I only read your mail first I wouldn't have to dig
    myself :) My solution is to strip element names in
    Scientific/IO/PDB.py<br>
    <br>
    thanks a lot!<br>
    <br>
    Cheers,<br>
    Ivan<br>
  </body>
</html>