From b96c82a1c1d95cfa090c4c99e4b4851a5c96e202 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 25 Feb 2020 16:49:40 -0500 Subject: Started implementing dimers on a torus --- spheres.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'spheres.hpp') diff --git a/spheres.hpp b/spheres.hpp index 040313c..3dc4a5e 100644 --- a/spheres.hpp +++ b/spheres.hpp @@ -20,6 +20,25 @@ zSpheres(double a, double k) { }; } +template +std::function&, const Spin&)> +zSpheresTorus(double L, double a, double k) { + return [L, a, k](const Spin& s1, const Spin& s2) -> double { + Vector d = diff(L, s1.x, s2.x); + + double σ = s1.s + s2.s; + double δ = σ - sqrt(d.transpose() * d); + + if (δ > -a * σ) { + return 0.5 * k * (2 * pow(a * σ, 2) - pow(δ, 2)); + } else if (δ > -2 * a * σ) { + return 0.5 * k * pow(δ + 2 * a * σ, 2); + } else { + return 0; + } + }; +} + template std::function)> bCenter(double H) { return [H](Spin s) -> double { return H * s.x.norm(); }; } -- cgit v1.2.3-54-g00ecf