/* * Warning: This code illustrative only: not well tested, and not meant for production use * without regression / tests being applied */ #include using namespace std; using namespace Grid; typedef SpinColourMatrix Propagator; typedef SpinColourVector Fermion; typedef PeriodicGimplR GimplR; template class CovariantLaplacianCshift : public SparseMatrixBase { public: INHERIT_GIMPL_TYPES(Gimpl); GridBase *grid; GaugeField U; CovariantLaplacianCshift(GaugeField &_U) : grid(_U.Grid()), U(_U) { }; virtual GridBase *Grid(void) { return grid; }; virtual void M (const Field &in, Field &out) { out=Zero(); for(int mu=0;mu(U, mu); // NB: Inefficent out = out - Gimpl::CovShiftForward(Umu,mu,in); out = out - Gimpl::CovShiftBackward(Umu,mu,in); out = out + 2.0*in; } }; virtual void Mdag (const Field &in, Field &out) { M(in,out);}; // Laplacian is hermitian virtual void Mdiag (const Field &in, Field &out) {assert(0);}; // Unimplemented need only for multigrid virtual void Mdir (const Field &in, Field &out,int dir, int disp){assert(0);}; // Unimplemented need only for multigrid virtual void MdirAll (const Field &in, std::vector &out) {assert(0);}; // Unimplemented need only for multigrid }; void MakePhase(Coordinate mom,LatticeComplex &phase) { GridBase *grid = phase.Grid(); auto latt_size = grid->GlobalDimensions(); ComplexD ci(0.0,1.0); phase=Zero(); LatticeComplex coor(phase.Grid()); for(int mu=0;mu Stout(rho); LatticeGaugeField Utmp(Uin.Grid()); Utmp = Uin; for(int i=0;i::avgPlaquette(U); std::cout << " Initial plaquette "<::SteepestDescentGaugeFix(Ufix,xform,alpha,100000,1.0e-14, 1.0e-14,true,orthog); plaq=WilsonLoops::avgPlaquette(Ufix); std::cout << " Final plaquette "< void GaussianSmear(LatticeGaugeField &U,Field &unsmeared,Field &smeared) { typedef CovariantLaplacianCshift Laplacian_t; Laplacian_t Laplacian(U); Integer Iterations = 40; Real width = 2.0; Real coeff = (width*width) / Real(4*Iterations); Field tmp(U.Grid()); smeared=unsmeared; // chi = (1-p^2/2N)^N kronecker for(int n = 0; n < Iterations; ++n) { Laplacian.M(smeared,tmp); smeared = smeared - coeff*tmp; std::cout << " smear iter " << n<<" " < void Solve(Action &D,LatticePropagator &source,LatticePropagator &propagator) { GridBase *UGrid = D.GaugeGrid(); GridBase *FGrid = D.FermionGrid(); LatticeFermion src4 (UGrid); LatticeFermion src5 (FGrid); LatticeFermion result5(FGrid); LatticeFermion result4(UGrid); ConjugateGradient CG(1.0e-12,100000); SchurRedBlackDiagTwoSolve schur(CG); ZeroGuesser ZG; // Could be a DeflatedGuesser if have eigenvectors for(int s=0;s(src4,source,s,c); D.ImportPhysicalFermionSource(src4,src5); result5=Zero(); schur(D,src5,result5,ZG); std::cout<(propagator,result4,s,c); } } } class MesonFile: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(MesonFile, std::vector >, data); }; void MesonTrace(std::string file,LatticePropagator &q1,LatticePropagator &q2,LatticeComplex &phase) { const int nchannel=4; Gamma::Algebra Gammas[nchannel][2] = { {Gamma::Algebra::Gamma5 ,Gamma::Algebra::Gamma5}, {Gamma::Algebra::GammaTGamma5,Gamma::Algebra::GammaTGamma5}, {Gamma::Algebra::GammaTGamma5,Gamma::Algebra::Gamma5}, {Gamma::Algebra::Gamma5 ,Gamma::Algebra::GammaTGamma5} }; Gamma G5(Gamma::Algebra::Gamma5); LatticeComplex meson_CF(q1.Grid()); MesonFile MF; for(int ch=0;ch meson_T; sliceSum(meson_CF,meson_T, Tdir); int nt=meson_T.size(); std::vector corr(nt); for(int t=0;t meson_T; sliceSum(meson_CF,meson_T, Tdir); int nt=meson_T.size(); std::vector corr(nt); for(int t=0;t &q1,std::vector &q2) { const int nchannel=4; Gamma::Algebra Gammas[nchannel][2] = { {Gamma::Algebra::Gamma5 ,Gamma::Algebra::Gamma5}, {Gamma::Algebra::GammaTGamma5,Gamma::Algebra::GammaTGamma5}, {Gamma::Algebra::GammaTGamma5,Gamma::Algebra::Gamma5}, {Gamma::Algebra::Gamma5 ,Gamma::Algebra::GammaTGamma5} }; Gamma G5(Gamma::Algebra::Gamma5); int nt=q1.size(); std::vector meson_CF(nt); MesonFile MF; for(int ch=0;ch corr(nt); for(int t=0;t 1 && argv[1][0] != '-' ) { std::cout<::ColdConfiguration(Umu); config="ColdConfig"; } // GaugeFix(Umu,Utmp); // Umu=Utmp; int nsmr=3; RealD rho=0.1; LinkSmear(nsmr,rho,Umu,Usmr); std::vector smeared_link({ 0,0,1} ); std::vector masses({ 0.004,0.02477,0.447} ); // u/d, s, c ?? std::vector M5s ({ 1.8,1.8,1.0} ); std::vector bs ({ 1.0,1.0,1.5} ); // DDM std::vector cs ({ 0.0,0.0,0.5} ); // DDM std::vector Ls_s ({ 16,16,12} ); std::vector FGrids; std::vector FrbGrids; std::vector momenta; momenta.push_back(Coordinate({0,0,0,0})); momenta.push_back(Coordinate({1,0,0,0})); momenta.push_back(Coordinate({2,0,0,0})); int nmass = masses.size(); int nmom = momenta.size(); std::vector FermActs; std::cout< boundary = {1,1,1,-1}; typedef MobiusFermionD FermionAction; FermionAction::ImplParams Params(boundary); for(int m=0;m phase(nmom,UGrid); for(int m=0;m Z2Props (nmom+nmass-1,UGrid); std::vector GFProps (nmom+nmass-1,UGrid); for(int p=0;p > wsnk_z2Props(nmom+nmass-1); std::vector > wsnk_gfProps(nmom+nmass-1); // Non-zero kaon and point and D two point // WW stick momentum on m1 (lighter) // zero momentum on m2 for(int m1=0;m1