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 {
111 : particle_(p), id_(id) {}
115 unsigned int get_id()
const {
return id_; }
122 ParticleMatrix(
unsigned int number_of_classes)
123 : protein_by_class_(number_of_classes),
124 min_distance_(std::numeric_limits<double>::max()),
129 : min_distance_(std::numeric_limits<double>::max()),
133 void resize(
unsigned int number_of_classes) {
134 protein_by_class_.resize(number_of_classes);
138 unsigned int add_type(
const kernel::ParticlesTemp &ps);
139 void create_distance_matrix(
const PairScore *ps);
140 void clear_particles() {
142 for (
unsigned int i = 0; i < protein_by_class_.size(); ++i)
143 protein_by_class_[i].clear();
145 unsigned int size()
const {
return particles_.size(); }
146 unsigned int get_number_of_classes()
const {
147 return protein_by_class_.size();
149 double get_distance(
unsigned int p1,
unsigned int p2)
const {
150 return dist_matrix_[p1 * size() + p2];
152 Ints const &get_ordered_neighbors(
unsigned int p)
const {
155 ParticleData
const &get_particle(
unsigned int p)
const {
156 return particles_[p];
158 Ints const &get_all_proteins_in_class(
unsigned int id)
const {
159 return protein_by_class_[id];
161 double max_distance()
const {
return max_distance_; }
162 double min_distance()
const {
return min_distance_; }
167 DistCompare(
unsigned int source, ParticleMatrix
const &parent)
168 : parent_(parent), source_(source) {}
170 bool operator()(
unsigned int p1,
unsigned int p2)
const {
171 return parent_.get_distance(source_, p1) <
172 parent_.get_distance(source_, p2);
176 ParticleMatrix
const &parent_;
177 unsigned int source_;
180 base::Vector<ParticleData> particles_;
182 base::Vector<Ints> order_;
183 base::Vector<Ints> protein_by_class_;
184 double min_distance_;
185 double max_distance_;
186 unsigned int current_id_;
189 class ExperimentalTree {
191 ExperimentalTree() : root_(-1), finalized_(false) {}
193 void connect(
unsigned int parent,
unsigned int child);
195 unsigned int add_composite(
const Ints &components);
196 unsigned int add_composite(
const Ints &components,
unsigned int parent);
200 Node() : visited_(false) {}
201 unsigned int get_number_of_parents()
const {
return parents_.size(); }
202 bool is_root()
const {
return get_number_of_parents() == 0; }
203 unsigned int get_number_of_children()
const {
return children_.size(); }
204 bool is_leaf()
const {
return get_number_of_children() == 0; }
205 unsigned int get_parent(
unsigned int idx)
const {
return parents_[idx]; }
206 unsigned int get_child(
unsigned int idx)
const {
return children_[idx]; }
207 typedef base::Vector<std::pair<unsigned int, int> > Label;
208 const Label &get_label()
const {
return label_; }
210 base::Vector<unsigned int> parents_;
211 base::Vector<unsigned int> children_;
216 bool find_cycle(
unsigned int node_index);
217 bool is_consistent(
unsigned int node_index)
const;
219 const Node *get_node(
unsigned int index)
const {
return &nodes_[index]; }
220 unsigned int get_number_of_nodes()
const {
return nodes_.size(); }
221 unsigned int get_root()
const {
return root_; }
222 void desc_to_label(
const Ints &components, Node::Label &label);
224 base::Vector<Node> nodes_;
228 #endif // IMP_DOXYGEN
230 ParticleMatrix particle_matrix_;
231 mutable ExperimentalTree tree_;
233 friend class MSConnectivityScore;
236 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.
Class for storing model, its restraints, constraints, and particles.
IMP::base::Vector< Int > Ints
Standard way to pass a bunch of Int values.