1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00
Grid/tests/sp2n/Test_hmc_Sp_Wilson2ASFermionGauge.cc

92 lines
2.6 KiB
C++
Raw Normal View History

2021-11-04 18:27:35 +00:00
#include <Grid/Grid.h>
2023-05-15 18:37:33 +01:00
int main(int argc, char** argv) {
2021-11-04 18:27:35 +00:00
using namespace Grid;
2023-05-15 18:36:05 +01:00
typedef Representations<SpFundamentalRepresentation,
SpTwoIndexAntiSymmetricRepresentation>
TheRepresentations;
2021-11-04 18:27:35 +00:00
Grid_init(&argc, &argv);
2023-05-15 18:36:05 +01:00
typedef GenericSp2nHMCRunnerHirep<TheRepresentations, MinimumNorm2>
HMCWrapper;
2021-11-04 18:27:35 +00:00
typedef SpWilsonTwoIndexAntiSymmetricImplR FermionImplPolicy;
typedef SpWilsonTwoIndexAntiSymmetricFermionR FermionAction;
typedef typename FermionAction::FermionField FermionField;
2023-05-15 18:36:05 +01:00
2021-11-04 18:27:35 +00:00
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2023-05-15 18:36:05 +01:00
2021-11-04 18:27:35 +00:00
HMCWrapper TheHMC;
2023-05-15 18:36:05 +01:00
2021-11-04 18:27:35 +00:00
TheHMC.Resources.AddFourDimGrid("gauge");
2023-05-15 18:36:05 +01:00
2021-11-04 18:27:35 +00:00
// Checkpointer definition
CheckpointerParameters CPparams;
CPparams.config_prefix = "ckpoint_lat";
CPparams.rng_prefix = "ckpoint_rng";
2022-11-25 13:10:29 +00:00
CPparams.saveInterval = 100;
2021-11-04 18:27:35 +00:00
CPparams.format = "IEEE64BIG";
2023-05-15 18:36:05 +01:00
2021-11-04 18:27:35 +00:00
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
RNGModuleParameters RNGpar;
RNGpar.serial_seeds = "1 2 3 4 5";
RNGpar.parallel_seeds = "6 7 8 9 10";
TheHMC.Resources.SetRNGSeeds(RNGpar);
// Construct observables
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
TheHMC.Resources.AddObservable<PlaqObs>();
2023-05-15 18:36:05 +01:00
RealD beta = 6.7;
2023-04-18 11:50:20 +01:00
SpWilsonGaugeActionR Waction(beta);
2023-05-15 18:36:05 +01:00
2021-11-04 18:27:35 +00:00
auto GridPtr = TheHMC.Resources.GetCartesian();
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
2023-05-15 18:36:05 +01:00
SpTwoIndexAntiSymmetricRepresentation::LatticeField U(GridPtr);
// LatticeGaugeField U(GridPtr);
2022-11-25 13:10:29 +00:00
RealD mass = -0.115;
2021-11-04 18:27:35 +00:00
2023-05-15 18:36:05 +01:00
std::vector<Complex> boundary = {-1, -1, -1, -1};
2021-11-04 18:27:35 +00:00
FermionAction::ImplParams bc(boundary);
FermionAction FermOp(U, *GridPtr, *GridRBPtr, mass, bc);
2023-05-15 18:36:05 +01:00
2021-11-04 18:27:35 +00:00
ConjugateGradient<FermionField> CG(1.0e-8, 2000, false);
2023-05-15 18:36:05 +01:00
2021-11-04 18:27:35 +00:00
TwoFlavourPseudoFermionAction<FermionImplPolicy> Nf2(FermOp, CG, CG);
2023-05-15 18:36:05 +01:00
2021-11-04 18:27:35 +00:00
Nf2.is_smeared = false;
std::cout << GridLogMessage << "mass " << mass << std::endl;
2023-05-15 18:36:05 +01:00
ActionLevel<HMCWrapper::Field, TheRepresentations> Level1(1);
Level1.push_back(&Nf2);
ActionLevel<HMCWrapper::Field, TheRepresentations> Level2(4);
Level2.push_back(&Waction);
TheHMC.TheAction.push_back(Level1);
TheHMC.TheAction.push_back(Level2);
TheHMC.Parameters.MD.MDsteps = 16;
TheHMC.Parameters.MD.trajL = 1.0;
TheHMC.ReadCommandLine(argc, argv);
TheHMC.Run();
2023-05-15 18:37:33 +01:00
if (std::string(argv[argc - 1]).compare("--assert=true") == 0) {
// this is the pseudofermion action's value for
// --grid 4.4.4.4 --Trajectories 1 --Thermalizations 0 --StartingType
// ColdStart and Nc == 4 if this assertion fails, check that you have run
// with these exact parameters
assert(Nc == 4);
assert(abs(Nf2.S(U) - 6586.6498) < 1.e-4);
}
2021-11-04 18:27:35 +00:00
Grid_finalize();
}