Grid 0.7.0
WilsonTMFermion5D.h
Go to the documentation of this file.
1 /*************************************************************************************
2
3 Grid physics library, www.github.com/paboyle/Grid
4
5 Source file: ./lib/qcd/action/fermion/WilsonTMFermion5D.h
6
7 Copyright (C) 2015
8
9Author: paboyle <paboyle@ph.ed.ac.uk> ; NB Christoph did similar in GPT
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License along
22 with this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25 See the full license in the file "LICENSE" in the top level distribution directory
26 *************************************************************************************/
27 /* END LEGAL */
28#pragma once
29
32
34
35template<class Impl>
37{
38 public:
40 public:
41
42 virtual void Instantiatable(void) {};
43
44 // Constructors
45 WilsonTMFermion5D(GaugeField &_Umu,
46 GridCartesian &Fgrid,
47 GridRedBlackCartesian &Frbgrid,
48 GridCartesian &Ugrid,
49 GridRedBlackCartesian &Urbgrid,
50 const std::vector<RealD> _mass,
51 const std::vector<RealD> _mu,
52 const ImplParams &p= ImplParams()
53 ) :
54 WilsonFermion5D<Impl>(_Umu,
55 Fgrid,
56 Frbgrid,
57 Ugrid,
58 Urbgrid,
59 4.0,p)
60
61 {
62 update(_mass,_mu);
63 }
64
65 virtual void Meooe(const FermionField &in, FermionField &out) {
66 if (in.Checkerboard() == Odd) {
67 this->DhopEO(in, out, DaggerNo);
68 } else {
69 this->DhopOE(in, out, DaggerNo);
70 }
71 }
72
73 virtual void MeooeDag(const FermionField &in, FermionField &out) {
74 if (in.Checkerboard() == Odd) {
75 this->DhopEO(in, out, DaggerYes);
76 } else {
77 this->DhopOE(in, out, DaggerYes);
78 }
79 }
80
81 // allow override for twisted mass and clover
82 virtual void Mooee(const FermionField &in, FermionField &out) {
83 out.Checkerboard() = in.Checkerboard();
84 //axpibg5x(out,in,a,b); // out = a*in + b*i*G5*in
85 for (int s=0;s<(int)this->mass.size();s++) {
86 ComplexD a = 4.0+this->mass[s];
87 ComplexD b(0.0,this->mu[s]);
88 axpbg5y_ssp(out,a,in,b,in,s,s);
89 }
90 }
91
92 virtual void MooeeDag(const FermionField &in, FermionField &out) {
93 out.Checkerboard() = in.Checkerboard();
94 for (int s=0;s<(int)this->mass.size();s++) {
95 ComplexD a = 4.0+this->mass[s];
96 ComplexD b(0.0,-this->mu[s]);
97 axpbg5y_ssp(out,a,in,b,in,s,s);
98 }
99 }
100 virtual void MooeeInv(const FermionField &in, FermionField &out) {
101 for (int s=0;s<(int)this->mass.size();s++) {
102 RealD m = this->mass[s];
103 RealD tm = this->mu[s];
104 RealD mtil = 4.0+this->mass[s];
105 RealD sq = mtil*mtil+tm*tm;
106 ComplexD a = mtil/sq;
107 ComplexD b(0.0, -tm /sq);
108 axpbg5y_ssp(out,a,in,b,in,s,s);
109 }
110 }
111 virtual void MooeeInvDag(const FermionField &in, FermionField &out) {
112 for (int s=0;s<(int)this->mass.size();s++) {
113 RealD m = this->mass[s];
114 RealD tm = this->mu[s];
115 RealD mtil = 4.0+this->mass[s];
116 RealD sq = mtil*mtil+tm*tm;
117 ComplexD a = mtil/sq;
118 ComplexD b(0.0,tm /sq);
119 axpbg5y_ssp(out,a,in,b,in,s,s);
120 }
121 }
122
123 virtual void M(const FermionField &in, FermionField &out)
124 {
125 out.Checkerboard() = in.Checkerboard();
126 this->Dhop(in, out, DaggerNo);
127 FermionField tmp(out.Grid());
128 for (int s=0;s<(int)this->mass.size();s++) {
129 ComplexD a = 4.0+this->mass[s];
130 ComplexD b(0.0,this->mu[s]);
131 axpbg5y_ssp(tmp,a,in,b,in,s,s);
132 }
133 axpy(out, 1.0, tmp, out);
134 }
135
136 // needed for fast PV
137 void update(const std::vector<RealD>& _mass, const std::vector<RealD>& _mu)
138 {
139 assert(_mass.size() == _mu.size());
140 assert(_mass.size() == this->FermionGrid()->_fdimensions[0]);
141 this->mass = _mass;
142 this->mu = _mu;
143 }
144
145 private:
146 std::vector<RealD> mu;
147 std::vector<RealD> mass;
148
149};
150
153
static const int Odd
void axpy(Lattice< vobj > &ret, sobj a, const Lattice< vobj > &x, const Lattice< vobj > &y)
void axpbg5y_ssp(Lattice< vobj > &z, Coeff a, const Lattice< vobj > &x, Coeff b, const Lattice< vobj > &y, int s, int sp)
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
static constexpr int DaggerYes
Definition QCD.h:70
static constexpr int DaggerNo
Definition QCD.h:69
std::complex< RealD > ComplexD
Definition Simd.h:79
double RealD
Definition Simd.h:61
WilsonTMFermion5D< WilsonImplD > WilsonTMFermion5DD
WilsonTMFermion5D< WilsonImplF > WilsonTMFermion5DF
FermionField & tmp(void)
WilsonFermion5D(GaugeField &_Umu, GridCartesian &FiveDimGrid, GridRedBlackCartesian &FiveDimRedBlackGrid, GridCartesian &FourDimGrid, GridRedBlackCartesian &FourDimRedBlackGrid, double _M5, const ImplParams &p=ImplParams())
void DhopEO(const FermionField &in, FermionField &out, int dag)
void Dhop(const FermionField &in, FermionField &out, int dag)
void DhopOE(const FermionField &in, FermionField &out, int dag)
virtual void Mooee(const FermionField &in, FermionField &out)
virtual void Meooe(const FermionField &in, FermionField &out)
virtual void MooeeInvDag(const FermionField &in, FermionField &out)
virtual void MooeeInv(const FermionField &in, FermionField &out)
void update(const std::vector< RealD > &_mass, const std::vector< RealD > &_mu)
WilsonTMFermion5D(GaugeField &_Umu, GridCartesian &Fgrid, GridRedBlackCartesian &Frbgrid, GridCartesian &Ugrid, GridRedBlackCartesian &Urbgrid, const std::vector< RealD > _mass, const std::vector< RealD > _mu, const ImplParams &p=ImplParams())
virtual void MeooeDag(const FermionField &in, FermionField &out)
virtual void MooeeDag(const FermionField &in, FermionField &out)
virtual void Instantiatable(void)
virtual void M(const FermionField &in, FermionField &out)