00001 /** 00002 * \file core/DiameterRestraint.h 00003 * \brief A restraint to maintain the diameter of a set of points 00004 * 00005 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00006 */ 00007 00008 #ifndef IMPCORE_DIAMETER_RESTRAINT_H 00009 #define IMPCORE_DIAMETER_RESTRAINT_H 00010 00011 #include "core_config.h" 00012 00013 #include "internal/remove_pointers.h" 00014 #include <IMP/PairContainer.h> 00015 #include <IMP/SingletonContainer.h> 00016 #include <IMP/Restraint.h> 00017 #include <IMP/UnaryFunction.h> 00018 00019 IMPCORE_BEGIN_NAMESPACE 00020 00021 //! Restrain the diameter of a set of points 00022 /** This class also serves as an example of how to build restraints which 00023 have internal ScoreStates and perhaps more than one actual restraint 00024 object. 00025 */ 00026 class IMPCOREEXPORT DiameterRestraint: public Restraint 00027 { 00028 IMP::internal::OwnerPointer<ScoreState> ss_; 00029 IMP::internal::OwnerPointer<Particle> p_; 00030 Float diameter_; 00031 IMP::internal::OwnerPointer<SingletonContainer> sc_; 00032 IMP::internal::OwnerPointer<UnaryFunction> f_; 00033 FloatKey dr_; 00034 public: 00035 //! Use f to restraint sc to be withing diameter of one another 00036 /** f should have a minimum at 0 and be an upper bound-style function. 00037 */ 00038 DiameterRestraint(UnaryFunction *f, 00039 SingletonContainer *sc, Float diameter); 00040 00041 IMP_RESTRAINT(DiameterRestraint); 00042 00043 void set_model(Model *m); 00044 }; 00045 00046 00047 IMPCORE_END_NAMESPACE 00048 00049 #endif /* IMPCORE_DIAMETER_RESTRAINT_H */