/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./tests/Test_fthmc.cc Copyright (C) 2022 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 using namespace std; using namespace Grid; typedef MobiusFermionD FermionAction; typedef WilsonImplD FimplD; typedef WilsonImplD FermionImplPolicy; template void ForceTest(Action &action,ConfigurationBase & smU,MomentumFilterBase &Filter) { LatticeGaugeField U = smU.get_U(false); // unsmeared config 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 << "*********************************************************"<(UdSdU,mu); Pmu= PeekIndex(P,mu); dS = dS - trace(Pmu*UdSdUmu)*eps*2.0*HMC_MOMENTUM_DENOMINATOR; } ComplexD dSpred = sum(dS); RealD diff = S2-S1-dSpred.real(); std::cout<< GridLogMessage << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++"< seeds({1,2,3,4,5,6,7,8}); GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds); SU::HotConfiguration(RNG4,U); #endif WilsonGaugeActionR PlaqAction(6.0); IwasakiGaugeActionR RectAction(2.13); PlaqAction.is_smeared = true; RectAction.is_smeared = true; //////////////////////////////////// // Fermion Action //////////////////////////////////// RealD mass=0.01; RealD pvmass=1.0; RealD M5=1.8; RealD b=1.5; RealD c=0.5; // Double versions std::vector boundary = {1,1,1,-1}; FermionAction::ImplParams Params(boundary); FermionAction DdwfPeriodic(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,b,c,Params); FermionAction PVPeriodic (U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,pvmass,M5,b,c,Params); double StoppingCondition = 1.0e-8; double MaxCGIterations = 50000; ConjugateGradient CG(StoppingCondition,MaxCGIterations); TwoFlavourRatioPseudoFermionAction Nf2(PVPeriodic, DdwfPeriodic,CG,CG); Nf2.is_smeared = true; //////////////////////////////////////////////// // Plaquette only FTHMC smearer //////////////////////////////////////////////// double rho = 0.1; Smear_Stout Smearer(rho); SmearedConfigurationMasked SmartConfig(UGrid,2*Nd,Smearer); SmearedConfiguration StoutConfig(UGrid,1,Smearer); JacobianAction Jacobian(&SmartConfig); //////////////////////////////////////////////// // Run some tests //////////////////////////////////////////////// MomentumFilterNone FilterNone; std::cout << " ********* FIELD TRANSFORM SMEARING ***** "<(PlaqAction,SmartConfig,FilterNone); SmartConfig.set_Field(U); ForceTest(RectAction,SmartConfig,FilterNone); SmartConfig.set_Field(U); ForceTest(Jacobian,SmartConfig,FilterNone); SmartConfig.set_Field(U); ForceTest(Nf2,SmartConfig,FilterNone); std::cout << " ********* STOUT SMEARING ***** "<(PlaqAction,StoutConfig,FilterNone); StoutConfig.set_Field(U); ForceTest(RectAction,StoutConfig,FilterNone); StoutConfig.set_Field(U); ForceTest(Nf2,StoutConfig,FilterNone); Grid_finalize(); }