mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-03 21:44:33 +00:00 
			
		
		
		
	Staggered phases first cut, c1, c2, u0
This commit is contained in:
		@@ -520,14 +520,17 @@ PARALLEL_FOR_LOOP
 | 
			
		||||
 | 
			
		||||
    INHERIT_GIMPL_TYPES(Gimpl);
 | 
			
		||||
      
 | 
			
		||||
    template <typename vtype> using iImplScalar            = iScalar<iScalar<iScalar<vtype> > >;
 | 
			
		||||
    template <typename vtype> using iImplSpinor            = iScalar<iScalar<iVector<vtype, Dimension> > >;
 | 
			
		||||
    template <typename vtype> using iImplHalfSpinor        = iVector<iScalar<iVector<vtype, Dimension> >, Ngp>;
 | 
			
		||||
    template <typename vtype> using iImplDoubledGaugeField = iVector<iScalar<iMatrix<vtype, Dimension> >, Nds>;
 | 
			
		||||
    
 | 
			
		||||
    typedef iImplScalar<Simd>            SiteComplex;
 | 
			
		||||
    typedef iImplSpinor<Simd>            SiteSpinor;
 | 
			
		||||
    typedef iImplHalfSpinor<Simd>        SiteHalfSpinor;
 | 
			
		||||
    typedef iImplDoubledGaugeField<Simd> SiteDoubledGaugeField;
 | 
			
		||||
    
 | 
			
		||||
    typedef Lattice<SiteComplex>           ComplexField;
 | 
			
		||||
    typedef Lattice<SiteSpinor>            FermionField;
 | 
			
		||||
    typedef Lattice<SiteDoubledGaugeField> DoubledGaugeField;
 | 
			
		||||
    
 | 
			
		||||
@@ -564,15 +567,46 @@ PARALLEL_FOR_LOOP
 | 
			
		||||
      conformable(Uds._grid, GaugeGrid);
 | 
			
		||||
      conformable(Umu._grid, GaugeGrid);
 | 
			
		||||
      GaugeLinkField U(GaugeGrid);
 | 
			
		||||
      GaugeLinkField UU(GaugeGrid);
 | 
			
		||||
      GaugeLinkField UUU(GaugeGrid);
 | 
			
		||||
      GaugeLinkField Udag(GaugeGrid);
 | 
			
		||||
      GaugeLinkField UUUdag(GaugeGrid);
 | 
			
		||||
      for (int mu = 0; mu < Nd; mu++) {
 | 
			
		||||
	U = PeekIndex<LorentzIndex>(Umu, mu);
 | 
			
		||||
 | 
			
		||||
	// Staggered Phase.
 | 
			
		||||
	ComplexField coor(GaugeGrid);
 | 
			
		||||
	ComplexField phases(GaugeGrid);
 | 
			
		||||
	ComplexField x(GaugeGrid); LatticeCoordinate(x,0);
 | 
			
		||||
	ComplexField y(GaugeGrid); LatticeCoordinate(y,1);
 | 
			
		||||
	ComplexField z(GaugeGrid); LatticeCoordinate(z,2);
 | 
			
		||||
	ComplexField t(GaugeGrid); LatticeCoordinate(t,3);
 | 
			
		||||
 | 
			
		||||
	SiteComplex zz(0.0,0.0);
 | 
			
		||||
	SiteComplex one(1.0,0.0);
 | 
			
		||||
 | 
			
		||||
	phases = one;
 | 
			
		||||
	if ( mu == 1 ) phases = where( mod(x    ,2)== zz, phases,-phases);
 | 
			
		||||
	if ( mu == 2 ) phases = where( mod(x+y  ,2)== zz, phases,-phases);
 | 
			
		||||
	if ( mu == 3 ) phases = where( mod(x+y+z,2)== zz, phases,-phases);
 | 
			
		||||
 | 
			
		||||
	U  = PeekIndex<LorentzIndex>(Umu, mu);
 | 
			
		||||
	UU = Gimpl::CovShiftForward(U,mu,U);
 | 
			
		||||
	UUU= Gimpl::CovShiftForward(U,mu,UU);
 | 
			
		||||
	
 | 
			
		||||
	U   = U   *phases;
 | 
			
		||||
	UUU = UUU *phases;
 | 
			
		||||
 | 
			
		||||
	PokeIndex<LorentzIndex>(Uds, U, mu);
 | 
			
		||||
	PokeIndex<LorentzIndex>(UUUds, U, mu);
 | 
			
		||||
	std::cout << GridLogMessage << " NOT created the treble links for staggered yet" <<std::endl;
 | 
			
		||||
	std::cout << GridLogMessage << " Must do this and also apply the staggered phases which requires understanding the action conventions" <<std::endl;
 | 
			
		||||
	U = adj(Cshift(U, mu, -1));
 | 
			
		||||
	PokeIndex<LorentzIndex>(Uds, U, mu + 4);
 | 
			
		||||
	PokeIndex<LorentzIndex>(UUUds, U, mu+4);
 | 
			
		||||
	PokeIndex<LorentzIndex>(UUUds, UUU, mu);
 | 
			
		||||
 | 
			
		||||
	std::cout << GridLogMessage << " Created the treble links for staggered Naik term" <<std::endl;
 | 
			
		||||
	std::cout << GridLogMessage << " Multiplied the staggered phases which requires understanding the action conventions" <<std::endl;
 | 
			
		||||
 | 
			
		||||
	Udag   = adj( Cshift(U, mu, -1));
 | 
			
		||||
	UUUdag = adj( Cshift(UUU, mu, -3));
 | 
			
		||||
	PokeIndex<LorentzIndex>(Uds, Udag, mu + 4);
 | 
			
		||||
	PokeIndex<LorentzIndex>(UUUds, UUUdag, mu+4);
 | 
			
		||||
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -43,6 +43,7 @@ ImprovedStaggeredFermionStatic::displacements({1, 1, 1, 1, -1, -1, -1, -1, 3, 3,
 | 
			
		||||
template <class Impl>
 | 
			
		||||
ImprovedStaggeredFermion<Impl>::ImprovedStaggeredFermion(GaugeField &_Umu, GridCartesian &Fgrid,
 | 
			
		||||
							 GridRedBlackCartesian &Hgrid, RealD _mass,
 | 
			
		||||
							 RealD _c1, RealD _c2,RealD _u0,
 | 
			
		||||
							 const ImplParams &p)
 | 
			
		||||
    : Kernels(p),
 | 
			
		||||
      _grid(&Fgrid),
 | 
			
		||||
@@ -51,6 +52,9 @@ ImprovedStaggeredFermion<Impl>::ImprovedStaggeredFermion(GaugeField &_Umu, GridC
 | 
			
		||||
      StencilEven(&Hgrid, npoint, Even, directions, displacements),  // source is Even
 | 
			
		||||
      StencilOdd(&Hgrid, npoint, Odd, directions, displacements),  // source is Odd
 | 
			
		||||
      mass(_mass),
 | 
			
		||||
      c1(_c1),
 | 
			
		||||
      c2(_c2),
 | 
			
		||||
      u0(_u0),
 | 
			
		||||
      Lebesgue(_grid),
 | 
			
		||||
      LebesgueEvenOdd(_cbgrid),
 | 
			
		||||
      Umu(&Fgrid),
 | 
			
		||||
@@ -63,15 +67,52 @@ ImprovedStaggeredFermion<Impl>::ImprovedStaggeredFermion(GaugeField &_Umu, GridC
 | 
			
		||||
  ImportGauge(_Umu);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
  ////////////////////////////////////////////////////////////
 | 
			
		||||
  // Momentum space propagator should be 
 | 
			
		||||
  // https://arxiv.org/pdf/hep-lat/9712010.pdf
 | 
			
		||||
  //
 | 
			
		||||
  // mom space action.
 | 
			
		||||
  //   gamma_mu i ( c1 sin pmu + c2 sin 3 pmu ) + m
 | 
			
		||||
  //
 | 
			
		||||
  // must track through staggered flavour/spin reduction in literature to 
 | 
			
		||||
  // turn to free propagator for the one component chi field, a la page 4/5
 | 
			
		||||
  // of above link to implmement fourier based solver.
 | 
			
		||||
  ////////////////////////////////////////////////////////////
 | 
			
		||||
template <class Impl>
 | 
			
		||||
void ImprovedStaggeredFermion<Impl>::ImportGauge(const GaugeField &_Umu) {
 | 
			
		||||
  GaugeField HUmu(_Umu._grid);
 | 
			
		||||
  HUmu = _Umu * (-0.5);
 | 
			
		||||
  Impl::DoubleStore(GaugeGrid(), Umu, UUUmu, HUmu);
 | 
			
		||||
 | 
			
		||||
  GaugeLinkField U(GaugeGrid);
 | 
			
		||||
 | 
			
		||||
  ////////////////////////////////////////////////////////
 | 
			
		||||
  // Double Store should take two fields for Naik and one hop separately.
 | 
			
		||||
  ////////////////////////////////////////////////////////
 | 
			
		||||
  Impl::DoubleStore(GaugeGrid(), Umu, UUUmu, _Umu);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  ////////////////////////////////////////////////////////
 | 
			
		||||
  // Apply scale factors to get the right fermion Kinetic term
 | 
			
		||||
  // 
 | 
			
		||||
  // 0.5 ( U p(x+mu) - Udag(x-mu) p(x-mu) ) 
 | 
			
		||||
  ////////////////////////////////////////////////////////
 | 
			
		||||
  for (int mu = 0; mu < Nd; mu++) {
 | 
			
		||||
 | 
			
		||||
    U = PeekIndex<LorentzIndex>(Umu, mu);
 | 
			
		||||
    PokeIndex<LorentzIndex>(Umu, U*( 0.5*c1/u0), mu );
 | 
			
		||||
    
 | 
			
		||||
    U = PeekIndex<LorentzIndex>(Umu, mu+4);
 | 
			
		||||
    PokeIndex<LorentzIndex>(Umu, U*(-0.5*c1/u0), mu+4);
 | 
			
		||||
 | 
			
		||||
    U = PeekIndex<LorentzIndex>(UUUmu, mu);
 | 
			
		||||
    PokeIndex<LorentzIndex>(UUUmu, U*( 0.5*c2/u0/u0/u0), mu );
 | 
			
		||||
    
 | 
			
		||||
    U = PeekIndex<LorentzIndex>(UUUmu, mu+4);
 | 
			
		||||
    PokeIndex<LorentzIndex>(UUUmu, U*(-0.5*c2/u0/u0/u0), mu+4);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  pickCheckerboard(Even, UmuEven, Umu);
 | 
			
		||||
  pickCheckerboard(Odd, UmuOdd, Umu);
 | 
			
		||||
  pickCheckerboard(Odd,  UmuOdd , Umu);
 | 
			
		||||
  pickCheckerboard(Even, UUUmuEven, UUUmu);
 | 
			
		||||
  pickCheckerboard(Odd, UUUmuOdd, UUUmu);
 | 
			
		||||
  pickCheckerboard(Odd,   UUUmuOdd, UUUmu);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/////////////////////////////
 | 
			
		||||
 
 | 
			
		||||
@@ -108,6 +108,7 @@ class ImprovedStaggeredFermion : public StaggeredKernels<Impl>, public ImprovedS
 | 
			
		||||
  // Constructor
 | 
			
		||||
  ImprovedStaggeredFermion(GaugeField &_Umu, GridCartesian &Fgrid,
 | 
			
		||||
			   GridRedBlackCartesian &Hgrid, RealD _mass,
 | 
			
		||||
			   RealD _c1=9.0/8.0, RealD _c2=-1.0/24.0,RealD _u0,
 | 
			
		||||
			   const ImplParams &p = ImplParams());
 | 
			
		||||
 | 
			
		||||
  // DoubleStore impl dependent
 | 
			
		||||
@@ -122,6 +123,9 @@ class ImprovedStaggeredFermion : public StaggeredKernels<Impl>, public ImprovedS
 | 
			
		||||
  // any other parameters of action ???
 | 
			
		||||
 | 
			
		||||
  RealD mass;
 | 
			
		||||
  RealD u0;
 | 
			
		||||
  RealD c1;
 | 
			
		||||
  RealD c2;
 | 
			
		||||
 | 
			
		||||
  GridBase *_grid;
 | 
			
		||||
  GridBase *_cbgrid;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user