Definition problem

Ricks Palton rpalton at mac.com
Mon Mar 11 09:02:46 EST 2002


Hi,

Here's a little program I found:

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')


When I execute it, here's what I get:

09:51:06 [localhost:~/Documents] r1ck5p$ python mymolecule.py 
  File "mymolecule.py", line 6
    def init(self, name, atoms, bonds):
      ^
IndentationError: expected an indented block


I'm on Mac OS X 10.1.3
What's the problem and what should I do?

Thankx
r1ck5p



More information about the Python-list mailing list