IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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
30IMPEM_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
41class IMPEMEXPORT FitRestraintBayesEM3D : public Restraint {
42 public:
43 //! Constructor
44 FitRestraintBayesEM3D(ParticlesTemp ps, DensityMap *em_map,
46 bool use_rigid_bodies = true, double sigma = .1,
47 double window_size = 1.0);
48
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
72IMPEM_END_NAMESPACE
73
74#endif /* IMPEM_FIT_RESTRAINT_BAYES_EM3D_H */
Simple atom decorator.
Compute a Bayesian formalism score and its derivatives to assess degree of match between a tested mod...
Class for handling density maps.
A decorator for particles with mass.
Storage of a model, its restraints, constraints and particles.
Refine a particle into a list of particles.
Abstract base class for all restraints.
Sampled density map.
Decorator for a sphere-like particle.
Decorator for helping deal with a hierarchy of molecules.
Class for adding derivatives from restraints to the model.
Restraint(Model *m, std::string name)
Create a restraint and register it with the model.
static FloatKey get_mass_key()
Class for handling density maps.
Definition DensityMap.h:95
virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
FitRestraintBayesEM3D(ParticlesTemp ps, DensityMap *em_map, FloatKey weight_key=atom::Mass::get_mass_key(), bool use_rigid_bodies=true, double sigma=.1, double window_size=1.0)
Constructor.
virtual IMP::ModelObjectsTemp do_get_inputs() const override
Vector< VectorD< 3 > > Vector3Ds
Definition VectorD.h:409
Vector< Pointer< Particle > > Particles
A list of reference-counted Particle objects.
Definition base_types.h:138
Key< 0 > FloatKey
The type used to identify float attributes in the Particles.
Definition base_types.h:32
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Definition base_types.h:122
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
A smart pointer to a ref-counted Object that is a class member.
Definition Pointer.h:144