20 def __init__(self, m, restraints):
21 super().__init__(m,
"WriteStats")
23 self.restraints = restraints
26 if (self.count != 10):
31 for r
in self.restraints:
32 print(r.get_name(), r.get_last_score())
47print(
"there are", len(chains),
"chains in 1z5s.pdb")
50native_chain_centers = []
55 rbd.set_coordinates_are_optimized(
True)
56 rigid_bodies.append(rbd)
57 print(
"chain has", rbd.get_number_of_members(),
58 "atoms",
"coordinates: ", rbd.get_coordinates())
59 native_chain_centers.append(rbd.get_coordinates())
64for rbd
in rigid_bodies:
68 rbd.get_coordinates(), rotation)
74 transformation1, transformation2)
76print(
"Writing transformed assembly")
82 native_chain_centers[0], native_chain_centers[1])
85r01.set_name(
"distance 0-1")
87 native_chain_centers[1], native_chain_centers[2])
90r12.set_name(
"distance 1-2")
92 native_chain_centers[2], native_chain_centers[3])
95r23.set_name(
"distance 2-3")
97 native_chain_centers[3], native_chain_centers[0])
100r30.set_name(
"distance 3-0")
101print(
"Distances in the solution: d01 =",
102 d01,
"d12 =", d12,
"d23 =", d23,
"d30 =", d30)
108 IMP.em2d.read_selection_file(selection_file)]
110print(len(em_images),
"images read")
124params.coarse_registration_method = IMP.em2d.ALIGN2D_PREPROCESSING
127params.save_match_images =
False
131em2d_restraint.setup(score_function, params)
132em2d_restraint.set_images(em_images)
133em2d_restraint.set_name(
"em2d restraint")
135em2d_restraint.set_particles(container)
145all_restraints = [r01, r12, r23, r30, em2d_restraints_set]
150s.set_scoring_function(sf)
153for rbd
in rigid_bodies:
156print(
"MonteCarlo sampler has", s.get_number_of_movers(),
"movers")
159o_state.set_period(10)
160s.add_optimizer_state(o_state)
162ostate2 = WriteStatisticsOptimizerScore(m, all_restraints)
163s.add_optimizer_state(ostate2)
166temperatures = [200, 100, 60, 40, 20, 5]
169optimization_steps = 10
170for T
in temperatures:
172 s.optimize(optimization_steps)
177print(
"*** End optimization ***")
179for rbd
in rigid_bodies:
180 print(
"chain has", rbd.get_number_of_members(),
181 "atoms",
"coordinates: ", rbd.get_coordinates())
182 new_centers.append(rbd.get_coordinates())
188print(
"Distances at the end of the optimization: d01 =",
189 d01,
"d12 =", d12,
"d23 =", d23,
"d30 =", d30)
Class for storing model, its restraints, constraints, and particles.
Shared optimizer state that is invoked upon commitment of new coordinates.
Object used to hold a set of restraints.
Select all non-alternative ATOM records.
Hierarchies get_by_type(Hierarchy mhd, GetByType t)
Gather all the molecular particles of a certain level in the hierarchy.
Store a list of ParticleIndexes.
Distance restraint between two particles.
Harmonic function (symmetric about the mean)
Create a scoring function on a list of restraints.
Modify the transformation of a rigid body.
static RigidBody setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor ps)
Parameters used by Em2DRestraint and ProjectionFinder.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
Rotation3D get_random_rotation_3d()
Pick a rotation at random from all possible rotations.
Rotation2D compose(const Rotation2D &a, const Rotation2D &b)
Compose two rotations a and b.
VectorD< D > get_random_vector_in(const BoundingBoxD< D > &bb)
Generate a random vector in a box with uniform density.
double get_distance(const Line3D &s, const Vector3D &p)
Get closest distance between a line and a point.
Transformation2D get_rotation_about_point(const Vector2D &point, const Rotation2D &rotation)
Generate a Transformation2D object from a rotation around a point.
Functionality for loading, creating, manipulating and scoring atomic structures.
void write_pdb(const Selection &mhd, TextOutput out, unsigned int model=1)
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.
Hierarchy read_pdb(TextInput input, Model *model, PDBSelector *selector=get_default_pdb_selector(), bool select_first_model=true)
Read all the molecules in the first model of the PDB file.
Various classes to hold sets of particles.
Basic functionality that is expected to be used by a wide variety of IMP users.
void transform(RigidBody a, const algebra::Transformation3D &tr)
Transform a rigid body.
GenericHierarchies get_leaves(Hierarchy mhd)
Get all the leaves of the bit of hierarchy.
Restraints using electron microscopy 2D images (class averages).
Images read_images(const Strings &names, const ImageReaderWriter *rw)
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
void set_log_level(LogLevel l)
Set the current global log level.
std::string get_relative_path(std::string base, std::string relative)
Return a path to a file relative to another file.
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.