#include using namespace std; using namespace Grid; using namespace Grid::QCD; typedef typename GparityDomainWallFermionR::FermionField FermionField; template void Replicate(Lattice &coarse,Lattice & fine) { typedef typename vobj::scalar_object sobj; GridBase *cg = coarse._grid; GridBase *fg = fine._grid; int nd = cg->_ndimension; subdivides(cg,fg); assert(cg->_ndimension==fg->_ndimension); std::vector ratio(cg->_ndimension); for(int d=0;d_ndimension;d++){ ratio[d] = fg->_fdimensions[d]/cg->_fdimensions[d]; } std::vector fcoor(nd); std::vector ccoor(nd); for(int g=0;ggSites();g++){ fg->GlobalIndexToGlobalCoor(g,fcoor); for(int d=0;d_gdimensions[d]; } sobj tmp; peekSite(tmp,coarse,ccoor); pokeSite(tmp,fine,fcoor); } } int main (int argc, char ** argv) { const int nu = 0; Grid_init(&argc,&argv); const int Ls=4; const int L =4; std::vector latt_2f(Nd,L); std::vector latt_1f(Nd,L); latt_1f[nu] = 2*L; std::vector simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd()); std::vector mpi_layout = GridDefaultMpi(); //node layout GridCartesian * UGrid_1f = SpaceTimeGrid::makeFourDimGrid(latt_1f, simd_layout, mpi_layout); GridRedBlackCartesian * UrbGrid_1f = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid_1f); GridCartesian * FGrid_1f = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid_1f); GridRedBlackCartesian * FrbGrid_1f = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid_1f); GridCartesian * UGrid_2f = SpaceTimeGrid::makeFourDimGrid(latt_2f, simd_layout, mpi_layout); GridRedBlackCartesian * UrbGrid_2f = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid_2f); GridCartesian * FGrid_2f = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid_2f); GridRedBlackCartesian * FrbGrid_2f = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid_2f); std::vector seeds4({1,2,3,4}); std::vector seeds5({5,6,7,8}); GridParallelRNG RNG5_2f(FGrid_2f); RNG5_2f.SeedFixedIntegers(seeds5); GridParallelRNG RNG4_2f(UGrid_2f); RNG4_2f.SeedFixedIntegers(seeds4); LatticeGaugeField Umu_2f(UGrid_2f); SU3::HotConfiguration(RNG4_2f,Umu_2f); LatticeFermion src (FGrid_2f); LatticeFermion tmpsrc(FGrid_2f); FermionField src_2f(FGrid_2f); LatticeFermion src_1f(FGrid_1f); // Replicate fermion source random(RNG5_2f,src); PokeIndex<0>(src_2f,src,0); tmpsrc=src*2.0; PokeIndex<0>(src_2f,tmpsrc,1); LatticeFermion result_1f(FGrid_1f); result_1f=zero; LatticeGaugeField Umu_1f(UGrid_1f); Replicate(Umu_2f,Umu_1f); //Coordinate grid for reference LatticeInteger xcoor_1f(UGrid_1f); LatticeCoordinate(xcoor_1f,nu); //Copy-conjugate the gauge field //First C-shift the lattice by Lx/2 { LatticeGaugeField Umu_shift = conjugate( Cshift(Umu_1f,nu,L) ); Umu_1f = where( xcoor_1f >= Integer(L), Umu_shift, Umu_1f ); // hack test to check the same Replicate(Umu_2f,Umu_shift); Umu_shift=Umu_shift-Umu_1f; cout << GridLogMessage << "Umu diff " << norm2(Umu_shift)<(Umu_1f,nu); Unu = where(xcoor_1f == Integer(2*L-1), -Unu, Unu); PokeIndex(Umu_1f,Unu,nu); } //Coordinate grid for reference LatticeInteger xcoor_1f5(FGrid_1f); LatticeCoordinate(xcoor_1f5,1+nu); Replicate(src,src_1f); src_1f = where( xcoor_1f5 >= Integer(L), 2.0*src_1f,src_1f ); RealD mass=0.0; RealD M5=1.8; DomainWallFermionR Ddwf(Umu_1f,*FGrid_1f,*FrbGrid_1f,*UGrid_1f,*UrbGrid_1f,mass,M5); LatticeFermion src_o_1f(FrbGrid_1f); LatticeFermion result_o_1f(FrbGrid_1f); pickCheckerboard(Odd,src_o_1f,src_1f); result_o_1f=zero; SchurDiagMooeeOperator HermOpEO(Ddwf); ConjugateGradient CG(1.0e-8,10000); CG(HermOpEO,src_o_1f,result_o_1f); GparityDomainWallFermionR GPDdwf(Umu_2f,*FGrid_2f,*FrbGrid_2f,*UGrid_2f,*UrbGrid_2f,mass,M5); for(int disp=-1;disp<=1;disp+=2) for(int mu=0;mu<5;mu++) { FermionField Dsrc_2f(FGrid_2f); LatticeFermion Dsrc_1f(FGrid_1f); LatticeFermion Dsrc_2freplica(FGrid_1f); LatticeFermion Dsrc_2freplica0(FGrid_1f); LatticeFermion Dsrc_2freplica1(FGrid_1f); if ( mu ==0 ) { std::cout << GridLogMessage<< " Cross checking entire hopping term"<(Dsrc_2f,0); LatticeFermion Dsrc_2f1(FGrid_2f); Dsrc_2f1 = PeekIndex<0>(Dsrc_2f,1); // Dsrc_2f1 = Dsrc_2f1 - Dsrc_2f0; // std::cout << GridLogMessage << " Cross check two halves " <= Integer(L), Dsrc_2freplica1,Dsrc_2freplica0 ); Dsrc_2freplica = Dsrc_2freplica - Dsrc_1f ; std::cout << GridLogMessage << " Cross check against doubled latt " < CG2f(1.0e-8,10000); SchurDiagMooeeOperator HermOpEO2f(GPDdwf); CG2f(HermOpEO2f,src_o_2f,result_o_2f); std::cout << "2f cb "<(result_o_2f,0); res1o = PeekIndex<0>(result_o_2f,1); std::cout << "res cb "<= Integer(L), replica1,replica0 ); replica0 = zero; setCheckerboard(replica0,result_o_1f); std::cout << "Norm2 solutions is " <