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. --- hard_spheres.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'hard_spheres.cpp') diff --git a/hard_spheres.cpp b/hard_spheres.cpp index b53f7cf..6a14953 100644 --- a/hard_spheres.cpp +++ b/hard_spheres.cpp @@ -29,10 +29,23 @@ int main(int argc, char* argv[]) { HardSphere<2>& s1 = r.pick(m.particles); HardSphere<2>& s2 = r.pick(m.particles); - - m.swap(1, s1, s2, r); - if (i % (N * 3) == 0) { + 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; + + if (i % (N) == 0) { draw(m); } } -- cgit v1.2.3-54-g00ecf