Restraints on pseudo atoms: Difference between revisions
No edit summary |
(Fix broken links, tidy up markup, add to Examples category) |
||
(4 intermediate revisions by the same user not shown) | |||
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 | <!-- ## page was renamed from Restraints_on_pseudo_atoms --> | ||
pseudo.py demonstrates the use of a restraint between a real atom and a pseudo atom. This input file should work with Modeller 10.0 or later. You will also need the [https://salilab.org/modeller/archive/pseudo-rsr-example/pseudo.atm pseudo.atm] input. | |||
< | <syntaxhighlight lang="python"> | ||
from modeller import * | from modeller import * | ||
from modeller.optimizers import | from modeller.optimizers import ConjugateGradients | ||
e = | e = Environ() | ||
e.edat.dynamic_sphere = False | e.edat.dynamic_sphere = False | ||
log.verbose() | log.verbose() | ||
Line 13: | Line 14: | ||
# Read in a dummy PDB, which defines five real atoms - four are positioned at | # 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 | # the corners of a square in the xy place, and the fifth is off in space | ||
m = | m = Model(e, file='pseudo.atm') | ||
# Define a pseudo atom as the gravity center of the first 4 atoms, and add | # Define a pseudo atom as the gravity center of the first 4 atoms, and add | ||
# it to the model's restraints | # it to the model's restraints | ||
p = pseudo_atom. | p = pseudo_atom.GravityCenter(m.atoms[0:5]) | ||
m.restraints.pseudo_atoms.append(p) | m.restraints.pseudo_atoms.append(p) | ||
Line 23: | Line 24: | ||
# created pseudo atom, and add it to the model's restraints. Since the mean is | # 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. | # zero, this will force atom 5 to coexist with the gravity center. | ||
r = forms. | r = forms.Gaussian(group=physical.xy_distance, | ||
feature=features. | feature=features.Distance(m.atoms[4], p), | ||
mean=0.0, stdev=0.100) | mean=0.0, stdev=0.100) | ||
m.restraints.add(r) | m.restraints.add(r) | ||
# Calculate the starting energy of all atoms in the system, then optimize | # Calculate the starting energy of all atoms in the system, then optimize | ||
s = | s = Selection(m) | ||
s.energy() | s.energy() | ||
cg = | cg = ConjugateGradients() | ||
cg.optimize(s, max_iterations=200) | cg.optimize(s, max_iterations=200) | ||
# Write out the final coordinates | # Write out the final coordinates | ||
m.write(file='pseudoout.atm') | m.write(file='pseudoout.atm') | ||
</ | </syntaxhighlight> | ||
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, [ | modeling run - see for example, [https://salilab.org/modeller/10.0/manual/node28.html Adding additional restraints to the defaults]. | ||
[[Category:Examples]] |
Latest revision as of 21:25, 16 August 2022
pseudo.py demonstrates the use of a restraint between a real atom and a pseudo atom. This input file should work with Modeller 10.0 or later. You will also need the pseudo.atm input.
from modeller import *
from modeller.optimizers import ConjugateGradients
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.GravityCenter(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 = ConjugateGradients()
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.