27 #include <boost/filesystem/fstream.hpp>
36 void run_sim(
const boost::filesystem::path& infile,
const boost::filesystem::path& outfile,
37 bool write_xml,
double time_limit)
39 maquis::cout.precision(10);
44 boost::filesystem::ifstream param_file(infile);
46 throw std::runtime_error(std::string(
"Could not open parameter file ") + infile.string() +
".");
47 alps::Parameters p; p.extract_from_xml(param_file);
52 parms.
set(
"chkpfile", (outfile.parent_path() / outfile.stem()).
string() +
".chkp");
53 parms.
set(
"resultfile", (outfile.parent_path() / outfile.stem()).
string() +
".h5");
54 parms.
set(
"run_seconds", time_limit);
55 if (parms.defined(
"SWEEPS")) parms.
set(
"nsweeps",
int(parms[
"SWEEPS"]));
56 if (parms.defined(
"TRUNCATION_ERROR")) parms.
set(
"truncation_final", parms[
"TRUNCATION_ERROR"]);
58 if (parms.defined(
"NUMSTATES")) {
59 parms.
set(
"max_bond_dimension",
int(parms[
"NUMSTATES"]));
60 }
else if (parms.defined(
"MAXSTATES")) {
64 double step = (int(parms[
"MAXSTATES"]) - init_bond) / (parms[
"nsweeps"]-1);
67 for (
int sweep = 1; sweep < parms[
"nsweeps"]; ++sweep) {
68 ss <<
"," << int(init_bond + step*sweep);
71 parms.set(
"sweep_bond_dimensions", ss.str());
72 }
else if (parms.defined(
"STATES")) {
73 parms.
set(
"sweep_bond_dimensions", parms[
"NUMSTATES"].str());
75 if (!parms.defined(
"max_bond_dimension") && !parms.defined(
"sweep_bond_dimensions"))
76 throw std::runtime_error(
"Number of renormalized states not set.");
void set(std::string const &key, T const &value)
wrapper of eigenstate_sim for symmetry factory
boost::shared_ptr< simulation_base > shared_ptr
void run_sim(const boost::filesystem::path &infile, const boost::filesystem::path &outfile, bool write_xml, double time_limit)
symmetry factory: runtime dispatch for SymmGroup template argument