1#ifndef __DIRAC_STAGGERED_H__
2#define __DIRAC_STAGGERED_H__
4#include "../plumbing/defs.h"
5#include "../datatypes/cmplx.h"
6#include "../datatypes/matrix.h"
7#include "../datatypes/sun.h"
8#include "../plumbing/field.h"
9#include "../../libraries/hmc/gauge_field.h"
11template <
typename vector>
Field<vector> staggered_dirac_temp[NDIM];
14inline void init_staggered_eta(
Field<double> (&staggered_eta)[NDIM]) {
18 element<CoordinateVector> l = X.coordinates();
19 element<int> sumcoord = 0;
20 for (
int d2 = e_x; d2 < d; d2++) {
25 staggered_eta[d][X] = (sumcoord % 2) * 2 - 1;
31template <
typename vtype>
32void dirac_staggered_diag(
const double mass,
const Field<vtype> &v_in,
34 v_out[par] = v_out[X] + mass * v_in[X];
39template <
typename vtype>
41 v_out[par] = (1.0 / mass) * v_out[X];
45template <
typename mtype,
typename vtype>
49 Field<vtype>(&vtemp)[NDIM] = staggered_dirac_temp<vtype>;
51 vtemp[dir].copy_boundary_condition(v_in);
57 vtemp[dir][opp_parity(par)] = gauge[dir][X].adjoint() * v_in[X];
63 v_out[par] = v_out[X] + 0.5 * sign * staggered_eta[dir][X] *
64 (gauge[dir][X] * v_in[X + dir] - vtemp[dir][X - dir]);
70template <
typename gaugetype,
typename momtype,
typename vtype>
78 -sign * 0.5 * staggered_eta[dir][X] * chi[X + dir].outer_product(psi[X]);
79 out[dir][opp_parity(par)] =
out[dir][X] + sign * 0.5 *
80 staggered_eta[dir][X + dir] *
81 psi[X + dir].outer_product(chi[X]);
101 using vector_type = SU_vector<matrix::size, hila::arithmetic_type<matrix>>;
117 init_staggered_eta(staggered_eta);
121 init_staggered_eta(staggered_eta);
125 init_staggered_eta(staggered_eta);
129 template <
typename M>
132 init_staggered_eta(staggered_eta);
138 dirac_staggered_diag(
mass, in, out,
ALL);
139 dirac_staggered_hop(gauge, in, out, staggered_eta,
ALL, 1);
145 dirac_staggered_diag(
mass, in, out,
ALL);
146 dirac_staggered_hop(gauge, in, out, staggered_eta,
ALL, -1);
151 template <
typename momtype>
154 dirac_staggered_calc_force(gauge, chi, psi,
force, staggered_eta, sign,
ALL);
159template <
typename vector,
typename matrix>
162 out.copy_boundary_condition(in);
168template <
typename vector,
typename matrix>
171 out.copy_boundary_condition(in);
205 using vector_type = SU_vector<matrix::size, hila::arithmetic_type<matrix>>;
219 init_staggered_eta(staggered_eta);
223 init_staggered_eta(staggered_eta);
227 : gauge(g.gauge),
mass(m) {
228 init_staggered_eta(staggered_eta);
232 template <
typename M>
235 init_staggered_eta(staggered_eta);
241 dirac_staggered_diag(
mass, in, out,
EVEN);
243 dirac_staggered_hop(gauge, in, out, staggered_eta,
ODD, 1);
244 dirac_staggered_diag_inverse(
mass, out,
ODD);
245 dirac_staggered_hop(gauge, out, out, staggered_eta,
EVEN, 1);
251 dirac_staggered_diag(
mass, in, out,
EVEN);
253 dirac_staggered_hop(gauge, in, out, staggered_eta,
ODD, -1);
254 dirac_staggered_diag_inverse(
mass, out,
ODD);
255 dirac_staggered_hop(gauge, out, out, staggered_eta,
EVEN, -1);
260 template <
typename momtype>
268 dirac_staggered_hop(gauge, chi, tmp, staggered_eta,
ODD, -sign);
269 dirac_staggered_diag_inverse(
mass, tmp,
ODD);
270 dirac_staggered_calc_force(gauge, tmp, psi,
force, staggered_eta, sign,
EVEN);
273 dirac_staggered_hop(gauge, psi, tmp, staggered_eta,
ODD, sign);
274 dirac_staggered_diag_inverse(
mass, tmp,
ODD);
275 dirac_staggered_calc_force(gauge, chi, tmp, force2, staggered_eta, sign,
ODD);
Array< n, m, T > operator*(Array< n, m, T > a, const Array< n, m, T > &b)
Multiplication operator.
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.
dir_mask_t start_gather(Direction d, Parity p=ALL) const
dirac_staggered_evenodd(double m, Field< matrix >(&U)[4])
Constructor: initialize mass, gauge and eta.
matrix matrix_type
The matrix type.
void dagger(Field< vector_type > &in, Field< vector_type > &out)
Applies the conjugate of the operator.
dirac_staggered_evenodd(double m, gauge_field_base< matrix > &g)
Constructor: initialize mass, gauge and eta.
double mass
the fermion mass
dirac_staggered_evenodd(dirac_staggered_evenodd &d)
Constructor: initialize mass, gauge and eta.
void force(const Field< vector_type > &chi, const Field< vector_type > &psi, Field< momtype >(&force)[4], int sign)
SU_vector< matrix::size, hila::arithmetic_type< matrix > > vector_type
The SU(N) vector type.
Parity par
The parity this operator applies to.
void apply(Field< vector_type > &in, Field< vector_type > &out)
Applies the operator to in.
dirac_staggered_evenodd(dirac_staggered_evenodd< M > &d, gauge_field_base< matrix > &g)
Construct from another Dirac_Wilson operator of a different type.
void force(const Field< vector_type > &chi, const Field< vector_type > &psi, Field< momtype >(&force)[4], int sign=1)
SU_vector< matrix::size, hila::arithmetic_type< matrix > > vector_type
The SU(N) vector type.
matrix matrix_type
The matrix type.
Parity par
The parity this operator applies to.
void apply(const Field< vector_type > &in, Field< vector_type > &out)
Applies the operator to in.
double mass
the fermion mass
dirac_staggered(dirac_staggered< M > &d, gauge_field_base< matrix > &g)
Construct from another Dirac_Wilson operator of a different type.
void dagger(const Field< vector_type > &in, Field< vector_type > &out)
Applies the conjugate of the operator.
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
constexpr Parity ALL
bit pattern: 011
std::ostream out
this is our default output file stream