IMP
2.1.1
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
Classes
Files
Examples
Indexes
File List
File Members
simplex.py
1
## \example gsl/simplex.py
2
# The IMP::gsl::Simplex optimizer is a local optimizer that does not
3
# require derivatives.
4
5
import
IMP
6
import
IMP.test
7
import
IMP.core
8
import
IMP.gsl
9
import
IMP.algebra
10
11
12
m =
IMP.kernel.Model
()
13
14
# create two particles to optimize
15
d0 =
IMP.core.XYZ.setup_particle
(
16
IMP.kernel.Particle
(m),
IMP.algebra.Vector3D
(0, 0, 0))
17
d1 =
IMP.core.XYZ.setup_particle
(
18
IMP.kernel.Particle
(m),
IMP.algebra.Vector3D
(3, 4, 5))
19
d0.set_coordinates_are_optimized(
True
)
20
d1.set_coordinates_are_optimized(
True
)
21
22
# restrain their distance to be 1
23
dist =
IMP.core.DistanceRestraint
(
IMP.core.Harmonic
(1, 1), d0, d1)
24
m.add_restraint(dist)
25
26
opt =
IMP.gsl.Simplex
(m)
27
opt.set_minimum_size(.000001)
28
opt.set_initial_length(1)
29
30
# probably more steps than are needed
31
e = opt.optimize(1000000)
32
print
IMP.core.get_distance
(d0, d1)
IMP::test
See IMP.test for more information.
Definition:
test_config.h:107
IMP::core::XYZ::setup_particle
static XYZ setup_particle(kernel::Model *m, ParticleIndex pi)
Definition:
XYZ.h:53
IMP::gsl
See IMP.gsl for more information.
Definition:
gsl/ConjugateGradients.h:15
IMP::core::DistanceRestraint
Distance restraint between two particles.
Definition:
DistanceRestraint.h:32
IMP::core::get_distance
double get_distance(XYZR a, XYZR b)
Compute the sphere distance between a and b.
Definition:
XYZR.h:88
IMP::algebra::VectorD< 3 >
IMP::gsl::Simplex
A simplex optimizer taken from GSL.
Definition:
Simplex.h:27
IMP::kernel::Particle
Class to handle individual model particles.
Definition:
kernel/declare_Particle.h:34
IMP::core
See IMP.core for more information.
Definition:
AngleRestraint.h:19
IMP::algebra
See IMP.algebra for more information.
Definition:
algebra_config.h:113
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/declare_Model.h:72
IMP::core::Harmonic
Harmonic function (symmetric about the mean)
Definition:
core/Harmonic.h:25