#include #include #include #include "space_wolff.hpp" #include "torus_symmetries.hpp" #include "animation.hpp" const unsigned D = 2; typedef Model, Radius> model; int main(int argc, char* argv[]) { const unsigned D = 2; double L = 32; unsigned N = 1000; double T = 2.0 / log(1.0 + sqrt(2.0)); double H = 1.0; unsigned n = 25; int opt; while ((opt = getopt(argc, argv, "n:N:L:T:H:")) != -1) { switch (opt) { case 'n': n = (unsigned)atof(optarg); break; case 'N': N = (unsigned)atof(optarg); break; case 'L': L = atof(optarg); break; case 'T': T = atof(optarg); break; case 'H': H = atof(optarg); break; default: exit(1); } } double k = 1e8; double a = 0.0; std::function&, const Spin&)> Z = [L, a, k](const Spin& s1, const Spin& s2) -> double { Vector d = diff(L, s1.x, s2.x); double σ = s1.s + s2.s; double δ = σ - sqrt(d.transpose() * d); if (δ > -a * σ) { return 0.5 * k * (2 * pow(a * σ, 2) - pow(δ, 2)); } else if (δ > -2 * a * σ) { return 0.5 * k * pow(δ + 2 * a * σ, 2); } else { return 0; } }; std::function)> B = [L, H](Spin s) -> double { return H * s.x(1); }; auto g = uniformGenTorus(L); std::ofstream ofile("test.dat"); Animation, Radius> A(L, 750, argc, argv, 1000, true); model sphere(L, Z, B); randutils::mt19937_rng rng; sphere.s.resize(n); unsigned nx = floor(sqrt(n)); for (unsigned i = 0; i < sphere.s.size(); i++) { Spin* ss = new Spin(); ss->x = {(i / nx) * L / nx, (i % nx) * L / nx}; ss->s = rng.pick({0.45, 0.45}); sphere.s[i] = ss; sphere.dict.insert(ss); } sphere.wolff(T, {g}, A, N); ofile.close(); return 0; }