IMP
2.4.0
The Integrative Modeling Platform
IMP Mainpage
Modules
Classes
Examples
core/excluded_volume.py
Setup an excluded volume restraint between a bunch of particles with radius.
1
## \example core/excluded_volume.py
2
# Setup an excluded volume restraint between a bunch of particles with radius.
3
#
4
5
import
IMP.example
6
7
(m, c) = IMP.example.create_model_and_particles()
8
9
# this container lists all pairs that are close at the time of evaluation
10
nbl =
IMP.container.ClosePairContainer
(c, 0, 2)
11
h =
IMP.core.HarmonicLowerBound
(0, 1)
12
sd =
IMP.core.SphereDistancePairScore
(h)
13
# use the lower bound on the inter-sphere distance to push the spheres apart
14
nbr =
IMP.container.PairsRestraint
(sd, nbl)
15
m.add_restraint(nbr)
16
17
# alternatively, one could just do
18
r =
IMP.core.ExcludedVolumeRestraint
(c)
19
m.add_restraint(r)
20
21
# get the current score
22
print(m.evaluate(
False
))