/************************************************************************************* grid` physics library, www.github.com/paboyle/Grid Source file: ./tests/Test_cshift.cc Copyright (C) 2015 Author: Azusa Yamaguchi Author: Peter Boyle This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ /* END LEGAL */ #include using namespace Grid; void MomentumSpacePropagatorTest(RealD mass,RealD M5, LatticePropagator &prop) { // what type LatticeComplex GridBase *_grid = prop.Grid(); typedef LatticeFermion FermionField; typedef LatticePropagator PropagatorField; typedef typename FermionField::vector_type vector_type; typedef typename FermionField::scalar_type ScalComplex; typedef iSinglet Tcomplex; typedef Lattice > LatComplex; Gamma::Algebra Gmu [] = { Gamma::Algebra::GammaX, Gamma::Algebra::GammaY, Gamma::Algebra::GammaZ, Gamma::Algebra::GammaT }; Coordinate latt_size = _grid->_fdimensions; PropagatorField num (_grid); num = Zero(); LatComplex sk(_grid); sk = Zero(); LatComplex sk2(_grid); sk2= Zero(); LatComplex W(_grid); W= Zero(); LatComplex a(_grid); a= Zero(); LatComplex one (_grid); one = ScalComplex(1.0,0.0); LatComplex denom(_grid); denom= Zero(); LatComplex cosha(_grid); LatComplex kmu(_grid); LatComplex Wea(_grid); LatComplex Wema(_grid); ScalComplex ci(0.0,1.0); SpinColourMatrixD identity = ComplexD(1.0); for(int mu=0;mu alpha //////////////////////////////////////////// cosha = (one + W*W + sk) / (abs(W)*2.0); // FIXME Need a Lattice acosh { autoView(cosha_v,cosha,CpuRead); autoView(a_v,a,CpuWrite); for(int idx=0;idx<_grid->lSites();idx++){ Coordinate lcoor(Nd); Tcomplex cc; // RealD sgn; _grid->LocalIndexToLocalCoor(idx,lcoor); peekLocalSite(cc,cosha_v,lcoor); assert((double)real(cc)>=1.0); assert(fabs((double)imag(cc))<=1.0e-15); cc = ScalComplex(::acosh(real(cc)),0.0); pokeLocalSite(cc,a_v,lcoor); }} Wea = ( exp( a) * abs(W) ); Wema= ( exp(-a) * abs(W) ); num = num + ( one - Wema ) * mass * identity; denom= ( Wea - one ) + mass*mass * (one - Wema); prop = num/denom; } int main (int argc, char ** argv) { Grid_init(&argc,&argv); int threads = GridThread::GetThreads(); std::cout< seeds({1,2,3,4}); GridSerialRNG sRNG; sRNG.SeedFixedIntegers(seeds); // naughty seeding GridParallelRNG pRNG(&GRID); pRNG.SeedFixedIntegers(seeds); LatticeGaugeFieldD Umu(&GRID); SU3::ColdConfiguration(pRNG,Umu); // Unit gauge // Umu=Zero(); //////////////////////////////////////////////////// // Wilson test //////////////////////////////////////////////////// { LatticeFermionD src(&GRID); gaussian(pRNG,src); LatticeFermionD tmp(&GRID); LatticeFermionD ref(&GRID); RealD mass=0.01; WilsonFermionD Dw(Umu,GRID,RBGRID,mass); Dw.M(src,tmp); std::cout << "Dw src = " < 1/2 gmu (eip - emip) = i sinp gmu Kinetic = Kinetic + sin(kmu)*ci*(Gamma(Gmu[mu])*src5_p); } // NB implicit sum over mu // // 1-1/2 Dw = 1 - 1/2 ( eip+emip) // = - 1/2 (ei - 2 + emi) // = - 1/4 2 (eih - eimh)(eih - eimh) // = 2 sink/2 ink/2 = sk2 W = one - M5 + sk2; Kinetic = Kinetic + W * src5_p; LatticeCoordinate(scoor,sdir); tmp5 = Cshift(src5_p,sdir,+1); tmp5 = (tmp5 - G5*tmp5)*0.5; tmp5 = where(scoor==Integer(Ls-1),mass*tmp5,-tmp5); Kinetic = Kinetic + tmp5; tmp5 = Cshift(src5_p,sdir,-1); tmp5 = (tmp5 + G5*tmp5)*0.5; tmp5 = where(scoor==Integer(0),mass*tmp5,-tmp5); Kinetic = Kinetic + tmp5; std::cout<<"Momentum space Ddwf "<< norm2(Kinetic)< HermOp(Ddwf); ConjugateGradient CG(1.0e-16,10000); CG(HermOp,src5,result5); //////////////////////////////////////////////////////////////////////// // Domain wall physical field propagator //////////////////////////////////////////////////////////////////////// /* psi = chiralProjectMinus(psi_5[0]); psi += chiralProjectPlus(psi_5[Ls-1]); */ ExtractSlice(tmp,result5,0 ,sdir); result4 = (tmp-G5*tmp)*0.5; ExtractSlice(tmp,result5,Ls-1,sdir); result4 = result4+(tmp+G5*tmp)*0.5; std::cout << " Taking difference" < HermOp(Dov); ConjugateGradient CG(1.0e-16,10000); CG(HermOp,src5,result5); //////////////////////////////////////////////////////////////////////// // Domain wall physical field propagator //////////////////////////////////////////////////////////////////////// /* psi = chiralProjectMinus(psi_5[0]); psi += chiralProjectPlus(psi_5[Ls-1]); */ ExtractSlice(tmp,result5,0 ,sdir); result4 = (tmp-G5*tmp)*0.5; ExtractSlice(tmp,result5,Ls-1,sdir); result4 = result4+(tmp+G5*tmp)*0.5; std::cout << " Taking difference" < QEDGimplTypesD; typedef Photon QEDGaction; QEDGaction Maxwell(QEDGaction::FEYNMAN_L); QEDGaction::GaugeField Prop(&GRID);Prop=Zero(); QEDGaction::GaugeField Source(&GRID);Source=Zero(); Maxwell.FreePropagator (Source,Prop); std::cout << " MaxwellFree propagator\n"; */ } Grid_finalize(); }