Skip to content

Commit 5a42696

Browse files
committed
change g3w to follow block2_gf
1 parent b634603 commit 5a42696

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

c++/triqs_ctseg/measures/four_point.cpp

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ namespace triqs_ctseg::measures {
2323
four_point::four_point(params_t const &p, work_data_t const &wdata, configuration_t const &config, results_t &results)
2424
: wdata{wdata}, config{config}, results{results} {
2525

26-
beta = p.beta;
27-
measure_g3w = p.measure_g3w;
28-
measure_f3w = p.measure_f3w;
26+
beta = p.beta;
27+
measure_g3w = p.measure_g3w;
28+
measure_f3w = p.measure_f3w;
2929

3030
auto g3w_vec = [&]() {
3131
std::vector<gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>> green_v;
@@ -39,7 +39,6 @@ namespace triqs_ctseg::measures {
3939
return green_v;
4040
};
4141

42-
std::vector<std::string> block_names;
4342
for (auto const &[bl_name, bl_size] : wdata.gf_struct) block_names.push_back(bl_name);
4443
auto bosonic_block_names = std::vector<std::string>{};
4544
for (auto const &str1 : block_names)
@@ -162,12 +161,31 @@ namespace triqs_ctseg::measures {
162161
if (measure_g3w) {
163162
g3w = mpi::all_reduce(g3w, c);
164163
g3w = g3w / (Z * beta);
165-
results.g3w = std::move(g3w);
164+
165+
std::vector<std::vector<gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>>> g3w_vec(wdata.gf_struct.size(), std::vector<gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>>(wdata.gf_struct.size()));
166+
for (int b1 : range(wdata.gf_struct.size())) {
167+
for (int b2 : range(wdata.gf_struct.size())) {
168+
g3w_vec[b1][b2] = g3w[b1 * wdata.gf_struct.size() + b2];
169+
}
170+
}
171+
172+
auto g3w_block = make_block2_gf(block_names, block_names, g3w_vec);
173+
results.g3w = std::move(g3w_block);
166174
}
175+
167176
if (measure_f3w) {
168177
f3w = mpi::all_reduce(f3w, c);
169178
f3w = f3w / (Z * beta);
170-
results.f3w = std::move(f3w);
179+
180+
std::vector<std::vector<gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>>> f3w_vec(wdata.gf_struct.size(), std::vector<gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>>(wdata.gf_struct.size()));
181+
for (int b1 : range(wdata.gf_struct.size())) {
182+
for (int b2 : range(wdata.gf_struct.size())) {
183+
f3w_vec[b1][b2] = f3w[b1 * wdata.gf_struct.size() + b2];
184+
}
185+
}
186+
187+
auto f3w_block = make_block2_gf(block_names, block_names, f3w_vec);
188+
results.f3w = std::move(f3w_block);
171189
}
172190

173191
}

c++/triqs_ctseg/measures/four_point.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ namespace triqs_ctseg::measures {
3333
bool measure_f3w;
3434
int n_w_fermionic;
3535
int n_w_bosonic;
36+
std::vector<std::string> block_names;
3637
std::vector<array<dcomplex, 4>> Mw_vector, nMw_vector;
3738
vector<dcomplex> y_exp_ini, y_exp_inc, x_exp_ini, x_exp_inc;
3839
vector<int> y_inner_index, x_inner_index;

c++/triqs_ctseg/results.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ namespace triqs_ctseg {
6161
std::optional<nda::vector<double>> state_hist;
6262

6363
/// Four-point correlation function
64-
std::optional<block_gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>> g3w;
64+
std::optional<block2_gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>> g3w;
6565

6666
/// Four-point correlation function improved estimator
67-
std::optional<block_gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>> f3w;
67+
std::optional<block2_gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>> f3w;
6868

6969
/// Average sign
7070
double average_sign;

python/triqs_ctseg/solver_core_desc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@
9292
doc = r"""State histogram""")
9393

9494
c.add_member(c_name = "g3w",
95-
c_type = "std::optional<block_gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>>",
95+
c_type = "std::optional<block2_gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>>",
9696
read_only= True,
9797
doc = r"""Four-point correlation function""")
9898

9999
c.add_member(c_name = "f3w",
100-
c_type = "std::optional<block_gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>>",
100+
c_type = "std::optional<block2_gf<prod<imfreq, imfreq, imfreq>, tensor_valued<4>>>",
101101
read_only= True,
102102
doc = r"""Four-point correlation function improved estimator""")
103103

0 commit comments

Comments
 (0)