00001 /** 00002 * \file example/ExampleComplexRestraint.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 IMPEXAMPLE_EXAMPLE_COMPLEX_RESTRAINT_H 00009 #define IMPEXAMPLE_EXAMPLE_COMPLEX_RESTRAINT_H 00010 00011 #include "example_config.h" 00012 00013 #include <IMP/PairContainer.h> 00014 #include <IMP/SingletonContainer.h> 00015 #include <IMP/Restraint.h> 00016 #include <IMP/ScoreState.h> 00017 #include <IMP/UnaryFunction.h> 00018 00019 IMPEXAMPLE_BEGIN_NAMESPACE 00020 00021 //! Restrain the diameter of a set of points 00022 /** This restraint shows how to write a restraint that includes 00023 a ScoreState which is needed to compute some invariant. 00024 00025 \note Be sure to check out the swig wrapper file and how it 00026 wraps this class. 00027 00028 The source code is as follows: 00029 \include ExampleComplexRestraint.h 00030 \include ExampleComplexRestraint.cpp 00031 00032 */ 00033 class IMPEXAMPLEEXPORT ExampleComplexRestraint: public Restraint 00034 { 00035 Pointer<ScoreState> ss_; 00036 Pointer<Particle> p_; 00037 Float diameter_; 00038 Pointer<SingletonContainer> sc_; 00039 Pointer<UnaryFunction> f_; 00040 FloatKey dr_; 00041 public: 00042 //! Use f to restraint sc to be withing diameter of one another 00043 /** f should have a minimum at 0 and be an upper bound-style function. 00044 */ 00045 ExampleComplexRestraint(UnaryFunction *f, 00046 SingletonContainer *sc, Float diameter); 00047 00048 IMP_RESTRAINT(ExampleComplexRestraint); 00049 00050 void set_model(Model *m); 00051 }; 00052 00053 00054 IMPEXAMPLE_END_NAMESPACE 00055 00056 #endif /* IMPEXAMPLE_EXAMPLE_COMPLEX_RESTRAINT_H */