Definition problem
Andy Gimblett
gimbo at ftech.net
Mon Mar 11 12:27:43 EST 2002
OK, forgot to attach the file... Sorry! :-)
--
Andy Gimblett - Programmer - Frontier Internet Services Limited
Tel: 029 20 820 044 Fax: 029 20 820 035 http://www.frontier.net.uk/
Statements made are at all times subject to Frontier's Terms and
Conditions of Business, which are available upon request.
-------------- next part --------------
#!/usr/bin/env python
from MMTK import *
from MMTK import Bonds
class MyMolecule(Molecule):
def __init__(self, name, atoms, bonds):
self.atoms = []
self.bonds = []
self.groups = []
self.name = name
for element, position in atoms:
self.atoms.append(Atom(element, position = position))
for i1, i2 in bonds:
self.bonds.append(Bonds.Bond((self.atoms[i1], self.atoms[i2])))
self.bonds = Bonds.BondList(self.bonds)
self.parent = None # top-level object
self.type = None # no database type
h2 = MyMolecule('h2', [('h', Vector(0., 0., -0.05)),
('h', Vector(0.,0., 0.05))], [(0, 1)])
h2.writeToFile('test.pdb')
More information about the Python-list
mailing list