/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./tests/Test_cayley_cg.cc Copyright (C) 2022 Author: Peter Boyle Author: Fabian Joswig This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ /* END LEGAL */ #include using namespace std; using namespace Grid; template void TestConserved(What & Dw, LatticeGaugeField &Umu, GridCartesian * UGrid, GridRedBlackCartesian * UrbGrid, GridParallelRNG *RNG4); Gamma::Algebra Gmu [] = { Gamma::Algebra::GammaX, Gamma::Algebra::GammaY, Gamma::Algebra::GammaZ, Gamma::Algebra::GammaT, Gamma::Algebra::Gamma5 }; int main (int argc, char ** argv) { Grid_init(&argc,&argv); int threads = GridThread::GetThreads(); std::cout< seeds5({5,6,7,8}); GridParallelRNG RNG4(UGrid); std::vector seeds4({1,2,3,4}); RNG4.SeedFixedIntegers(seeds4); LatticeGaugeField Umu(UGrid); if( argc > 1 && argv[1][0] != '-' ) { std::cout<::HotConfiguration(RNG4,Umu); } typename WilsonCloverFermionD::ImplParams params; WilsonAnisotropyCoefficients anis; RealD mass = 0.1; RealD csw_r = 1.0; RealD csw_t = 1.0; std::cout<(Dw,Umu,UGrid,UrbGrid,&RNG4); std::cout<(Dwc,Umu,UGrid,UrbGrid,&RNG4); std::cout<(Dwcc,Umu,UGrid,UrbGrid,&RNG4); std::cout<(Dewc,Umu,UGrid,UrbGrid,&RNG4); std::cout<(Dewcc,Umu,UGrid,UrbGrid,&RNG4); Grid_finalize(); } template void TestConserved(Action & Dw, LatticeGaugeField &Umu, GridCartesian * UGrid, GridRedBlackCartesian * UrbGrid, GridParallelRNG *RNG4) { LatticePropagator phys_src(UGrid); LatticePropagator seqsrc(UGrid); LatticePropagator prop4(UGrid); LatticePropagator Vector_mu(UGrid); LatticeComplex SV (UGrid); LatticeComplex VV (UGrid); LatticePropagator seqprop(UGrid); SpinColourMatrix kronecker; kronecker=1.0; Coordinate coor({0,0,0,0}); phys_src=Zero(); pokeSite(kronecker,phys_src,coor); ConjugateGradient CG(1.0e-16,100000); SchurRedBlackDiagTwoSolve schur(CG); ZeroGuesser zpg; for(int s=0;s(src4,phys_src,s,c); LatticeFermion result4(UGrid); result4=Zero(); schur(Dw,src4,result4,zpg); std::cout<(prop4,result4,s,c); } } auto curr = Current::Vector; const int mu_J=0; const int t_J=0; LatticeComplex ph (UGrid); ph=1.0; Dw.SeqConservedCurrent(prop4, seqsrc, phys_src, curr, mu_J, t_J, t_J,// whole lattice ph); for(int s=0;s(src4,seqsrc,s,c); LatticeFermion result4(UGrid); result4=Zero(); schur(Dw,src4,result4,zpg); FermToProp(seqprop,result4,s,c); } } Gamma g5(Gamma::Algebra::Gamma5); Gamma gT(Gamma::Algebra::GammaT); std::vector sumSV; std::vector sumVV; Dw.ContractConservedCurrent(prop4,prop4,Vector_mu,phys_src,Current::Vector,Tdir); SV = trace(Vector_mu); // Scalar-Vector conserved current VV = trace(gT*Vector_mu); // (local) Vector-Vector conserved current // Spatial sum sliceSum(SV,sumSV,Tdir); sliceSum(VV,sumVV,Tdir); const int Nt{static_cast(sumSV.size())}; std::cout< check_buf; test_S = trace(qSite*g); test_V = trace(qSite*g*Gamma::gmu[mu_J]); Dw.ContractConservedCurrent(prop4,prop4,cur,phys_src,curr,mu_J); c = trace(cur*g); sliceSum(c, check_buf, Tp); check_S = TensorRemove(check_buf[t_J]); auto gmu=Gamma::gmu[mu_J]; c = trace(cur*g*gmu); sliceSum(c, check_buf, Tp); check_V = TensorRemove(check_buf[t_J]); std::cout<