Main driver.
Read in all program options from the user using boost::program_options and setup the simulation cell, initial conditions and both the interaction and external potential. Either equilibrate or restart a simulation, then start measuring. We output all the simulation parameters to disk as a log file so that it can be restart again assigning it a unique PIMCID.
33 time_t start_time = time(NULL);
35 bool wallClockReached =
false;
45 catch(exception& ex) {
46 cerr <<
"error: " << ex.what() <<
"\n";
50 cerr <<
"Exception of unknown type!\n";
59 seed = setup.
seed(seed);
79 boost::ptr_vector<LookupTable> lookupPtrVec;
80 for(
int i=0; i<Npaths; i++){
81 lookupPtrVec.push_back(
89 if ((
constants()->extPotentialType() ==
"graphenelut3dtobinary") ||
90 (
constants()->extPotentialType() ==
"graphenelut3dtotext") ||
91 (
constants()->extPotentialType() ==
"graphenelut3dgenerate") ) {
97 Array<dVec,1> initialPos =
109 boost::ptr_vector<Path> pathPtrVec;
110 for(
int i=0; i<Npaths; i++){
111 pathPtrVec.push_back(
112 new Path(boxPtr,lookupPtrVec[i],
constants()->numTimeSlices(),
120 boost::ptr_vector<ActionBase> actionPtrVec;
121 for(
int i=0; i<Npaths; i++){
122 actionPtrVec.push_back(
123 setup.
action(pathPtrVec[i],lookupPtrVec[i],externalPotentialPtr,
124 interactionPotentialPtr,waveFunctionPtr) );
128 boost::ptr_vector< boost::ptr_vector<MoveBase> > movesPtrVec;
129 for(
int i=0; i<Npaths;i++){
130 movesPtrVec.push_back(
131 setup.
moves(pathPtrVec[i],&actionPtrVec[i],random));
135 boost::ptr_vector< boost::ptr_vector<EstimatorBase> > estimatorsPtrVec;
136 for(
int i=0; i<Npaths;i++){
137 estimatorsPtrVec.push_back(
138 setup.
estimators(pathPtrVec[i],&actionPtrVec[i],random));
142 for(
uint32 j = 0; j < estimatorsPtrVec.back().size(); j++)
143 estimatorsPtrVec.back().at(j).appendLabel(str(format(
"%d") % (i+1)));
149 estimatorsPtrVec.push_back(setup.
estimators(pathPtrVec,actionPtrVec,random));
154 !setup.
params[
"start_with_state"].as<
string>().empty(),
155 setup.
params[
"bin_size"].as<
int>());
160 <<
" _____ _____ _____ _____" << endl
161 <<
"| __ \\ |_ _| / ____| / ____|" << endl
162 <<
"| |__) | | | | | __ | (___" << endl
163 <<
"| ___/ | | | | |_ | \\___ \\" << endl
164 <<
"| | _| |_ | |__| | ____) |" << endl
165 <<
"|_| |_____| \\_____| |_____/" << endl
169 <<
" _____ _____ __ __ _____" << endl
170 <<
" | __ \\ |_ _| | \\/ | / ____|" << endl
171 <<
" | |__) | | | | \\ / | | | " << endl
172 <<
" | ___/ | | | |\\/| | | | " << endl
173 <<
" | | _| |_ | | | | | |____ " << endl
174 <<
" |_| |_____| |_| |_| \\_____|" << endl
181 cout << format(
"[PIMCID: %s] - Pre-Equilibration Stage.") %
constants()->
id() << endl;
183 pimc.equilStep(n,setup.
params(
"relax"),setup.
params(
"relaxmu"));
187 if (!setup.
params(
"canonical") && setup.
params(
"relaxmu")) {
192 setup.
outputOptions(argc,argv,seed,boxPtr,lookupPtrVec.front().getNumNNGrid());
195 cout << format(
"[PIMCID: %s] - Measurement Stage.") %
constants()->
id() << endl;
198 int oldNumStored = 0;
200 int numOutput = setup.
params[
"output_config"].as<
int>();
204 if (pimc.numStoredBins > oldNumStored) {
205 oldNumStored = pimc.numStoredBins;
206 cout << format(
"[PIMCID: %s] - Bin #%5d stored to disk.") %
constants()->
id()
207 % oldNumStored << endl;
212 if ((numOutput > 0) && ((n % numOutput) == 0)) {
213 pathPtrVec.front().outputConfig(outNum);
219 current_time = time(NULL);
221 wallClockReached =
true;
225 }
while (pimc.numStoredBins < setup.
params[
"number_bins_stored"].as<
int>());
226 if (wallClockReached)
227 cout << format(
"[PIMCID: %s] - Wall clock limit reached.") %
constants()->
id() << endl;
229 cout << format(
"[PIMCID: %s] - Measurement complete.") %
constants()->
id() << endl;
237 delete interactionPotentialPtr;
238 delete externalPotentialPtr;
240 delete waveFunctionPtr;
Pre-equilibration via classical Monte Carlo.
void updateNames()
Update the data name and rename any existing files.
string id()
Get simulation UUID.
uint32 numEqSteps()
Get the number of equilibration steps.
The base class which holds details on the generalized box that our system will be simulated inside of...
The particle (bead) lookup table.
The main driver class for the entire path integral monte carlo program.
The space-time trajectories.
The base class from which all specific potentials are derived from.
virtual Array< dVec, 1 > initialConfig(const Container *, MTRand &, const int)
Default Initial configuration of particles.
ActionBase * action(const Path &, LookupTable &, PotentialBase *, PotentialBase *, WaveFunctionBase *)
Setup the action.
uint32 seed(const uint32)
Return the random seed.
bool parseOptions()
Parse the command line options for obvious errors and return values.
PotentialBase * interactionPotential(const Container *)
Setup the interaction potential.
WaveFunctionBase * waveFunction(const Path &, LookupTable &)
Setup the trial wave function.
void setConstants()
Setup the simulation constants.
void outputOptions(int, char *[], const uint32, const Container *, const iVec &)
Output the simulation parameters to a log file.
void communicator()
Setup the communicator.
boost::ptr_vector< EstimatorBase > * estimators(Path &, ActionBase *, MTRand &)
Create a list of estimators to be measured.
void getOptions(int, char *[])
Define all command line options and get them from the command line.
boost::ptr_vector< MoveBase > * moves(Path &, ActionBase *, MTRand &)
Define the Monte Carlo updates that will be performed.
Parameters params
All simulation parameters.
Container * cell()
Setup the simulation cell.
bool worldlines()
Setup the worldlines.
PotentialBase * externalPotential(const Container *)
Setup the external potential.
Holds a base class that all trial wave function classes will be derived from.
unsigned long uint32
Unsigned integer type, at least 32 bits.
Communicator * communicate()
Global public access to the communcator singleton.
ConstantParameters * constants()
Global public access to the constants.