IMP logo
IMP Reference Guide  develop.d97d4ead1f,2024/11/21
The Integrative Modeling Platform
LogWrapper.h
Go to the documentation of this file.
1 /**
2  * \file IMP/isd/LogWrapper.h
3  * \brief Calculate the -Log of a list of restraints.
4  *
5  * Copyright 2007-2023 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPISD_LOG_WRAPPER_H
10 #define IMPISD_LOG_WRAPPER_H
11 
12 #include <IMP/isd/isd_config.h>
13 #include <IMP/container_macros.h>
14 #include <IMP/RestraintSet.h>
15 #include <cereal/access.hpp>
16 #include <cereal/types/base_class.hpp>
17 
18 
19 IMPISD_BEGIN_NAMESPACE
20 
21 //! Calculate the -Log of a list of restraints.
22 /** This is intended to be used with restraints where their score represents
23  the probability (from 0 to 1) of being satisfied.
24  \note Any weights of the wrapped restraints are ignored.
25  */
26 class IMPISDEXPORT LogWrapper : public RestraintSet {
27 
28  friend class cereal::access;
29  template<class Archive> void serialize(Archive &ar) {
30  ar(cereal::base_class<RestraintSet>(this));
31  }
33 
34  void show_it(std::ostream &out) const;
35 
36  public:
37  //! Create an empty set that is registered with the model
38  LogWrapper(Model *m, double weight, const std::string &name = "LogWrapper %1%");
39  //! Create an empty set that is registered with the model
40  LogWrapper(Model *m, const std::string &name = "LogWrapper %1%");
41  //! Create a set that is registered with the model
42  LogWrapper(const RestraintsTemp &rs, double weight,
43  const std::string &name = "LogWrapper %1%");
44  LogWrapper() {}
45 
46  virtual double unprotected_evaluate(
47  IMP::DerivativeAccumulator* accum) const override;
48  virtual double unprotected_evaluate_moved(
49  IMP::DerivativeAccumulator* accum, const ParticleIndexes &moved_pis,
50  const ParticleIndexes &reset_pis) const override;
51  void do_add_score_and_derivatives(ScoreAccumulator sa) const override;
52  void do_add_score_and_derivatives_moved(
53  ScoreAccumulator sa, const ParticleIndexes &moved_pis,
54  const ParticleIndexes &reset_pis) const override;
55 
57 
58 };
59 
60 IMPISD_END_NAMESPACE
61 
62 #endif /* IMPISD_LOG_WRAPPER_H */
Used to hold a set of related restraints.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Macros to define containers of objects.
Object used to hold a set of restraints.
Definition: RestraintSet.h:41
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Definition: object_macros.h:95
Class for adding up scores during ScoringFunction evaluation.
Calculate the -Log of a list of restraints.
Definition: LogWrapper.h:26
virtual double unprotected_evaluate_moved(DerivativeAccumulator *da, const ParticleIndexes &moved_pis, const ParticleIndexes &reset_pis) const
Return the unweighted score, taking moving particles into account.
Definition: Restraint.h:129
double unprotected_evaluate(DerivativeAccumulator *da) const override
Return the unweighted score for the restraint.
Class for adding derivatives from restraints to the model.