9#ifndef IMPISD_GAUSSIAN_EM_RESTRAINT_H
10#define IMPISD_GAUSSIAN_EM_RESTRAINT_H
12#include <IMP/isd/isd_config.h>
25#include <boost/unordered_map.hpp>
26#include <cereal/access.hpp>
27#include <cereal/types/vector.hpp>
67 Float model_cutoff_dist,
Float density_cutoff_dist,
69 bool update_model=
true,
bool backbone_slope=
false,
71 std::string name=
"GaussianEMRestraint%1%");
85 return cross_correlation_;
141 void show(std::ostream &out)
const { out <<
"GEM restraint"; }
152 double model_cutoff_dist_, density_cutoff_dist_;
156 bool update_model_,local_;
158 Float normalization_;
160 Float self_mm_score_;
164 std::string density_fn_;
171 mutable double cross_correlation_;
174 void create_containers();
176 friend class cereal::access;
178 template<
class Archive>
void serialize(Archive &ar) {
179 ar(cereal::base_class<Restraint>(
this), model_cutoff_dist_,
180 density_cutoff_dist_, model_ps_, density_ps_, slope_, update_model_,
181 local_, msize_,dsize_, normalization_, dd_score_, self_mm_score_,
182 slope_ps_, density_fn_, exp_grid_,
183 invdx_, argmax_, cross_correlation_);
185 if (std::is_base_of<cereal::detail::InputArchiveBase, Archive>::value) {
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.
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, bool local=false, std::string name="GaussianEMRestraint%1%")
Setup the GaussianEMRestraint.
Float get_slope() const
Get restraint slope.
double get_probability() const
Returns exp(score).
double get_model_self_score() const
Get the precalculated model-model self-overlap score.
virtual IMP::ModelObjectsTemp do_get_inputs() const override
void compute_initial_scores()
Pre-calculate the density-density and model-model scores.
double get_density_cutoff_distance() const
Get the cutoff for model-density interactions.
double get_density_density_score() const
Get the precalculated density-density overlap score.
virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ParticleIndexes get_model_particle_indexes() const
Get the particles for the model GMM.
double get_model_cutoff_distance() const
Get the cutoff for model-model interactions.
void set_density_filename(std::string density_fn)
Set the filename corresponding to the density GMM particles.
ParticleIndexes get_slope_particle_indexes() const
Get the model particles that the slope term acts on.
RestraintInfo * get_dynamic_info() const override
ParticleIndexes get_density_particle_indexes() const
Get the particles for the density GMM.
RestraintInfo * get_static_info() const override
void set_slope(Float s)
Set restraint slope.
bool get_is_local() const
Return true iff only density particles near the model are considered.
double get_cross_correlation_coefficient() const
Get cross correlation between the model and the map.
Macros to define containers of objects.
Decorator to hold Gaussian3D.
Handling of file input/output.
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_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
#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.