00001 /** 00002 * \file example/ExampleRestraint.h 00003 * \brief A restraint on a list of particle pairs. 00004 * 00005 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00006 * 00007 */ 00008 00009 #ifndef IMPEXAMPLE_EXAMPLE_RESTRAINT_H 00010 #define IMPEXAMPLE_EXAMPLE_RESTRAINT_H 00011 00012 #include "example_config.h" 00013 #include <IMP/SingletonScore.h> 00014 #include <IMP/Restraint.h> 00015 #include <IMP/PairContainer.h> 00016 #include <IMP/PairScore.h> 00017 00018 IMPEXAMPLE_BEGIN_NAMESPACE 00019 00020 //! Apply a PairScore to a list of particle pairs 00021 /** This restraint could be used, in conjunction with a 00022 ClosePairsScoreState and a SphereDistancePairScore, 00023 to prevent particles from interpenetrating. 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 ExampleRestraint.h 00030 \include ExampleRestraint.cpp 00031 */ 00032 class IMPEXAMPLEEXPORT ExampleRestraint : public Restraint 00033 { 00034 /** IMP::Objects should be stored using Pointer objects 00035 to make sure that they are reference counted properly. 00036 */ 00037 Pointer<PairContainer> pc_; 00038 Pointer<PairScore> f_; 00039 public: 00040 //! Create the restraint. 00041 /** Restraints should store the particles they are to act on, 00042 preferably in a Singleton or PairContainer as appropriate. 00043 They should also take a score function or a UnaryFunction 00044 allowing the form of the scoring function to be changed. 00045 */ 00046 ExampleRestraint(PairScore* score_func, 00047 PairContainer *pc); 00048 00049 /** This macro declares the basic needed methods: evaluate and show 00050 */ 00051 IMP_RESTRAINT(ExampleRestraint); 00052 }; 00053 00054 IMPEXAMPLE_END_NAMESPACE 00055 00056 #endif /* IMPEXAMPLE_EXAMPLE_RESTRAINT_H */