2#include "gauge/stout_smear.h"
17#include "parameters.h"
18#include "polyakov_surface.h"
19#include "twist_specific_methods.h"
36template <
typename group>
39 static bool first =
true;
41 auto plaq = measure_plaq_with_z(
45 print_formatted_numbers(plaq,
"plaquette",
true,
true);
46 print_formatted_numbers(plaq,
"plaquette",
false,
true);
49 print_formatted_numbers(plaq,
"plaquette",
false,
true);
59template <
typename group>
61 const parameters &p) {
63 static bool first =
true;
65 auto plaq = measure_plaq_with_z(
69 print_formatted_numbers(plaq,
"plaquette",
true,
true);
70 print_formatted_numbers(plaq,
"plaquette",
false,
true);
73 print_formatted_numbers(plaq,
"plaquette",
false,
true);
77template <
typename group>
79 static bool first =
true;
80 auto poly = measure_polyakov_with_z(U);
81 auto poly_abs = measure_polyakov_with_z_abs(U);
83 print_formatted_numbers(poly,
"polyakov",
true,
true);
84 print_formatted_numbers(poly,
"polyakov",
false,
true);
85 print_formatted_numbers(poly_abs,
"polyakov abs",
false,
true);
88 print_formatted_numbers(poly,
"polyakov",
false,
true);
89 print_formatted_numbers(poly_abs,
"polyakov abs",
false,
true);
91 hila::out0 <<
"polyakov last: " << poly.back() <<
'\n';
92 hila::out0 <<
"polyakov abs last: " << poly_abs.back() <<
'\n';
95template <
typename group>
97 const parameters &p) {
98 static bool first =
true;
99 auto poly = measure_polyakov_with_z(U);
100 auto poly_abs = measure_polyakov_with_z_abs(U);
102 print_formatted_numbers(poly,
"polyakov",
true,
true);
103 print_formatted_numbers(poly,
"polyakov",
false,
true);
104 print_formatted_numbers(poly_abs,
"polyakov abs",
false,
true);
107 print_formatted_numbers(poly,
"polyakov",
false,
true);
108 print_formatted_numbers(poly_abs,
"polyakov abs",
false,
true);
125template <
typename group>
135template <
typename group>
136void update_multicanonical(
GaugeField<group> &U,
const parameters &p,
bool relax) {
143 auto OP = measure_polyakov_with_z_abs(U);
144 auto OP_old = measure_polyakov_with_z_abs(U_old);
146 if (!hila::muca::accept_reject(OP_old.back(), OP.back())) {
149 }
else if (p.muca_action) {
152 auto OP = measure_plaq_with_z(U, p.twist_coeff);
153 auto OP_old = measure_plaq_with_z(U_old, p.twist_coeff);
155 if (!hila::muca::accept_reject(OP_old.back(), OP.back())) {
179template <
typename group>
189 staples_timer.start();
192 staplesum_twist(U, staples, d, p.twist_coeff, par);
194 staples_timer.stop();
205 onsites(par) {
suN_heatbath(U[d][X], staples[X], p.beta); }
220template <
typename group>
223 for (
int n = 0; n < p.n_update; n++) {
224 for (
int i = 0; i < p.n_overrelax; i++) {
243template <
typename group>
245 for (
int n = 0; n < p.n_update; n++) {
246 for (
int i = 0; i < p.n_overrelax; i++) {
247 update_multicanonical(U, p,
true);
250 update_multicanonical(U, p,
false);
262 const parameters &p) {
265 bool iterate_status =
true;
266 while (iterate_status) {
267 for (
int i = 0; i < p.muca_updates; i++) {
268 do_trajectory_multicanonical(U, p);
271 auto OP = measure_plaq_with_z(U, p.twist_coeff);
272 hila::out0 <<
"Order parameter: " << OP.back() << std::endl;
273 iterate_status = hila::muca::iterate_weights(OP.back());
275 auto OP = measure_polyakov_with_z_abs(U);
276 hila::out0 <<
"Order parameter: " <<
abs(OP.back()) << std::endl;
277 iterate_status = hila::muca::iterate_weights(OP.back());
283int main(
int argc,
char **argv) {
306 lsize = par.get(
"lattice size");
308 p.beta = par.get(
"beta");
311 p.deltab = par.get(
"delta beta fraction");
313 p.n_overrelax = par.get(
"overrelax steps");
314 p.n_update = par.get(
"updates in trajectory");
315 p.n_trajectories = par.get(
"trajectories");
316 p.n_thermal = par.get(
"thermalization");
319 long seed = par.get(
"random seed");
321 p.n_save = par.get(
"traj/saved");
323 p.config_file = par.get(
"config name");
324 p.twist_coeff = par.get(
"twist_coeff");
325 if (par.get_item(
"updates/profile meas", {
"off",
"%i"}) == 1) {
326 p.n_profile = par.get();
331 p.n_smear = par.get(
"smearing steps");
332 p.smear_coeff = par.get(
"smear coefficient");
333 p.z_smear = par.get(
"z smearing steps");
334 p.n_surface = par.get(
"traj/surface");
335 p.n_dump_polyakov = par.get(
"traj/polyakov dump");
337 if (p.n_smear.size() != p.z_smear.size()) {
339 <<
"Error in input file: number of values in 'smearing steps' != 'z "
345 p.n_dump_polyakov = 0;
347 p.muca_action = par.get(
"muca_action");
348 p.muca_poly = par.get(
"muca_poly");
349 p.muca_updates = par.get(
"muca_updates");
350 p.measure_surface = par.get(
"measure_surface");
351 double initial_state = par.get(
"initial_state");
357 lattice.
setup(lsize);
362 int start_traj = -p.n_thermal;
373 foralldir(d) { onsites(
ALL) U[d][X].gaussian_random(); }
375 restore_checkpoint(U, start_traj, p);
379 if (p.muca_action || p.muca_poly) {
382 MFile.open(
"muca_measurements", std::ios_base::app);
383 iterate_weights_multicanonical(U, p);
393 do_trajectory_ptr = do_trajectory_multicanonical<mygroup>;
394 measure_plaquette_ptr = measure_plaq_multicanonical<mygroup>;
395 measure_polyakov_ptr = measure_poly<mygroup>;
396 }
else if (p.muca_poly) {
397 do_trajectory_ptr = do_trajectory_multicanonical<mygroup>;
398 measure_plaquette_ptr = measure_plaq<mygroup>;
399 measure_polyakov_ptr = measure_poly_multicanonical<mygroup>;
401 do_trajectory_ptr = do_trajectory<mygroup>;
402 measure_plaquette_ptr = measure_plaq<mygroup>;
403 measure_polyakov_ptr = measure_poly<mygroup>;
406 for (
int trajectory = start_traj; trajectory < p.n_trajectories;
410 update_timer.start();
413 do_trajectory_ptr(U, p);
416 hila::synchronize_threads();
420 if (trajectory >= 0) {
421 measure_timer.start();
423 measure_plaquette_ptr(U, p);
425 measure_polyakov_ptr(U, p);
427 if (p.measure_surface)
428 measure_polyakov_surface(U, p, trajectory);
432 measure_timer.stop();
435 if (p.n_save > 0 && (trajectory + 1) % p.n_save == 0) {
436 checkpoint(U, trajectory, p);
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
void reunitarize_gauge()
Reunitarize Gauge Field consisting of matrices.
static constexpr int size()
Returns size of Vector or square Matrix.
void setup(const CoordinateVector &siz)
General lattice setup.
T abs(const Complex< T > &a)
Return absolute value of Complex number.
Parity
Parity enum with values EVEN, ODD, ALL; refers to parity of the site. Parity of site (x,...
constexpr Parity EVEN
bit pattern: 001
#define foralldir(d)
Macro to loop over (all) Direction(s)
constexpr Parity ODD
bit pattern: 010
Direction
Enumerator for direction that assigns integer to direction to be interpreted as unit vector.
constexpr Parity ALL
bit pattern: 011
void write_weight_function(string W_function_filename)
Reads the precomputed weight function from run_parameters struct and saves it into a file.
void initialise(const string wfile_name)
Loads parameters and weights for the multicanonical computation.
double weight(double OP)
process 0 interface to "weight function" for the user accessing the weights.
Header for model agnostic implementation of various multicanonical (muca) methods.
std::ostream out0
This writes output only from main process (node 0)
void initialize(int argc, char **argv)
Read in command line arguments. Initialise default stream and MPI communication.
void seed_random(uint64_t seed, bool device_rng=true)
Seed random generators with 64-bit unsigned value. On MPI shuffles the seed so that different MPI ran...
bool is_rng_seeded()
Check if RNG is seeded already.
void finishrun()
Normal, controlled exit - all nodes must call this. Prints timing information and information about c...
void terminate(int status)
void update(GaugeField< group > &U, const parameters &p, bool relax)
Wrapper update function.
void update_parity_dir(GaugeField< group > &U, const parameters &p, Parity par, Direction d, bool relax)
Wrapper function to updated GaugeField per direction.
void do_trajectory(GaugeField< group > &U, const parameters &p)
Evolve gauge field.
double suN_heatbath(SU< N, T > &U, const SU< N, T > &staple, double beta)
heatbath
void suN_overrelax(SU< N, T > &U, const SU< N, T > &staple)
Overrelaxation using SU(2) subgroups