IMP  2.2.1
The Integrative Modeling Platform
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
19 d0.set_coordinates_are_optimized(True)
20 d1.set_coordinates_are_optimized(True)
21 
22 # restrain their distance to be 1
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)
See IMP.test for more information.
Definition: test_config.h:107
static XYZ setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: XYZ.h:51
See IMP.gsl for more information.
Distance restraint between two particles.
double get_distance(XYZR a, XYZR b)
Compute the sphere distance between a and b.
Definition: XYZR.h:88
A simplex optimizer taken from GSL.
Definition: Simplex.h:27
Class to handle individual model particles.
See IMP.core for more information.
See IMP.algebra for more information.
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:72
Harmonic function (symmetric about the mean)
Definition: core/Harmonic.h:24