diff options
-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++; } } |