24#include <triqs/mc_tools.hpp>
25#include <triqs/utility/callbacks.hpp>
26#include <triqs/operators/many_body_operator.hpp>
27#include <triqs/stat/histograms.hpp>
28#include <triqs/atom_diag/atom_diag.hpp>
29#include <triqs/atom_diag/functions.hpp>
30#include <triqs/utility/macros.hpp>
34#include "container_set.hpp"
35#include "parameters.hpp"
36#include "configuration.hpp"
38namespace triqs_cthyb {
45 gf_struct_t gf_struct;
46 many_body_op_t _h_loc;
47 many_body_op_t _h_loc0;
51 std::vector<matrix_t> _density_matrix;
52 mpi::communicator _comm;
53 histo_map_t _performance_analysis;
54 mc_weight_t _average_sign;
55 double _average_order;
56 double _auto_corr_time;
57 bool _auto_corr_time_converged =
true;
59 std::optional<configuration> _last_configuration;
62 std::optional<G_iw_t> _G0_iw;
64 std::optional<std::vector<matrix<dcomplex>>> Delta_infty_vec;
98 many_body_op_t
h_loc()
const {
return _h_loc; }
101 many_body_op_t
h_loc0()
const {
return _h_loc0; }
110 [[deprecated(
"Use h_loc0() instead.")]]
112 if (delta_interface) TRIQS_RUNTIME_ERROR <<
"Delta_infty cannot be accessed when using the Delta interface";
113 return Delta_infty_vec.value();
117 block_gf_view<imtime>
Delta_tau() {
return _Delta_tau; }
121 if (delta_interface) TRIQS_RUNTIME_ERROR <<
"G0_iw cannot be accessed when using the Delta interface";
122 return _G0_iw.value();
135 C2PY_PROPERTY_GET(performance_analysis) histo_map_t get_performance_analysis()
const {
return _performance_analysis; }
157#ifdef HYBRIDISATION_IS_COMPLEX
166#ifdef LOCAL_HAMILTONIAN_IS_COMPLEX
173 static std::string hdf5_format() {
return "CTHYB_SolverCore"; }
176 friend void h5_write(h5::group h5group, std::string subgroup_name,
solver_core const &s) {
177 h5::group grp = subgroup_name.empty() ? h5group : h5group.create_group(subgroup_name);
178 write_hdf5_format(grp, s);
179 h5_write_attribute(grp,
"TRIQS_GIT_HASH", std::string(STRINGIZE(TRIQS_GIT_HASH)));
180 h5_write_attribute(grp,
"CTHYB_GIT_HASH", std::string(STRINGIZE(CTHYB_GIT_HASH)));
181 h5_write(grp,
"container_set", s.container_set());
182 h5_write(grp,
"constr_parameters", s.constr_parameters);
183 h5_write(grp,
"solve_parameters", s.solve_parameters);
184 h5_write(grp,
"G0_iw", s._G0_iw);
185 h5_write(grp,
"Delta_tau", s._Delta_tau);
187 h5_write(grp,
"h_diag", s.h_diag);
188 h5_write(grp,
"h_loc", s._h_loc);
189 h5_write(grp,
"density_matrix", s._density_matrix);
190 h5_write(grp,
"average_sign", s._average_sign);
191 h5_write(grp,
"average_order", s._average_order);
192 h5_write(grp,
"auto_corr_time", s._auto_corr_time);
193 h5_write(grp,
"auto_corr_time_converged", s._auto_corr_time_converged);
194 h5_write(grp,
"solve_status", s._solve_status);
195 h5_write(grp,
"Delta_infty_vec", s.Delta_infty_vec);
199 C2PY_IGNORE
static solver_core h5_read_construct(h5::group h5group, std::string subgroup_name) {
200 h5::group grp = subgroup_name.empty() ? h5group : h5group.open_group(subgroup_name);
201 auto constr_parameters = h5::h5_read<constr_parameters_t>(grp,
"constr_parameters");
203 h5_read(grp,
"container_set", s.container_set());
204 h5_read(grp,
"solve_parameters", s.solve_parameters);
205 h5_read(grp,
"G0_iw", s._G0_iw);
206 h5_read(grp,
"Delta_tau", s._Delta_tau);
208 h5::try_read(grp,
"h_diag", s.h_diag);
209 h5::try_read(grp,
"h_loc", s._h_loc);
210 h5::try_read(grp,
"density_matrix", s._density_matrix);
211 h5::try_read(grp,
"average_sign", s._average_sign);
212 h5::try_read(grp,
"average_order", s._average_order);
213 h5::try_read(grp,
"auto_corr_time", s._auto_corr_time);
214 h5::try_read(grp,
"auto_corr_time_converged", s._auto_corr_time_converged);
215 h5::try_read(grp,
"solve_status", s._solve_status);
216 h5::try_read(grp,
"Delta_infty_vec", s.Delta_infty_vec);
constr_parameters_t constr_parameters
Parameters used for constructing the solver.
C2PY_PROPERTY_GET(performance_analysis) histo_map_t get_performance_analysis() const
Histograms related to the performance analysis.
many_body_op_t h_loc() const
The local Hamiltonian used in the last solve.
double average_order() const
Average perturbation order.
solve_parameters_t last_solve_parameters() const
Parameters used in the last solve.
std::optional< configuration > last_configuration() const
Final configuration of the last solve call.
block_gf_view< imfreq > G0_iw()
Non-interacting Green's function in Matsubara frequencies.
atom_diag const & h_loc_diagonalization() const
Diagonalization of .
int solve_status() const
Status of the solve on exit.
double auto_corr_time() const
Auto-correlation time in units of MC cycles.
constr_parameters_t last_constr_parameters() const
Parameters used for constructing the solver.
solve_parameters_t solve_parameters
Parameters passed to the solve method.
void solve(solve_parameters_t const &p)
mc_weight_t average_sign() const
Monte Carlo average sign.
std::vector< matrix_t > density_matrix() const
Atomic :math:G(\tau) in imaginary time.
many_body_op_t h_loc0() const
The noninteracting part of the local Hamiltonian.
bool local_hamiltonian_is_complex() const
Is the solver compiled with support for a complex local Hamiltonian?
bool auto_corr_time_converged() const
Whether the auto-correlation time estimate has saturated (false: it is only a lower bound,...
bool hybridisation_is_complex() const
Is the solver compiled with support for complex hybridization?
block_gf_view< imtime > Delta_tau()
Hybridization function in imaginary time.
std::vector< matrix< dcomplex > > Delta_infty()
in Matsubara frequencies.
solver_core(constr_parameters_t const &p)
Container for all results accumulated by the simulation.
friend void h5_read(h5::group h5group, std::string subgroup_name, container_set_t &c)
Function that reads all containers to hdf5 file.
Parameters used for constructing the solver class.
Parameters passed to the solve method of the solver class.