IMP logo
IMP Reference Guide  2.20.2
The Integrative Modeling Platform
FitRestraintBayesEM3D.h
Go to the documentation of this file.
1 /**
2  * \file IMP/em/FitRestraintBayesEM3D.h
3  * \brief Calculate the Bayesian score and derivative
4  * based on fit to an EM density map. This restraint differs from
5  * em::FitRestraint because it does not use a cross_correlation_coefficient as
6  * score but a Bayesian similarity measure.
7  *
8  * Copyright 2007-2020 IMP Inventors. All rights reserved.
9  *
10  */
11 
12 #ifndef IMPEM_FIT_RESTRAINT_BAYES_EM3D_H
13 #define IMPEM_FIT_RESTRAINT_BAYES_EM3D_H
14 
15 #include <IMP/Model.h>
16 #include <IMP/Refiner.h>
17 #include <IMP/Restraint.h>
18 #include <IMP/atom/Atom.h>
19 #include <IMP/atom/Hierarchy.h>
20 #include <IMP/atom/Mass.h>
21 #include <IMP/core/XYZR.h>
22 #include <IMP/em/em_config.h>
23 
24 #include <boost/unordered_map.hpp>
25 
26 #include "BayesEM3D.h"
27 #include "DensityMap.h"
28 #include "SampledDensityMap.h"
29 
30 IMPEM_BEGIN_NAMESPACE
31 
32 //! Calculate score based on fit to EM map
33 /** The score is a function of the difference between
34  the normalize EM map and the map simulated from the particles.
35  This restraint is numerically stable and
36  incorporate knowledge about the uncertainty in the EM map.
37  Note: This is still in development.
38  \ingroup exp_restraint
39 */
40 
41 class IMPEMEXPORT FitRestraintBayesEM3D : public Restraint {
42  public:
43  //! Constructor
45  FloatKey weight_key = atom::Mass::get_mass_key(),
46  bool use_rigid_bodies = true, double sigma = .1,
47  double window_size = 1.0);
48 
49  virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const
50  override;
51  virtual IMP::ModelObjectsTemp do_get_inputs() const override;
53 
54  private:
55  IMP::PointerMember<DensityMap> target_dens_map_;
56  double resolution_;
57  double voxel_size_;
58  double sigma_;
59  double window_size_;
60  // reference to the IMP environment
61  core::XYZs xyzs_;
62 
63  // score and derivatives
64  mutable double score_;
65  mutable algebra::Vector3Ds dv_;
66 
67  // Particles
68  Particles ps_;
69  FloatKey weight_key_;
70 };
71 
72 IMPEM_END_NAMESPACE
73 
74 #endif /* IMPEM_FIT_RESTRAINT_BAYES_EM3D_H */
A decorator for particles with mass.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Simple atom decorator.
Storage of a model, its restraints, constraints and particles.
virtual double unprotected_evaluate(DerivativeAccumulator *da) const
Return the unweighted score for the restraint.
Class for handling density maps.
Decorator for helping deal with a hierarchy of molecules.
Class for handling density maps.
Definition: DensityMap.h:95
Refine a particle into a list of particles.
A smart pointer to a ref-counted Object that is a class member.
Definition: Pointer.h:143
Compute a Bayesian formalism score and its derivatives to assess degree of match between a tested mod...
Abstract base class for all restraints.
Calculate score based on fit to EM map.
Decorator for a sphere-like particle.
Sampled density map.
virtual ModelObjectsTemp do_get_inputs() const =0
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:56