HILA
Loading...
Searching...
No Matches
log_plaquette_action.h
Go to the documentation of this file.
1/** @file log_plaquette_action.h */
2
3#ifndef LOG_PLAQUETTE_ACTION_H_
4#define LOG_PLAQUETTE_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_plaq_mat(const GaugeField<group> &U, Direction dir1, Direction dir2,
13 out_only Field<group> &C) {
14 // sets C=log(U) where U is the plaquette variable panned by dir1 and dir2
15 U[dir2].start_gather(dir1, ALL);
16 U[dir1].start_gather(dir2, ALL);
17
18 onsites(ALL) {
19 // log of dir1-dir2-plaquette that starts and ends at X; corresponds to F[dir1][dir2]
20 // at center location X+dir1/2+dir2/2 of plaquette:
21 C[X] = log((U[dir1][X] * U[dir2][X + dir1] * (U[dir2][X] * U[dir1][X + dir2]).dagger()))
22 .expand();
23 }
24}
25
26template <typename group>
27double measure_s_log_plaq(const GaugeField<group> &U) {
28 // measure the log action for dir1<dir2
29 // (just to have same normalization as with plaquette action)
30 Reduction<double> stot = 0;
31 stot.allreduce(false).delayed(true);
33 foralldir(dir1) foralldir(dir2) if (dir1 < dir2) {
34 get_log_plaq_mat(U, dir1, dir2, C);
35 onsites(ALL) {
36 stot += 0.5 * C[X].squarenorm();
37 }
38 }
39 return stot.value() / group::size();
40}
41
42template <typename group, typename atype = hila::arithmetic_type<group>>
43void get_force_log_plaq_add(const GaugeField<group> &U, VectorField<Algebra<group>> &K,
44 atype eps = 1.0) {
45 // compute gauge force for clover action and add result to K
47
48 foralldir(dir1) foralldir(dir2) if (dir1 < dir2) {
49 // get matrix log of the plaquette matrix in (dir1,dir2)-plane
50 get_log_plaq_mat(U, dir1, dir2, C);
51
52 // define the path around the plaquette
53 std::vector<Direction> path = {dir1, dir2, -dir1, -dir2};
54
55 // the force on the link (Y,dir) from the log of plaquette C with foot point X is:
56 // F[dir][Y] = -d_{Y,dir}(-0.5*Tr(C*C))
57 // = 0.5*Tr((d_{Y,dir}C)*C) + 0.5*Tr(C*(d_{Y,dir}C))
58 // = Tr((d_{Y,dir}C)*C)
59 // with: d_{Y,dir}log(P[X]) = (d_{Y,dir}P[X])*P[X].dagger()
60 // furthermore: (d^a_{X,dir[0]}P[X])*P[X].dagger() = T^a
61 // (d^a_{X+dir[0],dir[1]}P[X])*P[X].dagger() =
62 // U[dir[0]][X].dagger() * T^a * U[dir[0]][X]
63 // ...
64 // ...
65 // We therefore need only C to compute the log-action force:
66 get_wloop_force_from_wl_add(U, path, C, eps, K);
67 }
68}
69
70template <typename group, typename atype = hila::arithmetic_type<group>>
71void get_force_log_plaq(const GaugeField<group> &U, out_only VectorField<Algebra<group>> &K,
72 atype eps = 1.0) {
73 // determine gauge force for clover action and store result in K
74 foralldir(d1) {
75 K[d1][ALL] = 0;
76 }
77 get_force_log_plaq_add(U, K, eps);
78}
79
80
81#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
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