PROFASI  Version 1.5
Public Member Functions | List of all members
prf::MC Class Reference

MC class handles the Markov Chain Monte Carlo evolution. More...

#include <MC.hh>

Inherits HandlerBase.

Inherited by prf::GMC.

Public Member Functions

 MC ()
 default constructor
 
UpdatesHandlerupdates_hander ()
 Return pointer to the manager of conformational updates.
 
FFHandler * forcefield_handler ()
 Return pointer to the force field manager.
 
void forcefield_handler (FFHandler *fh)
 Introduce the force field manager.
 
RandomNumberBaseRandomNumberGenerator ()
 Return a pointer to the random number generator for other use.
 
void RandomNumberGenerator (RandomNumberBase *grn)
 Force use of a different a random number generator.
 
double temperature () const
 Get temperature in dimensionless ProFASi units.
 
void temperature (double x)
 Set temperature in dimensionless ProFASi units.
 
double temperature_in_kelvin () const
 Get MC temperature in Kelvin.
 
void temperature_in_kelvin (double val)
 Assign a temperature in kelvin for the simulation.
 
void SetBeta (double be)
 Set inverse temperature (model units for temperature)
 
void Connect (Population *p)
 Tell MC what population of proteins it needs to evolve.
 
virtual int Setup ()
 Initialize.
 
virtual int SimpleStep ()
 Perform one Monte Carlo step: naive version.
 
virtual int Step ()
 One Monte Carlo Step, as used in PROFASI.
 
void Step (int nstps)
 Perform nstps Monte Carlo steps.
 
void RunCycle ()
 Run a Monte Carlo cycle or sweep.
 
void SetCycleLength (int i)
 Set length of cycle to i.
 
virtual int parseCommand (InstructionString s)
 Execute an instruction.
 
- Public Member Functions inherited from HandlerBase
virtual void parseCommands (std::list< InstructionString > &cmds, int argc, char *argv[])
 Parse commands passed as a deque of InstructionString objects.
 

Detailed Description

The MC class accumulates information about the force field and updates and the population of proteins. It then performs the Markov Chain evolution of that system, using predefined probabilities for the updates. MC as such performs only fixed-temperature simulations. For most practical purposes this would be inadequate. But it works as a good base class for other methods such as the Simulated Tempering (SimTemp class) or Simulated Annealing (SimAnneal class).

The acceptance probability for a proposed update is very much like the Metropolis probability, but with a prefactor. For certain updates, like BGS, it is necessary to use an additional factor in the probability to ensure detail balance.

In version 1.5 handling of energy terms is delegated to a new force field handler class, FFHandler. Similarly operations relating to the conformational updates are delegated to the UpdatesHandler. Both these handlers are members of the MC class. Using the handler classes help maintain a modular structure in the code. These measures are also the first step towards making MC algorithms such as parallel tempering, simulated tempering or simulated annealing available as a pure template library, independent of the rest of ProFASi. Such a library could be useful for arbitrary systems not necessarily related to proteins.

Another change relative to earlier versions of ProFASI, made to bring the MC class closer to a pure representation of the Markov chain Monte Carlo algorithm was to rid it of the responsibility of keeping track of the number of temperatures and the temperature index for simulated tempering, parallel tempering and simulated annealing. Although these variables are common to these three algorithm, they do not belong to the concept of the basic Monte Carlo algorithm.

Member Function Documentation

int MC::parseCommand ( InstructionString  s)
virtual

The MC class handles some instructions of its own, as well as forwarding instructions meant for the UpdatesHandler. Instructions for the MC class are:

  • steps_per_cycle : Sets how many Monte Carlo updates constitute a Monte Carlo cycle. Example: steps_per_cylce 100
  • random_number_seed : Manually set a random number seed.
  • temperature Temperature for the MC simulation. Example: temperature 310 Kelvin, or temperature 0.485. If no unit is given, temperature is read in the dimensionless ProFASi units.
  • ntmp Number of temperatures (mostly relevant for methods derived from Metropolis Monte Carlo) Example: ntmp 10

Reimplemented in prf::WangLandau, and prf::ParTemp.

void prf::MC::RunCycle ( )
inline

A Monte Carlo sweep or cycle consists of a pre-configured number of Monte Carlo steps. The default number of steps ( ProFASi v 1.5 ) is the number of degrees of freedom in the population. This may be changed to any value using the command "steps_per_cycle N". This function is a short-hand to call Step() many times.

void MC::SetCycleLength ( int  i)

If a positive value is passed, cycle length is set to that value. If a negative number or 0 is passed, cycle length is set equal to the number of degrees of freedom in the system.

int MC::Setup ( )
virtual

After this function, the MC object should be ready to do Monte Carlo steps.

Reimplemented in prf::ParTemp.

int MC::SimpleStep ( )
virtual

Select an update. Find energy change. Ask the Metropolis question. Decide whether or not to accept the update, and do so.This function, is not used in ProFASi, except during debugging.

int MC::Step ( )
virtual

Similar to the SimpleStep function, but with a speed up trick. The random number to be used for the Metropolis question is completely independent of the energy calculations. In this version of the Monte Carlo step, that random number is generated before the energy calculations (but after the conformational update). Using it, and the temperature, a maximum acceptable energy increase is calculated before doing anything with the energy terms. This value is passed to the force field handler for the delta E calculations. It is understood that if the energy change is greater than this limit, it need not be calculated precisely. The conformational update will be rejected anyway! So, the FFHandler gets a license to return any (too) large value, if it has ascertained that the correct value lies beyond the limit passed to it. See the documentation of the deltaE_with_limit() function in FFHandler for a little more on this.

Reimplemented in prf::WangLandau.


The documentation for this class was generated from the following files:

PROFASI: Protein Folding and Aggregation Simulator, Version 1.5
© (2005-2016) Anders Irbäck and Sandipan Mohanty
Documentation generated on Mon Jul 18 2016 using Doxygen version 1.8.2