Restraints on pseudo atoms: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
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 attachment:pseudo.atm input. | |||
pseudo. | |||
<pre><nowiki>#!python | |||
from modeller import * | |||
from modeller.optimizers import conjugate_gradients | |||
e = environ() | |||
e.edat.dynamic_sphere = False | |||
log.verbose() | |||
# Read in a dummy PDB, which defines five real atoms - four are positioned at | |||
# the corners of a square in the xy place, and the fifth is off in space | |||
m = model(e, file='pseudo.atm') | |||
# Define a pseudo atom as the gravity center of the first 4 atoms, and add | |||
# it to the model's restraints | |||
p = pseudo_atom.gravity_center(m.atoms[0:5]) | |||
m.restraints.pseudo_atoms.append(p) | |||
# Create a restraint on the distance between the real fifth atom and the newly | |||
# created pseudo atom, and add it to the model's restraints. Since the mean is | |||
# zero, this will force atom 5 to coexist with the gravity center. | |||
r = forms.gaussian(group=physical.xy_distance, | |||
feature=features.distance(m.atoms[4], p), | |||
mean=0.0, stdev=0.100) | |||
m.restraints.add(r) | |||
# Calculate the starting energy of all atoms in the system, then optimize | |||
s = selection(m) | |||
s.energy() | |||
cg = conjugate_gradients() | |||
cg.optimize(s, max_iterations=200) | |||
# Write out the final coordinates | |||
m.write(file='pseudoout.atm') | |||
</nowiki></pre> | |||
It is straightforward to add restraints of this type to a comparative | It is straightforward to add restraints of this type to a comparative | ||
modeling run - see for example, http://salilab.org/modeller/ | modeling run - see for example, [http://salilab.org/modeller/9v1/manual/node26.html Adding additional restraints to the defaults]. | ||
Revision as of 00:00, 1 January 1970
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 attachment:pseudo.atm input.
#!python from modeller import * from modeller.optimizers import conjugate_gradients e = environ() e.edat.dynamic_sphere = False log.verbose() # Read in a dummy PDB, which defines five real atoms - four are positioned at # the corners of a square in the xy place, and the fifth is off in space m = model(e, file='pseudo.atm') # Define a pseudo atom as the gravity center of the first 4 atoms, and add # it to the model's restraints p = pseudo_atom.gravity_center(m.atoms[0:5]) m.restraints.pseudo_atoms.append(p) # Create a restraint on the distance between the real fifth atom and the newly # created pseudo atom, and add it to the model's restraints. Since the mean is # zero, this will force atom 5 to coexist with the gravity center. r = forms.gaussian(group=physical.xy_distance, feature=features.distance(m.atoms[4], p), mean=0.0, stdev=0.100) m.restraints.add(r) # Calculate the starting energy of all atoms in the system, then optimize s = selection(m) s.energy() cg = conjugate_gradients() cg.optimize(s, max_iterations=200) # Write out the final coordinates 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.