From 54c6b1376d9ee23a6b3cef6315d75afa212b8c39 Mon Sep 17 00:00:00 2001 From: Andrew Zhen Ning Yong Date: Wed, 21 Apr 2021 16:56:46 +0100 Subject: [PATCH] Quick fix of conserved current implementation in CayleyFermion5D. Now function treats current insertion with appropriate periodic boundary conditions in the mu=3 direction. --- .../implementation/CayleyFermion5DImplementation.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Grid/qcd/action/fermion/implementation/CayleyFermion5DImplementation.h b/Grid/qcd/action/fermion/implementation/CayleyFermion5DImplementation.h index e426356a..1b363846 100644 --- a/Grid/qcd/action/fermion/implementation/CayleyFermion5DImplementation.h +++ b/Grid/qcd/action/fermion/implementation/CayleyFermion5DImplementation.h @@ -828,6 +828,7 @@ void CayleyFermion5D::SeqConservedCurrent(PropagatorField &q_in, #if (!defined(GRID_HIP)) int tshift = (mu == Nd-1) ? 1 : 0; + unsigned int LLt = GridDefaultLatt()[Tp]; //////////////////////////////////////////////// // GENERAL CAYLEY CASE //////////////////////////////////////////////// @@ -933,8 +934,14 @@ void CayleyFermion5D::SeqConservedCurrent(PropagatorField &q_in, tmp = tmp *ph; tmp = Cshift(tmp,mu,-1); Impl::multLinkField(Utmp,this->Umu,tmp,mu+Nd); // Adjoint link - tmp = -1*G_s[s]*( Utmp + gmu*Utmp ); - tmp = where((lcoor>=tmin+tshift),tmp,zz); // Mask the time + tmp = -G_s[s]*( Utmp + gmu*Utmp ); + // Mask the time + if (tmax == LLt - 1 && tshift == 1){ // quick fix to include timeslice 0 if tmax + tshift is over the last timeslice + unsigned int t0 = 0; + tmp = where(((lcoor==t0) || (lcoor>=tmin+tshift)),tmp,zz); + } else { + tmp = where((lcoor>=tmin+tshift),tmp,zz); + } L_Q += where((lcoor<=tmax+tshift),tmp,zz); // Position of current complicated InsertSlice(L_Q, q_out, s , 0);