2016-06-03 11:24:26 +01:00
|
|
|
/*************************************************************************************
|
2016-01-02 14:51:32 +00:00
|
|
|
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
|
|
|
Source file: ./lib/qcd/action/fermion/WilsonFermion5D.cc
|
|
|
|
|
|
|
|
Copyright (C) 2015
|
|
|
|
|
|
|
|
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
|
|
|
Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
|
|
|
|
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|
|
|
Author: Peter Boyle <peterboyle@Peters-MacBook-Pro-2.local>
|
|
|
|
Author: paboyle <paboyle@ph.ed.ac.uk>
|
|
|
|
|
|
|
|
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 */
|
2017-02-22 18:09:33 +00:00
|
|
|
#include <Grid/qcd/action/fermion/FermionCore.h>
|
|
|
|
#include <Grid/qcd/action/fermion/WilsonFermion5D.h>
|
|
|
|
#include <Grid/perfmon/PerfCount.h>
|
2015-05-31 15:09:02 +01:00
|
|
|
|
|
|
|
namespace Grid {
|
|
|
|
namespace QCD {
|
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
// S-direction is INNERMOST and takes no part in the parity.
|
|
|
|
const std::vector<int> WilsonFermion5DStatic::directions ({1,2,3,4, 1, 2, 3, 4});
|
|
|
|
const std::vector<int> WilsonFermion5DStatic::displacements({1,1,1,1,-1,-1,-1,-1});
|
2015-05-31 15:09:02 +01:00
|
|
|
|
|
|
|
// 5d lattice for DWF.
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
|
|
|
WilsonFermion5D<Impl>::WilsonFermion5D(GaugeField &_Umu,
|
2016-10-06 17:52:45 +01:00
|
|
|
GridCartesian &FiveDimGrid,
|
|
|
|
GridRedBlackCartesian &FiveDimRedBlackGrid,
|
|
|
|
GridCartesian &FourDimGrid,
|
|
|
|
GridRedBlackCartesian &FourDimRedBlackGrid,
|
|
|
|
RealD _M5,const ImplParams &p) :
|
2015-08-15 23:25:49 +01:00
|
|
|
Kernels(p),
|
2016-07-14 23:54:35 +01:00
|
|
|
_FiveDimGrid (&FiveDimGrid),
|
2015-05-31 15:09:02 +01:00
|
|
|
_FiveDimRedBlackGrid(&FiveDimRedBlackGrid),
|
2016-07-14 23:54:35 +01:00
|
|
|
_FourDimGrid (&FourDimGrid),
|
2015-05-31 15:09:02 +01:00
|
|
|
_FourDimRedBlackGrid(&FourDimRedBlackGrid),
|
|
|
|
Stencil (_FiveDimGrid,npoint,Even,directions,displacements),
|
|
|
|
StencilEven(_FiveDimRedBlackGrid,npoint,Even,directions,displacements), // source is Even
|
|
|
|
StencilOdd (_FiveDimRedBlackGrid,npoint,Odd ,directions,displacements), // source is Odd
|
2015-06-02 16:57:12 +01:00
|
|
|
M5(_M5),
|
2015-05-31 15:09:02 +01:00
|
|
|
Umu(_FourDimGrid),
|
|
|
|
UmuEven(_FourDimRedBlackGrid),
|
|
|
|
UmuOdd (_FourDimRedBlackGrid),
|
|
|
|
Lebesgue(_FourDimGrid),
|
2016-12-08 17:28:28 +00:00
|
|
|
LebesgueEvenOdd(_FourDimRedBlackGrid),
|
|
|
|
_tmp(&FiveDimRedBlackGrid)
|
2015-05-31 15:09:02 +01:00
|
|
|
{
|
2016-12-16 16:55:36 +00:00
|
|
|
// some assertions
|
|
|
|
assert(FiveDimGrid._ndimension==5);
|
|
|
|
assert(FourDimGrid._ndimension==4);
|
|
|
|
assert(FourDimRedBlackGrid._ndimension==4);
|
|
|
|
assert(FiveDimRedBlackGrid._ndimension==5);
|
|
|
|
assert(FiveDimRedBlackGrid._checker_dim==1); // Don't checker the s direction
|
|
|
|
|
|
|
|
// extent of fifth dim and not spread out
|
|
|
|
Ls=FiveDimGrid._fdimensions[0];
|
|
|
|
assert(FiveDimRedBlackGrid._fdimensions[0]==Ls);
|
|
|
|
assert(FiveDimGrid._processors[0] ==1);
|
|
|
|
assert(FiveDimRedBlackGrid._processors[0] ==1);
|
|
|
|
|
|
|
|
// Other dimensions must match the decomposition of the four-D fields
|
|
|
|
for(int d=0;d<4;d++){
|
|
|
|
|
|
|
|
assert(FiveDimGrid._processors[d+1] ==FourDimGrid._processors[d]);
|
|
|
|
assert(FiveDimRedBlackGrid._processors[d+1] ==FourDimGrid._processors[d]);
|
|
|
|
assert(FourDimRedBlackGrid._processors[d] ==FourDimGrid._processors[d]);
|
|
|
|
|
|
|
|
assert(FiveDimGrid._fdimensions[d+1] ==FourDimGrid._fdimensions[d]);
|
|
|
|
assert(FiveDimRedBlackGrid._fdimensions[d+1]==FourDimGrid._fdimensions[d]);
|
|
|
|
assert(FourDimRedBlackGrid._fdimensions[d] ==FourDimGrid._fdimensions[d]);
|
|
|
|
|
|
|
|
assert(FiveDimGrid._simd_layout[d+1] ==FourDimGrid._simd_layout[d]);
|
|
|
|
assert(FiveDimRedBlackGrid._simd_layout[d+1]==FourDimGrid._simd_layout[d]);
|
|
|
|
assert(FourDimRedBlackGrid._simd_layout[d] ==FourDimGrid._simd_layout[d]);
|
|
|
|
}
|
|
|
|
|
2016-07-14 23:54:35 +01:00
|
|
|
if (Impl::LsVectorised) {
|
|
|
|
|
|
|
|
int nsimd = Simd::Nsimd();
|
|
|
|
|
|
|
|
// Dimension zero of the five-d is the Ls direction
|
|
|
|
assert(FiveDimGrid._simd_layout[0] ==nsimd);
|
|
|
|
assert(FiveDimRedBlackGrid._simd_layout[0]==nsimd);
|
|
|
|
|
|
|
|
for(int d=0;d<4;d++){
|
|
|
|
assert(FourDimGrid._simd_layout[d]=1);
|
|
|
|
assert(FourDimRedBlackGrid._simd_layout[d]=1);
|
|
|
|
assert(FiveDimRedBlackGrid._simd_layout[d+1]==1);
|
|
|
|
}
|
2015-05-31 15:09:02 +01:00
|
|
|
|
2016-07-14 23:54:35 +01:00
|
|
|
} else {
|
|
|
|
|
|
|
|
// Dimension zero of the five-d is the Ls direction
|
|
|
|
assert(FiveDimRedBlackGrid._simd_layout[0]==1);
|
|
|
|
assert(FiveDimGrid._simd_layout[0] ==1);
|
2016-12-16 16:55:36 +00:00
|
|
|
|
2015-05-31 15:09:02 +01:00
|
|
|
}
|
2016-07-14 23:54:35 +01:00
|
|
|
|
2015-05-31 15:09:02 +01:00
|
|
|
// Allocate the required comms buffer
|
2015-07-29 09:53:39 +01:00
|
|
|
ImportGauge(_Umu);
|
2016-07-14 23:54:35 +01:00
|
|
|
}
|
|
|
|
/*
|
2016-04-19 23:38:01 +01:00
|
|
|
template<class Impl>
|
2016-06-07 21:16:56 +01:00
|
|
|
WilsonFermion5D<Impl>::WilsonFermion5D(int simd,GaugeField &_Umu,
|
2016-10-06 17:52:45 +01:00
|
|
|
GridCartesian &FiveDimGrid,
|
|
|
|
GridRedBlackCartesian &FiveDimRedBlackGrid,
|
|
|
|
GridCartesian &FourDimGrid,
|
|
|
|
RealD _M5,const ImplParams &p) :
|
2016-04-19 23:38:01 +01:00
|
|
|
{
|
|
|
|
int nsimd = Simd::Nsimd();
|
|
|
|
|
|
|
|
// some assertions
|
|
|
|
assert(FiveDimGrid._ndimension==5);
|
|
|
|
assert(FiveDimRedBlackGrid._ndimension==5);
|
|
|
|
assert(FiveDimRedBlackGrid._checker_dim==0); // Checkerboard the s-direction
|
|
|
|
assert(FourDimGrid._ndimension==4);
|
|
|
|
|
|
|
|
// Dimension zero of the five-d is the Ls direction
|
|
|
|
Ls=FiveDimGrid._fdimensions[0];
|
|
|
|
assert(FiveDimGrid._processors[0] ==1);
|
|
|
|
assert(FiveDimGrid._simd_layout[0] ==nsimd);
|
|
|
|
|
|
|
|
assert(FiveDimRedBlackGrid._fdimensions[0]==Ls);
|
|
|
|
assert(FiveDimRedBlackGrid._processors[0] ==1);
|
|
|
|
assert(FiveDimRedBlackGrid._simd_layout[0]==nsimd);
|
|
|
|
|
|
|
|
// Other dimensions must match the decomposition of the four-D fields
|
|
|
|
for(int d=0;d<4;d++){
|
|
|
|
assert(FiveDimRedBlackGrid._fdimensions[d+1]==FourDimGrid._fdimensions[d]);
|
|
|
|
assert(FiveDimRedBlackGrid._processors[d+1] ==FourDimGrid._processors[d]);
|
|
|
|
|
|
|
|
assert(FourDimGrid._simd_layout[d]=1);
|
|
|
|
assert(FiveDimRedBlackGrid._simd_layout[d+1]==1);
|
|
|
|
|
|
|
|
assert(FiveDimGrid._fdimensions[d+1] ==FourDimGrid._fdimensions[d]);
|
|
|
|
assert(FiveDimGrid._processors[d+1] ==FourDimGrid._processors[d]);
|
|
|
|
assert(FiveDimGrid._simd_layout[d+1] ==FourDimGrid._simd_layout[d]);
|
|
|
|
}
|
|
|
|
|
2016-06-07 21:16:56 +01:00
|
|
|
{
|
|
|
|
}
|
2016-04-19 23:38:01 +01:00
|
|
|
}
|
2016-07-14 23:54:35 +01:00
|
|
|
*/
|
|
|
|
|
2016-10-06 09:25:12 +01:00
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::Report(void)
|
|
|
|
{
|
2016-10-06 17:52:45 +01:00
|
|
|
std::vector<int> latt = GridDefaultLatt();
|
|
|
|
RealD volume = Ls; for(int mu=0;mu<Nd;mu++) volume=volume*latt[mu];
|
|
|
|
RealD NP = _FourDimGrid->_Nprocessors;
|
2017-02-07 06:37:10 +00:00
|
|
|
RealD NN = _FourDimGrid->NodeCount();
|
2016-10-06 17:52:45 +01:00
|
|
|
|
|
|
|
if ( DhopCalls > 0 ) {
|
|
|
|
std::cout << GridLogMessage << "#### Dhop calls report " << std::endl;
|
2017-02-07 06:37:10 +00:00
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D Number of DhopEO Calls : " << DhopCalls << std::endl;
|
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D TotalTime /Calls : " << DhopTotalTime / DhopCalls << " us" << std::endl;
|
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D CommTime /Calls : " << DhopCommTime / DhopCalls << " us" << std::endl;
|
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D FaceTime /Calls : " << DhopFaceTime / DhopCalls << " us" << std::endl;
|
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D ComputeTime1/Calls : " << DhopComputeTime / DhopCalls << " us" << std::endl;
|
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D ComputeTime2/Calls : " << DhopComputeTime2/ DhopCalls << " us" << std::endl;
|
2016-10-06 17:52:45 +01:00
|
|
|
|
2017-02-28 22:05:22 +00:00
|
|
|
// Average the compute time
|
|
|
|
_FourDimGrid->GlobalSum(DhopComputeTime);
|
|
|
|
DhopComputeTime/=NP;
|
2016-10-21 13:36:18 +01:00
|
|
|
RealD mflops = 1344*volume*DhopCalls/DhopComputeTime/2; // 2 for red black counting
|
2016-10-06 17:52:45 +01:00
|
|
|
std::cout << GridLogMessage << "Average mflops/s per call : " << mflops << std::endl;
|
2016-10-22 18:14:27 +01:00
|
|
|
std::cout << GridLogMessage << "Average mflops/s per call per rank : " << mflops/NP << std::endl;
|
2017-02-07 06:37:10 +00:00
|
|
|
std::cout << GridLogMessage << "Average mflops/s per call per node : " << mflops/NN << std::endl;
|
2016-10-06 17:52:45 +01:00
|
|
|
|
2017-02-07 06:37:10 +00:00
|
|
|
RealD Fullmflops = 1344*volume*DhopCalls/(DhopTotalTime)/2; // 2 for red black counting
|
2016-11-28 11:37:02 +00:00
|
|
|
std::cout << GridLogMessage << "Average mflops/s per call (full) : " << Fullmflops << std::endl;
|
|
|
|
std::cout << GridLogMessage << "Average mflops/s per call per rank (full): " << Fullmflops/NP << std::endl;
|
2017-02-07 06:37:10 +00:00
|
|
|
std::cout << GridLogMessage << "Average mflops/s per call per node (full): " << Fullmflops/NN << std::endl;
|
2016-11-28 11:37:02 +00:00
|
|
|
|
2016-10-06 17:52:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( DerivCalls > 0 ) {
|
2016-10-22 18:14:27 +01:00
|
|
|
std::cout << GridLogMessage << "#### Deriv calls report "<< std::endl;
|
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D Number of Deriv Calls : " <<DerivCalls <<std::endl;
|
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D CommTime/Calls : " <<DerivCommTime/DerivCalls<<" us" <<std::endl;
|
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D ComputeTime/Calls : " <<DerivComputeTime/DerivCalls<<" us" <<std::endl;
|
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D Dhop ComputeTime/Calls : " <<DerivDhopComputeTime/DerivCalls<<" us" <<std::endl;
|
|
|
|
|
|
|
|
RealD mflops = 144*volume*DerivCalls/DerivDhopComputeTime;
|
|
|
|
std::cout << GridLogMessage << "Average mflops/s per call : " << mflops << std::endl;
|
|
|
|
std::cout << GridLogMessage << "Average mflops/s per call per node : " << mflops/NP << std::endl;
|
2016-11-28 11:37:02 +00:00
|
|
|
|
|
|
|
RealD Fullmflops = 144*volume*DerivCalls/(DerivDhopComputeTime+DerivCommTime)/2; // 2 for red black counting
|
|
|
|
std::cout << GridLogMessage << "Average mflops/s per call (full) : " << Fullmflops << std::endl;
|
|
|
|
std::cout << GridLogMessage << "Average mflops/s per call per node (full): " << Fullmflops/NP << std::endl; }
|
2016-10-06 09:25:12 +01:00
|
|
|
|
2016-10-06 17:52:45 +01:00
|
|
|
if (DerivCalls > 0 || DhopCalls > 0){
|
2016-11-28 11:37:02 +00:00
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D Stencil" <<std::endl; Stencil.Report();
|
2016-10-22 18:14:27 +01:00
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D StencilEven"<<std::endl; StencilEven.Report();
|
2016-11-28 11:37:02 +00:00
|
|
|
std::cout << GridLogMessage << "WilsonFermion5D StencilOdd" <<std::endl; StencilOdd.Report();
|
2016-10-06 09:25:12 +01:00
|
|
|
}
|
|
|
|
}
|
2016-10-06 17:52:45 +01:00
|
|
|
|
2016-10-06 09:25:12 +01:00
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::ZeroCounters(void) {
|
2016-10-06 17:52:45 +01:00
|
|
|
DhopCalls = 0;
|
|
|
|
DhopCommTime = 0;
|
|
|
|
DhopComputeTime = 0;
|
2017-02-07 06:37:10 +00:00
|
|
|
DhopComputeTime2= 0;
|
|
|
|
DhopFaceTime = 0;
|
|
|
|
DhopTotalTime = 0;
|
2016-10-06 17:52:45 +01:00
|
|
|
|
|
|
|
DerivCalls = 0;
|
|
|
|
DerivCommTime = 0;
|
|
|
|
DerivComputeTime = 0;
|
|
|
|
DerivDhopComputeTime = 0;
|
|
|
|
|
2016-10-06 09:25:12 +01:00
|
|
|
Stencil.ZeroCounters();
|
|
|
|
StencilEven.ZeroCounters();
|
|
|
|
StencilOdd.ZeroCounters();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::ImportGauge(const GaugeField &_Umu)
|
2015-07-29 09:53:39 +01:00
|
|
|
{
|
2016-04-19 23:38:01 +01:00
|
|
|
GaugeField HUmu(_Umu._grid);
|
|
|
|
HUmu = _Umu*(-0.5);
|
2016-02-15 22:02:36 +00:00
|
|
|
Impl::DoubleStore(GaugeGrid(),Umu,HUmu);
|
2015-05-31 15:09:02 +01:00
|
|
|
pickCheckerboard(Even,UmuEven,Umu);
|
|
|
|
pickCheckerboard(Odd ,UmuOdd,Umu);
|
|
|
|
}
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::DhopDir(const FermionField &in, FermionField &out,int dir5,int disp)
|
2015-06-08 12:04:59 +01:00
|
|
|
{
|
2015-06-09 22:41:59 +01:00
|
|
|
int dir = dir5-1; // Maps to the ordering above in "directions" that is passed to stencil
|
|
|
|
// we drop off the innermost fifth dimension
|
2015-06-22 12:49:44 +01:00
|
|
|
// assert( (disp==1)||(disp==-1) );
|
|
|
|
// assert( (dir>=0)&&(dir<4) ); //must do x,y,z or t;
|
2015-06-08 12:04:59 +01:00
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
Compressor compressor(DaggerNo);
|
2016-01-10 19:20:16 +00:00
|
|
|
Stencil.HaloExchange(in,compressor);
|
2015-06-08 12:04:59 +01:00
|
|
|
|
|
|
|
int skip = (disp==1) ? 0 : 1;
|
|
|
|
|
|
|
|
int dirdisp = dir+skip*4;
|
2015-12-15 23:14:12 +00:00
|
|
|
int gamma = dir+(1-skip)*4;
|
2015-06-08 12:04:59 +01:00
|
|
|
|
2015-06-09 10:26:19 +01:00
|
|
|
assert(dirdisp<=7);
|
|
|
|
assert(dirdisp>=0);
|
|
|
|
|
2017-02-21 10:24:27 +00:00
|
|
|
parallel_for(int ss=0;ss<Umu._grid->oSites();ss++){
|
2015-06-08 12:04:59 +01:00
|
|
|
for(int s=0;s<Ls;s++){
|
|
|
|
int sU=ss;
|
|
|
|
int sF = s+Ls*sU;
|
2017-02-07 06:37:10 +00:00
|
|
|
Kernels::DhopDir(Stencil,Umu,Stencil.CommBuf(),sF,sU,in,out,dirdisp,gamma);
|
2015-06-08 12:04:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
2015-11-06 11:30:17 +00:00
|
|
|
void WilsonFermion5D<Impl>::DerivInternal(StencilImpl & st,
|
2016-10-06 17:52:45 +01:00
|
|
|
DoubledGaugeField & U,
|
|
|
|
GaugeField &mat,
|
|
|
|
const FermionField &A,
|
|
|
|
const FermionField &B,
|
|
|
|
int dag)
|
2015-07-26 02:54:38 +01:00
|
|
|
{
|
2016-10-06 17:52:45 +01:00
|
|
|
DerivCalls++;
|
2015-07-26 02:54:38 +01:00
|
|
|
assert((dag==DaggerNo) ||(dag==DaggerYes));
|
|
|
|
|
2015-08-01 14:06:07 +01:00
|
|
|
conformable(st._grid,A._grid);
|
|
|
|
conformable(st._grid,B._grid);
|
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
Compressor compressor(dag);
|
2015-07-26 02:54:38 +01:00
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
FermionField Btilde(B._grid);
|
|
|
|
FermionField Atilde(B._grid);
|
2015-07-26 02:54:38 +01:00
|
|
|
|
2016-10-06 17:52:45 +01:00
|
|
|
DerivCommTime-=usecond();
|
2016-01-10 19:20:16 +00:00
|
|
|
st.HaloExchange(B,compressor);
|
2016-10-06 17:52:45 +01:00
|
|
|
DerivCommTime+=usecond();
|
2015-07-31 21:58:35 +01:00
|
|
|
|
|
|
|
Atilde=A;
|
|
|
|
|
2016-10-06 17:52:45 +01:00
|
|
|
DerivComputeTime-=usecond();
|
|
|
|
for (int mu = 0; mu < Nd; mu++) {
|
2015-07-26 02:54:38 +01:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// Flip gamma if dag
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
int gamma = mu;
|
2016-10-06 17:52:45 +01:00
|
|
|
if (!dag) gamma += Nd;
|
2015-07-26 02:54:38 +01:00
|
|
|
|
|
|
|
////////////////////////
|
|
|
|
// Call the single hop
|
|
|
|
////////////////////////
|
2015-07-31 21:58:35 +01:00
|
|
|
|
2016-10-06 17:52:45 +01:00
|
|
|
DerivDhopComputeTime -= usecond();
|
2017-02-21 10:24:27 +00:00
|
|
|
parallel_for (int sss = 0; sss < U._grid->oSites(); sss++) {
|
2016-10-06 17:52:45 +01:00
|
|
|
for (int s = 0; s < Ls; s++) {
|
|
|
|
int sU = sss;
|
|
|
|
int sF = s + Ls * sU;
|
2015-08-01 14:06:07 +01:00
|
|
|
|
2016-10-06 17:52:45 +01:00
|
|
|
assert(sF < B._grid->oSites());
|
|
|
|
assert(sU < U._grid->oSites());
|
2015-07-26 02:54:38 +01:00
|
|
|
|
2017-02-07 06:37:10 +00:00
|
|
|
Kernels::DhopDir(st, U, st.CommBuf(), sF, sU, B, Btilde, mu, gamma);
|
2015-07-31 21:58:35 +01:00
|
|
|
|
2016-10-06 17:52:45 +01:00
|
|
|
////////////////////////////
|
|
|
|
// spin trace outer product
|
|
|
|
////////////////////////////
|
2015-07-31 21:58:35 +01:00
|
|
|
}
|
|
|
|
}
|
2016-10-06 17:52:45 +01:00
|
|
|
DerivDhopComputeTime += usecond();
|
|
|
|
Impl::InsertForce5D(mat, Btilde, Atilde, mu);
|
2015-07-26 02:54:38 +01:00
|
|
|
}
|
2016-10-06 17:52:45 +01:00
|
|
|
DerivComputeTime += usecond();
|
2015-07-26 02:54:38 +01:00
|
|
|
}
|
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
2016-10-22 18:14:27 +01:00
|
|
|
void WilsonFermion5D<Impl>::DhopDeriv(GaugeField &mat,
|
|
|
|
const FermionField &A,
|
|
|
|
const FermionField &B,
|
|
|
|
int dag)
|
2015-07-26 02:54:38 +01:00
|
|
|
{
|
|
|
|
conformable(A._grid,FermionGrid());
|
|
|
|
conformable(A._grid,B._grid);
|
|
|
|
conformable(GaugeGrid(),mat._grid);
|
|
|
|
|
|
|
|
mat.checkerboard = A.checkerboard;
|
|
|
|
|
|
|
|
DerivInternal(Stencil,Umu,mat,A,B,dag);
|
|
|
|
}
|
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::DhopDerivEO(GaugeField &mat,
|
2016-10-22 18:14:27 +01:00
|
|
|
const FermionField &A,
|
|
|
|
const FermionField &B,
|
|
|
|
int dag)
|
2015-07-26 02:54:38 +01:00
|
|
|
{
|
|
|
|
conformable(A._grid,FermionRedBlackGrid());
|
|
|
|
conformable(GaugeRedBlackGrid(),mat._grid);
|
|
|
|
conformable(A._grid,B._grid);
|
|
|
|
|
|
|
|
assert(B.checkerboard==Odd);
|
|
|
|
assert(A.checkerboard==Even);
|
|
|
|
mat.checkerboard = Even;
|
|
|
|
|
|
|
|
DerivInternal(StencilOdd,UmuEven,mat,A,B,dag);
|
|
|
|
}
|
|
|
|
|
2015-11-06 11:30:17 +00:00
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::DhopDerivOE(GaugeField &mat,
|
2016-10-22 18:14:27 +01:00
|
|
|
const FermionField &A,
|
|
|
|
const FermionField &B,
|
|
|
|
int dag)
|
2015-07-26 02:54:38 +01:00
|
|
|
{
|
|
|
|
conformable(A._grid,FermionRedBlackGrid());
|
|
|
|
conformable(GaugeRedBlackGrid(),mat._grid);
|
|
|
|
conformable(A._grid,B._grid);
|
|
|
|
|
|
|
|
assert(B.checkerboard==Even);
|
|
|
|
assert(A.checkerboard==Odd);
|
|
|
|
mat.checkerboard = Odd;
|
|
|
|
|
|
|
|
DerivInternal(StencilEven,UmuOdd,mat,A,B,dag);
|
|
|
|
}
|
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
2015-11-06 11:30:17 +00:00
|
|
|
void WilsonFermion5D<Impl>::DhopInternal(StencilImpl & st, LebesgueOrder &lo,
|
2016-10-22 18:14:27 +01:00
|
|
|
DoubledGaugeField & U,
|
|
|
|
const FermionField &in, FermionField &out,int dag)
|
2017-02-07 06:37:10 +00:00
|
|
|
{
|
|
|
|
DhopTotalTime-=usecond();
|
|
|
|
#ifdef GRID_OMP
|
|
|
|
if ( WilsonKernelsStatic::Comms == WilsonKernelsStatic::CommsAndCompute )
|
|
|
|
DhopInternalOverlappedComms(st,lo,U,in,out,dag);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
DhopInternalSerialComms(st,lo,U,in,out,dag);
|
|
|
|
DhopTotalTime+=usecond();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::DhopInternalOverlappedComms(StencilImpl & st, LebesgueOrder &lo,
|
|
|
|
DoubledGaugeField & U,
|
|
|
|
const FermionField &in, FermionField &out,int dag)
|
|
|
|
{
|
|
|
|
#ifdef GRID_OMP
|
|
|
|
// assert((dag==DaggerNo) ||(dag==DaggerYes));
|
|
|
|
typedef CartesianCommunicator::CommsRequest_t CommsRequest_t;
|
|
|
|
|
|
|
|
Compressor compressor(dag);
|
|
|
|
|
|
|
|
int LLs = in._grid->_rdimensions[0];
|
|
|
|
int len = U._grid->oSites();
|
|
|
|
|
|
|
|
DhopFaceTime-=usecond();
|
|
|
|
st.HaloExchangeOptGather(in,compressor);
|
|
|
|
DhopFaceTime+=usecond();
|
|
|
|
std::vector<std::vector<CommsRequest_t> > reqs;
|
|
|
|
|
|
|
|
#pragma omp parallel
|
|
|
|
{
|
|
|
|
int nthreads = omp_get_num_threads();
|
|
|
|
int me = omp_get_thread_num();
|
|
|
|
int myoff, mywork;
|
|
|
|
|
|
|
|
GridThread::GetWork(len,me-1,mywork,myoff,nthreads-1);
|
|
|
|
int sF = LLs * myoff;
|
|
|
|
|
|
|
|
if ( me == 0 ) {
|
|
|
|
DhopCommTime-=usecond();
|
|
|
|
st.CommunicateBegin(reqs);
|
|
|
|
st.CommunicateComplete(reqs);
|
|
|
|
DhopCommTime+=usecond();
|
|
|
|
} else {
|
|
|
|
// Interior links in stencil
|
|
|
|
if ( me==1 ) DhopComputeTime-=usecond();
|
|
|
|
if (dag == DaggerYes) Kernels::DhopSiteDag(st,lo,U,st.CommBuf(),sF,myoff,LLs,mywork,in,out,1,0);
|
|
|
|
else Kernels::DhopSite(st,lo,U,st.CommBuf(),sF,myoff,LLs,mywork,in,out,1,0);
|
|
|
|
if ( me==1 ) DhopComputeTime+=usecond();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DhopFaceTime-=usecond();
|
|
|
|
st.CommsMerge();
|
|
|
|
DhopFaceTime+=usecond();
|
|
|
|
|
|
|
|
#pragma omp parallel
|
|
|
|
{
|
|
|
|
int nthreads = omp_get_num_threads();
|
|
|
|
int me = omp_get_thread_num();
|
|
|
|
int myoff, mywork;
|
|
|
|
|
|
|
|
GridThread::GetWork(len,me,mywork,myoff,nthreads);
|
|
|
|
int sF = LLs * myoff;
|
|
|
|
|
|
|
|
// Exterior links in stencil
|
|
|
|
if ( me==0 ) DhopComputeTime2-=usecond();
|
|
|
|
if (dag == DaggerYes) Kernels::DhopSiteDag(st,lo,U,st.CommBuf(),sF,myoff,LLs,mywork,in,out,0,1);
|
|
|
|
else Kernels::DhopSite (st,lo,U,st.CommBuf(),sF,myoff,LLs,mywork,in,out,0,1);
|
|
|
|
if ( me==0 ) DhopComputeTime2+=usecond();
|
|
|
|
}// end parallel region
|
|
|
|
#else
|
|
|
|
assert(0);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::DhopInternalSerialComms(StencilImpl & st, LebesgueOrder &lo,
|
|
|
|
DoubledGaugeField & U,
|
|
|
|
const FermionField &in, FermionField &out,int dag)
|
2015-05-31 15:09:02 +01:00
|
|
|
{
|
2015-06-22 12:49:44 +01:00
|
|
|
// assert((dag==DaggerNo) ||(dag==DaggerYes));
|
2015-08-10 20:47:44 +01:00
|
|
|
Compressor compressor(dag);
|
2015-05-31 15:09:02 +01:00
|
|
|
|
2016-04-19 23:38:01 +01:00
|
|
|
int LLs = in._grid->_rdimensions[0];
|
2015-11-06 11:47:14 +00:00
|
|
|
|
2016-10-06 17:52:45 +01:00
|
|
|
DhopCommTime-=usecond();
|
2016-12-27 11:23:13 +00:00
|
|
|
st.HaloExchangeOpt(in,compressor);
|
2016-10-06 17:52:45 +01:00
|
|
|
DhopCommTime+=usecond();
|
2015-05-31 15:09:02 +01:00
|
|
|
|
2016-10-06 17:52:45 +01:00
|
|
|
DhopComputeTime-=usecond();
|
2015-05-31 15:09:02 +01:00
|
|
|
// Dhop takes the 4d grid from U, and makes a 5d index for fermion
|
2017-02-07 06:37:10 +00:00
|
|
|
|
|
|
|
if (dag == DaggerYes) {
|
2017-02-21 10:24:27 +00:00
|
|
|
parallel_for (int ss = 0; ss < U._grid->oSites(); ss++) {
|
2017-02-07 06:37:10 +00:00
|
|
|
int sU = ss;
|
|
|
|
int sF = LLs * sU;
|
|
|
|
Kernels::DhopSiteDag(st,lo,U,st.CommBuf(),sF,sU,LLs,1,in,out);
|
|
|
|
}
|
|
|
|
} else {
|
2017-02-21 10:24:27 +00:00
|
|
|
parallel_for (int ss = 0; ss < U._grid->oSites(); ss++) {
|
2017-02-07 06:37:10 +00:00
|
|
|
int sU = ss;
|
|
|
|
int sF = LLs * sU;
|
|
|
|
Kernels::DhopSite(st,lo,U,st.CommBuf(),sF,sU,LLs,1,in,out);
|
|
|
|
}
|
|
|
|
}
|
2016-10-06 17:52:45 +01:00
|
|
|
DhopComputeTime+=usecond();
|
2016-04-06 10:32:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::DhopOE(const FermionField &in, FermionField &out,int dag)
|
2015-05-31 15:09:02 +01:00
|
|
|
{
|
2016-10-21 13:36:18 +01:00
|
|
|
DhopCalls++;
|
2015-05-31 15:09:02 +01:00
|
|
|
conformable(in._grid,FermionRedBlackGrid()); // verifies half grid
|
|
|
|
conformable(in._grid,out._grid); // drops the cb check
|
|
|
|
|
|
|
|
assert(in.checkerboard==Even);
|
|
|
|
out.checkerboard = Odd;
|
|
|
|
|
2016-01-04 14:18:40 +00:00
|
|
|
DhopInternal(StencilEven,LebesgueEvenOdd,UmuOdd,in,out,dag);
|
2015-05-31 15:09:02 +01:00
|
|
|
}
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::DhopEO(const FermionField &in, FermionField &out,int dag)
|
2015-05-31 15:09:02 +01:00
|
|
|
{
|
2016-10-21 13:36:18 +01:00
|
|
|
DhopCalls++;
|
2015-05-31 15:09:02 +01:00
|
|
|
conformable(in._grid,FermionRedBlackGrid()); // verifies half grid
|
|
|
|
conformable(in._grid,out._grid); // drops the cb check
|
|
|
|
|
|
|
|
assert(in.checkerboard==Odd);
|
|
|
|
out.checkerboard = Even;
|
|
|
|
|
2016-01-04 14:18:40 +00:00
|
|
|
DhopInternal(StencilOdd,LebesgueEvenOdd,UmuEven,in,out,dag);
|
2015-05-31 15:09:02 +01:00
|
|
|
}
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::Dhop(const FermionField &in, FermionField &out,int dag)
|
2015-05-31 15:09:02 +01:00
|
|
|
{
|
2016-10-21 13:36:18 +01:00
|
|
|
DhopCalls+=2;
|
2015-05-31 15:09:02 +01:00
|
|
|
conformable(in._grid,FermionGrid()); // verifies full grid
|
|
|
|
conformable(in._grid,out._grid);
|
|
|
|
|
|
|
|
out.checkerboard = in.checkerboard;
|
|
|
|
|
2016-01-04 14:18:40 +00:00
|
|
|
DhopInternal(Stencil,Lebesgue,Umu,in,out,dag);
|
2015-05-31 15:09:02 +01:00
|
|
|
}
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::DW(const FermionField &in, FermionField &out,int dag)
|
2015-06-02 16:57:12 +01:00
|
|
|
{
|
|
|
|
out.checkerboard=in.checkerboard;
|
|
|
|
Dhop(in,out,dag); // -0.5 is included
|
|
|
|
axpy(out,4.0-M5,in,out);
|
|
|
|
}
|
2015-08-10 20:47:44 +01:00
|
|
|
|
2016-09-26 09:39:09 +01:00
|
|
|
template<class Impl>
|
2016-10-10 23:46:45 +01:00
|
|
|
void WilsonFermion5D<Impl>::MomentumSpacePropagatorHt(FermionField &out,const FermionField &in, RealD mass)
|
2016-09-26 09:39:09 +01:00
|
|
|
{
|
2016-10-10 23:46:45 +01:00
|
|
|
// what type LatticeComplex
|
|
|
|
GridBase *_grid = _FourDimGrid;
|
|
|
|
conformable(_grid,out._grid);
|
|
|
|
|
|
|
|
typedef typename FermionField::vector_type vector_type;
|
|
|
|
typedef typename FermionField::scalar_type ScalComplex;
|
|
|
|
typedef iSinglet<ScalComplex> Tcomplex;
|
|
|
|
typedef Lattice<iSinglet<vector_type> > LatComplex;
|
|
|
|
|
2017-01-24 03:13:43 +00:00
|
|
|
Gamma::Algebra Gmu [] = {
|
|
|
|
Gamma::Algebra::GammaX,
|
|
|
|
Gamma::Algebra::GammaY,
|
|
|
|
Gamma::Algebra::GammaZ,
|
|
|
|
Gamma::Algebra::GammaT
|
2016-10-10 23:46:45 +01:00
|
|
|
};
|
2016-09-26 09:39:09 +01:00
|
|
|
|
2016-10-10 23:46:45 +01:00
|
|
|
std::vector<int> latt_size = _grid->_fdimensions;
|
2016-09-26 09:39:09 +01:00
|
|
|
|
2016-10-10 23:46:45 +01:00
|
|
|
|
|
|
|
FermionField 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);
|
|
|
|
|
|
|
|
for(int mu=0;mu<Nd;mu++) {
|
|
|
|
|
|
|
|
LatticeCoordinate(kmu,mu);
|
|
|
|
|
|
|
|
RealD TwoPiL = M_PI * 2.0/ latt_size[mu];
|
|
|
|
|
|
|
|
kmu = TwoPiL * kmu;
|
|
|
|
|
|
|
|
sk2 = sk2 + 2.0*sin(kmu*0.5)*sin(kmu*0.5);
|
|
|
|
sk = sk + sin(kmu) *sin(kmu);
|
|
|
|
|
|
|
|
num = num - sin(kmu)*ci*(Gamma(Gmu[mu])*in);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
W = one - M5 + sk2;
|
|
|
|
|
|
|
|
////////////////////////////////////////////
|
|
|
|
// Cosh alpha -> alpha
|
|
|
|
////////////////////////////////////////////
|
|
|
|
cosha = (one + W*W + sk) / (W*2.0);
|
|
|
|
|
|
|
|
// FIXME Need a Lattice acosh
|
|
|
|
for(int idx=0;idx<_grid->lSites();idx++){
|
|
|
|
std::vector<int> lcoor(Nd);
|
|
|
|
Tcomplex cc;
|
|
|
|
RealD sgn;
|
|
|
|
_grid->LocalIndexToLocalCoor(idx,lcoor);
|
|
|
|
peekLocalSite(cc,cosha,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,lcoor);
|
|
|
|
}
|
|
|
|
|
|
|
|
Wea = ( exp( a) * W );
|
|
|
|
Wema= ( exp(-a) * W );
|
|
|
|
|
|
|
|
num = num + ( one - Wema ) * mass * in;
|
|
|
|
denom= ( Wea - one ) + mass*mass * (one - Wema);
|
|
|
|
out = num/denom;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::MomentumSpacePropagatorHw(FermionField &out,const FermionField &in,RealD mass)
|
|
|
|
{
|
2017-01-24 03:13:43 +00:00
|
|
|
Gamma::Algebra Gmu [] = {
|
|
|
|
Gamma::Algebra::GammaX,
|
|
|
|
Gamma::Algebra::GammaY,
|
|
|
|
Gamma::Algebra::GammaZ,
|
|
|
|
Gamma::Algebra::GammaT
|
2016-09-26 09:39:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
GridBase *_grid = _FourDimGrid;
|
|
|
|
conformable(_grid,out._grid);
|
|
|
|
|
|
|
|
typedef typename FermionField::vector_type vector_type;
|
|
|
|
typedef typename FermionField::scalar_type ScalComplex;
|
|
|
|
|
|
|
|
typedef Lattice<iSinglet<vector_type> > LatComplex;
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<int> latt_size = _grid->_fdimensions;
|
|
|
|
|
|
|
|
LatComplex sk(_grid); sk = zero;
|
|
|
|
LatComplex sk2(_grid); sk2= zero;
|
|
|
|
|
|
|
|
LatComplex w_k(_grid); w_k= zero;
|
|
|
|
LatComplex b_k(_grid); b_k= zero;
|
|
|
|
|
|
|
|
LatComplex one (_grid); one = ScalComplex(1.0,0.0);
|
|
|
|
|
|
|
|
FermionField num (_grid); num = zero;
|
|
|
|
LatComplex denom(_grid); denom= zero;
|
|
|
|
LatComplex kmu(_grid);
|
|
|
|
ScalComplex ci(0.0,1.0);
|
|
|
|
|
|
|
|
for(int mu=0;mu<Nd;mu++) {
|
|
|
|
|
|
|
|
LatticeCoordinate(kmu,mu);
|
|
|
|
|
|
|
|
RealD TwoPiL = M_PI * 2.0/ latt_size[mu];
|
|
|
|
|
|
|
|
kmu = TwoPiL * kmu;
|
|
|
|
|
|
|
|
sk2 = sk2 + 2.0*sin(kmu*0.5)*sin(kmu*0.5);
|
|
|
|
sk = sk + sin(kmu)*sin(kmu);
|
|
|
|
|
|
|
|
num = num - sin(kmu)*ci*(Gamma(Gmu[mu])*in);
|
|
|
|
|
|
|
|
}
|
2016-10-10 23:46:45 +01:00
|
|
|
num = num + mass * in ;
|
2016-09-26 09:39:09 +01:00
|
|
|
|
|
|
|
b_k = sk2 - M5;
|
|
|
|
|
|
|
|
w_k = sqrt(sk + b_k*b_k);
|
|
|
|
|
2016-10-10 23:46:45 +01:00
|
|
|
denom= ( w_k + b_k + mass*mass) ;
|
2016-09-26 09:39:09 +01:00
|
|
|
|
|
|
|
denom= one/denom;
|
|
|
|
out = num*denom;
|
2016-10-10 23:46:45 +01:00
|
|
|
|
2016-09-26 09:39:09 +01:00
|
|
|
}
|
|
|
|
|
2017-04-25 18:00:24 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
* Conserved current utilities for Wilson fermions, for contracting propagators
|
|
|
|
* to make a conserved current sink or inserting the conserved current
|
|
|
|
* sequentially.
|
|
|
|
******************************************************************************/
|
|
|
|
template <class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::ContractConservedCurrent(PropagatorField &q_in_1,
|
|
|
|
PropagatorField &q_in_2,
|
|
|
|
PropagatorField &q_out,
|
|
|
|
Current curr_type,
|
|
|
|
unsigned int mu)
|
|
|
|
{
|
|
|
|
conformable(q_in_1._grid, FermionGrid());
|
|
|
|
conformable(q_in_1._grid, q_in_2._grid);
|
|
|
|
conformable(_FourDimGrid, q_out._grid);
|
|
|
|
|
|
|
|
PropagatorField q1_s(_FourDimGrid);
|
|
|
|
PropagatorField q2_s(_FourDimGrid);
|
|
|
|
PropagatorField tmp(_FourDimGrid);
|
|
|
|
|
|
|
|
// Contract across 5th dimension.
|
|
|
|
q_out = zero;
|
|
|
|
for (int s = 0; s < Ls; ++s)
|
|
|
|
{
|
|
|
|
ExtractSlice(q1_s, q_in_1, 0, s);
|
|
|
|
ExtractSlice(q2_s, q_in_2, 0, Ls - s - 1);
|
|
|
|
Kernels::ContractConservedCurrentInternal(q1_s, q2_s, tmp, Umu, curr_type, mu);
|
|
|
|
|
|
|
|
// Axial current sign
|
|
|
|
Real G_s = (curr_type == Current::Axial) ? ((s < Ls/2) ? -1. : 1.) : 1.;
|
|
|
|
q_out += G_s*tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template <class Impl>
|
|
|
|
void WilsonFermion5D<Impl>::SeqConservedCurrent(PropagatorField &q_in,
|
|
|
|
PropagatorField &q_out,
|
|
|
|
Current curr_type,
|
|
|
|
unsigned int mu,
|
|
|
|
std::vector<Real> mom,
|
|
|
|
unsigned int tmin,
|
|
|
|
unsigned int tmax)
|
|
|
|
{
|
|
|
|
conformable(q_in._grid, FermionGrid());
|
|
|
|
conformable(q_in._grid, q_out._grid);
|
|
|
|
Lattice<iSinglet<Simd>> ph(_FourDimGrid), coor(_FourDimGrid);
|
|
|
|
Complex i(0.0, 1.0);
|
|
|
|
|
|
|
|
// Momentum projection
|
|
|
|
ph = zero;
|
|
|
|
for(unsigned int nu = 0; nu < Nd - 1; nu++)
|
|
|
|
{
|
|
|
|
LatticeCoordinate(coor, nu);
|
|
|
|
ph = ph + mom[nu]*coor*((1./(_FourDimGrid->_fdimensions[nu])));
|
|
|
|
}
|
|
|
|
ph = exp((Real)(2*M_PI)*i*ph);
|
|
|
|
|
|
|
|
// Sequential insertion
|
|
|
|
Kernels::SeqConservedCurrentInternal(q_in, q_out, Umu, curr_type,
|
|
|
|
mu, ph, tmin, tmax);
|
|
|
|
|
|
|
|
// Axial current sign.
|
|
|
|
if (curr_type == Current::Axial)
|
|
|
|
{
|
|
|
|
SitePropagator result;
|
|
|
|
parallel_for(int sU = 0; sU < Umu._grid->oSites(); sU++)
|
|
|
|
{
|
|
|
|
int sF = sU * Ls;
|
|
|
|
for (int s = 0; s < Ls/2; s++)
|
|
|
|
{
|
|
|
|
vstream(q_out._odata[sF], -q_out._odata[sF]);
|
|
|
|
sF++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-09-26 09:39:09 +01:00
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
FermOpTemplateInstantiate(WilsonFermion5D);
|
2015-12-07 07:04:57 +00:00
|
|
|
GparityFermOpTemplateInstantiate(WilsonFermion5D);
|
2016-06-03 11:24:26 +01:00
|
|
|
|
2015-06-20 14:22:29 +01:00
|
|
|
}}
|
2015-05-31 15:09:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
|