1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45:36 +00:00

Debugging the Clover term

This commit is contained in:
Guido Cossu 2017-08-04 16:08:07 +01:00
parent fde71c3c52
commit 75ee6cfc86
8 changed files with 149 additions and 52 deletions

2
.gitignore vendored
View File

@ -123,3 +123,5 @@ make-bin-BUCK.sh
lib/qcd/spin/gamma-gen/*.h lib/qcd/spin/gamma-gen/*.h
lib/qcd/spin/gamma-gen/*.cc lib/qcd/spin/gamma-gen/*.cc
.vscode/settings.json
settings.json

11
.vscode/settings.json vendored
View File

@ -36,6 +36,15 @@
"tuple": "cpp", "tuple": "cpp",
"type_traits": "cpp", "type_traits": "cpp",
"typeinfo": "cpp", "typeinfo": "cpp",
"utility": "cpp" "utility": "cpp",
"iostream": "cpp",
"strstream": "cpp",
"complex": "cpp",
"fstream": "cpp",
"iomanip": "cpp",
"istream": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"streambuf": "cpp"
} }
} }

View File

@ -69,6 +69,8 @@ public:
std::vector<int> _lstart; // local start of array in gcoors _processor_coor[d]*_ldimensions[d] std::vector<int> _lstart; // local start of array in gcoors _processor_coor[d]*_ldimensions[d]
std::vector<int> _lend ; // local end of array in gcoors _processor_coor[d]*_ldimensions[d]+_ldimensions_[d]-1 std::vector<int> _lend ; // local end of array in gcoors _processor_coor[d]*_ldimensions[d]+_ldimensions_[d]-1
bool _isCheckerBoarded;
public: public:
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////

View File

@ -69,6 +69,7 @@ public:
/////////////////////// ///////////////////////
// Grid information // Grid information
/////////////////////// ///////////////////////
_isCheckerBoarded = false;
_ndimension = dimensions.size(); _ndimension = dimensions.size();
_fdimensions.resize(_ndimension); _fdimensions.resize(_ndimension);

View File

@ -139,6 +139,7 @@ public:
/////////////////////// ///////////////////////
// Grid information // Grid information
/////////////////////// ///////////////////////
_isCheckerBoarded = true;
_checker_dim = checker_dim; _checker_dim = checker_dim;
assert(checker_dim_mask[checker_dim]==1); assert(checker_dim_mask[checker_dim]==1);
_ndimension = dimensions.size(); _ndimension = dimensions.size();

View File

@ -35,27 +35,6 @@ namespace Grid
namespace QCD namespace QCD
{ {
//WilsonLoop::CloverPlaquette
/////////////////////////////////////////////////////
//// Clover plaquette combination in mu,nu plane with Double Stored U
////////////////////////////////////////////////////
//static void CloverPlaquette(GaugeMat &Q, const std::vector<GaugeMat> &U,
// const int mu, const int nu){
// Q = zero;
// Q += Gimpl::CovShiftBackward(
// U[mu], mu, Gimpl::CovShiftBackward(
// U[nu], nu, Gimpl::CovShiftForward(U[mu], mu, U[nu] )));
// Q += Gimpl::CovShiftForward(
// U[mu], mu, Gimpl::CovShiftForward(
// U[nu], nu, Gimpl::CovShiftBackward(U[mu], mu, U[nu+Nd] )));
// Q += Gimpl::CovShiftBackward(
// U[nu], nu, Gimpl::CovShiftForward(
// U[mu], mu, Gimpl::CovShiftForward(U[nu], nu, U[mu+Nd] )));
// Q += Gimpl::CovShiftForward(
// U[mu], mu, Gimpl::CovShiftBackward(
// U[nu], nu, Gimpl::CovShiftBackward(U[mu], mu, U[nu] )));
// }
// *NOT* EO // *NOT* EO
template <class Impl> template <class Impl>
RealD WilsonCloverFermion<Impl>::M(const FermionField &in, FermionField &out) RealD WilsonCloverFermion<Impl>::M(const FermionField &in, FermionField &out)
@ -89,7 +68,7 @@ RealD WilsonCloverFermion<Impl>::Mdag(const FermionField &in, FermionField &out)
template <class Impl> template <class Impl>
void WilsonCloverFermion<Impl>::ImportGauge(const GaugeField &_Umu) void WilsonCloverFermion<Impl>::ImportGauge(const GaugeField &_Umu)
{ {
this->ImportGauge(_Umu); WilsonFermion<Impl>::ImportGauge(_Umu);
GridBase *grid = _Umu._grid; GridBase *grid = _Umu._grid;
typename Impl::GaugeLinkField Bx(grid), By(grid), Bz(grid), Ex(grid), Ey(grid), Ez(grid); typename Impl::GaugeLinkField Bx(grid), By(grid), Bz(grid), Ex(grid), Ey(grid), Ez(grid);
@ -102,12 +81,12 @@ void WilsonCloverFermion<Impl>::ImportGauge(const GaugeField &_Umu)
WilsonLoops<Impl>::FieldStrength(Ez, _Umu, Tdir, Zdir); WilsonLoops<Impl>::FieldStrength(Ez, _Umu, Tdir, Zdir);
// Compute the Clover Operator acting on Colour and Spin // Compute the Clover Operator acting on Colour and Spin
CloverTerm = fillClover(Bx) * (Gamma(Gamma::Algebra::SigmaYZ)); CloverTerm = fillCloverYZ(Bx);
CloverTerm += fillClover(By) * (Gamma(Gamma::Algebra::MinusSigmaXZ)); CloverTerm += fillCloverXZ(By);
CloverTerm += fillClover(Bz) * (Gamma(Gamma::Algebra::SigmaXY)); CloverTerm += fillCloverXY(Bz);
CloverTerm += fillClover(Ex) * (Gamma(Gamma::Algebra::MinusSigmaXT)); CloverTerm += fillCloverXT(Ex);
CloverTerm += fillClover(Ey) * (Gamma(Gamma::Algebra::MinusSigmaYT)); CloverTerm += fillCloverYT(Ey);
CloverTerm += fillClover(Ez) * (Gamma(Gamma::Algebra::MinusSigmaZT)); CloverTerm += fillCloverZT(Ez) ;
CloverTerm *= csw; CloverTerm *= csw;
int lvol = _Umu._grid->lSites(); int lvol = _Umu._grid->lSites();
@ -130,8 +109,11 @@ void WilsonCloverFermion<Impl>::ImportGauge(const GaugeField &_Umu)
for (int a = 0; a < DimRep; a++) for (int a = 0; a < DimRep; a++)
for (int b = 0; b < DimRep; b++) for (int b = 0; b < DimRep; b++)
EigenCloverOp(a + j * DimRep, b + k * DimRep) = Qx()(j, k)(a, b); EigenCloverOp(a + j * DimRep, b + k * DimRep) = Qx()(j, k)(a, b);
//std::cout << EigenCloverOp << std::endl;
EigenInvCloverOp = EigenCloverOp.inverse(); EigenInvCloverOp = EigenCloverOp.inverse();
//std::cout << EigenInvCloverOp << std::endl;
for (int j = 0; j < Ns; j++) for (int j = 0; j < Ns; j++)
for (int k = 0; k < Ns; k++) for (int k = 0; k < Ns; k++)
for (int a = 0; a < DimRep; a++) for (int a = 0; a < DimRep; a++)
@ -139,17 +121,21 @@ void WilsonCloverFermion<Impl>::ImportGauge(const GaugeField &_Umu)
Qxinv()(j, k)(a, b) = EigenInvCloverOp(a + j * DimRep, b + k * DimRep); Qxinv()(j, k)(a, b) = EigenInvCloverOp(a + j * DimRep, b + k * DimRep);
pokeLocalSite(Qxinv, CloverTermInv, lcoor); pokeLocalSite(Qxinv, CloverTermInv, lcoor);
}
// Separate the even and odd parts. // Separate the even and odd parts.
pickCheckerboard(Even, CloverTermEven, CloverTerm); pickCheckerboard(Even, CloverTermEven, CloverTerm);
pickCheckerboard( Odd, CloverTermOdd, CloverTerm); pickCheckerboard( Odd, CloverTermOdd, CloverTerm);
pickCheckerboard(Even, CloverTermInvEven, CloverTermInv); pickCheckerboard(Even, CloverTermInvEven, CloverTermInv);
pickCheckerboard( Odd, CloverTermInvOdd, CloverTermInv); pickCheckerboard( Odd, CloverTermInvOdd, CloverTermInv);
}
} }
template <class Impl> template <class Impl>
void WilsonCloverFermion<Impl>::Mooee(const FermionField &in, FermionField &out) void WilsonCloverFermion<Impl>::Mooee(const FermionField &in, FermionField &out)
{ {
conformable(in,out);
this->MooeeInternal(in, out, DaggerNo, InverseNo); this->MooeeInternal(in, out, DaggerNo, InverseNo);
} }
@ -176,15 +162,27 @@ void WilsonCloverFermion<Impl>::MooeeInternal(const FermionField &in, FermionFie
{ {
out.checkerboard = in.checkerboard; out.checkerboard = in.checkerboard;
CloverFieldType *Clover; CloverFieldType *Clover;
if (in.checkerboard == Odd){ assert(in.checkerboard == Odd || in.checkerboard == Even);
if (in._grid->_isCheckerBoarded)
{
if (in.checkerboard == Odd)
{
std::cout << "Calling clover term Odd" << std::endl; std::cout << "Calling clover term Odd" << std::endl;
Clover = (inv) ? &CloverTermInvOdd : &CloverTermOdd; Clover = (inv) ? &CloverTermInvOdd : &CloverTermOdd;
} }
if (in.checkerboard == Even){ else
{
std::cout << "Calling clover term Even" << std::endl; std::cout << "Calling clover term Even" << std::endl;
Clover = (inv) ? &CloverTermInvEven : &CloverTermEven; Clover = (inv) ? &CloverTermInvEven : &CloverTermEven;
} }
}
else
{
Clover = (inv) ? &CloverTermInv : &CloverTerm;
}
std::cout << GridLogMessage << "*Clover.checkerboard " << (*Clover).checkerboard << std::endl;
if (dag){ out = adj(*Clover) * in;} else { out = *Clover * in;} if (dag){ out = adj(*Clover) * in;} else { out = *Clover * in;}
} // MooeeInternal } // MooeeInternal

View File

@ -94,17 +94,102 @@ private:
// eventually these two can be compressed into 6x6 blocks instead of the 12x12 // eventually these two can be compressed into 6x6 blocks instead of the 12x12
// using the DeGrand-Rossi basis for the gamma matrices // using the DeGrand-Rossi basis for the gamma matrices
CloverFieldType fillClover(const GaugeLinkField& F){ CloverFieldType fillCloverYZ(const GaugeLinkField &F)
{
CloverFieldType T(F._grid); CloverFieldType T(F._grid);
T = zero;
PARALLEL_FOR_LOOP PARALLEL_FOR_LOOP
for (int i = 0; i < CloverTerm._grid->oSites(); i++){ for (int i = 0; i < CloverTerm._grid->oSites(); i++)
for (int s1 = 0; s1 < Nc; s1++) {
for (int s2 = 0; s2 < Nc; s2++) T._odata[i]()(0, 1) = timesMinusI(F._odata[i]()());
T._odata[i]()(s1,s2) = F._odata[i]()(); T._odata[i]()(1, 0) = timesMinusI(F._odata[i]()());
T._odata[i]()(2, 3) = timesMinusI(F._odata[i]()());
T._odata[i]()(3, 2) = timesMinusI(F._odata[i]()());
} }
return T; return T;
}
CloverFieldType fillCloverXZ(const GaugeLinkField &F)
{
CloverFieldType T(F._grid);
T = zero;
PARALLEL_FOR_LOOP
for (int i = 0; i < CloverTerm._grid->oSites(); i++)
{
T._odata[i]()(0, 1) = -F._odata[i]()();
T._odata[i]()(1, 0) = F._odata[i]()();
T._odata[i]()(2, 3) = -F._odata[i]()();
T._odata[i]()(3, 2) = F._odata[i]()();
} }
return T;
}
CloverFieldType fillCloverXY(const GaugeLinkField &F)
{
CloverFieldType T(F._grid);
T = zero;
PARALLEL_FOR_LOOP
for (int i = 0; i < CloverTerm._grid->oSites(); i++)
{
T._odata[i]()(0, 0) = timesMinusI(F._odata[i]()());
T._odata[i]()(1, 1) = timesI(F._odata[i]()());
T._odata[i]()(2, 2) = timesMinusI(F._odata[i]()());
T._odata[i]()(3, 3) = timesI(F._odata[i]()());
}
return T;
}
CloverFieldType fillCloverXT(const GaugeLinkField &F)
{
CloverFieldType T(F._grid);
T = zero;
PARALLEL_FOR_LOOP
for (int i = 0; i < CloverTerm._grid->oSites(); i++)
{
T._odata[i]()(0, 1) = timesMinusI(F._odata[i]()());
T._odata[i]()(1, 0) = timesMinusI(F._odata[i]()());
T._odata[i]()(2, 3) = timesI(F._odata[i]()());
T._odata[i]()(3, 2) = timesI(F._odata[i]()());
}
return T;
}
CloverFieldType fillCloverYT(const GaugeLinkField &F)
{
CloverFieldType T(F._grid);
T = zero;
PARALLEL_FOR_LOOP
for (int i = 0; i < CloverTerm._grid->oSites(); i++)
{
T._odata[i]()(0, 1) = (F._odata[i]()());
T._odata[i]()(1, 0) = -(F._odata[i]()());
T._odata[i]()(2, 3) = -(F._odata[i]()());
T._odata[i]()(3, 2) = (F._odata[i]()());
}
return T;
}
CloverFieldType fillCloverZT(const GaugeLinkField &F)
{
CloverFieldType T(F._grid);
T = zero;
PARALLEL_FOR_LOOP
for (int i = 0; i < CloverTerm._grid->oSites(); i++)
{
T._odata[i]()(0, 0) = timesMinusI(F._odata[i]()());
T._odata[i]()(1, 1) = timesI(F._odata[i]()());
T._odata[i]()(2, 2) = timesI(F._odata[i]()());
T._odata[i]()(3, 3) = timesMinusI(F._odata[i]()());
}
return T;
}
}; };
} }
} }

View File

@ -91,7 +91,7 @@ int main (int argc, char ** argv)
} }
WilsonCloverFermionR Dwc(Umu,Grid,RBGrid,mass,csw,params); WilsonCloverFermionR Dwc(Umu,Grid,RBGrid,mass,csw,params);
Dwc.ImportGauge(Umu);
std::cout<<GridLogMessage<<"=========================================================="<<std::endl; std::cout<<GridLogMessage<<"=========================================================="<<std::endl;
std::cout<<GridLogMessage<<"= Testing Dhop against cshift implementation "<<std::endl; std::cout<<GridLogMessage<<"= Testing Dhop against cshift implementation "<<std::endl;
@ -191,7 +191,6 @@ int main (int argc, char ** argv)
Dwc.MooeeInv(src_e,phi_e); Dwc.MooeeInv(src_e,phi_e);
Dwc.Mooee(chi_o,src_o); Dwc.Mooee(chi_o,src_o);
exit(1);
Dwc.MooeeInv(src_o,phi_o); Dwc.MooeeInv(src_o,phi_o);
setCheckerboard(phi,phi_e); setCheckerboard(phi,phi_e);