Defining new molecules

Victor Manuel Rosas-García
Thu, 25 Feb 1999 08:53:53 -0800 (PST)

Hello guys,

How should new molecules be defined in the database? We´re trying to
model a cyclodextrin, so we have written a molecule definition file
following the guidelines found in the manual.  I won't reproduce the
file here to avoid wasting bandwidth, but we think the definition is
complete: it includes the list of atom labels of the form:

C1  = Atom('C')

it also includes the bonds in the form:

bonds = [Bond(C2, C1),    Bond(C3, C2),    Bond(C4, C3),    Bond(C5,
[snip, snip]

and the default configuration Z-matrix:

configurations = {
    'default': ZMatrix([[C1],
			[C2,   C1,   1.5980688*Ang],      
			[C3,   C2,   1.5932909*Ang,  C1,   108.207969*deg],      
			[C4,   C3,   1.5915628*Ang,  C2,   109.374762*deg,  C1,   
[snip, snip]

then, when I tried to assign the structure to a python variable I did
as follows (in interactive mode):

Python 1.5.1 (#2, Jan 12 1999, 19:13:08) [C] on aix4
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from mmtk import *
>>> a = Molecule('acetone')

so far, so good.  Then:

>>> b = Molecule('bcdex2')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "/usr/local/mmtk/", line 403, in __init__
    ChemicalObject.__init__(self, blueprint, _memo)
  File "/usr/local/mmtk/", line 21, in __init__
    blueprint = self.blueprintclass(blueprint)
  File "/usr/local/mmtk/", line 337, in __init__
    BlueprintObject.__init__(self, type, molecule_types, memo)
  File "/usr/local/mmtk/", line 302, in __init__
    original = database.findType(original)
  File "/usr/local/mmtk/", line 67, in findType
    self.types[name] = self.type_constructor(filename)
  File "/usr/local/mmtk/", line 174, in __init__
    ChemicalObjectType.__init__(self, filename, MoleculeEnvironment,
  File "/usr/local/mmtk/", line 80, in __init__
    execfile(filename, vars(module), newvars)
  File "/home/vrosas/Molecules/bcdex2", line 195, in ?
    configurations = {
TypeError: __sub__ nor __rsub__ defined for these operands

Note: /home/vrosas/ is my home directory in the machine

What's wrong?  AFAIK, __sub__ is a python builtin operand that yields
the difference of two items (not necessarily numerical).  I couldn't
find a __rsub__ operand, though.
Victor M. Rosas García
Computational Chemistry Apprentice


Get your free address at