home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
2.16.0
The Integrative Modeling Platform
IMP Manual
Reference Guide
Tutorial Index
Modules
Classes
Examples
version 2.16.0
container/bipartite_nonbonded_interactions.py
This example shows how set up excluded volume interactions between two sets of particles.
1
## \example container/bipartite_nonbonded_interactions.py
2
# This example shows how set up excluded volume interactions between two
3
# sets of particles.
4
5
import
IMP
6
import
IMP.core
7
import
IMP.container
8
import
sys
9
10
IMP.setup_from_argv
(sys.argv,
"bipartite nonbonded interactions"
)
11
12
# This example addes a restraint on bipartite nonbonded interactions
13
# after excluding a set of bonded interactions.
14
15
m =
IMP.Model
()
16
# The set of particles
17
ps0 =
IMP.container.ListSingletonContainer
(
18
m,
IMP.core.create_xyzr_particles
(m, 20, 1.0))
19
ps1 =
IMP.container.ListSingletonContainer
(
20
m,
IMP.core.create_xyzr_particles
(m, 20, 2.0))
21
22
# Set up the nonbonded list
23
nbl =
IMP.container.CloseBipartitePairContainer
(ps0, ps1, 0, 1)
24
25
# Set up excluded volume
26
ps =
IMP.core.SphereDistancePairScore
(
IMP.core.HarmonicLowerBound
(0, 1))
27
evr =
IMP.container.PairsRestraint
(ps, nbl)
28
29
# Set up optimizer
30
o =
IMP.core.ConjugateGradients
(m)
31
o.set_scoring_function([evr])
32
33
o.optimize(1000)