IMP logo
IMP Reference Guide  2.15.0
The Integrative Modeling Platform
MonteCarloWithWte.h
Go to the documentation of this file.
1 /**
2  * \file IMP/spb/MonteCarloWithWte.h
3  * \brief An exotic version of MonteCarlo
4  *
5  * Copyright 2007-2021 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPSPB_MONTE_CARLO_WITH_WTE_H
9 #define IMPSPB_MONTE_CARLO_WITH_WTE_H
10 
11 #include <IMP/spb/spb_config.h>
12 
13 #include <IMP/Restraint.h>
14 #include <IMP/core.h>
15 #include <boost/scoped_array.hpp>
16 
17 IMPSPB_BEGIN_NAMESPACE
18 
19 //! MonteCarlo in the Well-Tempered Ensemble
20 class IMPSPBEXPORT MonteCarloWithWte : public core::MonteCarlo {
21  double min_;
22  double max_;
23  double sigma_;
24  double gamma_;
25  double dx_;
26  double w0_;
27  boost::scoped_array<double> bias_;
28  int nbin_;
29  bool full_;
31 
32  void do_initialize(double emin, double emax, double sigma, double gamma,
33  double w0);
34 
35  void update_bias(double score);
36  virtual double do_evaluate(const ParticleIndexes &moved) const IMP_OVERRIDE;
37  double get_spline(double score) const;
38 
39  public:
40  MonteCarloWithWte(Model *m, double emin, double emax, double sigma,
41  double gamma, double w0);
42 
43  MonteCarloWithWte(Model *m, double emin, double emax, double sigma,
44  double gamma, double w0, RestraintSet *rset);
45 
46  double get_bias(double score) const;
47 
48 #ifndef SWIG
49  double *get_bias_buffer() const { return bias_.get(); }
50 #endif
51 
52  Floats get_bias_asfloats() const {
53  Floats buffer(bias_.get(), bias_.get() + nbin_);
54  return buffer;
55  }
56 
57  int get_nbin() const { return nbin_; }
58 
59  void set_w0(double w0) { w0_ = w0; }
60 
61  void set_bias(const Floats &bias) {
62  IMP_USAGE_CHECK(bias.size() == static_cast<unsigned int>(nbin_),
63  "Don't match");
64  std::copy(bias.begin(), bias.end(), bias_.get());
65  }
66 
67  // IMP_MONTE_CARLO(MonteCarloWithWte);
68  virtual void do_step();
69 
71 };
72 
73 IMPSPB_END_NAMESPACE
74 
75 #endif /* IMPSPB_MONTE_CARLO_WITH_WTE_H */
A Monte Carlo optimizer.
Definition: MonteCarlo.h:45
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Include all non-deprecated headers in IMP.core.
MonteCarlo in the Well-Tempered Ensemble.
Object used to hold a set of restraints.
Definition: RestraintSet.h:37
virtual void do_step()
a class that inherits from this should override this method
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
virtual double do_evaluate(const ParticleIndexes &moved) const
Get the current energy.
Definition: MonteCarlo.h:179
A smart pointer to a ref-counted Object that is a class member.
Definition: Pointer.h:146
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Definition: check_macros.h:168
Abstract base class for all restraints.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.