30#include <Grid/Eigen/unsupported/CXX11/Tensor>
34template <
typename FImpl>
49 const Gamma GammaA_left,
50 const Gamma GammaB_left,
51 const Gamma GammaA_right,
52 const Gamma GammaB_right,
54 const int wick_contractions,
60 const Gamma GammaA_left,
61 const Gamma GammaB_left,
62 const Gamma GammaA_right,
63 const Gamma GammaB_right,
64 const int wick_contractions,
69 int &wick_contractions);
73 const Gamma GammaA_left,
74 const Gamma GammaB_left,
75 const Gamma GammaA_right,
76 const Gamma GammaB_right,
77 const int wick_contractions,
83 const Gamma GammaA_left,
84 const Gamma GammaB_left,
85 const Gamma GammaA_right,
86 const Gamma GammaB_right,
87 const int wick_contractions,
89 template <
class mobj,
class robj>
93 const Gamma GammaA_left,
94 const Gamma GammaB_left,
95 const Gamma GammaA_right,
96 const Gamma GammaB_right,
97 const int wick_contractions,
101 template <
class mobj,
class robj>
105 const Gamma GammaA_left,
106 const Gamma GammaB_left,
107 const Gamma GammaA_right,
108 const Gamma GammaB_right,
109 const int wick_contractions,
116 const mobj2 &Dq2_spec,
117 const mobj2 &Dq3_spec,
122 int wick_contraction,
127 const mobj2 &Dq1_spec,
129 const mobj2 &Dq3_spec,
134 int wick_contraction,
139 const mobj2 &Dq1_spec,
140 const mobj2 &Dq2_spec,
146 int wick_contraction,
149 template <
class mobj>
152 const mobj &Dq_spec1,
153 const mobj &Dq_spec2,
156 int wick_contraction,
164 const mobj2 &Du_spec,
168 const Gamma GammaB_sigma,
169 const Gamma GammaB_nucl,
174 const mobj2 &Du_spec,
178 const Gamma GammaB_sigma,
179 const Gamma GammaB_nucl,
185 const mobj2 &Du_spec,
189 const Gamma GammaB_sigma,
190 const Gamma GammaB_nucl,
195 const mobj2 &Du_spec,
199 const Gamma GammaB_sigma,
200 const Gamma GammaB_nucl,
204 const mobj2 &Dd_spec,
205 const mobj2 &Ds_spec,
209 const Gamma GammaB_sigma,
210 const Gamma GammaB_nucl,
214 const mobj2 &Dd_spec,
215 const mobj2 &Ds_spec,
219 const Gamma GammaB_sigma,
220 const Gamma GammaB_nucl,
223 template <
class mobj>
229 const Gamma GammaB_sigma,
230 const Gamma GammaB_nucl,
231 const std::string op,
233 template <
class mobj>
240 const Gamma GammaB_sigma,
241 const Gamma GammaB_nucl,
242 const std::string op,
244 template <
class mobj>
251 const Gamma GammaB_sigma,
252 const Gamma GammaB_nucl,
253 const std::string op,
257template <
class FImpl>
262 const Gamma GammaA_i,
263 const Gamma GammaB_i,
264 const Gamma GammaA_f,
265 const Gamma GammaB_f,
267 const int wick_contraction,
271 Gamma g4(Gamma::Algebra::GammaT);
273 auto D1_GAi = D1 * GammaA_i;
274 auto D1_GAi_g4 = D1_GAi * g4;
275 auto D1_GAi_P = 0.5*(D1_GAi + (
Real)parity * D1_GAi_g4);
276 auto GAf_D1_GAi_P = GammaA_f * D1_GAi_P;
277 auto GBf_D1_GAi_P = GammaB_f * D1_GAi_P;
279 auto D2_GBi = D2 * GammaB_i;
280 auto GBf_D2_GBi = GammaB_f * D2_GBi;
281 auto GAf_D2_GBi = GammaA_f * D2_GBi;
283 auto GBf_D3 = GammaB_f * D3;
284 auto GAf_D3 = GammaA_f * D3;
288 for (
int ie_f=0; ie_f < 6 ; ie_f++){
289 int a_f = (ie_f < 3 ? ie_f : (6-ie_f)%3 );
290 int b_f = (ie_f < 3 ? (ie_f+1)%3 : (8-ie_f)%3 );
291 int c_f = (ie_f < 3 ? (ie_f+2)%3 : (7-ie_f)%3 );
292 int eSgn_f = (ie_f < 3 ? 1 : -1);
293 for (
int ie_i=0; ie_i < 6 ; ie_i++){
294 int a_i = (ie_i < 3 ? ie_i : (6-ie_i)%3 );
295 int b_i = (ie_i < 3 ? (ie_i+1)%3 : (8-ie_i)%3 );
296 int c_i = (ie_i < 3 ? (ie_i+2)%3 : (7-ie_i)%3 );
297 int eSgn_i = (ie_i < 3 ? 1 : -1);
299 ee =
Real(eSgn_f * eSgn_i);
301 if (wick_contraction & 1){
302 for (
int rho=0; rho<
Ns; rho++){
303 auto GAf_D1_GAi_P_rr_cc = GAf_D1_GAi_P()(rho,rho)(c_f,c_i);
304 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
305 for (
int beta_i=0; beta_i<
Ns; beta_i++){
306 result()()() += ee * GAf_D1_GAi_P_rr_cc
307 * D2_GBi ()(alpha_f,beta_i)(a_f,a_i)
308 * GBf_D3 ()(alpha_f,beta_i)(b_f,b_i);
313 if (wick_contraction & 2){
314 for (
int rho=0; rho<
Ns; rho++){
315 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
316 auto D1_GAi_P_ar_ac = D1_GAi_P()(alpha_f,rho)(a_f,c_i);
317 for (
int beta_i=0; beta_i<
Ns; beta_i++){
318 result()()() += ee * D1_GAi_P_ar_ac
319 * GBf_D2_GBi ()(alpha_f,beta_i)(b_f,a_i)
320 * GAf_D3 ()(rho,beta_i)(c_f,b_i);
325 if (wick_contraction & 4){
326 for (
int rho=0; rho<
Ns; rho++){
327 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
328 auto GBf_D1_GAi_P_ar_bc = GBf_D1_GAi_P()(alpha_f,rho)(b_f,c_i);
329 for (
int beta_i=0; beta_i<
Ns; beta_i++){
330 result()()() += ee * GBf_D1_GAi_P_ar_bc
331 * GAf_D2_GBi ()(rho,beta_i)(c_f,a_i)
332 * D3 ()(alpha_f,beta_i)(a_f,b_i);
337 if (wick_contraction & 8){
338 for (
int rho=0; rho<
Ns; rho++){
339 auto GAf_D1_GAi_P_rr_cc = GAf_D1_GAi_P()(rho,rho)(c_f,c_i);
340 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
341 for (
int beta_i=0; beta_i<
Ns; beta_i++){
342 result()()() -= ee * GAf_D1_GAi_P_rr_cc
343 * GBf_D2_GBi ()(alpha_f,beta_i)(b_f,a_i)
344 * D3 ()(alpha_f,beta_i)(a_f,b_i);
349 if (wick_contraction & 16){
350 for (
int rho=0; rho<
Ns; rho++){
351 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
352 auto GBf_D1_GAi_P_ar_bc = GBf_D1_GAi_P()(alpha_f,rho)(b_f,c_i);
353 for (
int beta_i=0; beta_i<
Ns; beta_i++){
354 result()()() -= ee * GBf_D1_GAi_P_ar_bc
355 * D2_GBi ()(alpha_f,beta_i)(a_f,a_i)
356 * GAf_D3 ()(rho,beta_i)(c_f,b_i);
361 if (wick_contraction & 32){
362 for (
int rho=0; rho<
Ns; rho++){
363 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
364 auto D1_GAi_P_ar_ac = D1_GAi_P()(alpha_f,rho)(a_f,c_i);
365 for (
int beta_i=0; beta_i<
Ns; beta_i++){
366 result()()() -= ee * D1_GAi_P_ar_ac
367 * GAf_D2_GBi ()(rho,beta_i)(c_f,a_i)
368 * GBf_D3 ()(alpha_f,beta_i)(b_f,b_i);
377template <
class FImpl>
382 const Gamma GammaA_i,
383 const Gamma GammaB_i,
384 const Gamma GammaA_f,
385 const Gamma GammaB_f,
386 const int wick_contraction,
390 auto D1_GAi = D1 * GammaA_i;
391 auto GAf_D1_GAi = GammaA_f * D1_GAi;
392 auto GBf_D1_GAi = GammaB_f * D1_GAi;
394 auto D2_GBi = D2 * GammaB_i;
395 auto GBf_D2_GBi = GammaB_f * D2_GBi;
396 auto GAf_D2_GBi = GammaA_f * D2_GBi;
398 auto GBf_D3 = GammaB_f * D3;
399 auto GAf_D3 = GammaA_f * D3;
403 for (
int ie_f=0; ie_f < 6 ; ie_f++){
404 int a_f = (ie_f < 3 ? ie_f : (6-ie_f)%3 );
405 int b_f = (ie_f < 3 ? (ie_f+1)%3 : (8-ie_f)%3 );
406 int c_f = (ie_f < 3 ? (ie_f+2)%3 : (7-ie_f)%3 );
407 int eSgn_f = (ie_f < 3 ? 1 : -1);
408 for (
int ie_i=0; ie_i < 6 ; ie_i++){
409 int a_i = (ie_i < 3 ? ie_i : (6-ie_i)%3 );
410 int b_i = (ie_i < 3 ? (ie_i+1)%3 : (8-ie_i)%3 );
411 int c_i = (ie_i < 3 ? (ie_i+2)%3 : (7-ie_i)%3 );
412 int eSgn_i = (ie_i < 3 ? 1 : -1);
414 ee =
Real(eSgn_f * eSgn_i);
416 if (wick_contraction & 1){
417 for (
int rho_i=0; rho_i<
Ns; rho_i++){
418 for (
int rho_f=0; rho_f<
Ns; rho_f++){
419 auto GAf_D1_GAi_rr_cc = GAf_D1_GAi()(rho_f,rho_i)(c_f,c_i);
420 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
421 for (
int beta_i=0; beta_i<
Ns; beta_i++){
422 result()(rho_f,rho_i)() += ee * GAf_D1_GAi_rr_cc
423 * D2_GBi ()(alpha_f,beta_i)(a_f,a_i)
424 * GBf_D3 ()(alpha_f,beta_i)(b_f,b_i);
429 if (wick_contraction & 2){
430 for (
int rho_i=0; rho_i<
Ns; rho_i++){
431 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
432 auto D1_GAi_ar_ac = D1_GAi()(alpha_f,rho_i)(a_f,c_i);
433 for (
int beta_i=0; beta_i<
Ns; beta_i++){
434 auto GBf_D2_GBi_ab_ba = GBf_D2_GBi ()(alpha_f,beta_i)(b_f,a_i);
435 for (
int rho_f=0; rho_f<
Ns; rho_f++){
436 result()(rho_f,rho_i)() += ee * D1_GAi_ar_ac
438 * GAf_D3 ()(rho_f,beta_i)(c_f,b_i);
444 if (wick_contraction & 4){
445 for (
int rho_i=0; rho_i<
Ns; rho_i++){
446 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
447 auto GBf_D1_GAi_ar_bc = GBf_D1_GAi()(alpha_f,rho_i)(b_f,c_i);
448 for (
int beta_i=0; beta_i<
Ns; beta_i++){
449 auto D3_ab_ab = D3 ()(alpha_f,beta_i)(a_f,b_i);
450 for (
int rho_f=0; rho_f<
Ns; rho_f++){
451 result()(rho_f,rho_i)() += ee * GBf_D1_GAi_ar_bc
452 * GAf_D2_GBi ()(rho_f,beta_i)(c_f,a_i)
459 if (wick_contraction & 8){
460 for (
int rho_i=0; rho_i<
Ns; rho_i++){
461 for (
int rho_f=0; rho_f<
Ns; rho_f++){
462 auto GAf_D1_GAi_rr_cc = GAf_D1_GAi()(rho_f,rho_i)(c_f,c_i);
463 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
464 for (
int beta_i=0; beta_i<
Ns; beta_i++){
465 result()(rho_f,rho_i)() -= ee * GAf_D1_GAi_rr_cc
466 * GBf_D2_GBi ()(alpha_f,beta_i)(b_f,a_i)
467 * D3 ()(alpha_f,beta_i)(a_f,b_i);
472 if (wick_contraction & 16){
473 for (
int rho_i=0; rho_i<
Ns; rho_i++){
474 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
475 auto GBf_D1_GAi_ar_bc = GBf_D1_GAi()(alpha_f,rho_i)(b_f,c_i);
476 for (
int beta_i=0; beta_i<
Ns; beta_i++){
477 auto D2_GBi_ab_aa = D2_GBi()(alpha_f,beta_i)(a_f,a_i);
478 for (
int rho_f=0; rho_f<
Ns; rho_f++){
479 result()(rho_f,rho_i)() -= ee * GBf_D1_GAi_ar_bc
481 * GAf_D3 ()(rho_f,beta_i)(c_f,b_i);
487 if (wick_contraction & 32){
488 for (
int rho_i=0; rho_i<
Ns; rho_i++){
489 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
490 auto D1_GAi_ar_ac = D1_GAi()(alpha_f,rho_i)(a_f,c_i);
491 for (
int beta_i=0; beta_i<
Ns; beta_i++){
492 auto GBf_D3_ab_bb = GBf_D3()(alpha_f,beta_i)(b_f,b_i);
493 for (
int rho_f=0; rho_f<
Ns; rho_f++){
494 result()(rho_f,rho_i)() -= ee * D1_GAi_ar_ac
495 * GAf_D2_GBi ()(rho_f,beta_i)(c_f,a_i)
511 assert(qi.size() == 3 && qf.size() == 3 &&
"Only sets of 3 quarks accepted.");
512 const int epsilon[6][3] = {{0,1,2},{1,2,0},{2,0,1},{0,2,1},{2,1,0},{1,0,2}};
514 for (
int ie=0; ie < 6 ; ie++) {
515 wick_contractions += ( ( qi[0] == qf[epsilon[ie][0]]
516 && qi[1] == qf[epsilon[ie][1]]
517 && qi[2] == qf[epsilon[ie][2]]) ? 1 : 0) << ie;
530 const Gamma GammaA_left,
531 const Gamma GammaB_left,
532 const Gamma GammaA_right,
533 const Gamma GammaB_right,
534 const int wick_contractions,
539 assert(
Ns==4 &&
"Baryon code only implemented for N_spin = 4");
540 assert(
Nc==3 &&
"Baryon code only implemented for N_colour = 3");
542 assert(parity==1 || parity == -1 &&
"Parity must be +1 or -1");
552 bytes += grid->
oSites() * (432.*
sizeof(
vComplex) + 126.*
sizeof(int) + 36.*
sizeof(
Real));
553 for (
int ie=0; ie < 6 ; ie++){
555 bytes += ( wick_contractions & (1 << ie) ) ? grid->
oSites() * (4.*
sizeof(int) + 4752.*
sizeof(
vComplex)) : 0.;
557 bytes += ( wick_contractions & (1 << ie) ) ? grid->
oSites() * (64.*
sizeof(int) + 5184.*
sizeof(
vComplex)) : 0.;
567 typedef decltype(coalescedRead(vbaryon_corr[0])) cVec;
569 BaryonSite(D1,D2,D3,GammaA_left,GammaB_left,GammaA_right,GammaB_right,parity,wick_contractions,result);
570 coalescedWrite(vbaryon_corr[ss],result);
575 std::cout <<
GridLogDebug << std::setw(10) << bytes/t*1.0e6/1024/1024/1024 <<
" GB/s " << std::endl;
582 const Gamma GammaA_left,
583 const Gamma GammaB_left,
584 const Gamma GammaA_right,
585 const Gamma GammaB_right,
586 const int wick_contractions,
590 assert(
Ns==4 &&
"Baryon code only implemented for N_spin = 4");
591 assert(
Nc==3 &&
"Baryon code only implemented for N_colour = 3");
604 typedef decltype(coalescedRead(vbaryon_corr[0])) spinor;
605 spinor result=Zero();
606 BaryonSiteMatrix(D1,D2,D3,GammaA_left,GammaB_left,GammaA_right,GammaB_right,wick_contractions,result);
607 coalescedWrite(vbaryon_corr[ss],result);
616template <
class FImpl>
617template <
class mobj,
class robj>
621 const Gamma GammaA_left,
622 const Gamma GammaB_left,
623 const Gamma GammaA_right,
624 const Gamma GammaB_right,
625 const int wick_contractions,
631 assert(
Ns==4 &&
"Baryon code only implemented for N_spin = 4");
632 assert(
Nc==3 &&
"Baryon code only implemented for N_colour = 3");
634 assert(parity==1 || parity == -1 &&
"Parity must be +1 or -1");
636 for (
int t=0; t<nt; t++) {
637 BaryonSite(D1[t],D2[t],D3[t],GammaA_left,GammaB_left,GammaA_right,GammaB_right,parity,wick_contractions,result[t]);
641template <
class FImpl>
642template <
class mobj,
class robj>
646 const Gamma GammaA_left,
647 const Gamma GammaB_left,
648 const Gamma GammaA_right,
649 const Gamma GammaB_right,
650 const int wick_contractions,
655 assert(
Ns==4 &&
"Baryon code only implemented for N_spin = 4");
656 assert(
Nc==3 &&
"Baryon code only implemented for N_colour = 3");
658 for (
int t=0; t<nt; t++) {
659 BaryonSiteMatrix(D1[t],D2[t],D3[t],GammaA_left,GammaB_left,GammaA_right,GammaB_right,wick_contractions,result[t]);
677 const mobj2 &Dq2_spec,
678 const mobj2 &Dq3_spec,
683 int wick_contraction,
686 Gamma g5(Gamma::Algebra::Gamma5);
688 auto adjD4 = g5 *
adj(Dq4_tf) * g5 ;
689 auto adjD4_g_D1 = adjD4 * GammaJ * Dq1_ti;
690 auto Gf_adjD4_g_D1 = GammaBf * adjD4_g_D1;
691 auto D2_Gi = Dq2_spec * GammaBi;
692 auto Gf_D2_Gi = GammaBf * D2_Gi;
693 auto Gf_D3 = GammaBf * Dq3_spec;
697 for (
int ie_f=0; ie_f < 6 ; ie_f++){
698 int a_f = (ie_f < 3 ? ie_f : (6-ie_f)%3 );
699 int b_f = (ie_f < 3 ? (ie_f+1)%3 : (8-ie_f)%3 );
700 int c_f = (ie_f < 3 ? (ie_f+2)%3 : (7-ie_f)%3 );
701 int eSgn_f = (ie_f < 3 ? 1 : -1);
702 for (
int ie_i=0; ie_i < 6 ; ie_i++){
703 int a_i = (ie_i < 3 ? ie_i : (6-ie_i)%3 );
704 int b_i = (ie_i < 3 ? (ie_i+1)%3 : (8-ie_i)%3 );
705 int c_i = (ie_i < 3 ? (ie_i+2)%3 : (7-ie_i)%3 );
706 int eSgn_i = (ie_i < 3 ? 1 : -1);
708 ee =
Real(eSgn_f * eSgn_i);
710 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
711 for (
int beta_i=0; beta_i<
Ns; beta_i++){
712 auto D2_Gi_ab_aa = D2_Gi ()(alpha_f,beta_i)(a_f,a_i);
713 auto Gf_D3_ab_bb = Gf_D3 ()(alpha_f,beta_i)(b_f,b_i);
714 auto Gf_D2_Gi_ab_ba = Gf_D2_Gi ()(alpha_f,beta_i)(b_f,a_i);
715 auto Dq3_spec_ab_ab = Dq3_spec ()(alpha_f,beta_i)(a_f,b_i);
717 for (
int gamma_i=0; gamma_i<
Ns; gamma_i++){
718 auto ee_adjD4_g_D1_ag_ac = ee * adjD4_g_D1 ()(alpha_f,gamma_i)(a_f,c_i);
719 auto ee_Gf_adjD4_g_D1_ag_bc = ee * Gf_adjD4_g_D1()(alpha_f,gamma_i)(b_f,c_i);
720 for (
int gamma_f=0; gamma_f<
Ns; gamma_f++){
721 auto ee_adjD4_g_D1_gg_cc = ee * adjD4_g_D1 ()(gamma_f,gamma_i)(c_f,c_i);
722 auto Dq3_spec_gb_cb = Dq3_spec ()(gamma_f,beta_i)(c_f,b_i);
723 auto D2_Gi_gb_ca = D2_Gi ()(gamma_f,beta_i)(c_f,a_i);
726 if(wick_contraction == 1) {
727 result()(gamma_f,gamma_i)() -= ee_adjD4_g_D1_gg_cc
731 if(wick_contraction == 2) {
732 result()(gamma_f,gamma_i)() -= ee_adjD4_g_D1_ag_ac
736 if(wick_contraction == 3) {
737 result()(gamma_f,gamma_i)() -= ee_Gf_adjD4_g_D1_ag_bc
741 if(wick_contraction == 4) {
742 result()(gamma_f,gamma_i)() += ee_adjD4_g_D1_gg_cc
746 if(wick_contraction == 5) {
747 result()(gamma_f,gamma_i)() += ee_Gf_adjD4_g_D1_ag_bc
751 if(wick_contraction == 6) {
752 result()(gamma_f,gamma_i)() += ee_adjD4_g_D1_ag_ac
770 const mobj2 &Dq1_spec,
772 const mobj2 &Dq3_spec,
777 int wick_contraction,
780 Gamma g5(Gamma::Algebra::Gamma5);
782 auto adjD4_g_D2_Gi = g5 *
adj(Dq4_tf) * g5 * GammaJ * Dq2_ti * GammaBi;
783 auto Gf_adjD4_g_D2_Gi = GammaBf * adjD4_g_D2_Gi;
784 auto Gf_D1 = GammaBf * Dq1_spec;
785 auto Gf_D3 = GammaBf * Dq3_spec;
789 for (
int ie_f=0; ie_f < 6 ; ie_f++){
790 int a_f = (ie_f < 3 ? ie_f : (6-ie_f)%3 );
791 int b_f = (ie_f < 3 ? (ie_f+1)%3 : (8-ie_f)%3 );
792 int c_f = (ie_f < 3 ? (ie_f+2)%3 : (7-ie_f)%3 );
793 int eSgn_f = (ie_f < 3 ? 1 : -1);
794 for (
int ie_i=0; ie_i < 6 ; ie_i++){
795 int a_i = (ie_i < 3 ? ie_i : (6-ie_i)%3 );
796 int b_i = (ie_i < 3 ? (ie_i+1)%3 : (8-ie_i)%3 );
797 int c_i = (ie_i < 3 ? (ie_i+2)%3 : (7-ie_i)%3 );
798 int eSgn_i = (ie_i < 3 ? 1 : -1);
800 ee =
Real(eSgn_f * eSgn_i);
802 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
803 for (
int beta_i=0; beta_i<
Ns; beta_i++){
804 auto adjD4_g_D2_Gi_ab_aa = adjD4_g_D2_Gi ()(alpha_f,beta_i)(a_f,a_i);
805 auto Gf_D3_ab_bb = Gf_D3 ()(alpha_f,beta_i)(b_f,b_i);
806 auto Gf_adjD4_g_D2_Gi_ab_ba = Gf_adjD4_g_D2_Gi ()(alpha_f,beta_i)(b_f,a_i);
807 auto Dq3_spec_ab_ab = Dq3_spec ()(alpha_f,beta_i)(a_f,b_i);
809 for (
int gamma_i=0; gamma_i<
Ns; gamma_i++){
810 auto ee_Dq1_spec_ag_ac = ee * Dq1_spec ()(alpha_f,gamma_i)(a_f,c_i);
811 auto ee_Gf_D1_ag_bc = ee * Gf_D1 ()(alpha_f,gamma_i)(b_f,c_i);
812 for (
int gamma_f=0; gamma_f<
Ns; gamma_f++){
813 auto ee_Dq1_spec_gg_cc = ee * Dq1_spec ()(gamma_f,gamma_i)(c_f,c_i);
814 auto Dq3_spec_gb_cb = Dq3_spec ()(gamma_f,beta_i)(c_f,b_i);
815 auto adjD4_g_D2_Gi_gb_ca = adjD4_g_D2_Gi ()(gamma_f,beta_i)(c_f,a_i);
817 if(wick_contraction == 1) {
818 result()(gamma_f,gamma_i)() -= ee_Dq1_spec_gg_cc
819 * adjD4_g_D2_Gi_ab_aa
822 if(wick_contraction == 2) {
823 result()(gamma_f,gamma_i)() -= ee_Dq1_spec_ag_ac
824 * Gf_adjD4_g_D2_Gi_ab_ba
827 if(wick_contraction == 3) {
828 result()(gamma_f,gamma_i)() -= ee_Gf_D1_ag_bc
829 * adjD4_g_D2_Gi_gb_ca
832 if(wick_contraction == 4) {
833 result()(gamma_f,gamma_i)() += ee_Dq1_spec_gg_cc
834 * Gf_adjD4_g_D2_Gi_ab_ba
837 if(wick_contraction == 5) {
838 result()(gamma_f,gamma_i)() += ee_Gf_D1_ag_bc
839 * adjD4_g_D2_Gi_ab_aa
842 if(wick_contraction == 6) {
843 result()(gamma_f,gamma_i)() += ee_Dq1_spec_ag_ac
844 * adjD4_g_D2_Gi_gb_ca
861 const mobj2 &Dq1_spec,
862 const mobj2 &Dq2_spec,
868 int wick_contraction,
871 Gamma g5(Gamma::Algebra::Gamma5);
873 auto adjD4_g_D3 = g5 *
adj(Dq4_tf) * g5 * GammaJ * Dq3_ti;
874 auto Gf_adjD4_g_D3 = GammaBf * adjD4_g_D3;
875 auto Gf_D1 = GammaBf * Dq1_spec;
876 auto D2_Gi = Dq2_spec * GammaBi;
877 auto Gf_D2_Gi = GammaBf * D2_Gi;
881 for (
int ie_f=0; ie_f < 6 ; ie_f++){
882 int a_f = (ie_f < 3 ? ie_f : (6-ie_f)%3 );
883 int b_f = (ie_f < 3 ? (ie_f+1)%3 : (8-ie_f)%3 );
884 int c_f = (ie_f < 3 ? (ie_f+2)%3 : (7-ie_f)%3 );
885 int eSgn_f = (ie_f < 3 ? 1 : -1);
886 for (
int ie_i=0; ie_i < 6 ; ie_i++){
887 int a_i = (ie_i < 3 ? ie_i : (6-ie_i)%3 );
888 int b_i = (ie_i < 3 ? (ie_i+1)%3 : (8-ie_i)%3 );
889 int c_i = (ie_i < 3 ? (ie_i+2)%3 : (7-ie_i)%3 );
890 int eSgn_i = (ie_i < 3 ? 1 : -1);
892 ee =
Real(eSgn_f * eSgn_i);
894 for (
int alpha_f=0; alpha_f<
Ns; alpha_f++){
895 for (
int beta_i=0; beta_i<
Ns; beta_i++){
896 auto D2_Gi_ab_aa = D2_Gi ()(alpha_f,beta_i)(a_f,a_i);
897 auto Gf_adjD4_g_D3_ab_bb = Gf_adjD4_g_D3 ()(alpha_f,beta_i)(b_f,b_i);
898 auto Gf_D2_Gi_ab_ba = Gf_D2_Gi ()(alpha_f,beta_i)(b_f,a_i);
899 auto adjD4_g_D3_ab_ab = adjD4_g_D3 ()(alpha_f,beta_i)(a_f,b_i);
901 for (
int gamma_i=0; gamma_i<
Ns; gamma_i++) {
902 auto ee_Dq1_spec_ag_ac = ee * Dq1_spec ()(alpha_f,gamma_i)(a_f,c_i);
903 auto ee_Gf_D1_ag_bc = ee * Gf_D1 ()(alpha_f,gamma_i)(b_f,c_i);
904 for (
int gamma_f=0; gamma_f<
Ns; gamma_f++) {
905 auto ee_Dq1_spec_gg_cc = ee * Dq1_spec ()(gamma_f,gamma_i)(c_f,c_i);
906 auto adjD4_g_D3_gb_cb = adjD4_g_D3 ()(gamma_f,beta_i)(c_f,b_i);
907 auto D2_Gi_gb_ca = D2_Gi ()(gamma_f,beta_i)(c_f,a_i);
909 if(wick_contraction == 1) {
910 result()(gamma_f,gamma_i)() -= ee_Dq1_spec_gg_cc
912 * Gf_adjD4_g_D3_ab_bb;
914 if(wick_contraction == 2) {
915 result()(gamma_f,gamma_i)() -= ee_Dq1_spec_ag_ac
919 if(wick_contraction == 3) {
920 result()(gamma_f,gamma_i)() -= ee_Gf_D1_ag_bc
924 if(wick_contraction == 4) {
925 result()(gamma_f,gamma_i)() += ee_Dq1_spec_gg_cc
929 if(wick_contraction == 5) {
930 result()(gamma_f,gamma_i)() += ee_Gf_D1_ag_bc
934 if(wick_contraction == 6) {
935 result()(gamma_f,gamma_i)() += ee_Dq1_spec_ag_ac
937 * Gf_adjD4_g_D3_ab_bb;
955 const mobj &Dq_spec1,
956 const mobj &Dq_spec2,
959 int wick_contraction,
965 assert(
Ns==4 &&
"Baryon code only implemented for N_spin = 4");
966 assert(
Nc==3 &&
"Baryon code only implemented for N_colour = 3");
977 mobj * Dq_spec_p = &my_Dq_spec[0];
981 auto Dq_ti = vq_ti(ss);
982 auto Dq_tf = vq_tf(ss);
983 typedef decltype(coalescedRead(vcorr[0])) spinor;
984 spinor result=Zero();
985 BaryonGamma3ptGroup1Site(Dq_ti,Dq_spec_p[0],Dq_spec_p[1],Dq_tf,GammaJ,GammaBi,GammaBf,wick_contraction,result);
986 coalescedWrite(vcorr[ss],coalescedRead(vcorr[ss])+result);
988 }
else if (group == 2) {
990 auto Dq_ti = vq_ti(ss);
991 auto Dq_tf = vq_tf(ss);
992 typedef decltype(coalescedRead(vcorr[0])) spinor;
993 spinor result=Zero();
994 BaryonGamma3ptGroup2Site(Dq_spec_p[0],Dq_ti,Dq_spec_p[1],Dq_tf,GammaJ,GammaBi,GammaBf,wick_contraction,result);
995 coalescedWrite(vcorr[ss],coalescedRead(vcorr[ss])+result);
997 }
else if (group == 3) {
999 auto Dq_ti = vq_ti(ss);
1000 auto Dq_tf = vq_tf(ss);
1001 typedef decltype(coalescedRead(vcorr[0])) spinor;
1002 spinor result=Zero();
1003 BaryonGamma3ptGroup3Site(Dq_spec_p[0],Dq_spec_p[1],Dq_ti,Dq_tf,GammaJ,GammaBi,GammaBf,wick_contraction,result);
1004 coalescedWrite(vcorr[ss],coalescedRead(vcorr[ss])+result);
1021template <
class FImpl>
1024 const mobj2 &Du_spec,
1027 const Gamma Gamma_H,
1028 const Gamma GammaB_sigma,
1029 const Gamma GammaB_nucl,
1033 Gamma g5(Gamma::Algebra::Gamma5);
1035 auto adjDd_GH_Ds = g5 *
adj(Dd_tf) * g5 * Gamma_H * Ds_ti;
1036 auto Gn_adjDd_GH_Ds = GammaB_nucl * adjDd_GH_Ds;
1037 auto Du_Gs = Du_spec * GammaB_sigma;
1038 auto Dq_GH = Dq_loop * Gamma_H;
1039 auto Tr_Dq_GH =
trace(Dq_GH)()()();
1043 for (
int ie_n=0; ie_n < 6 ; ie_n++){
1044 int a_n = (ie_n < 3 ? ie_n : (6-ie_n)%3 );
1045 int b_n = (ie_n < 3 ? (ie_n+1)%3 : (8-ie_n)%3 );
1046 int c_n = (ie_n < 3 ? (ie_n+2)%3 : (7-ie_n)%3 );
1047 int eSgn_n = (ie_n < 3 ? 1 : -1);
1048 for (
int ie_s=0; ie_s < 6 ; ie_s++){
1049 int a_s = (ie_s < 3 ? ie_s : (6-ie_s)%3 );
1050 int b_s = (ie_s < 3 ? (ie_s+1)%3 : (8-ie_s)%3 );
1051 int c_s = (ie_s < 3 ? (ie_s+2)%3 : (7-ie_s)%3 );
1052 int eSgn_s = (ie_s < 3 ? 1 : -1);
1054 ee =
Real(eSgn_n * eSgn_s);
1055 for (
int alpha_n=0; alpha_n<
Ns; alpha_n++){
1056 for (
int beta_s=0; beta_s<
Ns; beta_s++){
1058 auto Gn_adjDd_GH_Ds_ab_bb = Gn_adjDd_GH_Ds ()(alpha_n, beta_s)(b_n,b_s);
1060 for (
int gamma_s=0; gamma_s<
Ns; gamma_s++){
1061 for (
int gamma_n=0; gamma_n<
Ns; gamma_n++){
1062 result()(gamma_n,gamma_s)() += ee * Gn_adjDd_GH_Ds_ab_bb
1063 * Du_spec ()(gamma_n,gamma_s)(c_n,c_s)
1064 * Du_Gs ()(alpha_n, beta_s)(a_n,a_s)
1067 result()(gamma_n,gamma_s)() -= ee * Gn_adjDd_GH_Ds_ab_bb
1068 * Du_spec ()(alpha_n,gamma_s)(a_n,c_s)
1069 * Du_Gs ()(gamma_n, beta_s)(c_n,a_s)
1082template <
class FImpl>
1086 const mobj2 &Du_spec,
1089 const Gamma Gamma_H,
1090 const Gamma GammaB_sigma,
1091 const Gamma GammaB_nucl,
1095 Gamma g5(Gamma::Algebra::Gamma5);
1097 auto Du_Gs = Du_spec * GammaB_sigma;
1098 auto adjDd_GH_Ds = g5 *
adj(Dd_tf) * g5 * Gamma_H * Ds_ti;
1099 auto Gn_adjDd_GH_Ds = GammaB_nucl * adjDd_GH_Ds;
1100 auto adjDu_GH_Du = g5 *
adj(Du_tf) * g5 * Gamma_H * Du_ti;
1101 auto adjDu_GH_Du_Gs = adjDu_GH_Du * GammaB_sigma;
1105 for (
int ie_n=0; ie_n < 6 ; ie_n++){
1106 int a_n = (ie_n < 3 ? ie_n : (6-ie_n)%3 );
1107 int b_n = (ie_n < 3 ? (ie_n+1)%3 : (8-ie_n)%3 );
1108 int c_n = (ie_n < 3 ? (ie_n+2)%3 : (7-ie_n)%3 );
1109 int eSgn_n = (ie_n < 3 ? 1 : -1);
1110 for (
int ie_s=0; ie_s < 6 ; ie_s++){
1111 int a_s = (ie_s < 3 ? ie_s : (6-ie_s)%3 );
1112 int b_s = (ie_s < 3 ? (ie_s+1)%3 : (8-ie_s)%3 );
1113 int c_s = (ie_s < 3 ? (ie_s+2)%3 : (7-ie_s)%3 );
1114 int eSgn_s = (ie_s < 3 ? 1 : -1);
1116 ee =
Real(eSgn_n * eSgn_s);
1118 for (
int alpha_n=0; alpha_n<
Ns; alpha_n++){
1119 for (
int beta_s=0; beta_s<
Ns; beta_s++){
1121 auto Gn_adjDd_GH_Ds_ab_bb = Gn_adjDd_GH_Ds ()(alpha_n, beta_s)(b_n,b_s);
1123 for (
int gamma_s=0; gamma_s<
Ns; gamma_s++){
1124 for (
int gamma_n=0; gamma_n<
Ns; gamma_n++){
1126 result()(gamma_n,gamma_s)() += ee * Gn_adjDd_GH_Ds_ab_bb
1127 * adjDu_GH_Du ()(alpha_n,gamma_s)(a_n,c_s)
1128 * Du_Gs ()(gamma_n, beta_s)(c_n,a_s);
1130 result()(gamma_n,gamma_s)() += ee * Gn_adjDd_GH_Ds_ab_bb
1131 * adjDu_GH_Du_Gs ()(gamma_n, beta_s)(c_n,a_s)
1132 * Du_spec ()(alpha_n,gamma_s)(a_n,c_s);
1134 result()(gamma_n,gamma_s)() -= ee * Gn_adjDd_GH_Ds_ab_bb
1135 * adjDu_GH_Du_Gs ()(alpha_n, beta_s)(a_n,a_s)
1136 * Du_spec ()(gamma_n,gamma_s)(c_n,c_s);
1138 result()(gamma_n,gamma_s)() -= ee * Gn_adjDd_GH_Ds_ab_bb
1139 * adjDu_GH_Du ()(gamma_n,gamma_s)(c_n,c_s)
1140 * Du_Gs ()(alpha_n, beta_s)(a_n,a_s);
1152template <
class FImpl>
1155 const mobj2 &Du_spec,
1158 const Gamma Gamma_H,
1159 const Gamma GammaB_sigma,
1160 const Gamma GammaB_nucl,
1164 Gamma g5(Gamma::Algebra::Gamma5);
1166 auto adjDd_GH_Duloop_GH_Ds = g5 *
adj(Dd_tf) * g5 * Gamma_H * Dq_loop * Gamma_H * Ds_ti;
1167 auto Gn_adjDd_GH_Duloop_GH_Ds = GammaB_nucl * adjDd_GH_Duloop_GH_Ds;
1168 auto Du_Gs = Du_spec * GammaB_sigma;
1172 for (
int ie_n=0; ie_n < 6 ; ie_n++){
1173 int a_n = (ie_n < 3 ? ie_n : (6-ie_n)%3 );
1174 int b_n = (ie_n < 3 ? (ie_n+1)%3 : (8-ie_n)%3 );
1175 int c_n = (ie_n < 3 ? (ie_n+2)%3 : (7-ie_n)%3 );
1176 int eSgn_n = (ie_n < 3 ? 1 : -1);
1177 for (
int ie_s=0; ie_s < 6 ; ie_s++){
1178 int a_s = (ie_s < 3 ? ie_s : (6-ie_s)%3 );
1179 int b_s = (ie_s < 3 ? (ie_s+1)%3 : (8-ie_s)%3 );
1180 int c_s = (ie_s < 3 ? (ie_s+2)%3 : (7-ie_s)%3 );
1181 int eSgn_s = (ie_s < 3 ? 1 : -1);
1183 ee =
Real(eSgn_n * eSgn_s);
1185 for (
int alpha_n=0; alpha_n<
Ns; alpha_n++){
1186 for (
int beta_s=0; beta_s<
Ns; beta_s++){
1188 auto Gn_adjDd_GH_Duloop_GH_Ds_ab_bb = Gn_adjDd_GH_Duloop_GH_Ds ()(alpha_n,beta_s)(b_n,b_s);
1190 for (
int gamma_s=0; gamma_s<
Ns; gamma_s++){
1191 for (
int gamma_n=0; gamma_n<
Ns; gamma_n++){
1193 result()(gamma_n,gamma_s)() -= ee * Du_spec ()(gamma_n,gamma_s)(c_n,c_s)
1194 * Du_Gs ()(alpha_n,beta_s)(a_n,a_s)
1195 * Gn_adjDd_GH_Duloop_GH_Ds_ab_bb;
1197 result()(gamma_n,gamma_s)() += ee * Du_Gs ()(alpha_n,gamma_s)(a_n,c_s)
1198 * Du_spec ()(gamma_n,beta_s)(c_n,a_s)
1199 * Gn_adjDd_GH_Duloop_GH_Ds_ab_bb;
1211template <
class FImpl>
1215 const mobj2 &Du_spec,
1218 const Gamma Gamma_H,
1219 const Gamma GammaB_sigma,
1220 const Gamma GammaB_nucl,
1224 Gamma g5(Gamma::Algebra::Gamma5);
1226 auto Du_Gs = Du_spec * GammaB_sigma;
1227 auto adjDu_GH_Ds = g5 *
adj(Du_tf) * g5 * Gamma_H * Ds_ti;
1228 auto adjDd_GH_Du = g5 *
adj(Dd_tf) * g5 * Gamma_H * Du_ti;
1229 auto Gn_adjDd_GH_Du = GammaB_nucl * adjDd_GH_Du;
1231 auto Gn_adjDd_GH_Du_Gs = Gn_adjDd_GH_Du * GammaB_sigma;
1235 for (
int ie_n=0; ie_n < 6 ; ie_n++){
1236 int a_n = (ie_n < 3 ? ie_n : (6-ie_n)%3 );
1237 int b_n = (ie_n < 3 ? (ie_n+1)%3 : (8-ie_n)%3 );
1238 int c_n = (ie_n < 3 ? (ie_n+2)%3 : (7-ie_n)%3 );
1239 int eSgn_n = (ie_n < 3 ? 1 : -1);
1240 for (
int ie_s=0; ie_s < 6 ; ie_s++){
1241 int a_s = (ie_s < 3 ? ie_s : (6-ie_s)%3 );
1242 int b_s = (ie_s < 3 ? (ie_s+1)%3 : (8-ie_s)%3 );
1243 int c_s = (ie_s < 3 ? (ie_s+2)%3 : (7-ie_s)%3 );
1244 int eSgn_s = (ie_s < 3 ? 1 : -1);
1246 ee =
Real(eSgn_n * eSgn_s);
1248 for (
int alpha_n=0; alpha_n<
Ns; alpha_n++){
1249 for (
int beta_s=0; beta_s<
Ns; beta_s++){
1251 auto adjDu_GH_Ds_ab_ab = adjDu_GH_Ds()(alpha_n, beta_s)(a_n,b_s);
1252 auto Gn_adjDd_GH_Du_Gs_ab_ba = Gn_adjDd_GH_Du_Gs()(alpha_n, beta_s)(b_n,a_s);
1254 for (
int gamma_s=0; gamma_s<
Ns; gamma_s++){
1255 auto Gn_adjDd_GH_Du_ag_bc = Gn_adjDd_GH_Du()(alpha_n,gamma_s)(b_n,c_s);
1256 for (
int gamma_n=0; gamma_n<
Ns; gamma_n++){
1257 auto adjDu_GH_Ds_gb_cb = adjDu_GH_Ds()(gamma_n, beta_s)(c_n,b_s);
1259 result()(gamma_n,gamma_s)() += ee * adjDu_GH_Ds_ab_ab
1260 * Gn_adjDd_GH_Du_Gs_ab_ba
1261 * Du_spec()(gamma_n,gamma_s)(c_n,c_s);
1263 result()(gamma_n,gamma_s)() -= ee * adjDu_GH_Ds_gb_cb
1264 * Gn_adjDd_GH_Du_Gs_ab_ba
1265 * Du_spec()(alpha_n,gamma_s)(a_n,c_s);
1267 result()(gamma_n,gamma_s)() += ee * adjDu_GH_Ds_gb_cb
1268 * Gn_adjDd_GH_Du_ag_bc
1269 * Du_Gs()(alpha_n, beta_s)(a_n,a_s);
1271 result()(gamma_n,gamma_s)() -= ee * adjDu_GH_Ds_ab_ab
1272 * Gn_adjDd_GH_Du_ag_bc
1273 * Du_Gs()(gamma_n, beta_s)(c_n,a_s);
1282template<
class FImpl>
1283template <
class mobj>
1285 const mobj &Du_spec,
1288 const Gamma Gamma_H,
1289 const Gamma GammaB_sigma,
1290 const Gamma GammaB_nucl,
1291 const std::string op,
1295 assert(
Ns==4 &&
"Baryon code only implemented for N_spin = 4");
1296 assert(
Nc==3 &&
"Baryon code only implemented for N_colour = 3");
1307 mobj * Dq_spec_p = &my_Dq_spec[0];
1311 auto Dq_loop = vq_loop(ss);
1312 auto Dd_tf = vd_tf(ss);
1313 auto Ds_ti = vs_ti(ss);
1314 typedef decltype(coalescedRead(vcorr[0])) spinor;
1315 spinor result=Zero();
1316 SigmaToNucleonQ1EyeSite(Dq_loop,Dq_spec_p[0],Dd_tf,Ds_ti,Gamma_H,GammaB_sigma,GammaB_nucl,result);
1317 coalescedWrite(vcorr[ss],result);
1319 }
else if(op ==
"Q2"){
1321 auto Dq_loop = vq_loop(ss);
1322 auto Dd_tf = vd_tf(ss);
1323 auto Ds_ti = vs_ti(ss);
1324 typedef decltype(coalescedRead(vcorr[0])) spinor;
1325 spinor result=Zero();
1326 SigmaToNucleonQ2EyeSite(Dq_loop,Dq_spec_p[0],Dd_tf,Ds_ti,Gamma_H,GammaB_sigma,GammaB_nucl,result);
1327 coalescedWrite(vcorr[ss],result);
1330 assert(0 &&
"Weak Operator not correctly specified");
1334template<
class FImpl>
1335template <
class mobj>
1338 const mobj &Du_spec,
1341 const Gamma Gamma_H,
1342 const Gamma GammaB_sigma,
1343 const Gamma GammaB_nucl,
1344 const std::string op,
1348 assert(
Ns==4 &&
"Baryon code only implemented for N_spin = 4");
1349 assert(
Nc==3 &&
"Baryon code only implemented for N_colour = 3");
1361 mobj * Dq_spec_p = &my_Dq_spec[0];
1365 auto Dq_ti = vq_ti(ss);
1366 auto Dq_tf = vq_tf(ss);
1367 auto Dd_tf = vd_tf(ss);
1368 auto Ds_ti = vs_ti(ss);
1369 typedef decltype(coalescedRead(vcorr[0])) spinor;
1370 spinor result=Zero();
1371 SigmaToNucleonQ1NonEyeSite(Dq_ti,Dq_tf,Dq_spec_p[0],Dd_tf,Ds_ti,Gamma_H,GammaB_sigma,GammaB_nucl,result);
1372 coalescedWrite(vcorr[ss],result);
1374 }
else if(op ==
"Q2"){
1376 auto Dq_ti = vq_ti(ss);
1377 auto Dq_tf = vq_tf(ss);
1378 auto Dd_tf = vd_tf(ss);
1379 auto Ds_ti = vs_ti(ss);
1380 typedef decltype(coalescedRead(vcorr[0])) spinor;
1381 spinor result=Zero();
1382 SigmaToNucleonQ2NonEyeSite(Dq_ti,Dq_tf,Dq_spec_p[0],Dd_tf,Ds_ti,Gamma_H,GammaB_sigma,GammaB_nucl,result);
1383 coalescedWrite(vcorr[ss],result);
1386 assert(0 &&
"Weak Operator not correctly specified");
1400template <
class FImpl>
1403 const mobj2 &Dd_spec,
1404 const mobj2 &Ds_spec,
1407 const Gamma Gamma_H,
1408 const Gamma GammaB_xi,
1409 const Gamma GammaB_sigma,
1413 Gamma g5(Gamma::Algebra::Gamma5);
1415 auto DdG = Dd_spec * GammaB_sigma;
1416 auto GDs = GammaB_xi * Ds_spec;
1418 auto DsGDd = Ds_ti * Gamma_H * g5 *
adj(Dd_tf) * g5;
1420 auto DsGDdG = DsGDd * GammaB_sigma;
1422 auto GDsGDd = GammaB_xi * DsGDd;
1424 auto GDsGDdG = GDsGDd * GammaB_sigma;
1430 for (
int ie_s=0; ie_s < 6 ; ie_s++){
1431 int a_s = (ie_s < 3 ? ie_s : (6-ie_s)%3 );
1432 int b_s = (ie_s < 3 ? (ie_s+1)%3 : (8-ie_s)%3 );
1433 int c_s = (ie_s < 3 ? (ie_s+2)%3 : (7-ie_s)%3 );
1434 int eSgn_s = (ie_s < 3 ? 1 : -1);
1435 for (
int ie_x=0; ie_x < 6 ; ie_x++){
1436 int a_x = (ie_x < 3 ? ie_x : (6-ie_x)%3 );
1437 int b_x = (ie_x < 3 ? (ie_x+1)%3 : (8-ie_x)%3 );
1438 int c_x = (ie_x < 3 ? (ie_x+2)%3 : (7-ie_x)%3 );
1439 int eSgn_x = (ie_x < 3 ? 1 : -1);
1440 ee =
Real(eSgn_s * eSgn_x);
1441 auto ee_GD = ee * trGDq;
1442 for (
int alpha_x=0; alpha_x<
Ns; alpha_x++){
1443 for (
int beta_s=0; beta_s<
Ns; beta_s++){
1444 auto GDsGDdG_ab_ba = GDsGDd()(alpha_x,beta_s)(b_x,a_s);
1445 auto Ds_ab_ab = Ds_spec()(alpha_x,beta_s)(a_x,b_s);
1446 auto DsGDdG_ab_aa = DsGDd()(alpha_x,beta_s)(a_x,a_s);
1447 auto GDs_ab_bb = GDs()(alpha_x,beta_s)(b_x,b_s);
1448 for (
int gamma_x=0; gamma_x<
Ns; gamma_x++){
1449 auto DdG_cb_ca = DdG()(gamma_x,beta_s)(c_x,a_s);
1450 for (
int gamma_s=0; gamma_s<
Ns; gamma_s++){
1451 result()(gamma_x,gamma_s)() -= ee_GD * Dd_spec()(gamma_x,gamma_s)(c_x,c_s) * GDsGDdG_ab_ba * Ds_ab_ab;
1452 result()(gamma_x,gamma_s)() += ee_GD * DdG_cb_ca * GDsGDd()(alpha_x,gamma_s)(b_x,c_s) * Ds_ab_ab;
1453 result()(gamma_x,gamma_s)() += ee_GD * Dd_spec()(gamma_x,gamma_s)(c_x,c_s) * DsGDdG_ab_aa * GDs_ab_bb;
1454 result()(gamma_x,gamma_s)() -= ee_GD * DdG_cb_ca * DsGDd()(alpha_x,gamma_s)(a_x,c_s) * GDs_ab_bb;
1469template <
class FImpl>
1472 const mobj2 &Dd_spec,
1473 const mobj2 &Ds_spec,
1476 const Gamma Gamma_H,
1477 const Gamma GammaB_xi,
1478 const Gamma GammaB_sigma,
1482 Gamma g5(Gamma::Algebra::Gamma5);
1484 auto DdG = Dd_spec * GammaB_sigma;
1485 auto GDs = GammaB_xi * Ds_spec;
1487 auto DsGDqGDd = Ds_ti * Gamma_H * Dq_loop * Gamma_H * g5 *
adj(Dd_tf) * g5;
1489 auto DsGDqGDdG = DsGDqGDd * GammaB_sigma;
1491 auto GDsGDqGDd = GammaB_xi * DsGDqGDd;
1493 auto GDsGDqGDdG = GDsGDqGDd * GammaB_sigma;
1497 for (
int ie_s=0; ie_s < 6 ; ie_s++){
1498 int a_s = (ie_s < 3 ? ie_s : (6-ie_s)%3 );
1499 int b_s = (ie_s < 3 ? (ie_s+1)%3 : (8-ie_s)%3 );
1500 int c_s = (ie_s < 3 ? (ie_s+2)%3 : (7-ie_s)%3 );
1501 int eSgn_s = (ie_s < 3 ? 1 : -1);
1502 for (
int ie_x=0; ie_x < 6 ; ie_x++){
1503 int a_x = (ie_x < 3 ? ie_x : (6-ie_x)%3 );
1504 int b_x = (ie_x < 3 ? (ie_x+1)%3 : (8-ie_x)%3 );
1505 int c_x = (ie_x < 3 ? (ie_x+2)%3 : (7-ie_x)%3 );
1506 int eSgn_x = (ie_x < 3 ? 1 : -1);
1507 ee =
Real(eSgn_s * eSgn_x);
1508 for (
int alpha_x=0; alpha_x<
Ns; alpha_x++){
1509 for (
int beta_s=0; beta_s<
Ns; beta_s++){
1510 auto GDsGDqGDdG_ab_ba = GDsGDqGDdG()(alpha_x,beta_s)(b_x,a_s);
1511 auto Ds_ab_ab = Ds_spec()(alpha_x,beta_s)(a_x,b_s);
1512 auto DsGDqGDdG_ab_aa = GDsGDqGDdG()(alpha_x,beta_s)(a_x,a_s);
1513 auto GDs_ab_bb = GDs()(alpha_x,beta_s)(b_x,b_s);
1514 for (
int gamma_x=0; gamma_x<
Ns; gamma_x++){
1515 auto DdG_cb_ca = DdG()(gamma_x, beta_s)(c_x,a_s);
1516 for (
int gamma_s=0; gamma_s<
Ns; gamma_s++){
1517 result()(gamma_x,gamma_s)() -= ee * Dd_spec()(gamma_x,gamma_s)(c_x,c_s) * GDsGDqGDdG_ab_ba * Ds_ab_ab;
1518 result()(gamma_x,gamma_s)() += ee * DdG_cb_ca * GDsGDqGDd()(alpha_x,gamma_s)(b_x,c_s) * Ds_ab_ab;
1519 result()(gamma_x,gamma_s)() += ee * Dd_spec()(gamma_x,gamma_s)(c_x,c_s) * DsGDqGDdG_ab_aa * GDs_ab_bb;
1520 result()(gamma_x,gamma_s)() -= ee * DdG_cb_ca * DsGDqGDd()(alpha_x,gamma_s)(a_x,c_s) * GDs_ab_bb;
1527template<
class FImpl>
1528template <
class mobj>
1530 const mobj &Dd_spec,
1531 const mobj &Ds_spec,
1534 const Gamma Gamma_H,
1535 const Gamma GammaB_xi,
1536 const Gamma GammaB_sigma,
1537 const std::string op,
1541 assert(
Ns==4 &&
"Baryon code only implemented for N_spin = 4");
1542 assert(
Nc==3 &&
"Baryon code only implemented for N_colour = 3");
1554 mobj * Dq_spec_p = &my_Dq_spec[0];
1558 auto Dq_loop = vq_loop(ss);
1559 auto Dd_tf = vd_tf(ss);
1560 auto Ds_ti = vs_ti(ss);
1561 typedef decltype(coalescedRead(vcorr[0])) spinor;
1562 spinor result=Zero();
1563 XiToSigmaQ1EyeSite(Dq_loop,Dq_spec_p[0],Dq_spec_p[1],Dd_tf,Ds_ti,Gamma_H,GammaB_xi,GammaB_sigma,result);
1564 coalescedWrite(vcorr[ss],result);
1566 }
else if(op ==
"Q2"){
1568 auto Dq_loop = vq_loop(ss);
1569 auto Dd_tf = vd_tf(ss);
1570 auto Ds_ti = vs_ti(ss);
1571 typedef decltype(coalescedRead(vcorr[0])) spinor;
1572 spinor result=Zero();
1573 XiToSigmaQ2EyeSite(Dq_loop,Dq_spec_p[0],Dq_spec_p[1],Dd_tf,Ds_ti,Gamma_H,GammaB_xi,GammaB_sigma,result);
1574 coalescedWrite(vcorr[ss],result);
1577 assert(0 &&
"Weak Operator not correctly specified");
void acceleratorPut(T &dev, const T &host)
#define accelerator_inline
#define accelerator_for(iterator, num, nsimd,...)
std::vector< T, devAllocator< T > > deviceVector
accelerator_inline Grid_simd2< S, V > trace(const Grid_simd2< S, V > &arg)
Lattice< vobj > adj(const Lattice< vobj > &lhs)
#define autoView(l_v, l, mode)
GridLogger GridLogDebug(1, "Debug", GridLogColours, "PURPLE")
#define NAMESPACE_BEGIN(A)
accelerator_inline std::enable_if<!isGridTensor< T >::value, T >::type TensorRemove(T arg)
static accelerator_inline void BaryonSite(const mobj &D1, const mobj &D2, const mobj &D3, const Gamma GammaA_left, const Gamma GammaB_left, const Gamma GammaA_right, const Gamma GammaB_right, const int parity, const int wick_contractions, robj &result)
static void ContractBaryonsMatrix(const PropagatorField &q1_left, const PropagatorField &q2_left, const PropagatorField &q3_left, const Gamma GammaA_left, const Gamma GammaB_left, const Gamma GammaA_right, const Gamma GammaB_right, const int wick_contractions, SpinMatrixField &baryon_corr)
static void SigmaToNucleonEye(const PropagatorField &qq_loop, const mobj &Du_spec, const PropagatorField &qd_tf, const PropagatorField &qs_ti, const Gamma Gamma_H, const Gamma GammaB_sigma, const Gamma GammaB_nucl, const std::string op, SpinMatrixField &stn_corr)
static void BaryonGamma3pt(const PropagatorField &q_ti, const mobj &Dq_spec1, const mobj &Dq_spec2, const PropagatorField &q_tf, int group, int wick_contraction, const Gamma GammaJ, const Gamma GammaBi, const Gamma GammaBf, SpinMatrixField &stn_corr)
static accelerator_inline void SigmaToNucleonQ2EyeSite(const mobj &Dq_loop, const mobj2 &Du_spec, const mobj &Dd_tf, const mobj &Ds_ti, const Gamma Gamma_H, const Gamma GammaB_sigma, const Gamma GammaB_nucl, robj &result)
Lattice< iSpinMatrix< typename FImpl::Simd > > SpinMatrixField
static accelerator_inline void BaryonSiteMatrix(const mobj &D1, const mobj &D2, const mobj &D3, const Gamma GammaA_left, const Gamma GammaB_left, const Gamma GammaA_right, const Gamma GammaB_right, const int wick_contractions, robj &result)
static accelerator_inline void BaryonGamma3ptGroup1Site(const mobj &Dq1_ti, const mobj2 &Dq2_spec, const mobj2 &Dq3_spec, const mobj &Dq4_tf, const Gamma GammaJ, const Gamma GammaBi, const Gamma GammaBf, int wick_contraction, robj &result)
FImpl::PropagatorField PropagatorField
FImpl::ComplexField ComplexField
static void ContractBaryons(const PropagatorField &q1_left, const PropagatorField &q2_left, const PropagatorField &q3_left, const Gamma GammaA_left, const Gamma GammaB_left, const Gamma GammaA_right, const Gamma GammaB_right, const int wick_contractions, const int parity, ComplexField &baryon_corr)
static void SigmaToNucleonNonEye(const PropagatorField &qq_ti, const PropagatorField &qq_tf, const mobj &Du_spec, const PropagatorField &qd_tf, const PropagatorField &qs_ti, const Gamma Gamma_H, const Gamma GammaB_sigma, const Gamma GammaB_nucl, const std::string op, SpinMatrixField &stn_corr)
static accelerator_inline void BaryonGamma3ptGroup2Site(const mobj2 &Dq1_spec, const mobj &Dq2_ti, const mobj2 &Dq3_spec, const mobj &Dq4_tf, const Gamma GammaJ, const Gamma GammaBi, const Gamma GammaBf, int wick_contraction, robj &result)
static void WickContractions(std::string qi, std::string qf, int &wick_contractions)
static accelerator_inline void SigmaToNucleonQ2NonEyeSite(const mobj &Du_ti, const mobj &Du_tf, const mobj2 &Du_spec, const mobj &Dd_tf, const mobj &Ds_ti, const Gamma Gamma_H, const Gamma GammaB_sigma, const Gamma GammaB_nucl, robj &result)
static void ContractBaryonsSlicedMatrix(const mobj &D1, const mobj &D2, const mobj &D3, const Gamma GammaA_left, const Gamma GammaB_left, const Gamma GammaA_right, const Gamma GammaB_right, const int wick_contractions, const int nt, robj &result)
FImpl::FermionField FermionField
static accelerator_inline void XiToSigmaQ1EyeSite(const mobj &Dq_loop, const mobj2 &Dd_spec, const mobj2 &Ds_spec, const mobj &Dd_tf, const mobj &Ds_ti, const Gamma Gamma_H, const Gamma GammaB_sigma, const Gamma GammaB_nucl, robj &result)
static accelerator_inline void XiToSigmaQ2EyeSite(const mobj &Dq_loop, const mobj2 &Dd_spec, const mobj2 &Ds_spec, const mobj &Dd_tf, const mobj &Ds_ti, const Gamma Gamma_H, const Gamma GammaB_sigma, const Gamma GammaB_nucl, robj &result)
static accelerator_inline void BaryonGamma3ptGroup3Site(const mobj2 &Dq1_spec, const mobj2 &Dq2_spec, const mobj &Dq3_ti, const mobj &Dq4_tf, const Gamma GammaJ, const Gamma GammaBi, const Gamma GammaBf, int wick_contraction, robj &result)
static void ContractBaryonsSliced(const mobj &D1, const mobj &D2, const mobj &D3, const Gamma GammaA_left, const Gamma GammaB_left, const Gamma GammaA_right, const Gamma GammaB_right, const int wick_contractions, const int parity, const int nt, robj &result)
static accelerator_inline void SigmaToNucleonQ1EyeSite(const mobj &Dq_loop, const mobj2 &Du_spec, const mobj &Dd_tf, const mobj &Ds_ti, const Gamma Gamma_H, const Gamma GammaB_sigma, const Gamma GammaB_nucl, robj &result)
static accelerator_inline void SigmaToNucleonQ1NonEyeSite(const mobj &Du_ti, const mobj &Du_tf, const mobj2 &Du_spec, const mobj &Dd_tf, const mobj &Ds_ti, const Gamma Gamma_H, const Gamma GammaB_sigma, const Gamma GammaB_nucl, robj &result)
static void XiToSigmaEye(const PropagatorField &qq_loop, const mobj &Dd_spec, const mobj &Ds_spec, const PropagatorField &qd_tf, const PropagatorField &qs_ti, const Gamma Gamma_H, const Gamma GammaB_sigma, const Gamma GammaB_nucl, const std::string op, SpinMatrixField &xts_corr)