5 from __future__
import print_function
22 IMP.OptimizerState.__init__(self, m,
"WriteStats")
24 self.restraints = restraints
27 if (self.count != 10):
32 for r
in self.restraints:
33 print(r.get_name(), r.get_last_score())
47 chains = IMP.atom.get_by_type(prot, IMP.atom.CHAIN_TYPE)
48 print(
"there are", len(chains),
"chains in 1z5s.pdb")
51 native_chain_centers = []
56 rbd.set_coordinates_are_optimized(
True)
57 rigid_bodies.append(rbd)
58 print(
"chain has", rbd.get_number_of_members(),
59 "atoms",
"coordinates: ", rbd.get_coordinates())
60 native_chain_centers.append(rbd.get_coordinates())
65 for rbd
in rigid_bodies:
69 rbd.get_coordinates(), rotation)
75 transformation1, transformation2)
77 print(
"Writing transformed assembly")
83 native_chain_centers[0], native_chain_centers[1])
86 r01.set_name(
"distance 0-1")
88 native_chain_centers[1], native_chain_centers[2])
91 r12.set_name(
"distance 1-2")
93 native_chain_centers[2], native_chain_centers[3])
96 r23.set_name(
"distance 2-3")
98 native_chain_centers[3], native_chain_centers[0])
101 r30.set_name(
"distance 3-0")
102 print(
"Distances in the solution: d01 =",
103 d01,
"d12 =", d12,
"d23 =", d23,
"d30 =", d30)
109 IMP.em2d.read_selection_file(selection_file)]
111 print(len(em_images),
"images read")
125 params.coarse_registration_method = IMP.em2d.ALIGN2D_PREPROCESSING
128 params.save_match_images =
False
132 em2d_restraint.setup(score_function, params)
133 em2d_restraint.set_images(em_images)
134 em2d_restraint.set_name(
"em2d restraint")
136 em2d_restraint.set_particles(container)
146 all_restraints = [r01, r12, r23, r30, em2d_restraints_set]
151 s.set_scoring_function(sf)
154 for rbd
in rigid_bodies:
157 print(
"MonteCarlo sampler has", s.get_number_of_movers(),
"movers")
160 o_state.set_period(10)
161 s.add_optimizer_state(o_state)
163 ostate2 = WriteStatisticsOptimizerScore(m, all_restraints)
164 s.add_optimizer_state(ostate2)
167 temperatures = [200, 100, 60, 40, 20, 5]
170 optimization_steps = 10
171 for T
in temperatures:
173 s.optimize(optimization_steps)
178 print(
"*** End optimization ***")
180 for rbd
in rigid_bodies:
181 print(
"chain has", rbd.get_number_of_members(),
182 "atoms",
"coordinates: ", rbd.get_coordinates())
183 new_centers.append(rbd.get_coordinates())
189 print(
"Distances at the end of the optimization: d01 =",
190 d01,
"d12 =", d12,
"d23 =", d23,
"d30 =", d30)
Restraints using electron microscopy 2D images (class averages).
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
Various classes to hold sets of particles.
Rotation3D get_random_rotation_3d(const Rotation3D ¢er, double distance)
Pick a rotation at random near the provided one.
void add_radii(Hierarchy d, const ForceFieldParameters *ffp=get_all_atom_CHARMM_parameters(), FloatKey radius_key=FloatKey("radius"))
Add vdW radius from given force field.
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
Modify the transformation of a rigid body.
void write_pdb(const Selection &mhd, TextOutput out, unsigned int model=1)
Create a scoring function on a list of restraints.
GenericHierarchies get_leaves(Hierarchy mhd)
Get all the leaves of the bit of hierarchy.
Distance restraint between two particles.
void read_pdb(TextInput input, int model, Hierarchy h)
Transformation3D get_rotation_about_point(const Vector3D &point, const Rotation3D &rotation)
Generate a Transformation3D object from a rotation around a point.
Vector3D get_random_vector_in(const Cylinder3D &c)
Generate a random vector in a cylinder with uniform density.
Object used to hold a set of restraints.
Class for storing model, its restraints, constraints, and particles.
Select all non-alternative ATOM records.
Store a list of ParticleIndexes.
void transform(XYZ a, const algebra::Transformation3D &tr)
Apply a transformation to the particle.
Images read_images(const Strings &names, const ImageReaderWriter *rw)
std::string get_relative_path(std::string base, std::string relative)
Return a path to a file relative to another file.
Transformation3D compose(const Transformation3D &a, const Transformation3D &b)
Compose two transformations.
void set_log_level(LogLevel l)
Set the current global log level.
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...
Parameters used by Em2DRestraint and ProjectionFinder.
Shared optimizer state that is invoked upon commitment of new coordinates.
double get_distance(const VectorD< D > &v1, const VectorD< D > &v2)
Compute the distance between two vectors.
Functionality for loading, creating, manipulating and scoring atomic structures.
static RigidBody setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor ps)
Harmonic function (symmetric about the mean)