8 #ifndef IMPEM_RIGID_FITTING_H
9 #define IMPEM_RIGID_FITTING_H
19 #include <IMP/em/em_config.h>
35 typedef std::pair<algebra::Transformation3D,Float> FittingSolution;
38 bool operator()(
const FittingSolution &s1,
const FittingSolution & s2)
const
40 return s1.second < s2.second;
54 i<<
") in get_transformation is our of range ("<<
55 fs_.size()<<
")"<<std::endl);
65 i<<
") in get_transformation is out of range ("<<
66 fs_.size()<<
")"<<std::endl);
69 void set_score(
unsigned int i,
Float score) {
71 i<<
") in get_transformation is out of range ("<<
72 fs_.size()<<
")"<<std::endl);
78 void sort(
bool reverse=
false);
82 for(
unsigned int i=0;i<fs_.size();i++) fs_[i].first=fs_[i].first*t;
86 for(
unsigned int i=0;i<fs_.size();i++) all_ts.push_back(fs_[i].first);
89 void show(std::ostream& out=std::cout)
const {
90 for(std::vector<FittingSolution>::const_iterator it = fs_.begin();
91 it != fs_.end(); it++) {
92 out<<
"("<<it->first<<
" , "<<it->second<<
")"<<std::endl;
96 std::vector<FittingSolution> fs_;
133 Int number_of_optimization_runs = 5,
Int number_of_mc_steps = 10,
134 Int number_of_cg_steps=100,
135 Float max_translation=2.,
Float max_rotation=.3,
bool fast=
false);
171 Int number_of_optimization_runs = 5,
Int number_of_mc_steps = 10,
172 Int number_of_cg_steps=100,
173 Float max_translation=2.,
Float max_rotation=.3,
180 p, refiner,weight_key, dmap,
182 number_of_optimization_runs, number_of_mc_steps,
183 number_of_cg_steps, max_translation, max_rotation,fast);
212 Int number_of_optimization_runs = 5,
Int number_of_mc_steps = 10,
213 Int number_of_cg_steps=100,
214 Float max_translation=2.,
Float max_rotation=.3);
241 Int max_voxels_translation=2,
242 Int translation_step=1,
243 Float max_angle_in_radians = 0.174,
244 Int number_of_rotations = 100);
266 IMPEMEXPORT FittingSolutions
270 bool fast_version=
false,
bool local_score=
false,
271 const FloatKey &wei_key=atom::Mass::get_mass_key());
289 transformations,
true);
304 FloatKey wei_key=atom::Mass::get_mass_key());
Simple conjugate gradients optimizer.
Calculate score based on fit to EM map.
virtual const ParticlesTemp get_refined(Particle *a) const =0
Refine the passed particle into a set of particles.
Import IMP/kernel/RestraintSet.h in the namespace.
algebra::Transformation3D get_transformation(unsigned int i) const
Get the score of the i'th solution.
Simple Monte Carlo optimizer.
FittingSolutions local_rigid_fitting_grid_search(const kernel::ParticlesTemp &ps, const FloatKey &wei_key, DensityMap *dmap, Int max_voxels_translation=2, Int translation_step=1, Float max_angle_in_radians=0.174, Int number_of_rotations=100)
Local grid search rigid fitting.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
A simple list of fitting solutions.
algebra::Vector3D get_centroid(const XYZs &ps)
Get the centroid.
FittingSolutions compute_fitting_scores(const kernel::ParticlesTemp &ps, DensityMap *em_map, const algebra::Transformation3Ds &transformations, bool fast_version=false, bool local_score=false, const FloatKey &wei_key=atom::Mass::get_mass_key())
Compute fitting scores for a given set of rigid transformations.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Class for handling density maps.
Class for handling density maps.
functionality for defining rigid bodies
Float compute_fitting_score(const kernel::ParticlesTemp &ps, DensityMap *em_map, FloatKey wei_key=atom::Mass::get_mass_key())
Compute fitting scores for a given set of rigid transformations.
Import IMP/kernel/ScoreState.h in the namespace.
Class to handle individual model particles.
Storage of a model, its restraints, constraints and particles.
Classes to handle individual model particles.
IMP::base::Vector< IMP::base::Pointer< OptimizerState > > OptimizerStates
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
double Float
Basic floating-point value (could be float, double...)
void multiply(const algebra::Transformation3D &t)
int Int
Basic integer value.
Import IMP/kernel/OptimizerState.h in the namespace.
FittingSolutions local_rigid_fitting_around_points(kernel::Particle *p, Refiner *refiner, const FloatKey &wei_key, DensityMap *dmap, const algebra::Vector3Ds &anchor_centroids, OptimizerStates display_log, Int number_of_optimization_runs=5, Int number_of_mc_steps=10, Int number_of_cg_steps=100, Float max_translation=2., Float max_rotation=.3)
Local rigid fitting of a rigid body around a set of center points.
A decorator for a rigid body.
FittingSolutions local_rigid_fitting_around_point(kernel::Particle *p, Refiner *refiner, const FloatKey &weight_key, DensityMap *dmap, const algebra::Vector3D &anchor_centroid, OptimizerStates display_log, Int number_of_optimization_runs=5, Int number_of_mc_steps=10, Int number_of_cg_steps=100, Float max_translation=2., Float max_rotation=.3, bool fast=false)
Local rigid fitting of a rigid body around a center point.
Abstract class to implement hierarchical methods.
int get_number_of_solutions() const
Get the number of solutions in the set.
#define IMP_LOG_VERBOSE(expr)
FittingSolutions local_rigid_fitting(kernel::Particle *p, Refiner *refiner, const FloatKey &weight_key, DensityMap *dmap, OptimizerStates display_log, Int number_of_optimization_runs=5, Int number_of_mc_steps=10, Int number_of_cg_steps=100, Float max_translation=2., Float max_rotation=.3, bool fast=true)
Local rigid fitting of a rigid body.
Float get_score(unsigned int i) const
Get the score of the i'th solution.