From db9b5ba4ac75b3d4a2151e1b577928cfbb212bc1 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Thu, 16 Sep 2021 18:17:38 +0200 Subject: Implemented basic cluster flips. --- soft_spheres.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'soft_spheres.cpp') 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(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; -- cgit v1.2.3-54-g00ecf