12 #ifndef IMPCORE_MS_CONNECTIVITY_RESTRAINT_H
13 #define IMPCORE_MS_CONNECTIVITY_RESTRAINT_H
17 #include <IMP/core/core_config.h>
24 IMPCORE_BEGIN_NAMESPACE
29 #define IMP_GCC_VERSION \
30 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
31 #if IMP_GCC_VERSION >= 40100
32 #define IMPCORE_FRIEND_IS_OK
36 #define IMPCORE_FRIEND_IS_OK
76 unsigned int add_composite(
const Ints &components);
77 unsigned int add_composite(
const Ints &components,
unsigned int parent);
101 #ifdef IMPCORE_FRIEND_IS_OK
106 class ParticleMatrix {
112 : particle_(p), id_(id) {}
116 unsigned int get_id()
const {
return id_; }
123 ParticleMatrix(
unsigned int number_of_classes)
124 : protein_by_class_(number_of_classes),
125 min_distance_(std::numeric_limits<double>::max()),
130 : min_distance_(std::numeric_limits<double>::max()),
134 void resize(
unsigned int number_of_classes) {
135 protein_by_class_.resize(number_of_classes);
139 unsigned int add_type(
const kernel::ParticlesTemp &ps);
140 void create_distance_matrix(
const PairScore *ps);
141 void clear_particles() {
143 for (
unsigned int i = 0; i < protein_by_class_.size(); ++i)
144 protein_by_class_[i].clear();
146 unsigned int size()
const {
return particles_.size(); }
147 unsigned int get_number_of_classes()
const {
148 return protein_by_class_.size();
150 double get_distance(
unsigned int p1,
unsigned int p2)
const {
151 return dist_matrix_[p1 * size() + p2];
153 Ints const &get_ordered_neighbors(
unsigned int p)
const {
156 ParticleData
const &get_particle(
unsigned int p)
const {
157 return particles_[p];
159 Ints const &get_all_proteins_in_class(
unsigned int id)
const {
160 return protein_by_class_[id];
162 double max_distance()
const {
return max_distance_; }
163 double min_distance()
const {
return min_distance_; }
168 DistCompare(
unsigned int source, ParticleMatrix
const &parent)
169 : parent_(parent), source_(source) {}
171 bool operator()(
unsigned int p1,
unsigned int p2)
const {
172 return parent_.get_distance(source_, p1) <
173 parent_.get_distance(source_, p2);
177 ParticleMatrix
const &parent_;
178 unsigned int source_;
181 base::Vector<ParticleData> particles_;
183 base::Vector<Ints> order_;
184 base::Vector<Ints> protein_by_class_;
185 double min_distance_;
186 double max_distance_;
187 unsigned int current_id_;
190 class ExperimentalTree {
192 ExperimentalTree() : root_(-1), finalized_(false) {}
194 void connect(
unsigned int parent,
unsigned int child);
196 unsigned int add_composite(
const Ints &components);
197 unsigned int add_composite(
const Ints &components,
unsigned int parent);
201 Node() : visited_(false) {}
202 unsigned int get_number_of_parents()
const {
return parents_.size(); }
203 bool is_root()
const {
return get_number_of_parents() == 0; }
204 unsigned int get_number_of_children()
const {
return children_.size(); }
205 bool is_leaf()
const {
return get_number_of_children() == 0; }
206 unsigned int get_parent(
unsigned int idx)
const {
return parents_[idx]; }
207 unsigned int get_child(
unsigned int idx)
const {
return children_[idx]; }
208 typedef base::Vector<std::pair<unsigned int, int> > Label;
209 const Label &get_label()
const {
return label_; }
211 base::Vector<unsigned int> parents_;
212 base::Vector<unsigned int> children_;
217 bool find_cycle(
unsigned int node_index);
218 bool is_consistent(
unsigned int node_index)
const;
220 const Node *get_node(
unsigned int index)
const {
return &nodes_[index]; }
221 unsigned int get_number_of_nodes()
const {
return nodes_.size(); }
222 unsigned int get_root()
const {
return root_; }
223 void desc_to_label(
const Ints &components, Node::Label &label);
225 base::Vector<Node> nodes_;
229 #endif // IMP_DOXYGEN
231 ParticleMatrix particle_matrix_;
232 mutable ExperimentalTree tree_;
234 friend class MSConnectivityScore;
237 IMPCORE_END_NAMESPACE
Class for adding derivatives from restraints to the model.
Distance restraint between two particles.
IMP::kernel::PairScore PairScore
Import IMP/kernel/SingletonContainer.h in the namespace.
Hierarchy get_root(Hierarchy h)
Return the root of the hierarchy.
double get_distance(const Plane3D &pln, const Vector3D &p)
Return the distance between a plane and a point in 3D.
Abstract base class for all restraints.
PairScore * get_pair_score() const
Return the pair score used for scoring.
Import IMP/kernel/PairScore.h in the namespace.
A restraint is a term in an IMP ScoringFunction.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Class to handle individual model particles.
virtual Restraints do_create_current_decomposition() const
IMP::base::Vector< Float > Floats
Standard way to pass a bunch of Float values.
IMP::kernel::Particle Particle
virtual ModelObjectsTemp do_get_inputs() const =0
void add_particle(RMF::FileHandle fh, kernel::Particle *hs)
Ensure that a set of particles remains connected with one another.
IMP::base::Vector< Int > Ints
Standard way to pass a bunch of Int values.