diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2021-09-16 18:17:38 +0200 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2021-09-16 18:17:38 +0200 |
commit | db9b5ba4ac75b3d4a2151e1b577928cfbb212bc1 (patch) | |
tree | 8b2b971c233e0a02bcfb7afcc2fffa8aefdd8f69 /hard_spheres.cpp | |
parent | 496dcbd9960677db246a84bcd3e4b4230ee28e0a (diff) | |
download | spheres-db9b5ba4ac75b3d4a2151e1b577928cfbb212bc1.tar.gz spheres-db9b5ba4ac75b3d4a2151e1b577928cfbb212bc1.tar.bz2 spheres-db9b5ba4ac75b3d4a2151e1b577928cfbb212bc1.zip |
Implemented basic cluster flips.
Diffstat (limited to 'hard_spheres.cpp')
-rw-r--r-- | hard_spheres.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
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); } } |