diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2020-05-12 20:12:21 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2020-05-12 20:12:21 -0400 |
commit | 5e82f6a6b64a7c6dbe5c0a625292631f6f8b58f4 (patch) | |
tree | 540bb0bab7a239ea3f0d769dad058e6ab35247f7 | |
parent | 139c91c629f7be16ab8efef6e2089753057efe38 (diff) | |
download | code-5e82f6a6b64a7c6dbe5c0a625292631f6f8b58f4.tar.gz code-5e82f6a6b64a7c6dbe5c0a625292631f6f8b58f4.tar.bz2 code-5e82f6a6b64a7c6dbe5c0a625292631f6f8b58f4.zip |
Some simplifications.
-rw-r--r-- | metastable.cpp | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/metastable.cpp b/metastable.cpp index 5986b97..9a51358 100644 --- a/metastable.cpp +++ b/metastable.cpp @@ -83,20 +83,15 @@ void update_distribution_file(std::string id, const std::vector<std::vector<uint class meas : public measurement<ising_t, ising_t, graph<>> { private: std::vector<uint64_t> mag_dist; - std::vector<std::vector<uint64_t>> energy_mag_dist; - - signed E; signed M; - std::string model_string; public: meas(const wolff::system<ising_t, ising_t, graph<>>& S, double H) - : mag_dist(S.nv + 1, 0), energy_mag_dist(S.nv + 1) { - M = S.nv * S.s[0]; - E = S.ne; - for (std::vector<uint64_t>& d : energy_mag_dist) { - d.resize(S.ne + 1, 0); + : mag_dist(S.nv + 1, 0) { + M = 0; + for (const ising_t& s : S.s) { + M = M + S.s0.act_inverse(s); } model_string = "metastable_" + std::to_string(S.G.D) + "_" + std::to_string(S.G.L) + "_" + to_string_with_precision(S.T) + "_" + to_string_with_precision(H) + "_"; @@ -104,16 +99,6 @@ public: ~meas() { update_distribution_file("m", mag_dist, model_string); - update_distribution_file("e", energy_mag_dist, model_string); - } - - void plain_bond_visited(const wolff::system<ising_t, ising_t, graph<>>&, - const typename graph<>::halfedge&, const ising_t&, double dE) override { - if (dE > 0) { - E -= 2; - } else { - E += 2; - } } void ghost_bond_visited(const wolff::system<ising_t, ising_t, graph<>>&, const typename graph<>::vertex&, @@ -123,11 +108,11 @@ public: void post_cluster(unsigned, unsigned, const wolff::system<ising_t, ising_t, graph<>>& S) override { mag_dist[(S.nv + M) / 2]++; - energy_mag_dist[(S.nv + M) / 2][(E + S.ne) / 2]++; } }; int main(int argc, char* argv[]) { + unsigned w = (unsigned)1e2; unsigned N = (unsigned)1e4; unsigned D = 2; unsigned L = 128; @@ -136,8 +121,11 @@ int main(int argc, char* argv[]) { int opt; - while ((opt = getopt(argc, argv, "N:D:L:T:H:")) != -1) { + while ((opt = getopt(argc, argv, "w:N:D:L:T:H:")) != -1) { switch (opt) { + case 'w': // number of steps to wait + w = (unsigned)atof(optarg); + break; case 'N': // number of steps N = (unsigned)atof(optarg); break; @@ -174,6 +162,10 @@ int main(int argc, char* argv[]) { randutils::auto_seed_128 seeds; std::mt19937 rng(seeds); + wolff::measurement<ising_t, ising_t, graph<>> nullMeasurement; + + S.run_wolff(w, gen_ising<graph<>>, nullMeasurement, rng); + meas A(S, H); // run wolff N times |