From 172d3dc93a761652cf3bab70638be0c89e9fc474 Mon Sep 17 00:00:00 2001 From: Guido Cossu Date: Wed, 5 Apr 2017 16:24:04 +0100 Subject: [PATCH 1/2] Correcting names in tests --- tests/core/Test_wilson_even_odd.cc | 9 ++++----- ..._even_odd.cc => Test_wilson_twisted_mass_even_odd.cc} | 9 +++++---- 2 files changed, 9 insertions(+), 9 deletions(-) rename tests/core/{Test_wilson_tm_even_odd.cc => Test_wilson_twisted_mass_even_odd.cc} (97%) diff --git a/tests/core/Test_wilson_even_odd.cc b/tests/core/Test_wilson_even_odd.cc index 4933c36e..a2773244 100644 --- a/tests/core/Test_wilson_even_odd.cc +++ b/tests/core/Test_wilson_even_odd.cc @@ -2,11 +2,10 @@ Grid physics library, www.github.com/paboyle/Grid - Source file: ./tests/Test_wilson_even_odd.cc + Source file: ./tests/Test_wilson_tm_even_odd.cc Copyright (C) 2015 -Author: Peter Boyle Author: paboyle This program is free software; you can redistribute it and/or modify @@ -89,8 +88,8 @@ int main (int argc, char ** argv) } RealD mass=0.1; - RealD mu = 0.1; - WilsonTMFermionR Dw(Umu,Grid,RBGrid,mass,mu); + + WilsonFermionR Dw(Umu,Grid,RBGrid,mass); LatticeFermion src_e (&RBGrid); LatticeFermion src_o (&RBGrid); @@ -207,7 +206,7 @@ int main (int argc, char ** argv) pickCheckerboard(Odd ,phi_o,phi); RealD t1,t2; - SchurDiagMooeeOperator HermOpEO(Dw); + SchurDiagMooeeOperator HermOpEO(Dw); HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2); HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2); diff --git a/tests/core/Test_wilson_tm_even_odd.cc b/tests/core/Test_wilson_twisted_mass_even_odd.cc similarity index 97% rename from tests/core/Test_wilson_tm_even_odd.cc rename to tests/core/Test_wilson_twisted_mass_even_odd.cc index a2773244..4933c36e 100644 --- a/tests/core/Test_wilson_tm_even_odd.cc +++ b/tests/core/Test_wilson_twisted_mass_even_odd.cc @@ -2,10 +2,11 @@ Grid physics library, www.github.com/paboyle/Grid - Source file: ./tests/Test_wilson_tm_even_odd.cc + Source file: ./tests/Test_wilson_even_odd.cc Copyright (C) 2015 +Author: Peter Boyle Author: paboyle This program is free software; you can redistribute it and/or modify @@ -88,8 +89,8 @@ int main (int argc, char ** argv) } RealD mass=0.1; - - WilsonFermionR Dw(Umu,Grid,RBGrid,mass); + RealD mu = 0.1; + WilsonTMFermionR Dw(Umu,Grid,RBGrid,mass,mu); LatticeFermion src_e (&RBGrid); LatticeFermion src_o (&RBGrid); @@ -206,7 +207,7 @@ int main (int argc, char ** argv) pickCheckerboard(Odd ,phi_o,phi); RealD t1,t2; - SchurDiagMooeeOperator HermOpEO(Dw); + SchurDiagMooeeOperator HermOpEO(Dw); HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2); HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2); From 86aaa35294b6bcc1dc90441283bd89f434cfc977 Mon Sep 17 00:00:00 2001 From: paboyle Date: Fri, 7 Apr 2017 11:07:40 +0900 Subject: [PATCH 2/2] Christoph needs SchurDiagTwoKappa which is mobius specific. --- lib/qcd/action/fermion/Fermion.h | 1 + lib/qcd/action/fermion/SchurDiagTwoKappa.h | 102 +++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 lib/qcd/action/fermion/SchurDiagTwoKappa.h diff --git a/lib/qcd/action/fermion/Fermion.h b/lib/qcd/action/fermion/Fermion.h index 791afeee..ac42f177 100644 --- a/lib/qcd/action/fermion/Fermion.h +++ b/lib/qcd/action/fermion/Fermion.h @@ -58,6 +58,7 @@ Author: Peter Boyle #include #include #include +#include #include #include #include diff --git a/lib/qcd/action/fermion/SchurDiagTwoKappa.h b/lib/qcd/action/fermion/SchurDiagTwoKappa.h new file mode 100644 index 00000000..8305f98a --- /dev/null +++ b/lib/qcd/action/fermion/SchurDiagTwoKappa.h @@ -0,0 +1,102 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: SchurDiagTwoKappa.h + + Copyright (C) 2017 + +Author: Christoph Lehner +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 */ +#ifndef _SCHUR_DIAG_TWO_KAPPA_H +#define _SCHUR_DIAG_TWO_KAPPA_H + +namespace Grid { + + // This is specific to (Z)mobius fermions + template + class KappaSimilarityTransform { + public: + INHERIT_IMPL_TYPES(Matrix); + std::vector kappa, kappaDag, kappaInv, kappaInvDag; + + KappaSimilarityTransform (Matrix &zmob) { + for (int i=0;i<(int)zmob.bs.size();i++) { + Coeff_t k = 1.0 / ( 2.0 * (zmob.bs[i] *(4 - zmob.M5) + 1.0) ); + kappa.push_back( k ); + kappaDag.push_back( conj(k) ); + kappaInv.push_back( 1.0 / k ); + kappaInvDag.push_back( 1.0 / conj(k) ); + } + } + + template + void sscale(const Lattice& in, Lattice& out, Coeff_t* s) { + GridBase *grid=out._grid; + out.checkerboard = in.checkerboard; + assert(grid->_simd_layout[0] == 1); // should be fine for ZMobius for now + int Ls = grid->_rdimensions[0]; + parallel_for(int ss=0;ssoSites();ss++){ + vobj tmp = s[ss % Ls]*in._odata[ss]; + vstream(out._odata[ss],tmp); + } + } + + RealD sscale_norm(const Field& in, Field& out, Coeff_t* s) { + sscale(in,out,s); + return norm2(out); + } + + virtual RealD M (const Field& in, Field& out) { return sscale_norm(in,out,&kappa[0]); } + virtual RealD MDag (const Field& in, Field& out) { return sscale_norm(in,out,&kappaDag[0]);} + virtual RealD MInv (const Field& in, Field& out) { return sscale_norm(in,out,&kappaInv[0]);} + virtual RealD MInvDag (const Field& in, Field& out) { return sscale_norm(in,out,&kappaInvDag[0]);} + + }; + + template + class SchurDiagTwoKappaOperator : public SchurOperatorBase { + public: + KappaSimilarityTransform _S; + SchurDiagTwoOperator _Mat; + + SchurDiagTwoKappaOperator (Matrix &Mat): _S(Mat), _Mat(Mat) {}; + + virtual RealD Mpc (const Field &in, Field &out) { + Field tmp(in._grid); + + _S.MInv(in,out); + _Mat.Mpc(out,tmp); + return _S.M(tmp,out); + + } + virtual RealD MpcDag (const Field &in, Field &out){ + Field tmp(in._grid); + + _S.MDag(in,out); + _Mat.MpcDag(out,tmp); + return _S.MInvDag(tmp,out); + } + }; + +} + +#endif