next up previous contents index
Next: Restraints.unpick() unselect Up: The Restraints class: static Previous: Restraints.condense() remove   Contents   Index

Restraints.add() -- add restraint

add(*args)
This command adds one or more restraints to the end of the restraints list and selects them. It should be given one or more arguments, which are the restraints to add. These are mathematical form objects, as described in Section 5.3.1, or secondary structure objects, as described in Section 6.8.

This command is also useful for specifying cis-peptide bonds from your own scripts, using the cispeptide() command.

Example: examples/commands/add_restraint.py


# Example for: restraints.add(), restraints.unpick()

# This will enforce cis conformation for Pro-56.

# Make a model and stereochemical restraints:

from modeller import *
from modeller.scripts import complete_pdb, cispeptide

log.level(output=1, notes=1, warnings=1, errors=1, memory=0)
env = environ()
env.io.atom_files_directory = ['../atom_files']

env.libs.topology.read(file='$(LIB)/top_heav.lib')
env.libs.parameters.read(file='$(LIB)/par.lib')

code = '1fas'
mdl = complete_pdb(env, code)
rsr = mdl.restraints
atmsel = selection(mdl)
rsr.make(atmsel, restraint_type='stereo', spline_on_site=False)

# Change the Pro-56 restraint from trans to cis:
a = mdl.atoms
cispeptide(rsr, atom_ids1=(a['O:56'], a['C:56'], a['N:57'], a['CA:57']),
                atom_ids2=(a['CA:56'], a['C:56'], a['N:57'], a['CA:57']))

# Constrain the distance between alpha carbons in residues 5 and 15 to
# be less than 10 angstroms:
rsr.add(forms.upper_bound(group=physical.xy_distance,
                          feature=features.distance(a['CA:5'], a['CA:15']),
                          mean=10., stdev=0.1))

rsr.write(file='1fas.rsr')
atmsel.energy()



Automatic builds 2009-06-12