summaryrefslogtreecommitdiff
path: root/spheres_infinite.cpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2020-02-12 14:59:13 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2020-02-12 14:59:13 -0500
commitd5a7a3f2e5808e7a3327242dc9b368afed9383bf (patch)
tree515e87793a726260bdee6641d91780bc42ff2b1b /spheres_infinite.cpp
parent3044b71aa308c0fae90ae5655bda8bc76f6619dd (diff)
downloadspace_wolff-d5a7a3f2e5808e7a3327242dc9b368afed9383bf.tar.gz
space_wolff-d5a7a3f2e5808e7a3327242dc9b368afed9383bf.tar.bz2
space_wolff-d5a7a3f2e5808e7a3327242dc9b368afed9383bf.zip
Changed the RNG and implemented Transformations as the method for parameterizing movement.
Diffstat (limited to 'spheres_infinite.cpp')
-rw-r--r--spheres_infinite.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/spheres_infinite.cpp b/spheres_infinite.cpp
index a9cd7d0..3505d6d 100644
--- a/spheres_infinite.cpp
+++ b/spheres_infinite.cpp
@@ -68,7 +68,7 @@ public:
};
Gen<double, D, Euclidean<double, D>, double> eGen(double ε) {
- return [ε](const model& M, randutils::mt19937_rng& rng) -> Euclidean<double, 2> {
+ return [ε](model& M, Rng& rng) -> Transformation<double, D, Euclidean<double, D>, double>* {
Vector<double, D> t;
Matrix<double, D> m;
@@ -85,12 +85,12 @@ Gen<double, D, Euclidean<double, D>, double> eGen(double ε) {
}
Euclidean<double, D> g(t - m * t, m);
- return g;
+ return new SpinFlip<double, D, Euclidean<double, D>, double>(M, g, M.s[f_ind]);
};
}
Gen<double, D, Euclidean<double, D>, double> mGen(double ε) {
- return [ε](const model& M, randutils::mt19937_rng& rng) -> Euclidean<double, 2> {
+ return [ε](model& M, Rng& rng) -> Transformation<double, D, Euclidean<double, D>, double>* {
Matrix<double, D> m;
unsigned f_ind1 = rng.uniform((unsigned)0, (unsigned)M.s.size());
@@ -110,7 +110,7 @@ Gen<double, D, Euclidean<double, D>, double> mGen(double ε) {
m(1, 0) = -2 * cos(θ) * sin(θ);
Euclidean<double, D> g(t - m * t, m);
- return g;
+ return new PairFlip<double, D, Euclidean<double, D>, double>(M, g, M.s[f_ind1], M.s[f_ind2]);
};
}
@@ -123,9 +123,12 @@ int main(int argc, char* argv[]) {
double H = 1.0;
unsigned n = 25;
+ double k = 1e2;
+ double a = 0.1;
+
int opt;
- while ((opt = getopt(argc, argv, "n:N:L:T:H:")) != -1) {
+ while ((opt = getopt(argc, argv, "n:N:L:T:H:a:k:")) != -1) {
switch (opt) {
case 'n':
n = (unsigned)atof(optarg);
@@ -142,14 +145,17 @@ int main(int argc, char* argv[]) {
case 'H':
H = atof(optarg);
break;
+ case 'a':
+ a = atof(optarg);
+ break;
+ case 'k':
+ k = atof(optarg);
+ break;
default:
exit(1);
}
}
- double k = 1000;
- double a = 0.05;
-
std::function<double(const Spin<double, D, double>&, const Spin<double, D, double>&)> Z =
[L, a, k](const Spin<double, D, double>& s1, const Spin<double, D, double>& s2) -> double {
Vector<double, D> d = s1.x - s2.x;
@@ -170,19 +176,19 @@ int main(int argc, char* argv[]) {
return H * s.x.norm();
};
- auto g1 = eGen(0.25);
- auto g2 = mGen(0.1);
+ auto g1 = eGen(0.5);
+ auto g2 = mGen(0.2);
animation A(L, 750, argc, argv);
model sphere(1, Z, B);
- randutils::mt19937_rng rng;
+ Rng rng;
sphere.s.reserve(n);
unsigned nx = floor(sqrt(n));
for (unsigned i = 0; i < n; i++) {
Vector<double, D> pos = {(i / nx) * L / nx, (i % nx) * L / nx};
- sphere.s.push_back({pos, rng.uniform<double>(0.45, 0.45)});
+ sphere.s.push_back({pos, rng.uniform<double>(0.25, 0.45)});
sphere.dict.insert(&sphere.s.back());
}