HILA
Loading...
Searching...
No Matches
log_clover_action.h
Go to the documentation of this file.
1/** @file log_clover_action.h */
2
3#ifndef LOG_CLOVER_ACTION_H_
4#define LOG_CLOVER_ACTION_H_
5
6#include "hila.h"
8
9// functions for log clover gauge action
10
11template <typename group, typename atype = hila::arithmetic_type<group>>
12void get_log_clover_mat(const GaugeField<group> &U, Direction dir1, Direction dir2,
13 out_only Field<group> &Csum) {
14 // sets Csum=(C[0]+C[1]+C[2]+C[3])/4 where C[0],C[1],C[2],C[3] are the logs of the clover-leaf
15 // matrices in counter-clockwise order
16
17 U[dir2].start_gather(dir1, ALL);
18 U[dir1].start_gather(dir2, ALL);
19
20 Field<group> tF;
21
22 onsites(ALL) {
23 // log of dir1-dir2-plaquette that starts and ends at X; corresponds to F[dir1][dir2]
24 // at center location X+dir1/2+dir2/2 of plaquette:
25 Csum[X] = log((U[dir1][X] * U[dir2][X + dir1] * (U[dir2][X] * U[dir1][X + dir2]).dagger()))
26 .expand();
27 // parallel transport to X+dir1
28 tF[X] = U[dir1][X].dagger() * Csum[X] * U[dir1][X];
29 }
30 tF.start_gather(-dir1, ALL);
31 // add parallel transported leaf-matrix from X-dir1 to the leaf-matrix at X
32 onsites(ALL) {
33 Csum[X] += tF[X - dir1];
34 }
35
36 onsites(ALL) {
37 // parallel transport two-leaves sum from X to X+dir2
38 tF[X] = U[dir2][X].dagger() * Csum[X] * U[dir2][X];
39 }
40 tF.start_gather(-dir2, ALL);
41 // add parallel transported two-leaves sum from X-dir2 to two-leaves sum at X and divide by 4
42 onsites(ALL) {
43 Csum[X] += tF[X - dir2];
44 Csum[X] *= 0.25;
45 }
46}
47
48template <typename group>
49double measure_s_log(const GaugeField<group> &U) {
50 // measure the log action for dir1<dir2
51 // (just to have same normalization as with plaquette action)
52 Reduction<double> stot = 0;
53 stot.allreduce(false).delayed(true);
54 Field<group> Csum;
55 foralldir(dir1) foralldir(dir2) if (dir1 < dir2) {
56 get_log_clover_mat(U, dir1, dir2, Csum);
57 onsites(ALL) {
58 stot += 0.5 * Csum[X].squarenorm();
59 }
60 }
61 return stot.value() / group::size();
62}
63
64template <typename group, typename atype = hila::arithmetic_type<group>>
65void get_force_log_add(const GaugeField<group> &U, VectorField<Algebra<group>> &K,
66 atype eps = 1.0) {
67 // compute gauge force for clover action and add result to K
68 Field<group> Csum;
69
70 foralldir(dir1) foralldir(dir2) if (dir1 < dir2) {
71 // get the 4 clover leave matrices C[][X] (ordered counter-clockwise in (dir1,dir2)-plane)
72 // and their anti-hermitian traceless sum Csum[X]
73 get_log_clover_mat(U, dir1, dir2, Csum);
74
75 // define for each clover leaf matrix the correspondin path of gauge links
76 std::vector<Direction> paths[4] = {{dir1, dir2, -dir1, -dir2},
77 {dir2, -dir1, -dir2, dir1},
78 {-dir1, -dir2, dir1, dir2},
79 {-dir2, dir1, dir2, -dir1}};
80
81 // the force on the link (Y,dir) from the clover term with foot point X is:
82 // F[dir][Y] = -d_{Y,dir}(-0.5*Tr(Csum*Csum))
83 // = 0.5*Tr((d_{Y,dir}Csum)*Csum) + 0.5*Tr(Csum*(d_{Y,dir}Csum))
84 // = Tr((d_{Y,dir}Csum)*Csum)
85 // = 0.25*\sum_k Tr((d_{Y,dir}log(C[k][X]))*Csum[X])
86 // with: d_{Y,dir}log(C[k][X]) = (d_{Y,dir}C[k][X])*C[k][X].dagger()
87 // where C[k][X] is the k-th clover leaf matrix,
88 // furthermore: (d^a_{X,dir[0]}C[0][X])*C[0][X].dagger() = T^a
89 // (d^a_{X+dir[0],dir[1]}C[0][X])*C[0][X].dagger() =
90 // U[dir[0]][X].dagger() * T^a * U[dir[0]][X]
91 // ...
92 // ...
93 // We therefore need only Csum/4 to compute the log-action force:
94 for (int k = 0; k < 4; ++k) {
95 // compute the gauge force from the first 4 links of all the Wilson loops that are
96 // summed in tC[k] (is valid to do so since first 4 links are the same for all Wilson
97 // loops and projection on Lie-algebra is linear)
98 get_wloop_force_from_wl_add(U, paths[k], Csum, 0.25*eps, K);
99 }
100 }
101}
102
103template <typename group, typename atype = hila::arithmetic_type<group>>
104void get_force_log(const GaugeField<group> &U, out_only VectorField<Algebra<group>> &K,
105 atype eps = 1.0) {
106 // determine gauge force for clover action and store result in K
107 foralldir(d1) {
108 K[d1][ALL] = 0;
109 }
110 get_force_log_add(U, K, eps);
111}
112
113
114#endif
Array< n, m, T > log(Array< n, m, T > a)
Logarithm.
Definition array.h:1069
Definition su2.h:7
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
Definition field.h:61
double squarenorm() const
Squarenorm.
Definition field.h:1083
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