array<double,1> S() { array<double,1> res(mesh.size()); for(auto pt : mesh) { int i = pt.index(); double tau = double(pt); res(i) = 0.05*std::exp(-std::abs(tau - 0.5*beta)); } return res; }
array<double,1> GF() { array<double,1> res(mesh.size()); for(auto pt : mesh) { int i = pt.index(); double tau = double(pt); res(i) = -0.5*(std::exp(-tau*1.3)/(1 + std::exp(-beta*1.3)) + std::exp(tau*0.7)/(1 + std::exp(beta*0.7))); } return res; }
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}; }
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}; }
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; }
/// 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)); }