summaryrefslogtreecommitdiff
path: root/spheres_infinite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'spheres_infinite.cpp')
-rw-r--r--spheres_infinite.cpp70
1 files changed, 44 insertions, 26 deletions
diff --git a/spheres_infinite.cpp b/spheres_infinite.cpp
index 3f8747b..56abe77 100644
--- a/spheres_infinite.cpp
+++ b/spheres_infinite.cpp
@@ -36,28 +36,6 @@ public:
gluOrtho2D(-L, L, -L, L);
}
- void plain_site_transformed(const model& m, const Transformation<double, D, Euclidean<double, D>, double>& t) override {
- if (n > wait) {
- if (t.current().size() > 1) {
- glColor3f(0.0f, 0.0f, 1.0f);
- } else {
- glColor3f(0.0f, 1.0f, 0.0f);
- }
- for (const Spin<double, 2, double>* s : t.current()) {
- if (s != NULL) {
- glBegin(GL_POLYGON);
- unsigned n_points = 50;
- for (unsigned i = 0; i < n_points; i++) {
- glVertex2d(s0_tmp.act(*s).x(0) + s->s * cos(2 * i * M_PI / n_points),
- s0_tmp.act(*s).x(1) + s->s * sin(2 * i * M_PI / n_points));
- }
- glEnd();
- }
- }
- }
- tmp++;
- }
-
void pre_cluster(const model& m, unsigned, const Transformation<double, D, Euclidean<double, D>, double>* t) override {
s0_tmp = m.s0.inverse();
tmp = 0;
@@ -71,26 +49,58 @@ public:
Vector<double, 2> v2 = s0_tmp.act({r(0) - L * sin(θ), r(1) + L * cos(θ)});
glVertex2d(v1(0), v1(1));
glVertex2d(v2(0), v2(1));
+ if (n > wait)
+ file << v1.transpose() << " " << v2.transpose() << std::endl;
glEnd();
for (const Spin<double, 2, double>* s : m.s) {
glBegin(GL_POLYGON);
unsigned n_points = 50;
glColor3f(0.0f, 0.0f, 0.0f);
+ if (n > wait)
+ file << s << " " << s->s << " " << s0_tmp.act(*s).x.transpose() << " ";
for (unsigned i = 0; i < n_points; i++) {
glVertex2d(s0_tmp.act(*s).x(0) + s->s * cos(2 * i * M_PI / n_points),
s0_tmp.act(*s).x(1) + s->s * sin(2 * i * M_PI / n_points));
}
glEnd();
}
+ if (n > wait)
+ file << std::endl;
glLineWidth(3);
glFlush();
}
+ void plain_site_transformed(const model& m, const Transformation<double, D, Euclidean<double, D>, double>& t) override {
+ if (n > wait) {
+ if (t.current().size() > 1) {
+ glColor3f(0.0f, 0.0f, 1.0f);
+ } else {
+ glColor3f(0.0f, 1.0f, 0.0f);
+ }
+ for (const Spin<double, 2, double>* s : t.current()) {
+ if (s != NULL) {
+ file << s << " " << s0_tmp.act(t.r.act(*s)).x.transpose() << " ";
+ glBegin(GL_POLYGON);
+ unsigned n_points = 50;
+ for (unsigned i = 0; i < n_points; i++) {
+ glVertex2d(s0_tmp.act(*s).x(0) + s->s * cos(2 * i * M_PI / n_points),
+ s0_tmp.act(*s).x(1) + s->s * sin(2 * i * M_PI / n_points));
+ }
+ glEnd();
+ } else {
+ file << s << " " << s0_tmp.act({0, 0}).transpose() << " ";
+ }
+ }
+ }
+ tmp++;
+ }
+
void post_cluster(const model& m) override {
- glFlush();
t1 += tmp;
t2 += tmp * tmp;
if (n > wait) {
+ file << std::endl;
+ glFlush();
sleep(2);
}
n++;
@@ -280,10 +290,18 @@ int main(int argc, char* argv[]) {
return H * s.x.norm();
};
+ std::function<double(Spin<double, D, double>)> B_hard = [L, H](Spin<double, D, double> s) -> double {
+ if (fabs(s.x(0)) < 3 * L / 4 && fabs(s.x(1)) < 3 * L / 4) {
+ return 0;
+ } else {
+ return std::numeric_limits<double>::infinity();
+ }
+ };
+
auto g1 = eGen(1);
auto g2 = mGen(0.1);
auto g3 = tGen(0.1);
- auto g4 = rGen(1);
+ auto g4 = rGen(0);
auto tag = std::chrono::high_resolution_clock::now();
@@ -303,8 +321,8 @@ int main(int argc, char* argv[]) {
unsigned nx = floor(sqrt(n));
for (unsigned i = 0; i < sphere.s.size(); i++) {
Spin<double, 2, double>* ss = new Spin<double, 2, double>();
- ss->x = {(i / nx) * L / nx, (i % nx) * L / nx};
- ss->s = rng.pick({0.5, 0.5});
+ ss->x = {(i / nx) * L / nx - L / 2, (i % nx) * L / nx - L / 2};
+ ss->s = rng.pick({0.45, 0.45});
sphere.s[i] = ss;
sphere.dict.insert(ss);
}