pseudo.py demonstrates the use of a restraint between a real atom and a pseudo atom. This input file should work with Modeller 9v1 or later. You will also need the pseudo.atm input.
1 from modeller import *
2 from modeller.optimizers import conjugate_gradients
3
4 e = environ()
5 e.edat.dynamic_sphere = False
6 log.verbose()
7
8 # Read in a dummy PDB, which defines five real atoms - four are positioned at
9 # the corners of a square in the xy place, and the fifth is off in space
10 m = model(e, file='pseudo.atm')
11
12 # Define a pseudo atom as the gravity center of the first 4 atoms, and add
13 # it to the model's restraints
14 p = pseudo_atom.gravity_center(m.atoms[0:5])
15 m.restraints.pseudo_atoms.append(p)
16
17 # Create a restraint on the distance between the real fifth atom and the newly
18 # created pseudo atom, and add it to the model's restraints. Since the mean is
19 # zero, this will force atom 5 to coexist with the gravity center.
20 r = forms.gaussian(group=physical.xy_distance,
21 feature=features.distance(m.atoms[4], p),
22 mean=0.0, stdev=0.100)
23 m.restraints.add(r)
24
25 # Calculate the starting energy of all atoms in the system, then optimize
26 s = selection(m)
27 s.energy()
28 cg = conjugate_gradients()
29 cg.optimize(s, max_iterations=200)
30
31 # Write out the final coordinates
32 m.write(file='pseudoout.atm')
It is straightforward to add restraints of this type to a comparative modeling run - see for example, Adding additional restraints to the defaults.
