IMP logo
FitRestraint.h
Go to the documentation of this file.
1 /**
2  * \file FitRestraint.h
3  * \brief Calculate score based on fit to EM map.
4  *
5  * Copyright 2007-2012 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPEM_FIT_RESTRAINT_H
10 #define IMPEM_FIT_RESTRAINT_H
11 
12 #include "em_config.h"
13 #include "DensityMap.h"
14 #include "CoarseCC.h"
15 #include "SampledDensityMap.h"
16 
17 #include <IMP/atom/Hierarchy.h>
18 #include <IMP/atom/Atom.h>
19 #include <IMP/atom/Mass.h>
20 #include <IMP/core/XYZR.h>
21 #include <IMP/Model.h>
22 #include <IMP/Restraint.h>
23 #include <IMP/VersionInfo.h>
24 #include <IMP/Refiner.h>
25 
26 IMPEM_BEGIN_NAMESPACE
27 
28 //! Calculate score based on fit to EM map
29 /** \ingroup exp_restraint
30 
31  */
32 class IMPEMEXPORT FitRestraint : public Restraint
33 {
34 public:
35  //! Constructor
36  /**
37  \param[in] ps The particles participating in the fitting score
38  \param[in] em_map The density map used in the fitting score
39  \param[in] norm_factors if set, they are used as normalization factors
40  for the cross correlation calculations. This is relevant when the
41  cross-correlation score of the entire system is decomposed.
42  \param[in] weight_key the name of the weight attribute of the particles
43  \param[in] scale multiply the fitting restraint score and derivatives
44  by this value
45  \param[in] use_rigid_bodies is some of the particles are part of
46  a rigid body,
47  use the rigid body for faster calculations
48  \note Rigid-bodies are interpolated and not resampled
49  if use_rigid_bodies option
50  is selected.
51  This significantly reduces the running time but is less accurate.
52  If the user prefers to get more accurate results, provide
53  its members as input particles and not the rigid body.
54  */
56  DensityMap *em_map,
57  FloatPair norm_factors=FloatPair(0.,0.),
58  FloatKey weight_key= atom::Mass::get_mass_key(),
59  float scale=1,
60  bool use_rigid_bodies=true,
61  KernelType kt=GAUSSIAN);
62  //! \return the predicted density map of the model
63  SampledDensityMap * get_model_dens_map() const {
64  return model_dens_map_;
65  }
66  void set_scale_factor(float scale) {scalefac_=scale;}
67  float get_scale_factor() const {return scalefac_;}
68  IMP_RESTRAINT(FitRestraint);
69 
70 #ifndef SWIG
71  IMP_LIST(private, Particle, particle, Particle*, Particles);
72 #endif
73 private:
74  //! Store particles
75  void store_particles(ParticlesTemp ps);
76  //! Resample the model density map
77  void resample() const;
78  //! Create density maps: one for each rigid body and one for the rest.
79  void initialize_model_density_map(FloatKey weight_key);
80 
81  IMP::OwnerPointer<DensityMap> target_dens_map_;
82  mutable IMP::OwnerPointer<SampledDensityMap> model_dens_map_;
83  mutable SampledDensityMaps rb_model_dens_map_;
85  none_rb_model_dens_map_;
86  algebra::BoundingBoxD<3> target_bounding_box_;
87  // reference to the IMP environment
88  float scalefac_;
89  core::XYZs xyz_;
90  // derivatives
91  algebra::Vector3Ds dv_;
92  algebra::ReferenceFrame3Ds rbs_orig_rf_;
93  FloatKey weight_key_;
94  KernelParameters *kernel_params_;
95  DistanceMask *dist_mask_;
96  FloatPair norm_factors_;
97  bool use_rigid_bodies_;
98  //particle handling
99  //map particles to their rigid bodies
101  Particles all_ps_;
102  Particles not_part_of_rb_; //all particles that are not part of a rigid body
103  Particles part_of_rb_;
104  core::RigidBodies rbs_;
105  KernelType kt_;
106 };
107 
108 IMPEM_END_NAMESPACE
109 
110 #endif /* IMPEM_FIT_RESTRAINT_H */

Generated on Tue May 22 2012 23:33:14 for IMP by doxygen 1.8.1