1#ifndef __DIRAC_WILSON_H__
2#define __DIRAC_WILSON_H__
7#include "datatypes/wilson_vector.h"
9#include "hmc/gauge_field.h"
11template <
int N,
typename radix>
15template <
int N,
typename radix,
typename matrix>
16inline void Dirac_Wilson_hop(
const Field<matrix> *gauge,
const double kappa,
17 const Field<Wilson_vector<N, radix>> &v_in,
21 wilson_dirac_temp_vector<N, radix>;
22 for (
int dir = 0; dir < 2 * NDIM; dir++) {
29 onsites(opp_parity(par)) {
30 half_Wilson_vector<N, radix> h(v_in[X], dir, -sign);
31 vtemp[-dir][X] = gauge[dir][X].adjoint() * h;
33 onsites(opp_parity(par)) {
34 half_Wilson_vector<N, radix> h(v_in[X], dir, sign);
38 vtemp[dir].start_gather(dir, par);
39 vtemp[-dir].start_gather(-dir, par);
46 (kappa * gauge[dir][X] * vtemp[dir][X + dir]).expand(dir, sign) -
47 (kappa * vtemp[dir][X + dir]).expand(dir, -sign);
53template <
int N,
typename radix,
typename matrix>
54inline void Dirac_Wilson_hop_set(
const Field<matrix> *gauge,
const double kappa,
55 const Field<Wilson_vector<N, radix>> &v_in,
59 wilson_dirac_temp_vector<N, radix>;
60 for (
int dir = 0; dir < 2 * NDIM; dir++) {
67 onsites(opp_parity(par)) {
68 half_Wilson_vector<N, radix> h(v_in[X], dir, -sign);
69 vtemp[-dir][X] = gauge[dir][X].adjoint() * h;
71 onsites(opp_parity(par)) {
72 half_Wilson_vector<N, radix> h(v_in[X], dir, sign);
76 vtemp[dir].start_gather(dir, par);
77 vtemp[-dir].start_gather(-dir, par);
82 v_out[X] = -(kappa * gauge[dir][X] * vtemp[dir][X + dir]).expand(dir, sign) -
83 (kappa * vtemp[dir][X + dir]).expand(dir, -sign);
86 for (
int d = 1; d < NDIM; d++) {
89 half_Wilson_vector<N, radix> h1(v_in[X + dir], dir, sign);
91 (kappa * gauge[dir][X] * vtemp[dir][X + dir]).expand(dir, sign) -
92 (kappa * vtemp[dir][X + dir]).expand(dir, -sign);
98template <
int N,
typename radix>
99inline void Dirac_Wilson_diag(
const Field<Wilson_vector<N, radix>> &v_in,
100 Field<Wilson_vector<N, radix>> &v_out,
Parity par) {
101 v_out[par] = v_in[X];
105template <
int N,
typename radix>
106inline void Dirac_Wilson_diag_inverse(
Field<Wilson_vector<N, radix>> &v,
Parity par) {}
110template <
int N,
typename radix,
typename gaugetype,
typename momtype>
111inline void Dirac_Wilson_calc_force(
const Field<gaugetype> *gauge,
const double kappa,
112 const Field<Wilson_vector<N, radix>> &chi,
113 const Field<Wilson_vector<N, radix>> &psi,
116 wilson_dirac_temp_vector<N, radix>;
118 vtemp[1].copy_boundary_condition(chi);
121 onsites(opp_parity(par)) {
122 half_Wilson_vector<N, radix> hw(chi[X], dir, -sign);
126 half_Wilson_vector<N, radix> hw(psi[X], dir, sign);
132 -kappa * ((vtemp[0][X + dir].expand(dir, -sign)).outer_product(psi[X]));
133 out[dir][opp_parity(par)] =
135 kappa * ((vtemp[1][X + dir].expand(dir, sign)).outer_product(chi[X]));
155 static constexpr int N = matrix::size;
157 using radix = hila::arithmetic_type<matrix>;
178 template <
typename M>
184 Dirac_Wilson_diag(in, out,
ALL);
185 Dirac_Wilson_hop(gauge,
kappa, in, out,
ALL, 1);
190 Dirac_Wilson_diag(in, out,
ALL);
191 Dirac_Wilson_hop(gauge,
kappa, in, out,
ALL, -1);
196 template <
typename momtype>
199 Dirac_Wilson_calc_force(gauge,
kappa, chi, psi,
force,
ALL, sign);
204template <
int N,
typename radix,
typename matrix>
206 const Field<Wilson_vector<N, radix>> &in) {
213template <
int N,
typename radix,
typename matrix>
243 static constexpr int N = matrix::size;
245 using radix = hila::arithmetic_type<matrix>;
246 using vector_type = Wilson_vector<N, radix>;
264 : gauge(g.gauge),
kappa(k) {}
267 template <
typename M>
273 Dirac_Wilson_diag(in, out,
EVEN);
275 Dirac_Wilson_hop_set(gauge,
kappa, in, out,
ODD, 1);
276 Dirac_Wilson_diag_inverse(out,
ODD);
277 Dirac_Wilson_hop(gauge, -
kappa, out, out,
EVEN, 1);
283 Dirac_Wilson_diag(in, out,
EVEN);
285 Dirac_Wilson_hop_set(gauge,
kappa, in, out,
ODD, -1);
286 Dirac_Wilson_diag_inverse(out,
ODD);
287 Dirac_Wilson_hop(gauge, -
kappa, out, out,
EVEN, -1);
293 template <
typename momtype>
301 Dirac_Wilson_hop_set(gauge,
kappa, chi, tmp,
ODD, -sign);
302 Dirac_Wilson_diag_inverse(tmp,
ODD);
303 Dirac_Wilson_calc_force(gauge, -
kappa, tmp, psi,
force,
EVEN, sign);
306 Dirac_Wilson_hop_set(gauge,
kappa, psi, tmp,
ODD, sign);
307 Dirac_Wilson_diag_inverse(tmp,
ODD);
308 Dirac_Wilson_calc_force(gauge, -
kappa, chi, tmp, force2,
ODD, sign);
Array< n, m, T > operator*(Array< n, m, T > a, const Array< n, m, T > &b)
Multiplication operator.
void apply(const Field< vector_type > &in, Field< vector_type > &out)
Applies the operator to in.
matrix matrix_type
The matrix type.
Dirac_Wilson_evenodd(Dirac_Wilson_evenodd &d)
Constructor: initialize mass and gauge.
Parity par
The parity this operator applies to.
void dagger(const Field< vector_type > &in, Field< vector_type > &out)
Applies the conjugate of the operator.
double kappa
The hopping parameter, kappa = 1/(8-2m)
Dirac_Wilson_evenodd(double k, Field< matrix >(&U)[4])
Constructor: initialize mass and gauge.
void force(const Field< vector_type > &chi, const Field< vector_type > &psi, Field< momtype >(&force)[4], int sign)
hila::arithmetic_type< matrix > radix
The wilson vector type.
Dirac_Wilson_evenodd(double k, gauge_field_base< matrix > &g)
Constructor: initialize mass and gauge.
static constexpr int N
Size of the gauge matrix and color dimension of the Wilson vector.
Dirac_Wilson_evenodd(Dirac_Wilson_evenodd< M > &d, gauge_field_base< matrix > &g)
Construct from another Dirac_Wilson operator of a different type.
static constexpr int N
Size of the gauge matrix and color dimension of the Wilson vector.
void apply(const Field< vector_type > &in, Field< vector_type > &out)
Applies the operator to in.
Parity par
The parity this operator applies to.
void dagger(const Field< vector_type > &in, Field< vector_type > &out)
Applies the conjugate of the operator.
Dirac_Wilson(Dirac_Wilson< M > &d, gauge_field_base< matrix > &g)
Construct from another Dirac_Wilson operator of a different type.
Dirac_Wilson(double k, gauge_field_base< matrix > &g)
Constructor: initialize mass and gauge.
Dirac_Wilson(double k, Field< matrix >(&U)[4])
Constructor: initialize mass and gauge.
Dirac_Wilson(Dirac_Wilson &d)
Constructor: initialize mass and gauge.
double kappa
The hopping parameter, kappa = 1/(8-2m)
void force(const Field< vector_type > &chi, const Field< vector_type > &psi, Field< momtype >(&force)[4], int sign=1)
matrix matrix_type
The matrix type.
Wilson_vector< N, radix > vector_type
The wilson vector type.
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
void copy_boundary_condition(const Field< A > &rhs)
Copy the boundary condition from another field.
Definition of Complex types.
Parity
Parity enum with values EVEN, ODD, ALL; refers to parity of the site. Parity of site (x,...
constexpr Parity EVEN
bit pattern: 001
#define foralldir(d)
Macro to loop over (all) Direction(s)
constexpr Parity ODD
bit pattern: 010
Direction
Enumerator for direction that assigns integer to direction to be interpreted as unit vector.
constexpr Parity ALL
bit pattern: 011
This file defines all includes for HILA.
This files containts definitions for the Field class and the classes required to define it such as fi...
Definition of Matrix types.
std::ostream out
this is our default output file stream