-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathgauge_tools.h
More file actions
277 lines (245 loc) · 12.5 KB
/
gauge_tools.h
File metadata and controls
277 lines (245 loc) · 12.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#include <random_quda.h>
#include <timer.h>
namespace quda
{
/**
* @brief Calculates a variety of gauge-field observables.
* @param[in] Gauge field upon which we are measuring.
* @param[in,out] param Parameter struct that defines which
* observables we are making and the resulting observables.
*/
void gaugeObservables(GaugeField &u, QudaGaugeObservableParam ¶m);
/**
* @brief Project the input gauge field onto the SU(3) group. This
* is a destructive operation. The number of link failures is
* reported so appropriate action can be taken.
*
* @param U Gauge field that we are projecting onto SU(3)
* @param tol Tolerance to which the iterative algorithm works
* @param fails Number of link failures (device pointer)
*/
void projectSU3(GaugeField &U, double tol, int *fails);
/**
@brief Compute the plaquette of the gauge field
@param[in] U The gauge field upon which to compute the plaquette
@return double3 variable returning (plaquette, spatial plaquette,
temporal plaquette) site averages normalized such that each
plaquette is in the range [0,1]
*/
double3 plaquette(const GaugeField &U);
/**
@brief Compute the plaquette and rectangle (1x2 + 2x1) of the gauge field
@param[in] U The gauge field upon which to compute the plaquette and rectangle
@return double4 variable returning (spatial plaquette, temporal plaquette,
spatial rectangle, temporal rectangle) site averages normalized such that each
plaquette and rectangle is in the range [0,1]
*/
double4 plaquetteRectangle(const GaugeField &U);
/**
@brief Generate Gaussian distributed su(N) or SU(N) fields. If U
is a momentum field, then we generate random Gaussian distributed
field in the Lie algebra using the anti-Hermitation convention.
If U is in the group then we create a Gaussian distributed su(n)
field and exponentiate it, e.g., U = exp(sigma * H), where H is
the distributed su(n) field and sigma is the width of the
distribution (sigma = 0 results in a free field, and sigma = 1 has
maximum disorder).
@param[out] U The output gauge field
@param[in] rngstate random states
@param[in] sigma Width of Gaussian distrubution
*/
void gaugeGauss(GaugeField &U, RNG &rngstate, double epsilon);
/**
@brief Generate Gaussian distributed su(N) or SU(N) fields. If U
is a momentum field, then we generate random Gaussian distributed
field in the Lie algebra using the anti-Hermitation convention.
If U is in the group then we create a Gaussian distributed su(n)
field and exponentiate it, e.g., U = exp(sigma * H), where H is
the distributed su(n) field and sigma is the width of the
distribution (sigma = 0 results in a free field, and sigma = 1 has
maximum disorder).
@param[out] U The GaugeField
@param[in] seed The seed used for the RNG
@param[in] sigma Wdith of the Gaussian distribution
*/
void gaugeGauss(GaugeField &U, unsigned long long seed, double epsilon);
/**
@brief Generate a random noise gauge field. This variant allows
the user to manage the RNG state. Works with arbitrary colors
(e.g., coarse grids). Always exectures on the device so if
handed a host field, the interface will handle copying to and
from the device.
@param U The gauge field
@param randstates Random state
@param type The type of noise to create (QUDA_NOISE_GAUSSIAN or QUDA_NOISE_UNIFORM)
*/
void gaugeNoise(GaugeField &U, RNG &rngstate, QudaNoiseType type);
/**
@brief Generate a random noise gauge field. This variant allows
the user to manage the RNG state. Works with arbitrary colors
(e.g., coarse grids). Always exectures on the device so if
handed a host field, the interface will handle copying to and
from the device.
@param U The gauge field
@param seed The seed used for the RNG
@param type The type of noise to create (QUDA_NOISE_GAUSSIAN or QUDA_NOISE_UNIFORM)
*/
void gaugeNoise(GaugeField &U, unsigned long long seed, QudaNoiseType type);
/**
@brief Apply APE smearing to the gauge field
@param[out] dataDs Output smeared field
@param[in] dataOr Input gauge field
@param[in] alpha smearing parameter
@param[in] dir_ignore ignored direction
@param[in] smear_anisotropy for anisotropic smearing (treats dir=3 differently)
*/
void APEStep(GaugeField &dataDs, GaugeField &dataOr, double alpha, int dir_ignore, double smear_anisotropy);
/**
@brief Apply STOUT smearing to the gauge field
@param[out] dataDs Output smeared field
@param[in] dataOr Input gauge field
@param[in] rho smearing parameter
@param[in] dir_ignore ignored direction
@param[in] smear_anisotropy for anisotropic smearing (treats dir=3 differently)
*/
void STOUTStep(GaugeField &dataDs, GaugeField &dataOr, double rho, int dir_ignore, double smear_anisotropy);
/**
@brief Apply Over Improved STOUT smearing to the gauge field
@param[out] dataDs Output smeared field
@param[in] dataOr Input gauge field
@param[in] rho smearing parameter
@param[in] epsilon smearing parameter
@param[in] dir_ignore ignored direction
@param[in] smear_anisotropy for anisotropic smearing (treats dir=3 differently)
*/
void OvrImpSTOUTStep(GaugeField &dataDs, GaugeField &dataOr, double rho, double epsilon, int dir_ignore,
double smear_anisotropy);
/**
@brief Apply HYP smearing to the gauge field
@param[out] dataDs Output smeared field
@param[in] dataOr Input gauge field
@param[in] alpha1 smearing parameter
@param[in] alpha2 smearing parameter
@param[in] alpha3 smearing parameter
@param[in] dir_ignore ignored direction
*/
void HYPStep(GaugeField &dataDs, GaugeField &dataOr, double alpha1, double alpha2, double alpha3, int dir_ignore);
/**
@brief Apply Wilson Flow steps to the gauge field.
This routine assumes that the input and output fields are
extended, with the input field being exchanged prior to calling
this function. On exit from this routine, the output field will
have been exchanged.
@param[out] out Output smeared field
@param[in] temp Temp space
@param[in] in Input gauge field
@param[in] epsilon Step size
@param[in] smear_type Wilson (1x1) or Symanzik improved (2x1) staples, else error
@param[in] smear_anisotropy for anisotropic Wilson or Symanzik flow
@param[in] rk_order Order of the Runga-Kutta integrator
*/
void WFlowStep(GaugeField &out, GaugeField &temp, GaugeField &in, double epsilon, QudaGaugeSmearType smear_type,
double smear_anisotropy, int rk_order);
/**
@brief Apply intermediary Wilson Flow steps W1, W2 or Vt to the gauge field.
This routine assumes that the input and output fields are
extended, with the input field being exchanged prior to calling
this function. On exit from this routine, the output field will
have been exchanged.
@param[out] out Output smeared field
@param[in] temp Temp space
@param[in] in Input gauge field
@param[in] epsilon Step size
@param[in] smear_type Wilson (1x1) or Symanzik improved (2x1) staples, else error
@param[in] step_type Which intermediary Wilson Flow step (W1, W2 or Vt) to perform
*/
void GFlowStep(GaugeField &out, GaugeField &temp, GaugeField &in, double epsilon, QudaGaugeSmearType smear_type,
QudaWFlowStepType step_type);
/**
* @brief Rotate gauge field U_\mu(x) with rotation field g(x).
* U'_\mu(x) = g(x)U_\mu(x)g^\dagger(x+\mu)
* @param[in,out] out Rotated gauge field U'_\mu(x)
* @param[in] in Gauge field U_\mu(x)
* @param[in] rot Rotation field g(x)
*/
void gaugeRotate(GaugeField &out, const GaugeField &in, const GaugeField &rot);
/**
* @brief Gauge fixing with over-relaxation.
* @param[in,out] rot Rotation field to fix the gauge
* @param[in] u Gauge field
* @param[in] omega The over-relaxation parameter, most common value is 1.5 or 1.7
* @param[in] dir_ignore The ignored direction, 3 (Coulomb gauge) and 4 (Landau gauge) are common choices
*/
void gaugeFixOVRStep(GaugeField &rot, const GaugeField &u, double omega, int dir_ignore);
/**
* @brief Compute the gauge fixing quality, functional or theta is considered as the criterion.
* @param[in,out] quality The functional and theta value
* @param[in] u Fixed gauge field
* @param[in] rot Rotation field
* @param[in] dir_ignore The ignored direction, 3 (Coulomb gauge) and 4 (Landau gauge) are common choices
* @param[in] compute_theta Set to true to compute the theta value as the criterion
*/
void gaugeFixQuality(double quality[2], const GaugeField &rot, const GaugeField &u, int dir_ignore, bool compute_theta);
/**
* @brief Gauge fixing with overrelaxation with support for single and multi GPU.
* @param[in,out] data, quda gauge field
* @param[in] gauge_dir, 3 for Coulomb gauge fixing, other for Landau gauge fixing
* @param[in] Nsteps, maximum number of steps to perform gauge fixing
* @param[in] verbose_interval, print gauge fixing info when iteration count is a multiple of this
* @param[in] relax_boost, gauge fixing parameter of the overrelaxation method, most common value is 1.5 or 1.7.
* @param[in] tolerance, torelance value to stop the method, if this
* value is zero then the method stops when iteration reachs the
* maximum number of steps defined by Nsteps
* @param[in] reunit_interval, reunitarize gauge field when iteration count is a multiple of this
* @param[in] stopWtheta, 0 for MILC criterion and 1 to use the theta value
*/
void gaugeFixingOVR(GaugeField &data, const int gauge_dir, const int Nsteps, const int verbose_interval,
const double relax_boost, const double tolerance, const int reunit_interval, const int stopWtheta);
/**
* @brief Gauge fixing with Steepest descent method with FFTs with support for single GPU only.
* @param[in,out] data, quda gauge field
* @param[in] gauge_dir, 3 for Coulomb gauge fixing, other for Landau gauge fixing
* @param[in] Nsteps, maximum number of steps to perform gauge fixing
* @param[in] verbose_interval, print gauge fixing info when iteration count is a multiple of this
* @param[in] alpha, gauge fixing parameter of the method, most common value is 0.08
* @param[in] autotune, 1 to autotune the method, i.e., if the Fg inverts its tendency we decrease the alpha value
* @param[in] tolerance, torelance value to stop the method, if this
* value is zero then the method stops when iteration reachs the
* maximum number of steps defined by Nsteps
* @param[in] stopWtheta, 0 for MILC criterion and 1 to use the theta value
*/
void gaugeFixingFFT(GaugeField &data, const int gauge_dir, const int Nsteps, const int verbose_interval,
const double alpha, const int autotune, const double tolerance, const int stopWtheta);
/**
@brief Compute the Fmunu tensor
@param[out] Fmunu The Fmunu tensor
@param[in] gauge The gauge field upon which to compute the Fmnu tensor
*/
void computeFmunu(GaugeField &Fmunu, const GaugeField &gauge);
/**
@brief Compute the topological charge and field energy
@param[out] energy The total, spatial, and temporal field energy
@param[out] qcharge The total topological charge
@param[in] Fmunu The Fmunu tensor, usually calculated from a
smeared configuration
*/
void computeQCharge(double energy[3], double &qcharge, const GaugeField &Fmunu);
/**
@brief Compute the topological charge, field energy and the
topological charge density per lattice site
@param[out] energy The total, spatial, and temporal field energy
@param[out] qcharge The total topological charge
@param[out] qdensity The topological charge at each lattice site
@param[in] Fmunu The Fmunu tensor, usually calculated from a
smeared configuration
*/
void computeQChargeDensity(double energy[3], double &qcharge, void *qdensity, const GaugeField &Fmunu);
/**
* @brief Compute the trace of the Polyakov loop in a given dimension
* @param[out] ploop The real and imaginary parts of the Polyakov loop
* @param[in] gauge The gauge field upon which to compute the Polyakov loop
* @param[in] dir The direction to compute the Polyakov loop in
* @param[in] profile TimeProfile instance used for profiling.
*/
void gaugePolyakovLoop(double ploop[2], const GaugeField &u, int dir, TimeProfile &profile);
} // namespace quda