00001 /** 00002 * \file ConnectivityRestraint.h \brief Connectivity restraint. 00003 * 00004 * Restrict max distance between at least one pair of particles of any 00005 * two distinct types. 00006 * 00007 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00008 * 00009 */ 00010 00011 #ifndef IMPCORE_CONNECTIVITY_RESTRAINT_H 00012 #define IMPCORE_CONNECTIVITY_RESTRAINT_H 00013 00014 #include "core_config.h" 00015 #include "DistanceRestraint.h" 00016 00017 #include <IMP/SingletonContainer.h> 00018 #include <IMP/Restraint.h> 00019 #include <IMP/PairScore.h> 00020 00021 IMPCORE_BEGIN_NAMESPACE 00022 00023 //! Ensure that a set of particles remains connected with one another. 00024 /** The restraint takes several particles and ensures that they remain 00025 connected. If you wish to restraint the connectivity of sets of 00026 particles (i.e. each protein is represented using a set of balls) 00027 use an appropriate PairScore which calls a Refiner (such 00028 as LowestRefinedPairScore). 00029 00030 \verbinclude connectivity_restraint.py 00031 00032 More precisely, the restraint scores by computing the MST on the complete 00033 graph connecting all the particles. The edge weights are given by 00034 the value of the PairScore for the two endpoints of the edge. 00035 */ 00036 class IMPCOREEXPORT ConnectivityRestraint : public Restraint 00037 { 00038 IMP::internal::OwnerPointer<PairScore> ps_; 00039 IMP::internal::OwnerPointer<SingletonContainer> sc_; 00040 public: 00041 //! Use the given PairScore 00042 /** If sc is NULL, a ListSingletonContainer is created internally. 00043 */ 00044 ConnectivityRestraint(PairScore* ps, SingletonContainer *sc=NULL); 00045 /** @name Particles to be connected 00046 00047 The following methods are used to manipulate the list of particles 00048 that are to be connected. Each particle should have all the 00049 attributes expected by the PairScore used. 00050 00051 Ideally, one should pass a singleton container instead. These 00052 can only be used if none is passed. 00053 */ 00054 /*@{*/ 00055 void add_particle(Particle *p); 00056 void add_particles(const Particles &ps); 00057 void set_particles(const Particles &ps); 00058 /*@}*/ 00059 00060 //! Return the set of pairs which are connected by the restraint 00061 /** This set of pairs reflects the current configuration at the time of 00062 the get_connected_pairs() call, not the set at the time of the last 00063 evaluate() call. 00064 */ 00065 ParticlePairs get_connected_pairs() const; 00066 00067 IMP_RESTRAINT(ConnectivityRestraint); 00068 00069 //! Return the pair score used for scoring 00070 PairScore *get_pair_score() const { 00071 return ps_; 00072 } 00073 }; 00074 00075 IMPCORE_END_NAMESPACE 00076 00077 #endif /* IMPCORE_CONNECTIVITY_RESTRAINT_H */