Commit ffb37d8b authored by Manuel Schrauth's avatar Manuel Schrauth
Browse files

moved directories to config file

parent 4b71a640
0.93
0.9425
0.955
0.9675
0.98
0.9925
1.005
1.0175
File added
File added
File added
File added
File added
File added
[General]
nL = 12,16,24,32,48
betastart = 0.94
betaend = 1.04
nbeta = 10
nL = 8,12,16,24,32,48
betastart = 0.93
betaend = 1.03
nbeta = 8
[IO]
logfilename = ../log/logfile.txt
outdir = ../out
logdir = ../log
logfile = logfile.txt
[END]
......@@ -154,24 +154,34 @@ inline void coutsv(StateVector& vec)
// ---------------------------------------
const int myid = 0; // remove once a parallelization is available
#include "Heisenberg.h"
#include "Ising.h"
#include "Phi4.h"
#include "BlumeCapel.h"
#include "XXZAntiferro.h"
const std::string outdir = "../out/";
const int myid = 0;
#include "marqov.h"
int main()
{
// read config files
RegistryDB registry("../src/config");
// remove old output and prepare new one
std::string command = "rm -r " + outdir;
std::string outdir = registry.Get<std::string>("mc", "IO", "outdir" );
std::string logdir = registry.Get<std::string>("mc", "IO", "logdir" );
std::string command;
command = "rm -r " + outdir;
system(command.c_str());
command = "rm -r " + logdir;
system(command.c_str());
makeDir(outdir);
makeDir(logdir);
// ------------------ live view -----------------------
......@@ -190,17 +200,18 @@ int main()
*/
// ----------------------------------------------------
auto nL = registry.Get<std::vector<int> >("mc", "General", "nL" );
// extract Monte Carlo parameters
auto nL = registry.Get<std::vector<int> >("mc", "General", "nL" );
int nbeta = registry.Get<int>("mc", "General", "nbeta" );
double betastart = registry.Get<double>("mc", "General", "betastart" );
double betaend = registry.Get<double>("mc", "General", "betaend" );
double betastep = (betaend - betastart) / double(nbeta);
std::string logfilename = registry.Get<std::string>("mc", "IO", "logfilename" );
std::ofstream os(logfilename);
// write temperatures in logfile
std::string logfile = registry.Get<std::string>("mc", "IO", "logfile" );
std::ofstream os(logdir+"/"+logfile);
for (int i=0; i<nbeta; i++) os << betastart + i*betastep << endl;
os.close();
......@@ -215,6 +226,7 @@ int main()
// extract lattice size and prepare directories
const int L = nL[j];
cout << endl << "L = " << L << endl << endl;
cout << outdir+std::to_string(L) << endl;
makeDir(outdir+std::to_string(L));
// temperature loop
......@@ -227,7 +239,7 @@ int main()
RegularLattice lattice(L, dim);
// set up outfile
std::string outfile = outdir+std::to_string(L)+"/"+std::to_string(i)+".h5";
std::string outfile = outdir+"/"+std::to_string(L)+"/"+std::to_string(i)+".h5";
// set up model
// Marqov<RegularLattice, Ising<int> > marqov(lattice, currentbeta, outfile);
......@@ -243,8 +255,8 @@ int main()
// number of EMCS during relaxation and measurement
const int nrlx = 1000;
const int nmsr = 2000;
const int nrlx = 2500;
const int nmsr = 5000;
// perform simulation
......
......@@ -233,6 +233,8 @@ inline int Marqov<Grid, Hamiltonian>::metropolisstep(int rsite)
double dE = interactionenergydiff + onsiteenergydiff + (multisiteenergynew - multisiteenergyold);
// improve me: what about models with discrete statevectors where the acceptance probability should be
// looked up in tables? -> specialized Metropolis routine for this case??
int retval = 0;
if ( dE <= 0 )
......@@ -240,7 +242,7 @@ inline int Marqov<Grid, Hamiltonian>::metropolisstep(int rsite)
svold = svnew;
retval = 1;
}
else if (rng.d() < exp(-ham.beta*dE))
else if (rng.d() < exp(-ham.beta*dE))
{
svold = svnew;
retval = 1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment