27 #ifndef ALPS_MPS_OPTIM_DMRG_SIM_HPP
28 #define ALPS_MPS_OPTIM_DMRG_SIM_HPP
34 #include <boost/shared_ptr.hpp>
38 #include <alps/parser/xmlstream.h>
40 template <
class Matrix,
class SymmGroup>
65 int meas_each =
parms[
"measure_each"];
66 int chkp_each =
parms[
"chkp_each"];
70 if (
parms[
"use_compressed"])
74 boost::shared_ptr<opt_base_t> optimizer;
76 if (
parms[
"optimization"] ==
"singlesite")
79 else if(
parms[
"optimization"] ==
"twosite")
83 throw std::runtime_error(
"Don't know this optimizer");
93 optimizer->sweep(sweep,
Both);
96 if ((sweep+1) % meas_each == 0 || (sweep+1) == parms[
"nsweeps"])
101 ar[results_archive_path(sweep) +
"/parameters"] <<
parms;
102 ar[results_archive_path(sweep) +
"/results"] << optimizer->iteration_results();
107 if (always_measurements.size() > 0)
108 this->
measure(this->results_archive_path(sweep) +
"/results/", always_measurements);
113 if (stopped || (sweep+1) % chkp_each == 0 || (sweep+1) == parms[
"nsweeps"])
114 checkpoint_simulation(
mps, sweep, -1);
119 maquis::cout << e.what() <<
" checkpointing partial result." << std::endl;
124 ar[results_archive_path(e.
sweep()) +
"/parameters"] <<
parms;
125 ar[results_archive_path(e.
sweep()) +
"/results"] << optimizer->iteration_results();
139 std::string results_archive_path(
int sweep)
const
142 status[
"sweep"] = sweep;
150 status[
"sweep"] = sweep;
151 status[
"site"] = site;
Model< Matrix, SymmGroup >::measurements_type measurements_type
virtual void measure(std::string archive_path, measurements_type &meas)
MPS< Matrix, SymmGroup > mps
measurements_type iteration_measurements(int sweep)
time_stopper stop_callback
std::map< std::string, int > status_type
virtual void checkpoint_simulation(MPS< Matrix, SymmGroup > const &state, status_type const &)
dmrg_sim(DmrgParameters &parms_)
virtual std::string results_archive_path(status_type const &) const
measurements_type all_measurements
MPO< Matrix, SymmGroup > mpo
declaration of simulation class
MPO< Matrix, SymmGroup > mpoc