IMP logo
IMP Reference Guide  2.6.0
The Integrative Modeling Platform
container/nonbonded_interactions.py

This example shows how to set up an excluded volume restraint for a set of XYZRDecorator-style particles.

1 ## \example container/nonbonded_interactions.py
2 # This example shows how to set up an excluded volume restraint for a set
3 # of XYZRDecorator-style particles.
4 
5 import IMP
6 import IMP.core
7 import IMP.atom
8 import IMP.container
9 import sys
10 
11 IMP.setup_from_argv(sys.argv, "nonbonded interactions")
12 
13 # This example addes a restraint on nonbonded interactions
14 # after excluding a set of bonded interactions.
15 
16 m = IMP.Model()
17 # The set of particles
20 
21 # create a bond between two particles
22 bd0 = IMP.atom.Bonded.setup_particle(m, ps.get_indexes()[0])
23 bd1 = IMP.atom.Bonded.setup_particle(m, ps.get_indexes()[1])
24 IMP.atom.create_custom_bond(bd0, bd1, 2.0)
25 
26 # Set up the nonbonded list for all pairs at are touching
27 # and let things move 3 before updating the list
28 nbl = IMP.container.ClosePairContainer(ps, 0.0, 3.0)
29 nbl.add_pair_filter(IMP.atom.BondedPairFilter())
30 
31 # Set up excluded volume
33 evr = IMP.container.PairsRestraint(sdps, nbl)
34 
35 # Set up optimizer
37 o.set_scoring_function([evr])
38 
39 o.optimize(1000)