9 #ifndef IMPBAYESIANEM_GAUSSIAN_EM_RESTRAINT_H
10 #define IMPBAYESIANEM_GAUSSIAN_EM_RESTRAINT_H
12 #include "bayesianem_config.h"
23 #include <Eigen/Dense>
24 #include <boost/unordered_map.hpp>
26 IMPBAYESIANEM_BEGIN_NAMESPACE
28 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
29 struct KahanAccumulation{
33 sum(0.0),correction(0.0)
36 struct KahanVectorAccumulation{
38 Eigen::Vector3d correction;
39 KahanVectorAccumulation():
40 sum(Eigen::Vector3d(0,0,0)),
41 correction(Eigen::Vector3d(0,0,0))
44 inline KahanAccumulation KahanSum(KahanAccumulation accumulation,
double value){
45 KahanAccumulation result;
46 double y = value - accumulation.correction;
47 double t = accumulation.sum + y;
48 result.correction = (t - accumulation.sum) - y;
52 inline KahanVectorAccumulation
53 KahanVectorSum(KahanVectorAccumulation accumulation, Eigen::Vector3d value){
54 KahanVectorAccumulation result;
55 Eigen::Vector3d y = value - accumulation.correction;
56 Eigen::Vector3d t = accumulation.sum + y;
57 result.correction = (t - accumulation.sum) - y;
99 bool update_model=
true,
bool backbone_slope=
false,
100 std::string name=
"GaussianEMRestraint%1%");
104 return exp(-unprotected_evaluate(NULL));
120 void compute_initial_scores();
140 void show(std::ostream &out)
const { out <<
"GEM restraint"; }
151 double model_cutoff_dist_, density_cutoff_dist_;
160 Float normalization_;
162 Float self_mm_score_;
163 PointerMember<container::CloseBipartitePairContainer> md_container_;
167 Float cached_score_term_;
168 std::
string density_fn_;
178 IMPBAYESIANEM_END_NAMESPACE
Declare an efficient stl-compatible map.
Decorator to hold Gaussian3D.
A decorator for particles with mass.
virtual RestraintInfo * get_static_info() const
Store a list of ParticleIndexes.
Return all pairs from a SingletonContainer.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Float get_slope()
Get restraint slope.
Creates a restraint between two Gaussian Mixture Models, "model" and "density".
void set_density_filename(std::string density_fn)
Set the filename corresponding to the density GMM particles.
Macros to define containers of objects.
Class for storing model, its restraints, constraints, and particles.
Return all pairs from a SingletonContainer.
A smart pointer to a ref-counted Object that is a class member.
Report key:value information on restraints.
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.
std::string get_absolute_path(std::string file)
Convert a possibly relative path to an absolute path.
double Float
Basic floating-point value (could be float, double...)
void set_slope(Float s)
Set restraint slope.
double get_probability() const
Returns exp(score)
ParticleIndexes get_indexes(const ParticlesTemp &ps)
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.