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
|
#include <chrono>
#include <fstream>
#include <iostream>
#include "animation.hpp"
#include "space_wolff.hpp"
#include "spheres.hpp"
#include "torus_symmetries.hpp"
const unsigned D = 2;
typedef Model<double, D, TorusGroup<double, D>, Dimer<double, 2>> 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;
unsigned wait = 1000;
double k = 1e2;
double a = 0.1;
int opt;
while ((opt = getopt(argc, argv, "n:N:L:T:H:a:k:w:")) != -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;
case 'a':
a = atof(optarg);
break;
case 'k':
k = atof(optarg);
break;
case 'w':
wait = atoi(optarg);
break;
default:
exit(1);
}
}
auto zSingle = zSpheresTorus<D>(L, a, k);
auto Z = zDimers(zSingle);
std::function<double(Spin<double, D, Dimer<double, D>>)> B =
[L, H](Spin<double, D, Dimer<double, D>> s) -> double { return H * s.x(1); };
auto g1 = uniformGenTorus<D, Dimer<double, D>>(L);
auto tag = std::chrono::high_resolution_clock::now();
Animation<double, D, TorusGroup<double, D>, Dimer<double, D>> A(L, 750, argc, argv, wait, true);
model sphere(L, Z, B);
Rng rng;
sphere.s.resize(n);
unsigned nx = ceil(sqrt(n));
for (unsigned i = 0; i < sphere.s.size(); i++) {
Spin<double, 2, Dimer<double, D>>* ss = new Spin<double, 2, Dimer<double, D>>();
ss->x = {(i / nx) * L / nx, (i % nx) * L / nx};
ss->s = Dimer<double, D>{.relativePosition = {0.2, 0}, .radius = 0.25};
sphere.s[i] = ss;
sphere.dict.insert(ss);
}
sphere.wolff(T, {g1}, A, N);
std::ofstream snapfile;
snapfile.open("dimers_torus_snap.dat");
for (Spin<double, D, Dimer<double, D>>* s : sphere.s) {
Spin<double, D, Dimer<double, D>> rs = sphere.s0.inverse().act(*s);
snapfile << rs.s.radius << " " << rs.x.transpose() << " " << rs.s.relativePosition.transpose() << "\n";
delete s;
}
snapfile.close();
return 0;
}
|