00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IMPDOMINO_RESTRAINT_EVALUATOR_H
00009 #define IMPDOMINO_RESTRAINT_EVALUATOR_H
00010
00011
00012 #include "domino_config.h"
00013 #include "RestraintEvaluatorI.h"
00014 #include "DiscreteSampler.h"
00015 #include "CombState.h"
00016 #include <IMP/base_types.h>
00017 #include <vector>
00018 #include <IMP/ScoreState.h>
00019
00020 IMPDOMINO_BEGIN_NAMESPACE
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 IMPDOMINOEXPORT ScoreStates get_used_score_states(
00034 const IMP::Particles &ps, Model *m);
00035
00036
00037
00038 class IMPDOMINOEXPORT RestraintEvaluator : public RestraintEvaluatorI
00039 {
00040 public:
00041
00042
00043
00044 RestraintEvaluator(DiscreteSampler *ds) {
00045 ds_=ds;
00046 }
00047 ~RestraintEvaluator(){}
00048
00049
00050
00051
00052
00053
00054
00055
00056 void calc_scores(const Combinations &comb_states,
00057 CombinationValues &comb_values,
00058 Restraint *r, const Particles &ps);
00059 void show(std::ostream& out = std::cout) const{
00060 out<<"RestraintEvaluator"<<std::endl;
00061 }
00062 protected:
00063
00064
00065 void update_score_states(const IMP::Particles &ps) {
00066 if (ps.size() == 0) {
00067 IMP_WARN("calling update score states with no particles" << std::endl);
00068 return;
00069 }
00070 Model *m = ps[0]->get_model();
00071 ScoreStates score_states = get_used_score_states(ps,m);
00072 IMP_LOG(VERBOSE,"there are " << score_states.size() <<
00073 " score states"<<std::endl);
00074 for(ScoreStates::const_iterator it = score_states.begin();
00075 it != score_states.end(); it++) {
00076 (*it)->before_evaluate();
00077 }
00078 }
00079 DiscreteSampler *ds_;
00080 };
00081
00082
00083 IMPDOMINO_END_NAMESPACE
00084
00085 #endif