14#define CSFLOWS CSFLOWACTION
32template <
typename group,
typename atype = hila::arithmetic_type<group>>
45 atype isqrt2 = 1.0/
sqrt(2.0);
48 get_force_bp(U, E, eps);
50 atype c12 = -1.0 / 12.0;
51 atype c11 = 1.0 - 8.0 * c12;
52 get_force_impr(U, E, eps * c11, eps * c12);
55 atype c11 = 1.0 - 8.0 * c12;
56 get_force_impr(U, E, eps * c11, eps * c12);
59 atype c11 = 1.0 - 8.0 * c12;
60 get_force_impr(U, E, eps * c11, eps * c12);
62 get_force_log_plaq(U, E, eps);
64 get_force_wplaq(U, E, eps);
69 E[d][X] /= isqrt2 * E[d][X].norm();
70 K[d][X] -= E[d][X].dot(K[d][X]) * E[d][X];
71 K[d][X] /= isqrt2 * K[d][X].norm();
80template <
typename group,
typename atype = hila::arithmetic_type<group>>
85 atype res = measure_s_bp(U);
87 atype c12 = -1.0 / 12.0;
88 atype c11 = 1.0 - 8.0 * c12;
89 atype res = measure_s_impr(U, c11, c12);
92 atype c11 = 1.0 - 8.0 * c12;
93 atype res = measure_s_impr(U, c11, c12);
96 atype c11 = 1.0 - 8.0 * c12;
97 atype res = measure_s_impr(U, c11, c12);
99 atype res = measure_s_log_plaq(U);
101 atype res = measure_s_wplaq(U);
110template <
typename group,
typename atype = hila::arithmetic_type<group>>
117 get_force_wplaq(U, Kc, -2.0);
120 de += Kc[d][X].dot(K[d][X]);
123 return (atype)de.
value();
126template <
typename group,
typename atype = hila::arithmetic_type<group>>
133 get_force_clover(U, Kc, -2.0);
136 de += Kc[d][X].dot(K[d][X]);
139 return (atype)de.
value();
142template <
typename group,
typename atype = hila::arithmetic_type<group>>
149 get_force_log(U, Kc, -2.0);
152 de += Kc[d][X].dot(K[d][X]);
155 return (atype)de.
value();
158template <
typename group,
typename atype = hila::arithmetic_type<group>>
160 atype flow_t, atype t_step) {
164 static bool first =
true;
168 hila::out0 <<
"CSINFO using bulk-prevention action\n";
170 hila::out0 <<
"CSINFO using Luscher-Weisz action\n";
172 hila::out0 <<
"CSINFO using Iwasaki action\n";
176 hila::out0 <<
"cSINFO using log-plaquette action\n";
178 hila::out0 <<
"CSINFO using Wilson's plaquette action\n";
181 hila::out0 <<
"LCSFLMEAS t S-flow S-plaq E_plaq dE_plaq/dt "
182 " E_clv dE_clv/dt Qtopo_clv E_log dE_log/dt "
183 "Qtopo_log [t_step_size] [max_S-plaq]\n";
186 atype slocal = measure_cs_s(V) /
187 (lattice.volume() * NDIM * (NDIM - 1) / 2);
190 atype plaq = measure_s_wplaq(V, max_plaq) /
191 (lattice.volume() * NDIM * (NDIM - 1) / 2);
192 atype eplaq = plaq * NDIM * (NDIM - 1) *
198 measure_topo_charge_and_energy_clover(V, qtopocl, ecl);
199 ecl /= lattice.volume();
203 atype qtopolog, elog;
204 measure_topo_charge_and_energy_log(V, qtopolog, elog);
205 elog /= lattice.volume();
208 atype deplaqdt = measure_dE_wplaq_dt(V, K) / lattice.volume();
211 atype declovdt = measure_dE_clov_dt(V, K) / lattice.volume();
214 atype delogdt = measure_dE_log_dt(V, K) / lattice.volume();
217 hila::out0 << string_format(
"CSFLMEAS % 9.3f % 0.6e % 0.6e % 0.6e % 0.6e % 0.6e % 0.6e % 0.6e "
218 "% 0.6e % 0.6e % 0.6e [%0.3e] [%0.3e]",
219 flow_t, slocal, plaq, eplaq, deplaqdt, ecl, declovdt, qtopocl, elog,
220 delogdt, qtopolog, t_step, max_plaq)
224template <
typename group,
typename atype = hila::arithmetic_type<group>>
226 atype t_len, atype atol = 1.0e-6, atype rtol = 1.0e-6, atype tstep = 0.0) {
233 atype iesp = 1.0 / esp;
235 atype maxstepmf = 1.0e2;
236 atype minmaxreldiff =
pow(maxstepmf, -esp);
243 atype ubstep = (tmax - t) / 3.0;
245 atype tatol = atol *
sqrt(2.0);
266 atype a21 = -17.0 / 36.0, a22 = 8.0 / 9.0;
277 atype b21 = -1.25, b22 = 2.0;
279 atype step = min(tstep, ubstep);
287 atype maxstk = 1.0e-1;
296 reldiff[X] = (tk[d][X].squarenorm());
298 atype tmaxtk = reldiff.
max();
303 maxtk =
sqrt(0.5 * maxtk);
306 if (maxtk > maxstk) {
307 step = min(maxstk / maxtk,
309 hila::out0 <<
"CSFINFO using max. gauge force (max_X |F(X)|=" << maxtk
310 <<
") to set initial flow time step size: " << step <<
"\n";
312 step = min((atype)1.0, ubstep);
314 }
else if (step * maxtk > maxstk) {
315 step = min(maxstk / maxtk,
317 hila::out0 <<
"CSFINFO using max. gauge force (max_X |F(X)|=" << maxtk
318 <<
") to set initial flow time step size: " << step <<
"\n";
326 while (t < tmax && !stop) {
327 if (t + step >= tmax) {
332 if (t + 1.5 * step >= tmax) {
333 step = 0.501 * (tmax - t);
340 V[d][X] =
chexp(k1[d][X] * (step * a11)) * V[d][X];
348 tk[d][X] *= (step * b22);
349 tk[d][X] += k1[d][X] * (step * b21);
350 V2[d][X] =
chexp(tk[d][X]) * V[d][X];
353 k2[d][X] *= (step * a22);
354 k2[d][X] += k1[d][X] * (step * a21);
355 V[d][X] =
chexp(k2[d][X]) * V[d][X];
361 k1[d][X] *= (step * a33);
362 k1[d][X] -= k2[d][X];
363 V[d][X] =
chexp(k1[d][X]) * V[d][X];
368 atype maxreldiff = 0.0;
371 reldiff[X] = (V2[d][X] * V[d][X].dagger()).project_to_algebra().
norm() /
372 (tatol + rtol * tk[d][X].norm() / step);
374 atype tmaxreldiff = reldiff.
max();
375 if (tmaxreldiff > maxreldiff) {
376 maxreldiff = tmaxreldiff;
380 if (maxreldiff < 1.0) {
392 if (maxreldiff > minmaxreldiff) {
393 maxstep = step *
pow(maxreldiff, -iesp);
395 maxstep = step * maxstepmf;
399 step = min((atype)0.9 * maxstep, ubstep);
Array< n, m, T > sqrt(Array< n, m, T > a)
Square root.
Array< n, m, T > pow(Array< n, m, T > a, int b)
Power.
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
T max(Parity par=ALL) const
Find maximum value from Field.
void reunitarize_gauge()
Reunitarize Gauge Field consisting of matrices.
Special reduction class: enables delayed and non-blocking reductions, which are not possible with the...
const T value()
Return value of the reduction variable. Wait for the comms if needed.
Reduction & allreduce(bool b=true)
allreduce(bool) turns allreduce on or off. By default on.
Reduction & delayed(bool b=true)
deferred(bool) turns deferred on or off. By default turns on.
#define foralldir(d)
Macro to loop over (all) Direction(s)
constexpr Parity ALL
bit pattern: 011
int chexp(const Matrix_t< n, m, T, MT > &mat, Matrix_t< n, m, T, MT > &omat, Mt(&pl)[n])
Calculate exp of a square matrix.
std::ostream out0
This writes output only from main process (node 0)