// -------------- HDF5 -------------------------- /// Write into HDF5 friend void h5_write(h5::group fg, std::string subgroup_name, linear_mesh const &m) { h5::group gr = fg.create_group(subgroup_name); h5_write(gr, "domain", m.domain()); h5_write(gr, "min", m.xmin); h5_write(gr, "max", m.xmax); h5_write(gr, "size", long(m.size())); }
/// HDF5 interface friend void h5_write (h5::group g, std::string const & name, mc_generic const & mc){ auto gr = g.create_group(name); h5_write(gr,"moves", mc.AllMoves); h5_write(gr,"measures", mc.AllMeasures); h5_write(gr,"length_monte_carlo_cycle", mc.Length_MC_Cycle); h5_write(gr,"number_cycle_requested", mc.NCycles); h5_write(gr,"number_warming_cycle_requested", mc.NWarmIterations); h5_write(gr,"number_cycle_done", mc.NC); h5_write(gr,"number_measure_done", mc.nmeasures); h5_write(gr,"sign", mc.sign); h5_write(gr,"sum_sign", mc.sum_sign); }
/// Write into HDF5 friend void h5_write(h5::group fg, std::string subgroup_name, matsubara_freq_mesh const &m) { h5::group gr = fg.create_group(subgroup_name); h5_write(gr, "domain", m.domain()); h5_write(gr, "size", m.size()); if (m._positive_only) { // kept ONLY for backward compatibility of archives auto beta = m.domain().beta; h5_write(gr, "min", Fermion ? M_PI / beta : 0); h5_write(gr, "max", ((Fermion ? 1 : 0) + 2 * m.size()) * M_PI / beta); h5_write(gr, "kind", 2); } else { // A strange way : to preserve backward compatibility for old archive. h5_write(gr, "start_at_0", m._positive_only); } }
std::c14::enable_if_t<is_amv_value_or_view_class<ArrayType>::value && !has_scalar_or_string_value_type<ArrayType>::value> h5_write(h5::group gr, std::string name, ArrayType const& a) { if (a.is_empty()) TRIQS_RUNTIME_ERROR << " Cannot save an empty array into hdf5"; auto gr2 = gr.create_group(name); gr2.write_triqs_hdf5_data_scheme(a); // save the shape array<int, 1> sha(ArrayType::rank); for (int u = 0; u < ArrayType::rank; ++u) sha(u) = a.shape()[u]; h5_write(gr2, "shape", sha); #ifndef __cpp_generic_lambdas foreach(a, h5_impl::_save_lambda<ArrayType>{a, gr2}); #else foreach(a, [&](auto... is) { h5_write(gr2, h5_impl::_h5_name(is...), a(is...)); }); #endif }
// HDF5 interface friend void h5_write (h5::group g, std::string const & name, measure_set const & ms) { auto gr = g.create_group(name); for (auto & p : ms.m_map) h5_write(gr,p.first, p.second); }
/** @param fg Parent HDF5 group to write the space to @param name Name of the HDF5 subgroup to be created @param hs Hilbert subspace to be written */ friend void h5_write(h5::group fg, std::string const &name, sub_hilbert_space const &hs) { auto gr = fg.create_group(name); h5_write(gr, "index", hs.index); h5_write(gr, "fock_states", hs.fock_states); }
/** @param fg Parent HDF5 group to write the space to @param name Name of the HDF5 subgroup to be created @param hs Hilbert space to be written */ friend void h5_write(h5::group fg, std::string const &name, hilbert_space const &hs) { auto gr = fg.create_group(name); h5_write(gr, "dim", hs.dim); }
/// Write into HDF5 friend void h5_write(h5::group fg, std::string subgroup_name, discrete_mesh const &m) { h5::group gr = fg.create_group(subgroup_name); h5_write(gr, "domain", m.domain()); }
/// Write into HDF5 friend void h5_write(h5::group fg, std::string subgroup_name, matsubara_domain const &d) { h5::group gr = fg.create_group(subgroup_name); h5_write(gr, "beta", d.beta); h5_write(gr, "statistic", (d.statistic == Fermion ? "F" : "B")); }
/// Write into HDF5 friend void h5_write(h5::group fg, std::string subgroup_name, gf_mesh const& m) { h5::group gr = fg.create_group(subgroup_name); h5_write(gr, "dims", m.dims.to_vector()); }
friend void h5_write(h5::group fg, std::string subgroup_name, tail_impl const &t) { auto gr = fg.create_group(subgroup_name); h5_write(gr, "omin", t.omin); h5_write(gr, "mask", t._mask); h5_write(gr, "data", t._data); }
/// Write into HDF5 void h5_write(h5::group fg, std::string subgroup_name, bravais_lattice const& bl) { h5::group gr = fg.create_group(subgroup_name); h5_write(gr, "units", bl.units_); // NOT COMPLETE }
//------------------------------------------------------------------------------------ /// Write into HDF5 void h5_write(h5::group fg, std::string subgroup_name, brillouin_zone const& bz) { h5::group gr = fg.create_group(subgroup_name); h5_write(gr, "bravais_lattice", bz.lattice_); }
/// Write into HDF5 friend void h5_write(h5::group fg, std::string subgroup_name, gf_mesh const &m) { h5::group gr = fg.create_group(subgroup_name); auto l = [gr](int N, auto const &m) { h5_write(gr, "MeshComponent" + std::to_string(N), m); }; triqs::tuple::for_each_enumerate(m.components(), l); }
/// Write into HDF5 friend void h5_write(h5::group fg, std::string subgroup_name, gf_mesh const &m) { h5::group gr = fg.create_group(subgroup_name); h5_write(gr, "domain", m.domain()); h5_write(gr, "size", long(m.size())); h5_write(gr, "positive_freq_only", (m._positive_only?1:0)); }