IMP  2.4.0
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))
Support for running tests of IMP functionality.
static XYZ setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: XYZ.h:51
Several general purpose optimizers from the GNU Scientific Library (GSL).
Distance restraint between two particles.
double get_distance(XYZR a, XYZR b)
Compute the sphere distance between a and b.
Definition: XYZR.h:87
A simplex optimizer taken from GSL.
Definition: Simplex.h:27
Class to handle individual model particles.
Basic functionality that is expected to be used by a wide variety of IMP users.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73
Harmonic function (symmetric about the mean)
Definition: core/Harmonic.h:24