9#ifndef IMPBAYESIANEM_GAUSSIAN_EM_RESTRAINT_H
10#define IMPBAYESIANEM_GAUSSIAN_EM_RESTRAINT_H
12#include "bayesianem_config.h"
24#include <boost/unordered_map.hpp>
26IMPBAYESIANEM_BEGIN_NAMESPACE
28#if !defined(SWIG) && !defined(IMP_DOXYGEN)
29struct KahanAccumulation{
33 sum(0.0),correction(0.0)
36struct KahanVectorAccumulation{
38 Eigen::Vector3d correction;
39KahanVectorAccumulation():
40 sum(Eigen::Vector3d(0,0,0)),
41 correction(Eigen::Vector3d(0,0,0))
44inline 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;
52inline KahanVectorAccumulation
53KahanVectorSum(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%");
139 void show(std::ostream &out)
const { out <<
"GEM restraint"; }
150 double model_cutoff_dist_, density_cutoff_dist_;
159 Float normalization_;
161 Float self_mm_score_;
164 std::map<ParticleIndex,Float> map_score_dd_;
165 Float cached_score_term_;
166 std::string density_fn_;
176IMPBAYESIANEM_END_NAMESPACE
Return all pairs from a SingletonContainer.
Return all pairs from a SingletonContainer.
Store a list of ParticleIndexes.
A decorator for particles with mass.
Class for adding derivatives from restraints to the model.
Report key:value information on restraints.
Restraint(Model *m, std::string name)
Create a restraint and register it with the model.
RestraintInfo * get_static_info() const override
void set_slope(Float s)
Set restraint slope.
RestraintInfo * get_dynamic_info() const override
virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
virtual IMP::ModelObjectsTemp do_get_inputs() const override
double get_probability() const
Returns exp(score).
GaussianEMRestraint(Model *mdl, ParticleIndexes model_ps, ParticleIndexes density_ps, ParticleIndex global_sigma, Float model_cutoff_dist, Float density_cutoff_dist, Float slope, bool update_model=true, bool backbone_slope=false, std::string name="GaussianEMRestraint%1%")
Setup the GaussianEMRestraint.
void compute_initial_scores()
Pre-calculate the density-density and model-model scores.
Float get_slope()
Get restraint slope.
void set_density_filename(std::string density_fn)
Set the filename corresponding to the density GMM particles.
Macros to define containers of objects.
Decorator to hold Gaussian3D.
Helper functions to check for NaN or infinity.
Index< ParticleIndexTag > ParticleIndex
double Float
Basic floating-point value (could be float, double...).
std::string get_absolute_path(std::string file)
Convert a possibly relative path to an absolute path.
Vector< ParticleIndex, std::allocator< ParticleIndex > > ParticleIndexes
A list of particles, each identified by its ParticleIndex.
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
IMP::Vector< Float > Floats
Standard way to pass a bunch of Float values.
#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.