00001 /** 00002 * \file PairConstraint.h 00003 * \brief Use a PairModifier applied to a ParticlePairs to 00004 * maintain an invariant 00005 * 00006 * This file is generated by a script (core/tools/make-container). 00007 * Do not edit directly. 00008 * 00009 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00010 */ 00011 00012 #ifndef IMPCORE_PAIR_CONSTRAINT_H 00013 #define IMPCORE_PAIR_CONSTRAINT_H 00014 00015 #include "core_config.h" 00016 #include <IMP/PairModifier.h> 00017 #include <IMP/Constraint.h> 00018 #include <IMP/Particle.h> 00019 00020 IMP_BEGIN_NAMESPACE 00021 // for swig 00022 class PairModifier; 00023 IMP_END_NAMESPACE 00024 00025 IMPCORE_BEGIN_NAMESPACE 00026 //! Apply a PairFunction to a Pair 00027 /** The score state is passed up to two PairModifiers, one to 00028 apply before evaluation and the other after. The one after 00029 should take a DerivativeAccumulator as its last argument for 00030 PairModifier::apply() and will only be called if 00031 the score was computed with derivatives. 00032 00033 \see PairsConstraint 00034 */ 00035 class IMPCOREEXPORT PairConstraint : public Constraint 00036 { 00037 IMP::internal::OwnerPointer<PairModifier> f_; 00038 IMP::internal::OwnerPointer<PairModifier> af_; 00039 ParticlePair v_; 00040 public: 00041 /** before and after are the modifiers to apply before and after 00042 evaluate. 00043 */ 00044 PairConstraint(PairModifier *before, 00045 PairModifier *after, const ParticlePair& vt, 00046 std::string name="PairConstraint %1%"); 00047 00048 //! Apply this modifier to all the elements after an evaluate 00049 void set_after_evaluate_modifier(PairModifier* f) { 00050 af_=f; 00051 } 00052 00053 //! Apply this modifier to all the elements before an evaluate 00054 void set_before_evaluate_modifier(PairModifier* f) { 00055 f_=f; 00056 } 00057 00058 IMP_CONSTRAINT(PairConstraint); 00059 }; 00060 00061 00062 IMPCORE_END_NAMESPACE 00063 00064 #endif /* IMPCORE_PAIR_CONSTRAINT_H */