block_gf<legendre> atomic_g_l(gf_lehmann_t<Complex> const &lehmann, gf_struct_t const &gf_struct, gf_mesh<legendre> const &mesh) { double beta = mesh.domain().beta; auto g = block_gf{mesh, gf_struct}; fill_block_gf_from_lehmann<Complex>(g(), lehmann, make_term_proc<Complex>(beta, g())); return g; }
template <typename Opt> gf_mesh<imfreq, Opt> make_mesh_fourier_compatible(gf_mesh<imtime, Opt> const& m) { int L = m.size() - (m.kind() == full_bins ? 1 : 0); return {m.domain(), L}; }
gf_mesh<imtime, Opt> make_mesh_fourier_compatible(gf_mesh<imfreq, Opt> const& m, mesh_kind mk = full_bins) { int L = m.size() + (mk == full_bins ? 1 : 0); return {m.domain(), L}; }
// -------------- HDF5 -------------------------- /// 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, "n_pts", m.dims[2]); //h5_write(gr, "dims", m.dims.to_vector()); }
friend gf_mesh mpi_gather(gf_mesh m, mpi::communicator c, int root) { return gf_mesh{m.domain(), m.size(), m.positive_only()}; }
/// Scatter a mesh over the communicator c friend gf_mesh mpi_scatter(gf_mesh m, mpi::communicator c, int root) { auto m2 = gf_mesh{m.domain(), m.size(), m.positive_only()}; std::tie(m2._first_index_window, m2._last_index_window) = mpi::slice_range(m2._first_index, m2._last_index, c.size(), c.rank()); return m2; }
mesh_point(gf_mesh<imfreq> const &mesh, index_t const &index_) : matsubara_freq(index_, mesh.domain().beta, mesh.domain().statistic) , first_index_window(mesh.first_index_window()) , last_index_window(mesh.last_index_window()) {}
/// 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)); }