summaryrefslogtreecommitdiff
path: root/spheres_infinite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'spheres_infinite.cpp')
-rw-r--r--spheres_infinite.cpp57
1 files changed, 45 insertions, 12 deletions
diff --git a/spheres_infinite.cpp b/spheres_infinite.cpp
index af91427..3fd6da2 100644
--- a/spheres_infinite.cpp
+++ b/spheres_infinite.cpp
@@ -10,6 +10,46 @@
const unsigned D = 2;
typedef Model<double, D, Euclidean<double, D>, double> model;
+class SaveFlip : public measurement<double, D, Euclidean<double, D>, Radius> {
+ std::ofstream snapfile;
+ unsigned n;
+
+ public:
+ SaveFlip() {}
+
+ void pre_cluster(const Model<double, D, Euclidean<double, D>, Radius>& m, unsigned,
+ const Transformation<double, D, Euclidean<double, D>, Radius>* t) override {
+ snapfile.open("sphere_flip.dat");
+ n = 0;
+ for (const Sphere<D>* s : m.s) {
+ snapfile << s << " " << s->s << " " << s->x.transpose() << " ";
+ }
+ snapfile << "\n";
+ }
+
+ void plain_site_transformed(const Model<double, D, Euclidean<double, D>, Radius>& m,
+ const Transformation<double, D, Euclidean<double, D>, Radius>& t) override {
+ for (const Sphere<D>* s : t.current()) {
+ snapfile << s << " ";
+ }
+ snapfile << "\n";
+ n++;
+ }
+
+ void post_cluster(const Model<double, D, Euclidean<double, D>, Radius>& m) override {
+ for (const Sphere<D>* s : m.s) {
+ snapfile << s << " " << s->s << " " << s->x.transpose() << " ";
+ }
+ snapfile << "\n";
+ snapfile.close();
+ std::cout << n << "\n";
+ if (2 < n && n < 20) {
+ getchar();
+ }
+ }
+
+};
+
int main(int argc, char* argv[]) {
const unsigned D = 2;
@@ -65,7 +105,7 @@ int main(int argc, char* argv[]) {
};
auto g1 = nudgeGen<D, Radius>(1);
- auto g2 = swapGen<D, Radius>(0.1);
+ auto g2 = swapGen<D, Radius>(0.01);
auto g3 = accrossGen<D, Radius>(0.1);
auto g4 = centerGen<D, Radius>(0);
@@ -93,20 +133,13 @@ int main(int argc, char* argv[]) {
sphere.dict.insert(ss);
}
- sphere.wolff(T, {g1, g2, g3, g4}, A, N);
-
- file.close();
+ measurement<double, D, Euclidean<double, D>, Radius> A_tmp;
- std::ofstream snapfile;
- snapfile.open("sphere_snap.dat");
+ sphere.wolff(T, {g1, g2, g3, g4}, A_tmp, N);
- for (Spin<double, D, double>* s : sphere.s) {
- Spin<double, D, double> rs = sphere.s0.inverse().act(*s);
- snapfile << rs.s << " " << rs.x.transpose() << "\n";
- delete s;
- }
+ SaveFlip A_new;
+ sphere.wolff(T, {g2}, A_new, 10000);
- snapfile.close();
return 0;
}