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; }
auto operator()(Expr const &expr, clef::placeholder<N>, gf_mesh<brillouin_zone> const &m, lattice::k_t const &k) { auto n = m.locate_neighbours(k).index(); return clef::eval(expr, clef::placeholder<N>() = no_cast(m[n])); }
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; }
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}; }
/// Read from HDF5 friend void h5_read(h5::group fg, std::string subgroup_name, gf_mesh &m) { h5::group gr = fg.open_group(subgroup_name); auto l = [gr](int N, auto &m) { h5_read(gr, "MeshComponent" + std::to_string(N), m); }; triqs::tuple::for_each_enumerate(m.components(), l); }
operator cast_t() const { return m->index_to_point(index); }
void reset() { _atend = false; triqs::tuple::for_each(_c, [](auto &m) { m.reset(); }); }
// -------------- 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()); }
linear_index_t linear_index() const { return m->mp_to_linear(_c); }
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) : mesh_point(mesh, mesh.first_index_window()) {}
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)); }