/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./tests/lexLattice/Test_wilson_lex.cc Copyright (C) 2026 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 */ // // Wilson fermion operator on a lexicographic (Nsimd()==1) lattice. // // Exercises the spin-projected half spinor path -- WilsonCompressor and // WilsonStencil -- which the staggered and stencil tests do not reach. // // - lexicographic Dhop against a covariant-shift reference in the same chart // - both charts from one gauge field and source, compared elementwise // - gamma5 hermiticity and the even-odd hopping term in the lex chart // #include using namespace Grid; const RealD tol = 1.0e-10; Gamma::Algebra Gmu [] = { Gamma::Algebra::GammaX, Gamma::Algebra::GammaY, Gamma::Algebra::GammaZ, Gamma::Algebra::GammaT }; typedef WilsonFermion vWilsonOp; typedef WilsonFermion lexWilsonOp; //////////////////////////////////////////////////////////////////////// // Layout interchange; both lattices share the same scalar_object. //////////////////////////////////////////////////////////////////////// template void transfer(Lattice &out,const Lattice &in) { typedef typename vobjIn::scalar_object sobj; static_assert(std::is_same::value, "transfer: lattices must share scalar_object"); GRID_ASSERT(out.Grid()->gSites() == in.Grid()->gSites()); std::vector buf; unvectorizeToLexOrdArray(buf,in); vectorizeFromLexOrdArray(buf,out); } //////////////////////////////////////////////////////////////////////// // Wilson hopping term from covariant shifts, in whichever chart Impl names //////////////////////////////////////////////////////////////////////// template void ReferenceDhop(typename Impl::FermionField &ref, const typename Impl::GaugeField &Umu, const typename Impl::FermionField &src) { typedef typename Impl::GaugeLinkField LinkField; typedef typename Impl::FermionField FermionField; GridBase *grid = src.Grid(); std::vector U(Nd,grid); for(int mu=0;mu(Umu,mu); } FermionField tmp(grid); ref = Zero(); for(int mu=0;mu