PROFASI  Version 1.5
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BasicMCRun Class Reference

Constant temperature Monte Carlo simulations. More...

#include <BasicMCRun.hh>

Inheritance diagram for BasicMCRun:
Inheritance graph
[legend]

Public Member Functions

int parseCommands (std::list< InstructionString > &cmds)
 Execute commands collected with getCommands.
 

Protected Member Functions

virtual void writeConf ()
 Write program state to PROFASI binary configuration file.
 
int recover (unsigned rcyc=(unsigned)-1)
 Restore the state of the run to a given point of a previous run.
 
FILE * open_segment (std::string prfx)
 Open a new conf.data___ file for a new simulation segment.
 

Protected Attributes

PopulationHandler PH
 A population handler.
 
ObsHandler H
 An observable handler.
 
RandomNumberHandler ranh
 A handler object for random numbers.
 
FFHandler ffh
 A force field handler.
 

Detailed Description

This is an application program written in the form of a class. It has a Run function, and the "main" function simply needs to transfer control to this Run function. In ProFASi, there is no such thing as the "main profasi executable". Application programs should be written in the form of an interface class like this one and linked to the ProFASi libraries.

See Also
BasicMCRun program reference

Member Function Documentation

FILE * BasicMCRun::open_segment ( std::string  prfx)
protected

Open a data file to contain binary configuration snapshots for the run. Every time a run is restarted, a new conf.data___ file is created with a name based on the time of the first write event. The name is registered inside the "traj" file for the run, so that the traj file contains information about the segments in the appropriate order.

int BasicMCRun::recover ( unsigned  rcyc = (unsigned)-1)
protected

This restores the population, random number generator, temperature and energy classes to a specified point in a previously generated trajectory. MC updates should then follow the path of the older run unless external factors change this. The parameter passed is the MC cycle where the program should be restored. If a large value is passed (or the default argument used), the run is restored to the last saved configuration in the older trajectory. The name of the trajectory file used is fixed: it's called "traj", and it is located in the output directory of the run. Since the "traj" files are only envelopes containing information about data (but no actual data), additional files are needed for the recovery to work. These are the conf.data___ files found in the output directories. Without the conf.data___ files, the traj files can not be used to restore the program.

void BasicMCRun::writeConf ( )
protectedvirtual

Writes information about the current state of the program to a compressed binary configuration file. Every time this function is called, the following information is written: (i) MC time (ii) Temperature index (This is always 0 for BasicMCRun, but contains useful information for programs like ParTempRun. Writing a redundant 0 in BasicMCRun keeps the format of the data in the binary files fixed across all simulation programs in PROFASI) (iii) Total energy (iv) State of the random number generator, normally, as a pair of long and unsigned long variables. The first is the original seed, the second is the number of calls to the generator up until the time of the configuration save. Using these two, the random number generator can be restored (v) All degrees of freedom of the population.

The data is simply dumped without any formatting. So, the contents of the state files (normally called "conf...", found inside the run directories) are not (normal-) human readable. Since this way of writing data makes use of the internal structure of the data, it achieves optimal compression. But without knowledge of the layout of the bytes in the files, this data would be totally unreadable. Such information was formerly contained in a separate file called "conf.info" also generated by the simulation programs. The same byte for byte description of the contents of each block of data in the conf files is now contained as a human readable "header" section inside the "conf..." files.

PROFASI 1.5 makes the interaction with the binary "conf..." files more indirect, through the PROFASI trajectory description file, called n0/traj, n1/traj etc. This is an important topic and is described in detail in PROFASI trajectory files .

Reimplemented in WLRun.


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