/* * 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; 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::avgPlaquette(U); std::cout << " Initial plaquette "<::SteepestDescentGaugeFix(Ufix,xform,alpha,10000,1.0e-12, 1.0e-12,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-8,100000); SchurRedBlackDiagMooeeSolve 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 &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 seeds4({1,2,3,4}); GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4); LatticeGaugeField Umu(UGrid); LatticeGaugeField Ufixed(UGrid); std::string config; if( argc > 1 && argv[1][0] != '-' ) { std::cout<::ColdConfiguration(Umu); // SU::HotConfiguration(RNG4,Umu); config="HotConfig"; } GaugeFix(Umu,Ufixed); Umu=Ufixed; 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; int nmass = masses.size(); std::vector FermActs; std::cout< PointProps(nmass,UGrid); std::vector GaussProps(nmass,UGrid); std::vector Z2Props (nmass,UGrid); std::vector GFProps (nmass,UGrid); for(int m=0;m > wsnk_z2Props(nmass); std::vector > wsnk_gfProps(nmass); for(int m=0;m