Skip to content

Commit

Permalink
Fixed imtime_bubble_chi0_wk not returning chi on a symmetrized DLR me…
Browse files Browse the repository at this point in the history
…sh if Gf in argument has a symmetrized DLR mesh
  • Loading branch information
YannIntVeld committed Jul 24, 2024
1 parent fec7ca4 commit e3be325
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions c++/triqs_tprf/lattice/chi_imtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace triqs_tprf {
// ----------------------------------------------------
// chi0 bubble in DLR imaginary time

chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr) {
chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize) {

auto _ = all_t{};

Expand All @@ -45,7 +45,7 @@ chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr) {
int nb = g_tr.target().shape()[0];
double beta = tmesh.beta();

dlr_imtime btmesh{beta, Boson, tmesh.w_max(), tmesh.eps()};
dlr_imtime btmesh{beta, Boson, tmesh.w_max(), tmesh.eps(), symmetrize};
chi_Dtr_t chi0_tr{{btmesh, rmesh}, {nb, nb, nb, nb}};

auto g_target = g_tr.target();
Expand Down
2 changes: 1 addition & 1 deletion c++/triqs_tprf/lattice/chi_imtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace triqs_tprf {
@return Generalized susceptibility :math:`\chi^{(0)}_{\bar{a}b\bar{c}d}(\tau, \mathbf{r})` in imaginary time and real-space.
*/
chi_tr_t chi0_tr_from_grt_PH(g_tr_cvt g_tr);
chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr);
chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize=false);
chi_wr_t chi0_wr_from_grt_PH(g_tr_cvt g_tr, int nw);

/** Generalized susceptibility zero imaginary frequency bubble in the particle-hole channel :math:`\chi^{(0)}_{\bar{a}b\bar{c}d}(\omega=0, \mathbf{r})`
Expand Down
2 changes: 1 addition & 1 deletion python/triqs_tprf/lattice_desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,7 @@
out
Generalized susceptibility :math:`\chi^{(0)}_{\bar{a}b\bar{c}d}(\tau, \mathbf{r})` in imaginary time and real-space.""")

module.add_function ("triqs_tprf::chi_Dtr_t triqs_tprf::chi0_tr_from_grt_PH (triqs_tprf::g_Dtr_cvt g_tr)")
module.add_function ("triqs_tprf::chi_Dtr_t triqs_tprf::chi0_tr_from_grt_PH (triqs_tprf::g_Dtr_cvt g_tr, bool symmetrize=false)")

module.add_function ("std::tuple<triqs_tprf::g_Tk_t, triqs_tprf::g_Tk_t> triqs_tprf::g0_Tk_les_gtr_from_e_k(triqs_tprf::e_k_cvt e_k, triqs::mesh::retime Tmesh, double beta)")

Expand Down
10 changes: 9 additions & 1 deletion python/triqs_tprf/lattice_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ def imtime_bubble_chi0_wk(g_wk, nw=1, save_memory=False, verbose=True):

ntau = 2 * nw_g

is_dlr_mesh = type(wmesh) == MeshDLRImFreq
if is_dlr_mesh:
iw_values = np.fromiter(wmesh.values(), dtype=complex)
is_symmetrized = np.allclose(iw_values, -iw_values[::-1])

This comment has been minimized.

Copy link
@HugoStrand

HugoStrand Aug 26, 2024

Member

Dear Yan, I have sent a pull request to Triqs to get a MeshDLRImFreq.symmetrize() accessor, see TRIQS/triqs#960 . If that is accepted we can clean this up. Cheers, Hugo


# -- Memory Approximation

ng_tr = ntau * np.prod(nk) * norb**2 # storing G(tau, r)
Expand Down Expand Up @@ -252,7 +257,10 @@ def imtime_bubble_chi0_wk(g_wk, nw=1, save_memory=False, verbose=True):
else:
if not save_memory:
if verbose: mpi.report('--> chi0_tr_from_grt_PH (bubble in tau & r)')
chi0_tr = chi0_tr_from_grt_PH(g_tr)
if is_dlr_mesh:
chi0_tr = chi0_tr_from_grt_PH(g_tr, is_symmetrized)
else:
chi0_tr = chi0_tr_from_grt_PH(g_tr)
del g_tr

if verbose: mpi.report('--> chi_wr_from_chi_tr')
Expand Down

0 comments on commit e3be325

Please sign in to comment.