From 4740abed9fcd40359a9ced3a97ac1b9f56e379a0 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Mon, 20 Jul 2020 13:35:48 -0400 Subject: Thesis work. --- torus_symmetries.hpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'torus_symmetries.hpp') diff --git a/torus_symmetries.hpp b/torus_symmetries.hpp index 53f61ac..829c886 100644 --- a/torus_symmetries.hpp +++ b/torus_symmetries.hpp @@ -122,3 +122,54 @@ Gen, S> uniformGenTorus(double L) { }; } +template +Gen, S> rotateSwapTorus(double L, double ε) { + return [L, ε](Model, S>& M, + Rng& rng) -> Transformation, S>* { + Spin* s1 = rng.pick(M.s); + Spin* s2 = rng.pick(M.s); + + while (s1 == s2) { + s2 = rng.pick(M.s); + } + + Vector t1 = s1->x; + Vector t2 = s2->x; + Vector t = (t1 + t2) / 2; + + t(0) = mod(t(0) + rng.variate(0, ε), L); + t(1) = mod(t(1) + rng.variate(0, ε), L); + + Matrix m; + + m(0, 0) = -1; + m(1, 1) = -1; + m(0, 1) = 0; + m(1, 0) = 0; + + TorusGroup g(L, t - m * t, m); + + return new PairFlip, S>(M, g, s1, s2); + }; +} + +template +Gen, S> nudgeGenTorus(double L, double ε) { + std::vector> torusMatrices = torus_mats(); + return [L, ε, + torusMatrices](Model, S>& M, + Rng& rng) -> Transformation, S>* { + Matrix m = rng.pick(torusMatrices); + Spin* s = rng.pick(M.s); + Vector t = s->x; + + for (unsigned i = 0; i < D; i++) { + t(i) = mod(t(i) + rng.variate(0, ε), L); + } + + TorusGroup g = TorusGroup({(double)L, t - m * t, m}); + + return new SpinFlip, S>(M, g, s); + }; +} + -- cgit v1.2.3-54-g00ecf