IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
em/PCAFitRestraint.h
Go to the documentation of this file.
1/**
2 * \file IMP/em/PCAFitRestraint.h
3 * \brief Calculate match between density map PCA and particles PCA.
4 *
5 * Copyright 2007-2022 IMP Inventors. All rights reserved.
6 *
7 */
8
9#ifndef IMPEM_PCA_FIT_RESTRAINT_H
10#define IMPEM_PCA_FIT_RESTRAINT_H
11
12#include <IMP/em/em_config.h>
13#include "DensityMap.h"
14#include "CoarseCC.h"
15#include "SampledDensityMap.h"
16
17#include <IMP/atom/Hierarchy.h>
18#include <IMP/atom/Atom.h>
19#include <IMP/atom/Mass.h>
20#include <IMP/core/XYZR.h>
21#include <IMP/Model.h>
22#include <IMP/Restraint.h>
23#include <IMP/Refiner.h>
25
26IMPEM_BEGIN_NAMESPACE
27
28//! Calculate score based on fit to EM map
29/** \ingroup exp_restraint
30
31 */
32class IMPEMEXPORT PCAFitRestraint : public Restraint {
33 public:
34 //! Constructor
35 /**
36 \param[in] ps The particles participating in the fitting score
37 \param[in] em_map The density map used in the fitting score
38 \param[in] threshold consider all voxels above this value for
39 PCA calculation
40 \param[in] weight_key the name of the weight attribute of the particles
41 \param[in] max_pca_size_diff
42 \param[in] max_angle_diff
43 \param[in] max_centroid_diff
44 */
45 PCAFitRestraint(ParticlesTemp ps, DensityMap *em_map, float threshold,
46 float max_pca_size_diff, float max_angle_diff,
47 float max_centroid_diff,
48 FloatKey weight_key = atom::Mass::get_mass_key());
49
51 const override;
52 virtual IMP::ModelObjectsTemp do_get_inputs() const override;
54
55#ifndef SWIG
56 IMP_LIST(private, Particle, particle, Particle *, Particles);
57#endif
58 private:
59 //! Store particles
60 void store_particles(ParticlesTemp ps);
61
62 IMP::PointerMember<DensityMap> target_dens_map_;
63 float threshold_;
64 algebra::BoundingBoxD<3> target_bounding_box_;
65 // reference to the IMP environment
66 core::XYZs xyz_;
67 FloatKey weight_key_;
68 Particles all_ps_;
69 KernelType kt_;
70 algebra::PrincipalComponentAnalysis dens_pca_;
71 float max_angle_diff_, max_pca_size_diff_;
72 float max_centroid_diff_;
73};
74
75IMPEM_END_NAMESPACE
76
77#endif /* IMPEM_PCA_FIT_RESTRAINT_H */
Simple atom decorator.
Perform coarse fitting between two density objects.
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.
Class to handle individual particles of a Model object.
Definition Particle.h:45
Restraint(Model *m, std::string name)
Create a restraint and register it with the model.
An axis-aligned bounding box.
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.
PCAFitRestraint(ParticlesTemp ps, DensityMap *em_map, float threshold, float max_pca_size_diff, float max_angle_diff, float max_centroid_diff, FloatKey weight_key=atom::Mass::get_mass_key())
Constructor.
virtual IMP::ModelObjectsTemp do_get_inputs() const override
#define IMP_LIST(protection, Ucname, lcname, Data, PluralData)
A macro to provide a uniform interface for storing lists of objects.
Principal component analysis of a set of points.
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