IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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-2022 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#include <IMP/core/MonteCarlo.h>
13#include <IMP/Restraint.h>
14#include <boost/scoped_array.hpp>
15
16IMPSPB_BEGIN_NAMESPACE
17
18//! MonteCarlo in the Well-Tempered Ensemble
19class IMPSPBEXPORT MonteCarloWithWte : public core::MonteCarlo {
20 double min_;
21 double max_;
22 double sigma_;
23 double gamma_;
24 double dx_;
25 double w0_;
26 boost::scoped_array<double> bias_;
27 int nbin_;
28 bool full_;
30
31 void do_initialize(double emin, double emax, double sigma, double gamma,
32 double w0);
33
34 void update_bias(double score);
35 virtual double do_evaluate(
36 const ParticleIndexes &moved, bool) const 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() override;
69
70 IMP_OBJECT_METHODS(MonteCarloWithWte);
71};
72
73IMPSPB_END_NAMESPACE
74
75#endif /* IMPSPB_MONTE_CARLO_WITH_WTE_H */
Simple Monte Carlo optimizer.
Abstract base class for all restraints.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Object used to hold a set of restraints.
A Monte Carlo optimizer.
Definition MonteCarlo.h:46
virtual void do_step() override
a class that inherits from this should override this method
Vector< ParticleIndex, std::allocator< ParticleIndex > > ParticleIndexes
A list of particles, each identified by its ParticleIndex.
Definition base_types.h:199
IMP::Vector< Float > Floats
Standard way to pass a bunch of Float values.
Definition types.h:46
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
A smart pointer to a ref-counted Object that is a class member.
Definition Pointer.h:144