Skip to content

Commit d642b1f

Browse files
committed
[latt] chi0 bubble with two separate gfs
1 parent 24defb9 commit d642b1f

File tree

3 files changed

+59
-10
lines changed

3 files changed

+59
-10
lines changed

c++/triqs_tprf/lattice/chi_imtime.cpp

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ namespace triqs_tprf {
3535
// ----------------------------------------------------
3636
// chi0 bubble in DLR imaginary time
3737

38-
chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize) {
38+
chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr, g_Dtr_cvt g_bwd_tr, bool symmetrize) {
3939

40+
assert( g_tr.mesh() == g_bwd_tr.mesh() );
41+
assert( g_tr.target() == g_bwd_tr.target() );
42+
4043
auto _ = all_t{};
4144

4245
auto tmesh = std::get<0>(g_tr.mesh());
@@ -64,7 +67,7 @@ chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize) {
6467
#pragma omp critical
6568
{
6669
g_pr_t = g_tr[_, r];
67-
g_mr_t = g_tr(_, -r);
70+
g_mr_t = g_bwd_tr(_, -r);
6871
}
6972

7073
auto g_pr_c = make_gf_dlr(g_pr_t);
@@ -82,11 +85,18 @@ chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize) {
8285
return chi0_tr;
8386
}
8487

88+
chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize) {
89+
return chi0_tr_from_grt_PH(g_tr, g_tr, symmetrize);
90+
}
91+
8592
// ----------------------------------------------------
8693
// chi0 bubble in DLR imaginary time
8794
// -- specialization for w=0 (static bubble susceptibility)
8895

89-
chi_wr_t chi0_w0r_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize) {
96+
chi_wr_t chi0_w0r_from_grt_PH(g_Dtr_cvt g_tr, g_Dtr_cvt g_bwd_tr, bool symmetrize) {
97+
98+
assert( g_tr.mesh() == g_bwd_tr.mesh() );
99+
assert( g_tr.target() == g_bwd_tr.target() );
90100

91101
auto _ = all_t{};
92102

@@ -117,7 +127,7 @@ chi_wr_t chi0_w0r_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize) {
117127
#pragma omp critical
118128
{
119129
g_pr_t = g_tr[_, r];
120-
g_mr_t = g_tr(_, -r);
130+
g_mr_t = g_bwd_tr(_, -r);
121131
}
122132

123133
auto g_pr_c = make_gf_dlr(g_pr_t);
@@ -137,6 +147,9 @@ chi_wr_t chi0_w0r_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize) {
137147
return chi0_w0r;
138148
}
139149

150+
chi_wr_t chi0_w0r_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize) {
151+
return chi0_w0r_from_grt_PH(g_tr, g_tr, symmetrize);
152+
}
140153

141154
target_value_t<chi_t_t>::regular_type integrate_dlr_tau(chi_Dt_cvt chi_t) {
142155

@@ -156,7 +169,10 @@ target_value_t<chi_t_t>::regular_type integrate_dlr_tau(chi_Dt_cvt chi_t) {
156169
// ----------------------------------------------------
157170
// chi0 bubble in imaginary time
158171

159-
chi_tr_t chi0_tr_from_grt_PH(g_tr_cvt g_tr) {
172+
chi_tr_t chi0_tr_from_grt_PH(g_tr_cvt g_tr, g_tr_cvt g_bwd_tr) {
173+
174+
assert( g_tr.mesh() == g_bwd_tr.mesh() );
175+
assert( g_tr.target() == g_bwd_tr.target() );
160176

161177
auto _ = all_t{};
162178

@@ -192,7 +208,7 @@ chi_tr_t chi0_tr_from_grt_PH(g_tr_cvt g_tr) {
192208
#pragma omp critical
193209
{
194210
g_pr_t = g_tr[_, r];
195-
g_mr_t = g_tr(_, -r);
211+
g_mr_t = g_bwd_tr(_, -r);
196212
}
197213

198214
for (auto t : tmesh) chi0_t[t](a, b, c, d) << g_pr_t(t)(d, a) * g_mr_t(beta - t)(b, c);
@@ -206,8 +222,15 @@ chi_tr_t chi0_tr_from_grt_PH(g_tr_cvt g_tr) {
206222
return chi0_tr;
207223
}
208224

225+
chi_tr_t chi0_tr_from_grt_PH(g_tr_cvt g_tr) {
226+
return chi0_tr_from_grt_PH(g_tr, g_tr);
227+
}
228+
209229
// -- memory optimized version for smaller nw
210-
chi_wr_t chi0_wr_from_grt_PH(g_tr_cvt g_tr, int nw=1) {
230+
chi_wr_t chi0_wr_from_grt_PH(g_tr_cvt g_tr, g_tr_cvt g_bwd_tr, int nw=1) {
231+
232+
assert( g_tr.mesh() == g_bwd_tr.mesh() );
233+
assert( g_tr.target() == g_bwd_tr.target() );
211234

212235
auto _ = all_t{};
213236

@@ -236,7 +259,7 @@ chi_wr_t chi0_wr_from_grt_PH(g_tr_cvt g_tr, int nw=1) {
236259
#pragma omp critical
237260
{
238261
g_pr_t = g_tr[_, r];
239-
g_mr_t = g_tr(_, -r);
262+
g_mr_t = g_bwd_tr(_, -r);
240263
}
241264

242265
for (auto t : tmesh) chi0_t[t](a, b, c, d) << g_pr_t(t)(d, a) * g_mr_t(beta - t)(b, c);
@@ -250,10 +273,17 @@ chi_wr_t chi0_wr_from_grt_PH(g_tr_cvt g_tr, int nw=1) {
250273

251274
chi0_wr = mpi::all_reduce(chi0_wr);
252275
return chi0_wr;
276+
}
277+
278+
chi_wr_t chi0_wr_from_grt_PH(g_tr_cvt g_tr, int nw=1) {
279+
return chi0_wr_from_grt_PH(g_tr, g_tr, nw);
253280
}
254281

255282
// -- optimized version for w=0
256-
chi_wr_t chi0_w0r_from_grt_PH(g_tr_cvt g_tr) {
283+
chi_wr_t chi0_w0r_from_grt_PH(g_tr_cvt g_tr, g_tr_cvt g_bwd_tr) {
284+
285+
assert( g_tr.mesh() == g_bwd_tr.mesh() );
286+
assert( g_tr.target() == g_bwd_tr.target() );
257287

258288
auto _ = all_t{};
259289

@@ -283,7 +313,7 @@ chi_wr_t chi0_w0r_from_grt_PH(g_tr_cvt g_tr) {
283313
#pragma omp critical
284314
{
285315
g_pr_t = g_tr[_, r];
286-
g_mr_t = g_tr(_, -r);
316+
g_mr_t = g_bwd_tr(_, -r);
287317
}
288318

289319
for (auto t : tmesh) chi0_t[t](a, b, c, d) << g_pr_t(t)(d, a) * g_mr_t(beta - t)(b, c);
@@ -298,6 +328,10 @@ chi_wr_t chi0_w0r_from_grt_PH(g_tr_cvt g_tr) {
298328
return chi0_wr;
299329
}
300330

331+
chi_wr_t chi0_w0r_from_grt_PH(g_tr_cvt g_tr) {
332+
return chi0_w0r_from_grt_PH(g_tr, g_tr);
333+
}
334+
301335
target_value_t<chi_t_t>::regular_type chi_trapz_tau(chi_t_cvt chi_t) {
302336

303337
auto tmesh = chi_t.mesh();

c++/triqs_tprf/lattice/chi_imtime.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ namespace triqs_tprf {
3636
@return Generalized susceptibility :math:`\chi^{(0)}_{\bar{a}b\bar{c}d}(\tau, \mathbf{r})` in imaginary time and real-space.
3737
*/
3838
chi_tr_t chi0_tr_from_grt_PH(g_tr_cvt g_tr);
39+
chi_tr_t chi0_tr_from_grt_PH(g_tr_cvt g_tr, g_tr_cvt g_bwd_tr);
3940
chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize=false);
41+
chi_Dtr_t chi0_tr_from_grt_PH(g_Dtr_cvt g_tr, g_Dtr_cvt g_bwd_tr, bool symmetrize=false);
4042
chi_wr_t chi0_wr_from_grt_PH(g_tr_cvt g_tr, int nw);
43+
chi_wr_t chi0_wr_from_grt_PH(g_tr_cvt g_tr, g_tr_cvt g_bwd_tr, int nw);
4144

4245
/** Generalized susceptibility zero imaginary frequency bubble in the particle-hole channel :math:`\chi^{(0)}_{\bar{a}b\bar{c}d}(\omega=0, \mathbf{r})`
4346
@@ -52,7 +55,9 @@ chi_wr_t chi0_wr_from_grt_PH(g_tr_cvt g_tr, int nw);
5255
@return Generalized susceptibility :math:`\chi^{(0)}_{\bar{a}b\bar{c}d}(\mathbf{r})` in real-space.
5356
*/
5457
chi_wr_t chi0_w0r_from_grt_PH(g_tr_cvt g_tr);
58+
chi_wr_t chi0_w0r_from_grt_PH(g_tr_cvt g_tr, g_tr_cvt g_bwd_tr);
5559
chi_wr_t chi0_w0r_from_grt_PH(g_Dtr_cvt g_tr, bool symmetrize=false);
60+
chi_wr_t chi0_w0r_from_grt_PH(g_Dtr_cvt g_tr, g_Dtr_cvt g_bwd_tr, bool symmetrize=false);
5661

5762
/** Static susceptibility calculation :math:`\chi_{\bar{a}b\bar{c}d}(\omega=0, \mathbf{r})`
5863

python/triqs_tprf/lattice_desc.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,11 @@
13451345
out
13461346
Generalized susceptibility :math:`\chi^{(0)}_{\bar{a}b\bar{c}d}(\tau, \mathbf{r})` in imaginary time and real-space.""")
13471347

1348+
module.add_function ("triqs_tprf::chi_tr_t triqs_tprf::chi0_tr_from_grt_PH (triqs_tprf::g_tr_cvt g_tr, triqs_tprf::g_tr_cvt g_bwd_tr)")
1349+
13481350
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)")
1351+
1352+
module.add_function ("triqs_tprf::chi_Dtr_t triqs_tprf::chi0_tr_from_grt_PH (triqs_tprf::g_Dtr_cvt g_tr, triqs_tprf::g_Dtr_cvt g_bwd_tr, bool symmetrize=false)")
13491353

13501354
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)")
13511355

@@ -1372,6 +1376,8 @@
13721376

13731377
module.add_function ("triqs_tprf::chi_wr_t triqs_tprf::chi0_wr_from_grt_PH (triqs_tprf::g_tr_cvt g_tr, int nw)", doc = r"""""")
13741378

1379+
module.add_function ("triqs_tprf::chi_wr_t triqs_tprf::chi0_wr_from_grt_PH (triqs_tprf::g_tr_cvt g_tr, triqs_tprf::g_tr_cvt g_bwd_tr, int nw)", doc = r"""""")
1380+
13751381
module.add_function ("triqs_tprf::chi_wr_t triqs_tprf::chi0_w0r_from_grt_PH (triqs_tprf::g_tr_cvt g_tr)", doc = r"""Generalized susceptibility zero imaginary frequency bubble in the particle-hole channel :math:`\chi^{(0)}_{\bar{a}b\bar{c}d}(\omega=0, \mathbf{r})`
13761382
13771383
Computes
@@ -1391,6 +1397,8 @@
13911397
out
13921398
Generalized susceptibility :math:`\chi^{(0)}_{\bar{a}b\bar{c}d}(\mathbf{r})` in real-space.""")
13931399

1400+
module.add_function ("triqs_tprf::chi_wr_t triqs_tprf::chi0_w0r_from_grt_PH (triqs_tprf::g_tr_cvt g_tr, triqs_tprf::g_tr_cvt g_bwd_tr)")
1401+
13941402
module.add_function ("triqs_tprf::chi_wr_t triqs_tprf::chi0_w0r_from_grt_PH (triqs_tprf::g_Dtr_cvt g_tr, bool symmetrize=false)", doc = r"""Generalized susceptibility zero imaginary frequency bubble in the particle-hole channel :math:`\chi^{(0)}_{\bar{a}b\bar{c}d}(\omega=0, \mathbf{r})` using analytic integration of DLR basis functions in imaginary time.
13951403
13961404
Computes
@@ -1410,6 +1418,8 @@
14101418
out
14111419
Generalized susceptibility :math:`\chi^{(0)}_{\bar{a}b\bar{c}d}(\mathbf{r})` in real-space.""")
14121420

1421+
module.add_function ("triqs_tprf::chi_wr_t triqs_tprf::chi0_w0r_from_grt_PH (triqs_tprf::g_Dtr_cvt g_tr, triqs_tprf::g_Dtr_cvt g_bwd_tr, bool symmetrize=false)")
1422+
14131423
module.add_function ("triqs_tprf::chi_wr_t triqs_tprf::chi_w0r_from_chi_tr (triqs_tprf::chi_tr_cvt chi_tr)", doc = r"""Static susceptibility calculation :math:`\chi_{\bar{a}b\bar{c}d}(\omega=0, \mathbf{r})`
14141424
14151425
Explicit calculation of the static, zero frequency response, by 2nd order trapetzoidal

0 commit comments

Comments
 (0)