Quit[]

Install["/home/gluza/calculations/LoopTools-2.8/build/LoopTools"]

SetLambda[0]

(* 
To link OneLOop, custom and compile Makefile in mathlink.tgz first, preparing mloneloop.tm 
"rmu" parameter of OneLOop is fixed to 1 (can be changed in mlonelooptm.cpp)
*)

Install["mathlink/mloneloop"]

<<OLECv0.9.m

invariants={p1 p1->p1s,p2 p2->p2s,p3 p3->p3s,p4 p4->p4s,p5 p5->p5s,p1 p2->(s12-p1s-p2s)/2,p2 p3->(s23-p2s-p3s)/2,p3 p4->(s34-p3s-p4s)/2,p4 p5->(s45-p4s-p5s)/2,p1 p5->(s15-p1s-p5s)/2,p3 p5->(s12-s34-s45+p4s)/2,p1 p4->(s23-s15-s45+p5s)/2,p2 p5->(s34-s12-s15+p1s)/2,p1 p3->(s45-s12-s23+p2s)/2,p2 p4->(s15-s23-s34+p3s)/2};
invariantsDots={p1.p1->p1s,p2.p2->p2s,p3.p3->p3s,p4.p4->p4s,p5.p5->p5s,p1.p2->(s12-p1s-p2s)/2,p2.p3->(s23-p2s-p3s)/2,p3.p4->(s34-p3s-p4s)/2,p4.p5->(s45-p4s-p5s)/2,p1.p5->(s15-p1s-p5s)/2,p3.p5->(s12-s34-s45+p4s)/2,p1.p4->(s23-s15-s45+p5s)/2,p2.p5->(s34-s12-s15+p1s)/2,p1.p3->(s45-s12-s23+p2s)/2,p2.p4->(s15-s23-s34+p3s)/2};

chords={q[ind_,1]->p1[ind],q[ind_,2]->p1[ind]+p2[ind],q[ind_,3]->p1[ind]+p2[ind]+p3[ind],q[ind_,4]->p1[ind]+p2[ind]+p3[ind]+p4[ind],q[ind_,5]->0};

(* Functions used to convert iterator numbers to parameter used with new functions *)
chordsNum1[i_]:=ToExpression["chords" <> ToString[i]];
chordsNum2[i_,j_]:=ToExpression["chords" <> ToString[i]<>ToString[j]];
chordsNum3[i_,j_,k_]:=ToExpression["chords" <> ToString[i]<>ToString[j]<>ToString[k]];

SET1

(* SET1: kinematic points generated for 2->3 process with MC generator - Phokhara *)

p1p1=0.0000002611;
p2p2=0.0000002611;
p3p3=0.0111636884; 
p4p4=0.0111636884;
p5p5=0.0;
p1p2=0.5283711791;
p1p3=0.1677307791;
p1p4=0.3598733657;
p1p5=0.0007672955;
p2p3=0.3107016645;
p2p4=0.1534103430;
p2p5=0.0642594327;
p3p4=0.4521810237;
p3p5=0.0150877315;
p4p5=0.0499389967;

p1s=p4p4;
p2s=p1p1;
p3s=p5p5;
p4s=p2p2;
p5s=p3p3;

s12=p4p4+p1p1-2*p1p4;
s23=p1p1+p5p5-2*p1p5;
s34=p5p5+p2p2-2*p2p5;
s45=p2p2+p3p3-2*p2p3;
s15=p4p4+p3p3+2*p3p4;

me=0.00051099906;
mu=0.1056583568;
mf=0.0;
m1s=mu^2;
m2s=mf;
m3s=me^2;
m4s=me^2;
m5s=mf;

Tensor rank 1

(* Definition of LoopTools function *)

Rank1LoopTools[a_]:=Expand[q[mu1, a]Sum[q[mu1,i]E0i[ToExpression["ee"<>ToString[i]],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s],{i,1,4}]/.chords]/.p_[_]^n_.->p^n/.invariants

(* Definition of old hexagon.m relations functions *)

Rank1hexagon[a_]:=Expand[Expand[q[mu1, a]*RedE1[p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0]/.chords]/.p_[_]^n_.->p^n/.invariants

(* Definition of new contracted relations with LoopTools *)

CE1LoopTools[a_]:=CE1[chordsNum1[a],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0

(* Definition of new contracted relations with OneLoop *)

CE1OneLoop[a_]:=N[CE1[chordsNum1[a],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]]/.D4->D0rr/.C3->C0rr//Expand

Do[Print[i,") LoopTools: ",Rank1LoopTools[i],", Hexagon: ",Rank1hexagon[i],", CE1LoopTools: ",CE1LoopTools[i],", CE1OneLoop: ",CE1OneLoop[i]],{i,1,5}]

(* Example how to use single contracts,  "chords1" parameter means contracting with q[1] *)

CE1[chords1,p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0

Tensor rank 2

(* Definition of LoopTools functions *)

Rank2LoopTools[a_,b_]:=Expand[q[mu1, a]*q[mu2, b](Sum[q[mu1,i]q[mu2,j]E0i[ToExpression["ee"<>StringJoin[Map[ToString,Sort[{i,j}]]]],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]  ,{i,1,4},{j,1,4}]+ g[mu1,mu2]*E0i[ee00,p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s])/.chords]/.g[mu_,nu_]*p_[mu_]->p[nu]/.p_[n_]^2->p.p//.p1_[mu_] p2_[mu_]->p1.p2/.invariantsDots

(* Definition of old hexagon.m *)

Rank2hexagon[a_,b_]:=Expand[q[mu1, a]*q[mu2, b]RedE2[p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0/.chords]/.g[mu_,nu_]*p_[mu_]->p[nu]/.p_[n_]^2->p.p//.p1_[mu_] p2_[mu_]->p1.p2/.invariantsDots

(* Definition of new contracted reductions *)

CE2LoopTools[a_,b_]:=CE2[chordsNum2[a,b],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0

CE2OneLoop[a_,b_]:=CE2[chordsNum2[a,b],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0rr/.C3->C0rr//Expand

Do[Print["(",i,",",j,")  LoopTools: ",Rank2LoopTools[i,j],", Hexagon: ",Rank2hexagon[i,j],", CE2LoopTools: ",CE2LoopTools[i,j],", CE2OneLoop: ",CE2OneLoop[i,j]],{i,1,5},{j,i,5}]

(* Examples for separated contractions *)

CE2[chords12,p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0

CE2[chords12,p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0rr/.C3->C0rr//Expand

CE2[chords34,p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0

(*--- Rank2 contracted with gmunu ---*)

(* LoopTools *)

Expand[g[mu1,mu2]*(Sum[q[mu1,i]q[mu2,j]E0i[ToExpression["ee"<>StringJoin[Map[ToString,Sort[{i,j}]]]],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]  ,{i,1,4},{j,1,4}]+ g[mu1,mu2]*E0i[ee00,p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s])/.chords]/.g[mu1,mu2]^2->4/.g[mu1_,mu2_]*p1_[mu1_]*p2_[mu2_]->p1*p2/.invariants

(* Old hexagon *)

Expand[g[mu1,mu2]*RedE2[p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0/.chords]/.g[mu1,mu2]^2->4/.g[mu1_,mu2_]*p1_[mu1_]*p2_[mu2_]->p1*p2/.invariants

(* New reduction *)

CE2g[p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0

Tensor rank 3

(* Definition of LoopTools functions *)

Rank3LoopTools[a_,b_, c_]:=Expand[q[mu1, a]*q[mu2, b]*q[mu3, c](Sum[q[mu1,i]q[mu2,j]q[mu3,k]E0i[ToExpression["ee"<>StringJoin[Map[ToString,Sort[{i,j,k}]]]],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]  ,{i,1,4},{j,1,4},{k,1,4}]+Sum[(g[mu1,mu2]q[mu3,i]+g[mu2,mu3]q[mu1,i]+g[mu3,mu1]q[mu2,i])E0i[ToExpression["ee00"<>ToString[i]],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s],{i,1,4}])/.chords]/.g[mu_,nu_]*p_[mu_]->p[nu]/.p_[n_]^2->p.p//.p1_[mu_] p2_[mu_]->p1.p2/.invariantsDots

(* Definition of old hexagon relations *)

Rank3hexagon[a_,b_, c_]:=Expand[q[mu1, a]*q[mu2, b]*q[mu3, c]RedE3[p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0/.B2->B0/.chords]/.g[mu_,nu_]*p_[mu_]->p[nu]//.p1_[mu_] p2_[mu_]->p1.p2/.p_[n_]^2->p.p/.invariantsDots

(* Definition of new relations LT *)

CE3LoopTools[a_,b_, c_]:=CE3[chordsNum3[a,b,c],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0/. B2->B0

(* Definition of new relations OneLoop *)

CE3OneLoop[a_,b_, c_]:=CE3[chordsNum3[a,b,c],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0rr/.C3->C0rr/. B2->B0rr//Expand

(* Cross-check. All four are correct for chords q[1] - q[4]. Only C5[a,b,c] makes non zero values when contracting with q[5] *)

Do[Print["(",i,",",j,",",k,")  LoopTools: ",Rank3LoopTools[i,j,k],", Hexagon: ",Rank3hexagon[i,j,k],", CE3LoopTools: ",CE3LoopTools[i,j,k]," CE3OneLoop: ",CE3OneLoop[i,j,k]],{i,1,5},{j,i,5},{k,j,5}]

(*--- Contraction of Rank3 with gmunu and chord q[c, la]---*)

(* Definition of LoopTools function *)

Rank3gmunuLoopTools[a_]:=Expand[g[mu1,mu2]*q[mu3,a]*(Sum[q[mu1,i]q[mu2,j]q[mu3,k]E0i[ToExpression["ee"<>StringJoin[Map[ToString,Sort[{i,j,k}]]]],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]  ,{i,1,4},{j,1,4},{k,1,4}]+Sum[(g[mu1,mu2]q[mu3,i]+g[mu2,mu3]q[mu1,i]+g[mu3,mu1]q[mu2,i])E0i[ToExpression["ee00"<>ToString[i]],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s],{i,1,4}])/.chords]/.g[mu1,mu2]^2->4//.g[mu_,nu_]*p_[mu_]->p[nu]//.g[mu_,nu_]*p_[nu_]->p[mu]/.p_[n_]^2->p.p//.p1_[mu_] p2_[mu_]->p1.p2/.invariantsDots

(* Definition of old hexagon relations *)

Rank3gmunuHexagon[a_]:=Expand[g[mu1,mu2]*q[mu3,a]*RedE3[p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0/.B2->B0/.chords]/.g[mu1,mu2]^2->4//.g[mu_,nu_]*p_[mu_]->p[nu]//.g[mu_,nu_]*p_[nu_]->p[mu]/.p_[n_]^2->p.p//.p1_[mu_] p2_[mu_]->p1.p2/.invariantsDots

(* Definition of new relation LoopTools *)

CE3gLoopTools[a_]:=CE3g[chordsNum1[a],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0/.C3->C0/. B2->B0

(* Definition of new relation OneLoop *)

CE3gOneLoop[a_]:=CE3g[chordsNum1[a],p1s,p2s,p3s,p4s,p5s,s12,s23,s34,s45,s15,m1s,m2s,m3s,m4s,m5s]/.D4->D0rr/.C3->C0rr/. B2->B0rr//Expand

Do[Print[i,")  LoopTools: ",Rank3gmunuLoopTools[i],", Hexagon: ",Rank3gmunuHexagon[i],", CE3gLoopTools: ",CE3gLoopTools[i],", CE3gOneLoop: ",CE3gOneLoop[i]],{i,1,5}]