From 48db72259e66d6486d35e1e7ff2df6da74057648 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Tue, 18 Aug 2015 18:37:39 +0100 Subject: [PATCH] EvenOdd schur decomposed mpcdagmpc version of rhmc determinant. dH is also small and plaquette looks right. --- .../pseudofermion/OneFlavourEvenOddRational.h | 185 ++++++++++++++++++ tests/Test_rhmc_EOWilson1p1.cc | 55 ++++++ 2 files changed, 240 insertions(+) create mode 100644 lib/qcd/action/pseudofermion/OneFlavourEvenOddRational.h create mode 100644 tests/Test_rhmc_EOWilson1p1.cc diff --git a/lib/qcd/action/pseudofermion/OneFlavourEvenOddRational.h b/lib/qcd/action/pseudofermion/OneFlavourEvenOddRational.h new file mode 100644 index 00000000..beb3abc1 --- /dev/null +++ b/lib/qcd/action/pseudofermion/OneFlavourEvenOddRational.h @@ -0,0 +1,185 @@ +#ifndef QCD_PSEUDOFERMION_ONE_FLAVOUR_EVEN_ODD_RATIONAL_H +#define QCD_PSEUDOFERMION_ONE_FLAVOUR_EVEN_ODD_RATIONAL_H + +namespace Grid{ + namespace QCD{ + + /////////////////////////////////////// + // One flavour rational + /////////////////////////////////////// + + // S_f = chi^dag * N(Mpc^dag*Mpc)/D(Mpc^dag*Mpc) * chi + // + // Here, M is some operator + // N and D makeup the rat. poly + // + + template + class OneFlavourEvenOddRationalPseudoFermionAction : public Action { + public: + INHERIT_IMPL_TYPES(Impl); + + typedef OneFlavourRationalParams Params; + Params param; + + MultiShiftFunction PowerHalf ; + MultiShiftFunction PowerNegHalf; + MultiShiftFunction PowerQuarter; + MultiShiftFunction PowerNegQuarter; + + private: + + FermionOperator & FermOp;// the basic operator + + // NOT using "Nroots"; IroIro is -- perhaps later, but this wasn't good for us historically + // and hasenbusch works better + + FermionField PhiEven; // the pseudo fermion field for this trajectory + FermionField PhiOdd; // the pseudo fermion field for this trajectory + + + public: + + OneFlavourEvenOddRationalPseudoFermionAction(FermionOperator &Op, + Params & p ) : FermOp(Op), + PhiEven(Op.FermionRedBlackGrid()), + PhiOdd (Op.FermionRedBlackGrid()), + param(p) + { + AlgRemez remez(param.lo,param.hi,param.precision); + + // MdagM^(+- 1/2) + std::cout< sig^2 = 0.5. + // + // So eta should be of width sig = 1/sqrt(2). + + RealD scale = std::sqrt(0.5); + + FermionField eta (FermOp.FermionGrid()); + FermionField etaOdd (FermOp.FermionRedBlackGrid()); + FermionField etaEven(FermOp.FermionRedBlackGrid()); + + gaussian(pRNG,eta); eta=eta*scale; + + pickCheckerboard(Even,etaEven,eta); + pickCheckerboard(Odd,etaOdd,eta); + + FermOp.ImportGauge(U); + + // mutishift CG + SchurDifferentiableOperator Mpc(FermOp); + ConjugateGradientMultiShift msCG(param.MaxIter,PowerQuarter); + msCG(Mpc,etaOdd,PhiOdd); + + ////////////////////////////////////////////////////// + // FIXME : Clover term not yet.. + ////////////////////////////////////////////////////// + + assert(FermOp.ConstEE() == 1); + PhiEven = zero; + + }; + + ////////////////////////////////////////////////////// + // S = phi^dag (Mdag M)^-1/2 phi + ////////////////////////////////////////////////////// + virtual RealD S(const GaugeField &U) { + + FermOp.ImportGauge(U); + + FermionField Y(FermOp.FermionRedBlackGrid()); + + SchurDifferentiableOperator Mpc(FermOp); + + ConjugateGradientMultiShift msCG(param.MaxIter,PowerNegQuarter); + + msCG(Mpc,PhiOdd,Y); + + RealD action = norm2(Y); + std::cout << GridLogMessage << "Pseudofermion action FIXME -- is -1/4 solve or -1/2 solve faster??? "< MPhi_k (Npole,FermOp.FermionRedBlackGrid()); + + FermionField X(FermOp.FermionRedBlackGrid()); + FermionField Y(FermOp.FermionRedBlackGrid()); + + GaugeField tmp(FermOp.GaugeGrid()); + + FermOp.ImportGauge(U); + + SchurDifferentiableOperator Mpc(FermOp); + + ConjugateGradientMultiShift msCG(param.MaxIter,PowerNegHalf); + + msCG(Mpc,PhiOdd,MPhi_k); + + dSdU = zero; + for(int k=0;k latt_size = GridDefaultLatt(); + std::vector simd_layout = GridDefaultSimd(4,vComplex::Nsimd()); + std::vector mpi_layout = GridDefaultMpi(); + + GridCartesian Fine(latt_size,simd_layout,mpi_layout); + GridRedBlackCartesian RBFine(latt_size,simd_layout,mpi_layout); + GridParallelRNG pRNG(&Fine); + pRNG.SeedRandomDevice(); + LatticeLorentzColourMatrix U(&Fine); + + SU3::HotConfiguration(pRNG, U); + + // simplify template declaration? Strip the lorentz from the second template + WilsonGaugeAction Waction(5.6); + + Real mass=-0.77; + WilsonFermionR FermOp(U,Fine,RBFine,mass); + + // 1+1 flavour + OneFlavourRationalParams Params(1.0e-4,64.0,1000,1.0e-6); + OneFlavourEvenOddRationalPseudoFermionAction WilsonNf1a(FermOp,Params); + OneFlavourEvenOddRationalPseudoFermionAction WilsonNf1b(FermOp,Params); + + //Collect actions + ActionLevel Level1; + Level1.push_back(&WilsonNf1a); + Level1.push_back(&WilsonNf1b); + Level1.push_back(&Waction); + + ActionSet FullSet; + FullSet.push_back(Level1); + + // Create integrator + typedef MinimumNorm2 IntegratorAlgorithm;// change here to change the algorithm + + IntegratorParameters MDpar(12,20,1.0); + Integrator MDynamics(&Fine,MDpar, FullSet); + + // Create HMC + HMCparameters HMCpar; + HybridMonteCarlo HMC(HMCpar, MDynamics); + HMC.evolve(U); + +}