diff --git a/tests/forces/Test_ddhmc_boundary.cc b/tests/forces/Test_ddhmc_boundary.cc new file mode 100644 index 00000000..01b11611 --- /dev/null +++ b/tests/forces/Test_ddhmc_boundary.cc @@ -0,0 +1,202 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_ddhmc_boundary.cc + + Copyright (C) 2021 + +Author: Peter Boyle + + 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 +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace Grid; + +template +void ForceTest(Action &action,LatticeGaugeField & U,MomentumFilterBase &Filter) +{ + GridBase *UGrid = U.Grid(); + std::vector seeds({1,2,3,5}); + GridSerialRNG sRNG; sRNG.SeedFixedIntegers(seeds); + GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds); + + LatticeColourMatrix Pmu(UGrid); + LatticeGaugeField P(UGrid); + LatticeGaugeField UdSdU(UGrid); + + std::cout << GridLogMessage << "*********************************************************"<::HotConfiguration(RNG4,U); + + action.refresh(U,sRNG,RNG4); + + std::cout << GridLogMessage << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<(UdSdU,mu); + Pmu= PeekIndex(P,mu); + dS = dS - trace(Pmu*UdSdUmu)*eps*2.0*2.0; + } + ComplexD dSpred = sum(dS); + RealD diff = S2-S1-dSpred.real(); + + std::cout<< GridLogMessage << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++"< FilterNone; + ForceTest(PlaqAction,U,FilterNone); + ForceTest(RectAction,U,FilterNone); + + //////////////////////////////////// + // Unmodified matrix element + //////////////////////////////////// + RealD mass=0.01; + RealD M5=1.8; + + typedef DirichletFermionOperator DirichletFermion; + + Coordinate Block({16,16,16,8}); + + DomainWallFermionR DdwfPeriodic(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); + DomainWallFermionR Ddwf(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); + DirichletFermion DdwfDirichlet(Ddwf,Block); + + DomainWallFermionR PVPeriodic(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,1.0,M5); + DomainWallFermionR PV(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,1.0,M5); + DirichletFermion PVDirichlet(PV,Block); + + double StoppingCondition = 1.0e-12; + double MaxCGIterations = 10000; + ConjugateGradient CG(StoppingCondition,MaxCGIterations); + + // DDHMCFilter FilterDDHMC(Block,1); + DirichletFilter FilterDDHMC(Block); + + //////////////////// Two Flavour Determinant Ratio /////////////////////////////// + typedef WilsonImplR FermionImplPolicy; + TwoFlavourRatioPseudoFermionAction Nf2(PVPeriodic, DdwfPeriodic,CG,CG); + ForceTest(Nf2,U,FilterNone); + + //////////////////// Two Flavour Determinant force test Even Odd /////////////////////////////// + TwoFlavourEvenOddRatioPseudoFermionAction Nf2eo(PVPeriodic, DdwfPeriodic,CG,CG); + ForceTest(Nf2eo,U,FilterNone); + + //////////////////// DDHMC Boundary force /////////////////////////////// + + SchurFactoredFermionOperator + SchurDwf(DdwfPeriodic, + DdwfDirichlet, + CG,Block); + + SchurFactoredFermionOperator + SchurPV(PVPeriodic, + PVDirichlet, + CG,Block); + + + + DomainDecomposedBoundaryTwoFlavourPseudoFermion DBPFA(SchurDwf,CG,CG); + ForceTest(DBPFA,U,FilterDDHMC); + + DomainDecomposedBoundaryTwoFlavourRatioPseudoFermion DBPFRA(SchurPV,SchurDwf,CG,CG); + ForceTest(DBPFRA,U,FilterDDHMC); + + DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion DBPFBA(SchurPV,CG,CG); + ForceTest(DBPFBA,U,FilterDDHMC); + + Grid_finalize(); + +}