1
0
mirror of https://github.com/paboyle/Grid.git synced 2026-05-19 16:44:30 +01:00

Fix names, protect against bad index values, clean docstrings

This commit is contained in:
Alexis Provatas
2025-04-11 17:15:36 +01:00
parent a2b98d82e1
commit c646d91527
+15 -9
View File
@@ -177,12 +177,18 @@ public:
} }
////////////////////////////////////////////////// //////////////////////////////////////////////////
// average Polyakov loop in any direction (spatial or temporal) // average Polyakov loop in mu direction over all directions != mu
////////////////////////////////////////////////// //////////////////////////////////////////////////
static ComplexD avgPolyakovLoop(const GaugeField &Umu, const int mu) { //assume Nd=4 static ComplexD avgPolyakovLoop(const GaugeField &Umu, const int mu) { //assume Nd=4
// TODO: Protect against mu<0 || mu>=4 // Protect against bad value of mu [0, 3]
GaugeMat Ut(Umu.Grid()), P(Umu.Grid()); if ((mu < 0 ) || (mu > 3)) {
std::cout << GridLogError << "Index is not an integer inclusively between 0 and 3." << std::endl;
exit(1);
}
// U_loop is U_{mu}
GaugeMat U_loop(Umu.Grid()), P(Umu.Grid());
ComplexD out; ComplexD out;
int T = Umu.Grid()->GlobalDimensions()[3]; int T = Umu.Grid()->GlobalDimensions()[3];
int X = Umu.Grid()->GlobalDimensions()[0]; int X = Umu.Grid()->GlobalDimensions()[0];
@@ -190,12 +196,12 @@ public:
int Z = Umu.Grid()->GlobalDimensions()[2]; int Z = Umu.Grid()->GlobalDimensions()[2];
// Number of sites in mu direction // Number of sites in mu direction
int L = Umu.Grid()->GlobalDimensions()[mu]; int N_mu = Umu.Grid()->GlobalDimensions()[mu];
Ut = peekLorentz(Umu, mu); //Select direction U_loop = peekLorentz(Umu, mu); //Select direction
P = Ut; P = U_loop;
for (int t=1;t<L;t++){ for (int t=1;t<N_mu;t++){
P = Gimpl::CovShiftForward(Ut,mu,P); P = Gimpl::CovShiftForward(U_loop,mu,P);
} }
RealD norm = 1.0/(Nc*X*Y*Z*T); RealD norm = 1.0/(Nc*X*Y*Z*T);
out = sum(trace(P))*norm; out = sum(trace(P))*norm;
@@ -203,7 +209,7 @@ public:
} }
///////////////////////////////////////////////// /////////////////////////////////////////////////
// overload for temporal loop // overload for temporal Polyakov loop
///////////////////////////////////////////////// /////////////////////////////////////////////////
static ComplexD avgPolyakovLoop(const GaugeField &Umu) { static ComplexD avgPolyakovLoop(const GaugeField &Umu) {
return avgPolyakovLoop(Umu, 3); return avgPolyakovLoop(Umu, 3);