diff --git a/tests/forces/Test_fthmc.cc b/tests/forces/Test_fthmc.cc new file mode 100644 index 00000000..0a64cdb9 --- /dev/null +++ b/tests/forces/Test_fthmc.cc @@ -0,0 +1,170 @@ +/************************************************************************************* + + 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; + + +template +void ForceTest(Action &action,SmearedConfigurationMasked & 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*2.0; + } + 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 + + + RealD beta=6.0; + WilsonGaugeActionR PlaqAction(beta); + IwasakiGaugeActionR RectAction(beta); + + + //////////////////////////////////////////////// + // Plaquette only FTHMC smearer + //////////////////////////////////////////////// + double rho = 0.1; + Smear_Stout Smearer(rho); + SmearedConfigurationMasked SmartConfig(UGrid,2*Nd,Smearer,true); + + JacobianAction Jacobian(&SmartConfig); + + //////////////////////////////////////////////// + // Run some tests + //////////////////////////////////////////////// + MomentumFilterNone FilterNone; + SmartConfig.set_Field(U); + ForceTest(PlaqAction,SmartConfig,FilterNone); + SmartConfig.set_Field(U); + ForceTest(RectAction,SmartConfig,FilterNone); + SmartConfig.set_Field(U); + ForceTest(Jacobian,SmartConfig,FilterNone); + + Grid_finalize(); +}