home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
2.8.0
The Integrative Modeling Platform
IMP Manual
Reference Guide
Modules
Classes
Examples
doc
examples
gsl
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
import
sys
11
12
IMP.setup_from_argv
(sys.argv,
"simplex"
)
13
14
m =
IMP.Model
()
15
16
# create two particles to optimize
17
d0 =
IMP.core.XYZ.setup_particle
(
18
IMP.Particle
(m),
IMP.algebra.Vector3D
(0, 0, 0))
19
d1 =
IMP.core.XYZ.setup_particle
(
20
IMP.Particle
(m),
IMP.algebra.Vector3D
(3, 4, 5))
21
d0.set_coordinates_are_optimized(
True
)
22
d1.set_coordinates_are_optimized(
True
)
23
24
# restrain their distance to be 1
25
dist =
IMP.core.DistanceRestraint
(m,
IMP.core.Harmonic
(1, 1), d0, d1)
26
27
opt =
IMP.gsl.Simplex
(m)
28
opt.set_scoring_function([dist])
29
opt.set_minimum_size(.000001)
30
opt.set_initial_length(1)
31
32
# probably more steps than are needed
33
e = opt.optimize(1000000)
34
print(
IMP.core.get_distance
(d0, d1))
IMP::test
Support for running tests of IMP functionality.
IMP::setup_from_argv
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
IMP::gsl
Several general purpose optimizers from the GNU Scientific Library (GSL).
IMP::core::DistanceRestraint
Distance restraint between two particles.
Definition:
DistanceRestraint.h:32
IMP::core::XYZ::setup_particle
static XYZ setup_particle(Model *m, ParticleIndex pi)
Definition:
XYZ.h:51
IMP::core::get_distance
double get_distance(XYZR a, XYZR b)
Compute the sphere distance between a and b.
Definition:
XYZR.h:89
IMP::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
Model.h:72
IMP::gsl::Simplex
A simplex optimizer taken from GSL.
Definition:
Simplex.h:27
IMP::core
Basic functionality that is expected to be used by a wide variety of IMP users.
IMP::algebra
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
IMP::algebra::Vector3D
VectorD< 3 > Vector3D
Definition:
VectorD.h:395
IMP::Particle
Class to handle individual particles of a Model object.
Definition:
Particle.h:41
IMP::core::Harmonic
Harmonic function (symmetric about the mean)
Definition:
core/Harmonic.h:24