IMP logo
IMP Reference Guide  2.20.2
The Integrative Modeling Platform
HybridMonteCarlo.h
Go to the documentation of this file.
1 /**
2  * \file IMP/isd/HybridMonteCarlo.h
3  * \brief A hybrid monte carlo implementation
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPISD_HYBRID_MONTE_CARLO_H
10 #define IMPISD_HYBRID_MONTE_CARLO_H
11 
12 #include <IMP/isd/isd_config.h>
13 #include <IMP/core/MonteCarlo.h>
16 #include <IMP/macros.h>
17 
18 IMPISD_BEGIN_NAMESPACE
19 
20 //! Hybrid Monte Carlo optimizer
21 // moves all xyz particles having a fixed mass with an MD proposal
22 
23 class IMPISDEXPORT HybridMonteCarlo : public core::MonteCarlo {
24 
25  public:
26  HybridMonteCarlo(Model *m, Float kT = 1.0, unsigned steps = 100,
27  Float timestep = 1.0, unsigned persistence = 1);
28 
29  Float get_kinetic_energy() const;
30 
31  Float get_potential_energy() const;
32 
33  Float get_total_energy() const;
34 
35  // set md timestep
36  void set_timestep(Float ts);
37  double get_timestep() const;
38 
39  // set number of md steps per mc step
40  void set_number_of_md_steps(unsigned nsteps);
41  unsigned get_number_of_md_steps() const;
42 
43  // set how many mc steps happen until you redraw the momenta
44  void set_persistence(unsigned persistence = 1);
45  unsigned get_persistence() const;
46 
47  // return pointer to isd::MolecularDynamics instance
48  // useful if you want to set other stuff that is not exposed here
49  MolecularDynamics *get_md() const;
50 
51  // evaluate should return the total energy
52  double do_evaluate(const ParticleIndexes &, bool) const override;
53 
54  virtual void do_step() override;
56 
57  private:
58  unsigned num_md_steps_, persistence_;
59  unsigned persistence_counter_;
62 };
63 
64 IMPISD_END_NAMESPACE
65 
66 #endif /* IMPISD_HYBRID_MONTE_CARLO_H */
A Monte Carlo optimizer.
Definition: MonteCarlo.h:44
virtual double do_evaluate(const ParticleIndexes &moved, bool force_full_score) const
Get the current energy.
Definition: MonteCarlo.h:182
Simple Monte Carlo optimizer.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
A modifier which perturbs XYZs or Nuisances with a constant energy MD simulation. ...
Simple molecular dynamics optimizer.
Various general useful macros for IMP.
A smart pointer to a reference counted object.
Definition: Pointer.h:87
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:86
A smart pointer to a ref-counted Object that is a class member.
Definition: Pointer.h:143
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:19
Molecular dynamics optimizer on 1-D and 3-D particles.
Hybrid Monte Carlo optimizer.