diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-11-26 13:54:09 -0500 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-11-26 13:54:09 -0500 |
commit | e469017c8ed33e3571da265f63cd0e64576daf2f (patch) | |
tree | d7a22c95c662e63c30a66144437857a9acaef967 | |
parent | 5909ee739b56b905970b0a988a0f3fe6a2908b82 (diff) | |
parent | b7b4a7f07b5db23eae48a4b1181f8e1369ef8cb8 (diff) | |
download | space_wolff-e469017c8ed33e3571da265f63cd0e64576daf2f.tar.gz space_wolff-e469017c8ed33e3571da265f63cd0e64576daf2f.tar.bz2 space_wolff-e469017c8ed33e3571da265f63cd0e64576daf2f.zip |
Merge branch 'master' of git:research/wolff/code/space_wolff
-rw-r--r-- | ising.cpp | 39 |
1 files changed, 6 insertions, 33 deletions
@@ -54,17 +54,13 @@ int main(int argc, char* argv[]) { double pZ = 1.0 - exp(-1.0 / T); - std::function<double(spin<signed, D, signed>, spin<signed, D, signed>, spin<signed, D, signed>)> Z = - [L, pZ] (spin<signed, D, signed> s1, spin<signed, D, signed> s2, spin<signed, D, signed> s1_new) -> double { + std::function<double(spin<signed, D, signed>, spin<signed, D, signed>)> Z = + [L, pZ] (spin<signed, D, signed> s1, spin<signed, D, signed> s2) -> double { bool old_one_one = false; bool old_many_ones = false; bool old_any_two = false; - bool new_one_one = false; - bool new_many_ones = false; - bool new_any_two = false; vector<signed, D> old_diff = diff<signed, D>(L, s1.x, s2.x); - vector<signed, D> new_diff = diff<signed, D>(L, s1_new.x, s2.x); for (unsigned i = 0; i < D; i++) { if (old_diff(i) == 1 && !old_one_one) { @@ -74,38 +70,15 @@ int main(int argc, char* argv[]) { } else if (old_diff(i) > 1) { old_any_two = true; } - if (new_diff(i) == 1 && !new_one_one) { - new_one_one = true; - } else if (new_diff(i) == 1 && new_one_one) { - new_many_ones = true; - } else if (new_diff(i) > 1) { - new_any_two = true; - } } bool were_on_someone = !old_one_one && !old_any_two; - bool are_on_someone = !new_one_one && !new_any_two; bool were_nearest_neighbors = old_one_one && !old_many_ones && !old_any_two; - bool are_nearest_neighbors = new_one_one && !new_many_ones && !new_any_two; if (were_on_someone) { - return 0.0; - } else if (are_on_someone) { - return 1.0; - } else if (were_nearest_neighbors && are_nearest_neighbors) { - return 0.0; + return -std::numeric_limits<double>::infinity();; } else if (were_nearest_neighbors) { - if (s1.s * s2.s == 1) { - return pZ; - } else { - return 0.0; - } - } else if (are_nearest_neighbors) { - if (s1_new.s * s2.s == -1) { - return pZ; - } else { - return 0.0; - } + return s1.s * s2.s; } else { return 0.0; } @@ -141,7 +114,7 @@ int main(int argc, char* argv[]) { return nn; }; - model<signed, D, signed> ising(L, Z, B, neighbors); + model<signed, D, signed> ising(L, L, Z, B, neighbors); randutils::auto_seed_128 seeds; std::mt19937 rng{seeds}; @@ -160,7 +133,7 @@ int main(int argc, char* argv[]) { ising.s.push_back({{i, j}, -1}); down++; } - ising.dict.record<signed>({i, j}, n); + ising.dict.record({i, j}, n); n++; } } |