diff --git a/Grid/qcd/action/fermion/CloverHelpers.h b/Grid/qcd/action/fermion/CloverHelpers.h index c2bb0d8f..e8c45888 100644 --- a/Grid/qcd/action/fermion/CloverHelpers.h +++ b/Grid/qcd/action/fermion/CloverHelpers.h @@ -208,10 +208,20 @@ public: Clover += diag_mass; } - static void Exponentiate_Clover(CloverField& Clover, CloverField& CloverInv, RealD csw_t, RealD diag_mass) { + static void ExponentiateClover(CloverField& Clover, CloverField& CloverInv, RealD csw_t, RealD diag_mass) { // Do nothing } + static void InvertClover(CloverField& InvClover, + const CloverDiagonalField& diagonal, + const CloverTriangleField& triangle, + CloverDiagonalField& diagonalInv, + CloverTriangleField& triangleInv, + bool open_boundaries) { + + CompactHelpers::Invert(diagonal, triangle, diagonalInv, triangleInv); + } + // TODO: implement Cmunu for better performances with compact layout, but don't do it // here, but rather in WilsonCloverHelpers.h -> CompactWilsonCloverHelpers static GaugeLinkField Cmunu(std::vector &U, GaugeLinkField &lambda, int mu, int nu) { @@ -267,7 +277,7 @@ public: static int getNMAX(Lattice> &t, RealD R) {return getNMAX(1e-12,R);} static int getNMAX(Lattice> &t, RealD R) {return getNMAX(1e-6,R);} - static void Exponentiate_Clover(CloverField& Clover, CloverField& CloverInv, RealD csw_t, RealD diag_mass) { + static void ExponentiateClover(CloverField& Clover, CloverField& CloverInv, RealD csw_t, RealD diag_mass) { GridBase* grid = Clover.Grid(); CloverField ExpClover(grid); @@ -302,7 +312,24 @@ public: CloverInv = ExpClover * (1.0/diag_mass); + } + + static void InvertClover(CloverField& InvClover, + const CloverDiagonalField& diagonal, + const CloverTriangleField& triangle, + CloverDiagonalField& diagonalInv, + CloverTriangleField& triangleInv, + bool open_boundaries) { + + if (open_boundaries) + { + CompactHelpers::Invert(diagonal, triangle, diagonalInv, triangleInv); } + else + { + CompactHelpers::ConvertLayout(InvClover, diagonalInv, triangleInv); + } + } static GaugeLinkField Cmunu(std::vector &U, GaugeLinkField &lambda, int mu, int nu) { assert(0); diff --git a/Grid/qcd/action/fermion/implementation/CompactWilsonCloverFermionImplementation.h b/Grid/qcd/action/fermion/implementation/CompactWilsonCloverFermionImplementation.h index e45a531f..6ee22113 100644 --- a/Grid/qcd/action/fermion/implementation/CompactWilsonCloverFermionImplementation.h +++ b/Grid/qcd/action/fermion/implementation/CompactWilsonCloverFermionImplementation.h @@ -330,7 +330,7 @@ void CompactWilsonCloverFermion::ImportGauge(const GaugeFie // Convert the data layout of the clover term double t4 = usecond(); - CloverHelpers::Exponentiate_Clover(TmpOriginal, TmpInverse, csw_t, this->diag_mass); + CloverHelpers::ExponentiateClover(TmpOriginal, TmpInverse, csw_t, this->diag_mass); // Exponentiate the clover (nothing happens in case of the standard clover) double t5 = usecond(); @@ -342,9 +342,7 @@ void CompactWilsonCloverFermion::ImportGauge(const GaugeFie // Invert the Clover term (explicit inversion needed for the improvement in case of open boundary conditions) double t7 = usecond(); - //CompactHelpers::Invert(Diagonal, Triangle, DiagonalInv, TriangleInv); - CompactHelpers::ConvertLayout(TmpInverse, DiagonalInv, TriangleInv); - //if(open_boundaries) handle differently! + CloverHelpers::InvertClover(TmpInverse, Diagonal, Triangle, DiagonalInv, TriangleInv, open_boundaries); // Fill the remaining clover fields double t8 = usecond();