1#ifndef XPED_CTM_OPTS_HPP
2#define XPED_CTM_OPTS_HPP
6#include "yas/serialize.hpp"
7#include "yas/std_types.hpp"
12#include <boost/describe.hpp>
19BOOST_DEFINE_ENUM_CLASS(DIRECTION, LEFT, RIGHT, TOP, BOTTOM)
21BOOST_DEFINE_ENUM_CLASS(CORNER, UPPER_LEFT, UPPER_RIGHT, LOWER_LEFT, LOWER_RIGHT)
23BOOST_DEFINE_ENUM_CLASS(PROJECTION, CORNER, HALF, FULL)
25BOOST_DEFINE_ENUM_CLASS(CTM_INIT, FROM_TRIVIAL, FROM_A)
31 std::size_t max_presteps = 100;
32 std::size_t track_steps = 4;
34 double tol_E = 1.e-10;
35 double tol_N = 1.e-10;
37 double reinit_env_tol = 1.e-1;
39 CTM_INIT init = CTM_INIT::FROM_A;
41 Verbosity verbosity = Verbosity::ON_ENTRY;
43 std::string load =
"";
46 template <
typename Ar>
49 ar& YAS_OBJECT_NVP(
"CTMOpts",
51 (
"max_presteps", max_presteps),
52 (
"track_steps", track_steps),
55 (
"reinit_env_tol", reinit_env_tol),
57 (
"verbosity", verbosity),
59 (
"qn_scale", qn_scale));
65 fmt::format_to(std::back_inserter(res),
"{}:\n", fmt::styled(
"CTM options", fmt::emphasis::bold));
66 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• chi:", chi);
67 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• init:", fmt::streamed(init));
68 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• maximum pre-steps:", max_presteps);
69 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• tracked steps:", track_steps);
70 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• energy tolerance:", tol_E);
71 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• norm tolerance:", tol_N);
72 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• reinit_env_tol:", reinit_env_tol);
73 if(load.size() > 0) { fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• load from:", load); }
74 if(load.size() > 0) { fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• scale loaded qn by:", qn_scale); }
75 fmt::format_to(std::back_inserter(res),
" {:<30} {}",
"• verbosity:", fmt::streamed(verbosity));
83 res.
chi = t.contains(
"chi") ? t.at(
"chi").as_integer() : res.chi;
84 if(t.contains(
"init")) { res.init = util::enum_from_toml<CTM_INIT>(t.at(
"init")); }
85 res.max_presteps = t.contains(
"max_presteps") ? t.at(
"max_presteps").as_integer() : res.max_presteps;
86 res.track_steps = t.contains(
"track_steps") ? t.at(
"track_steps").as_integer() : res.track_steps;
87 res.tol_E = t.contains(
"tol_E") ? t.at(
"tol_E").as_floating() : res.tol_E;
88 res.reinit_env_tol = t.contains(
"reinit_env_tol") ? t.at(
"reinit_env_tol").as_floating() : res.reinit_env_tol;
89 if(t.contains(
"verbosity")) { res.verbosity = util::enum_from_toml<Verbosity>(t.at(
"verbosity")); }
90 res.load = t.contains(
"load") ?
static_cast<std::string
>(t.at(
"load").as_string()) : res.load;
91 res.qn_scale = t.contains(
"qn_scale") ? (t.at(
"qn_scale").as_integer()) : res.qn_scale;
107 fmt::format_to(std::back_inserter(res),
"{}:\n", fmt::styled(
"Checkpointing settings", fmt::emphasis::bold));
108 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• grow_all:",
GROW_ALL);
109 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• move:",
MOVE);
110 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• corner contraction:",
CORNER);
111 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• projector computation:",
PROJECTORS);
112 fmt::format_to(std::back_inserter(res),
" {:<30} {}\n",
"• Renormalization step:",
RENORMALIZE);
113 fmt::format_to(std::back_inserter(res),
" {:<30} {}",
"• RDM contraction:",
RDM);
CTM ctm_from_toml(const toml::value &t)
Definition: CTMOpts.hpp:80
Definition: CTMOpts.hpp:96
bool PROJECTORS
Definition: CTMOpts.hpp:100
bool CORNER
Definition: CTMOpts.hpp:99
bool GROW_ALL
Definition: CTMOpts.hpp:97
bool RENORMALIZE
Definition: CTMOpts.hpp:101
bool RDM
Definition: CTMOpts.hpp:102
bool MOVE
Definition: CTMOpts.hpp:98
auto info() const
Definition: CTMOpts.hpp:104
Definition: CTMOpts.hpp:28
auto info()
Definition: CTMOpts.hpp:62
std::size_t chi
Definition: CTMOpts.hpp:29
void serialize(Ar &ar)
Definition: CTMOpts.hpp:47