HILA
Loading...
Searching...
No Matches
clover_action.h
Go to the documentation of this file.
1/** @file clover_action.h */
2
3#ifndef CLOVER_ACTION_H_
4#define CLOVER_ACTION_H_
5
6#include "hila.h"
8
9// functions for clover gauge action
10
11template <typename group, typename atype = hila::arithmetic_type<group>>
12void get_clover_leaves(const GaugeField<group> &U, Direction d1, Direction d2, Field<group> (&C)[4],
13 Field<group> &Csum) {
14 // assignes the clover leave matrices in counter-clockwise order to C[0],C[1],C[2],C[3] and sets
15 // Csum to the full Clover matrix, i.e. to the anti-hermitian tracless part of
16 // (C[0]+C[1]+C[2]+C[3])/4
17
18 U[d2].start_gather(d1, ALL);
19 U[d1].start_gather(d2, ALL);
20 Field<group> tF;
21
22 onsites(ALL) {
23 // d1-d2-plaquette that starts and ends at X
24 C[0][X] = U[d1][X] * U[d2][X + d1] * (U[d2][X] * U[d1][X + d2]).dagger();
25 C[0][X] *= 0.25;
26
27 // parallel transport C[0][X] to X+d1 (use C[2][X] as temp. storage)
28 C[2][X] = U[d1][X].dagger() * C[0][X] * U[d1][X];
29 }
30
31 C[2].start_gather(-d1, ALL);
32
33 onsites(ALL) {
34 // parallel transport C[0][X] to X+d2 (use Csum as temp. storage)
35 Csum[X] = U[d2][X].dagger() * C[0][X] * U[d2][X];
36 }
37
38 Csum.start_gather(-d2, ALL);
39
40 onsites(ALL) {
41 C[1][X] = C[2][X - d1];
42
43 // parallel transport C[1][X] to X+d2 (use tF as temp. storage)
44 tF[X] = U[d2][X].dagger() * C[1][X] * U[d2][X];
45 }
46
47 tF.start_gather(-d2, ALL);
48
49 onsites(ALL) {
50 C[3][X] = Csum[X - d2];
51 }
52
53 onsites(ALL) {
54 C[2][X] = tF[X - d2];
55
56 Csum[X] = C[0][X];
57 Csum[X] += C[1][X];
58 Csum[X] += C[2][X];
59 Csum[X] += C[3][X];
60
61 // Lie-algebra project Csum[X]
62 Csum[X] -= Csum[X].dagger();
63 Csum[X] *= 0.5;
64 Csum[X] -= trace(Csum[X]) / group::size();
65 }
66}
67
68template <typename group, typename atype = hila::arithmetic_type<group>>
69atype measure_s_clover(const GaugeField<group> &U) {
70 // measure the clover action for dir1<dir2
71 // (just to have same normalization as with plaquette action)
72 Reduction<double> stot = 0;
73 stot.allreduce(false).delayed(true);
74 Field<group> C[4];
75 Field<group> Csum;
76 foralldir(dir1) foralldir(dir2) if (dir1 < dir2) {
77 get_clover_leaves(U, dir1, dir2, C, Csum);
78 onsites(ALL) {
79 stot += -0.5 * real(mul_trace(Csum[X], Csum[X]));
80 }
81 }
82 return (atype)stot.value() / group::size();
83}
84
85template <typename group, typename atype = hila::arithmetic_type<group>>
86void get_force_clover_add(const GaugeField<group> &U, VectorField<Algebra<group>> &K,
87 atype eps = 1.0) {
88 // compute gauge force for clover action and add result to K
89 Field<group> C[4];
90 Field<group> Csum;
91
92 Field<group> tC;
93 foralldir(dir1) foralldir(dir2) if (dir1 < dir2) {
94 // get the 4 clover leave matrices C[][X] (ordered counter-clockwise in (dir1,dir2)-plane)
95 // and their anti-hermitian traceless sum Csum[X]
96 get_clover_leaves(U, dir1, dir2, C, Csum);
97
98 // define for each clover leave matrix the correspondin path of gauge links
99 std::vector<Direction> paths[4] = {{dir1, dir2, -dir1, -dir2},
100 {dir2, -dir1, -dir2, dir1},
101 {-dir1, -dir2, dir1, dir2},
102 {-dir2, dir1, dir2, -dir1}};
103
104 // the force on the link (Y,dir) from the clover term with foot point X is:
105 // F[dir][Y] = d_{Y,dir}(0.5*Tr(Csum*Csum))
106 // = 0.5*Tr((d_{Y,dir}Csum)*Csum) + 0.5*Tr(Csum*(d_{Y,dir}Csum))
107 // = Tr((d_{Y,dir}Csum)*Csum)
108 // = 0.5*\sum_k (Tr((d_{Y,dir}C[k][X])*Csum[X]) -
109 // Tr((d_{Y,dir}C[k][X].dagger())*Csum[X])) = \sum_k
110 // Tr((d_{Y,dir}C[k][X])*Csum[X])
111 for (int k = 0; k < 4; ++k) {
112 // multiply the clover leave matrix C[k][X] by Csum[X] --> yields (weighted) sum
113 // of Wilson loops with foot point X and whose first 4 links are always those of C[k][X]
114 onsites(ALL) {
115 tC[X] = C[k][X] * Csum[X];
116 }
117 // compute the gauge force from the first 4 links of all the Wilson loops that are
118 // summed in tC[k] (is valid to do so since first 4 links are the same for all Wilson
119 // loops and projection on Lie-algebra is linear)
120 get_wloop_force_from_wl_add(U, paths[k], tC, eps, K);
121 }
122 }
123}
124
125template <typename group, typename atype = hila::arithmetic_type<group>>
126void get_force_clover(const GaugeField<group> &U, VectorField<Algebra<group>> &K, atype eps = 1.0) {
127 // determine gauge force for clover action and store result in K
128 foralldir(d1) {
129 K[d1][ALL] = 0;
130 }
131 get_force_clover_add(U, K, eps);
132}
133
134
135#endif
Array< n, m, hila::arithmetic_type< T > > real(const Array< n, m, T > &arg)
Return real part of Array.
Definition array.h:688
Definition su2.h:7
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
Definition field.h:61
Field< A > dagger() const
Returns dagger or Hermitian conjugate of Field depending on how it is defined for Field type T.
Definition field.h:1104
dir_mask_t start_gather(Direction d, Parity p=ALL) const
Definition field_comm.h:262
Gauge field class.
Definition gaugefield.h:22
Special reduction class: enables delayed and non-blocking reductions, which are not possible with the...
Definition reduction.h:14
const T value()
Return value of the reduction variable. Wait for the comms if needed.
Definition reduction.h:157
Reduction & allreduce(bool b=true)
allreduce(bool) turns allreduce on or off. By default on.
Definition reduction.h:130
Reduction & delayed(bool b=true)
deferred(bool) turns deferred on or off. By default turns on.
Definition reduction.h:148
Complex< T > dagger(const Complex< T > &val)
Return dagger of Complex number.
Definition cmplx.h:1223
#define foralldir(d)
Macro to loop over (all) Direction(s)
Definition coordinates.h:78
Direction
Enumerator for direction that assigns integer to direction to be interpreted as unit vector.
Definition coordinates.h:34
constexpr Parity ALL
bit pattern: 011
auto mul_trace(const Mtype1 &a, const Mtype2 &b)
Returns trace of product of two matrices.
Definition matrix.h:2309