summaryrefslogtreecommitdiff
path: root/soft_spheres.cpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2021-09-16 18:17:38 +0200
committerJaron Kent-Dobias <jaron@kent-dobias.com>2021-09-16 18:17:38 +0200
commitdb9b5ba4ac75b3d4a2151e1b577928cfbb212bc1 (patch)
tree8b2b971c233e0a02bcfb7afcc2fffa8aefdd8f69 /soft_spheres.cpp
parent496dcbd9960677db246a84bcd3e4b4230ee28e0a (diff)
downloadspheres-db9b5ba4ac75b3d4a2151e1b577928cfbb212bc1.tar.gz
spheres-db9b5ba4ac75b3d4a2151e1b577928cfbb212bc1.tar.bz2
spheres-db9b5ba4ac75b3d4a2151e1b577928cfbb212bc1.zip
Implemented basic cluster flips.
Diffstat (limited to 'soft_spheres.cpp')
-rw-r--r--soft_spheres.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/soft_spheres.cpp b/soft_spheres.cpp
index a71a472..cdd6f31 100644
--- a/soft_spheres.cpp
+++ b/soft_spheres.cpp
@@ -4,7 +4,7 @@ int main(int argc, char* argv[]) {
const unsigned n = 12;
unsigned N = 1200;
- double R = 0.024;
+ double R = 0.023;
double ε = 0.01;
unsigned steps = 1e6;
double β = 1;
@@ -28,16 +28,28 @@ int main(int argc, char* argv[]) {
Δxi = r.variate<double, std::normal_distribution>(0, ε);
}
- m.metropolis(β, s, Δx, r);
+ for (unsigned j = 0; j < N; j++)
+ m.metropolis(β, s, Δx, r);
SoftSphere<2, n>& s1 = r.pick(m.particles);
SoftSphere<2, n>& s2 = r.pick(m.particles);
-
- m.swap(β, s1, s2, r);
- if (i % (N * 3) == 0) {
- draw(m);
- }
+ Vector<2> t1 = s1.x;
+ Vector<2> t2 = s2.x;
+ Vector<2> t = (t1 + t2) / 2;
+
+ Matrix<2> mat;
+
+ mat(0, 0) = -1;
+ mat(1, 1) = -1;
+ mat(0, 1) = 0;
+ mat(1, 0) = 0;
+
+ Euclidean<2> g(t - mat * t, mat);
+
+ std::cout << m.clusterFlip(1, g, s1, r) << std::endl;
+
+ draw(m);
}
return 0;