IMP  2.3.1
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 
10 # This example addes a restraint on nonbonded interactions
11 # after excluding a set of bonded interactions.
12 
13 m = IMP.kernel.Model()
14 # The set of particles
17 
18 # create a bond between two particles
19 bd0 = IMP.atom.Bonded.setup_particle(ps.get_particle(0))
20 bd1 = IMP.atom.Bonded.setup_particle(ps.get_particle(1))
21 IMP.atom.create_custom_bond(bd0, bd1, 2.0)
22 
23 # Set up the nonbonded list for all pairs at are touching
24 # and let things move 3 before updating the list
25 nbl = IMP.container.ClosePairContainer(ps, 0.0, 3.0)
26 nbl.add_pair_filter(IMP.atom.BondedPairFilter())
27 
28 # Set up excluded volume
30 evr = IMP.container.PairsRestraint(sdps, nbl)
31 m.add_restraint(evr)
32 
33 # Set up optimizer
35 
36 o.optimize(1000)