26 const string str_vlevel = params.
get_string(
"verbose_level");
33 const std::vector<Field_F>& sq2,
34 const std::vector<Field_F>& sq3,
35 const std::vector<Field_F>& sq4)
39 std::vector<dcomplex> corr_global(Lt);
40 GammaMatrix gm_sink_12, gm_sink_34, gm_src_12, gm_src_34;
43 std::ofstream log_file;
56 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
57 double result = real(corr_global[0]);
65 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
72 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
79 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
86 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
93 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
100 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
107 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
114 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
121 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
128 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
135 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
142 meson_correlator(corr_global, gm_sink_12, gm_sink_34, gm_src_12, gm_src_34, sq1, sq2, sq3, sq4);
160 const std::vector<Field_F>& sq1,
161 const std::vector<Field_F>& sq2,
162 const std::vector<Field_F>& sq3,
163 const std::vector<Field_F>& sq4)
175 assert(corr_global.size() == Lt);
213 std::vector<dcomplex> corr_direct_1122_global(Lt);
214 std::vector<dcomplex> corr_direct_3344_global(Lt);
215 std::vector<dcomplex> corr_direct_1324_global(Lt);
216 std::vector<dcomplex> corr_direct_3142_global(Lt);
219 gm5_gm_sink_12, gm_gm5_src_12,
222 gm5_gm_sink_34, gm_gm5_src_34,
225 gm5_gm_sink_12, gm_gm5_src_34,
228 gm5_gm_sink_34, gm_gm5_src_12,
231 std::vector<dcomplex> corr_direct_global(Lt);
232 for (
int t_global = 0; t_global < Lt; ++t_global) {
233 corr_direct_global[t_global]
234 = corr_direct_1122_global[t_global] * corr_direct_3344_global[t_global]
235 + corr_direct_1324_global[t_global] * corr_direct_3142_global[t_global];
243 typedef std::vector<dcomplex> CorrSet;
244 std::vector<CorrSet> corr_cross_1124_global(Lt);
245 std::vector<CorrSet> corr_cross_3342_global(Lt);
246 std::vector<CorrSet> corr_cross_1322_global(Lt);
247 std::vector<CorrSet> corr_cross_3144_global(Lt);
248 for (
int t_global = 0; t_global < Lt; ++t_global) {
249 corr_cross_1124_global[t_global].resize(Nc * Nd * Nc * Nd);
250 corr_cross_3342_global[t_global].resize(Nc * Nd * Nc * Nd);
251 corr_cross_1322_global[t_global].resize(Nc * Nd * Nc * Nd);
252 corr_cross_3144_global[t_global].resize(Nc * Nd * Nc * Nd);
256 gm5_gm_sink_12, gm_gm5_src_12,
259 gm5_gm_sink_34, gm_gm5_src_34,
262 gm5_gm_sink_34, gm_gm5_src_12,
265 gm5_gm_sink_12, gm_gm5_src_34,
269 std::vector<dcomplex> corr_cross_global(Lt, cmplx(0.0, 0.0));
270 for (
int t_global = 0; t_global < Lt; ++t_global) {
271 for (
int c0 = 0; c0 < Nc; ++c0) {
272 for (
int d0 = 0; d0 < Nd; ++d0) {
273 for (
int c1 = 0; c1 < Nc; ++c1) {
274 for (
int d1 = 0; d1 < Nd; ++d1) {
275 int i_cd2_01 = c0 + Nc * d0 + Nc * Nd * c1 + Nc * Nd * Nc * d1;
276 int i_cd2_10 = c1 + Nc * d1 + Nc * Nd * c0 + Nc * Nd * Nc * d0;
278 dcomplex corr_1124 = corr_cross_1124_global[t_global][i_cd2_01];
279 dcomplex corr_3342 = corr_cross_3342_global[t_global][i_cd2_10];
281 corr_cross_global[t_global] += corr_1124 * corr_3342;
283 dcomplex corr_3144 = corr_cross_3144_global[t_global][i_cd2_01];
284 dcomplex corr_1322 = corr_cross_1322_global[t_global][i_cd2_10];
286 corr_cross_global[t_global] += corr_3144 * corr_1322;
295 for (
int t_global = 0; t_global < Lt; ++t_global) {
296 corr_global[t_global] = corr_direct_global[t_global] - corr_cross_global[t_global];
299 t_global, real(corr_global[t_global]), imag(corr_global[t_global]));
305 for (
int t_global = 0; t_global < Lt; ++t_global) {
307 t_global, real(corr_direct_global[t_global]), imag(corr_direct_global[t_global]));
312 for (
int t_global = 0; t_global < Lt; ++t_global) {
314 t_global, real(corr_cross_global[t_global]), imag(corr_cross_global[t_global]));
322 const std::vector<Field_F>& sq2,
323 const std::vector<Field_F>& sq3,
324 const std::vector<Field_F>& sq4,
325 const std::vector<int>& source_position)
330 std::vector<dcomplex> corr_global(Lt);
331 GammaMatrix gm_sink_12, gm_sink_34, gm_src_12, gm_src_34;
333 const int N_momentum = 10;
335 typedef std::vector<int> MomentumSet;
336 std::vector<MomentumSet> momentum_sink(N_momentum);
337 for (
int i_momentum = 0; i_momentum < N_momentum; i_momentum++) {
338 momentum_sink[i_momentum].resize(Ndim - 1);
343 momentum_sink[i_momentum][0] = 1;
344 momentum_sink[i_momentum][1] = 0;
345 momentum_sink[i_momentum][2] = 0;
349 momentum_sink[i_momentum][0] = 0;
350 momentum_sink[i_momentum][1] = 1;
351 momentum_sink[i_momentum][2] = 0;
355 momentum_sink[i_momentum][0] = 0;
356 momentum_sink[i_momentum][1] = 0;
357 momentum_sink[i_momentum][2] = 1;
361 momentum_sink[i_momentum][0] = 1;
362 momentum_sink[i_momentum][1] = 1;
363 momentum_sink[i_momentum][2] = 0;
367 momentum_sink[i_momentum][0] = 0;
368 momentum_sink[i_momentum][1] = 1;
369 momentum_sink[i_momentum][2] = 1;
373 momentum_sink[i_momentum][0] = 1;
374 momentum_sink[i_momentum][1] = 0;
375 momentum_sink[i_momentum][2] = 1;
379 momentum_sink[i_momentum][0] = 1;
380 momentum_sink[i_momentum][1] = 1;
381 momentum_sink[i_momentum][2] = 1;
385 momentum_sink[i_momentum][0] = 2;
386 momentum_sink[i_momentum][1] = 0;
387 momentum_sink[i_momentum][2] = 0;
391 momentum_sink[i_momentum][0] = 0;
392 momentum_sink[i_momentum][1] = 2;
393 momentum_sink[i_momentum][2] = 0;
397 momentum_sink[i_momentum][0] = 0;
398 momentum_sink[i_momentum][1] = 0;
399 momentum_sink[i_momentum][2] = 2;
403 std::ofstream log_file;
415 for (
int i_momentum = 0; i_momentum < N_momentum; i_momentum++) {
417 momentum_sink[i_momentum][0],
418 momentum_sink[i_momentum][1],
419 momentum_sink[i_momentum][2]);
421 gm_sink_12, gm_sink_34, gm_src_12, gm_src_34,
422 sq1, sq2, sq3, sq4, source_position);
429 for (
int i_momentum = 0; i_momentum < N_momentum; i_momentum++) {
431 momentum_sink[i_momentum][0],
432 momentum_sink[i_momentum][1],
433 momentum_sink[i_momentum][2]);
435 gm_sink_12, gm_sink_34, gm_src_12, gm_src_34,
436 sq1, sq2, sq3, sq4, source_position);
443 for (
int i_momentum = 0; i_momentum < N_momentum; i_momentum++) {
445 momentum_sink[i_momentum][0],
446 momentum_sink[i_momentum][1],
447 momentum_sink[i_momentum][2]);
449 gm_sink_12, gm_sink_34, gm_src_12, gm_src_34,
450 sq1, sq2, sq3, sq4, source_position);
457 for (
int i_momentum = 0; i_momentum < N_momentum; i_momentum++) {
459 momentum_sink[i_momentum][0],
460 momentum_sink[i_momentum][1],
461 momentum_sink[i_momentum][2]);
463 gm_sink_12, gm_sink_34, gm_src_12, gm_src_34,
464 sq1, sq2, sq3, sq4, source_position);
479 const std::vector<int>& momentum_sink,
484 const std::vector<Field_F>& sq1,
485 const std::vector<Field_F>& sq2,
486 const std::vector<Field_F>& sq3,
487 const std::vector<Field_F>& sq4,
488 const std::vector<int>& source_position)
495 assert(corr_global.size() == Lt);
500 gm_gm5_src = gm_src.
mult(gm5);
501 gm5_gm_sink = gm5.
mult(gm_sink);
503 std::vector<dcomplex> corr_local(Nt);
505 for (
int c0 = 0; c0 < Nc; ++c0) {
506 for (
int d0 = 0; d0 < Nd; ++d0) {
507 int d1 = gm_gm5_src.index(d0);
509 for (
int t = 0; t < Nt; ++t) {
512 contract_at_t(corr_t, momentum_sink, gm5_gm_sink, source_position,
513 sq1[c0 + Nc * d0], sq2[c0 + Nc * d1], t);
515 corr_local[t] += gm_gm5_src.value(d0) * corr_t;
522 for (
int t = 0; t < corr_global.size(); ++t) {
524 t, real(corr_global[t]), imag(corr_global[t]));
534 const std::vector<Field_F>& sq1,
535 const std::vector<Field_F>& sq2)
541 std::vector<dcomplex> corr_local(Nt, cmplx(0.0, 0.0));
543 for (
int c0 = 0; c0 < Nc; ++c0) {
544 for (
int d0 = 0; d0 < Nd; ++d0) {
545 int d1 = gm_gm5_src.
index(d0);
547 for (
int t = 0; t < Nt; ++t) {
551 sq1[c0 + Nc * d0], sq2[c0 + Nc * d1], t);
553 corr_local[t] += gm_gm5_src.
value(d0) * corr_t;
565 const std::vector<Field_F>& sq1,
566 const std::vector<Field_F>& sq2)
573 typedef std::vector<dcomplex> CorrSet;
574 std::vector<CorrSet> corr_local_idx(Nt);
575 for (
int t = 0; t < Nt; ++t) {
576 corr_local_idx[t].resize(Nc * Nd * Nc * Nd);
578 for (
int t = 0; t < Nt; ++t) {
579 for (
int i_cd2 = 0; i_cd2 < Nc * Nd * Nc * Nd; ++i_cd2) {
580 corr_local_idx[t][i_cd2] = cmplx(0.0, 0.0);
584 for (
int c0 = 0; c0 < Nc; ++c0) {
585 for (
int d0 = 0; d0 < Nd; ++d0) {
586 for (
int c1 = 0; c1 < Nc; ++c1) {
587 for (
int d1 = 0; d1 < Nd; ++d1) {
588 int d51 = gm_gm5_src.
index(d1);
590 for (
int t = 0; t < Nt; ++t) {
594 sq1[c0 + Nc * d0], sq2[c1 + Nc * d51], t);
596 int i_cd2 = c0 + Nc * d0 + Nc * Nd * c1 + Nc * Nd * Nc * d51;
598 corr_local_idx[t][i_cd2] = gm_gm5_src.
value(d1) * corr_t;
606 for (
int i_cd2 = 0; i_cd2 < Nc * Nd * Nc * Nd; ++i_cd2) {
607 std::vector<dcomplex> corr_local(Nt);
608 std::vector<dcomplex> corr_global(Lt);
610 for (
int t = 0; t < Nt; ++t) {
611 corr_local[t] = corr_local_idx[t][i_cd2];
616 for (
int t_global = 0; t_global < Lt; ++t_global) {
617 corr_cross_global[t_global][i_cd2] = corr_global[t_global];
625 const std::vector<dcomplex>& corr_local)
630 assert(corr_global.size() == Lt);
631 assert(corr_local.size() == Nt);
635 std::vector<dcomplex> corr_tmp(Lt, cmplx(0.0, 0.0));
637 for (
int t = 0; t < Nt; ++t) {
638 int t_global = t + ipe_t * Nt;
639 corr_tmp[t_global] = corr_local[t];
642 for (
int t_global = 0; t_global < Lt; ++t_global) {
646 corr_global[t_global] = cmplx(cr_r, cr_i);
void detailed(const char *format,...)
void contract_at_t(dcomplex &corr, const GammaMatrix &gm_sink, const Field_F &v1, const Field_F &v2, const int time)
Contraction of hadron for 4-spinor fermion.
void general(const char *format,...)
GammaMatrix get_GM(GMspecies spec)
void corr_direct(std::vector< dcomplex > &corr_direct_global, const GammaMatrix &gm5_gm_sink, const GammaMatrix &gm_gm5_src, const std::vector< Field_F > &sq1, const std::vector< Field_F > &sq2)
totally antisymmetric tensor: index.
virtual void set_parameters(const Parameters ¶ms)
void init(const std::string &filename)
static int ipe(const int dir)
logical coordinate of current proc.
void corr_cross_sink(std::vector< std::vector< dcomplex > > &corr_cross_global, const GammaMatrix &gm5_gm_sink, const GammaMatrix &gm_gm5_src, const std::vector< Field_F > &sq1, const std::vector< Field_F > &sq2)
void meson_momentum_correlator(std::vector< dcomplex > &corr_global, const std::vector< int > &momentum_sink, const GammaMatrix &gm_sink_12, const GammaMatrix &gm_sink_34, const GammaMatrix &gm_src_21, const GammaMatrix &gm_src_43, const std::vector< Field_F > &sq1, const std::vector< Field_F > &sq2, const std::vector< Field_F > &sq3, const std::vector< Field_F > &sq4, const std::vector< int > &source_position)
double meson_momentum_all(const std::vector< Field_F > &sq1, const std::vector< Field_F > &sq2, const std::vector< Field_F > &sq3, const std::vector< Field_F > &sq4, const std::vector< int > &source_position)
GammaMatrix mult(GammaMatrix) const
static const std::string class_name
double meson_all(const std::vector< Field_F > &sq1, const std::vector< Field_F > &sq2, const std::vector< Field_F > &sq3, const std::vector< Field_F > &sq4)
std::ostream & getStream()
Bridge::VerboseLevel m_vl
static int reduce_sum(int count, double *recv_buf, double *send_buf, int pattern=0)
make a global sum of an array of double over the communicator. pattern specifies the dimensions to be...
dcomplex value(int row) const
void meson_correlator(std::vector< dcomplex > &corr_global, const GammaMatrix &gm_sink_12, const GammaMatrix &gm_sink_34, const GammaMatrix &gm_src_21, const GammaMatrix &gm_src_43, const std::vector< Field_F > &sq1, const std::vector< Field_F > &sq2, const std::vector< Field_F > &sq3, const std::vector< Field_F > &sq4)
string get_string(const string &key) const
std::string m_filename_output
static VerboseLevel set_verbose_level(const std::string &str)
void global_corr_t(std::vector< dcomplex > &corr_global, const std::vector< dcomplex > &corr_local)
transform node-local correlator in t to global.