summaryrefslogtreecommitdiff
path: root/space_wolff.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'space_wolff.hpp')
-rw-r--r--space_wolff.hpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/space_wolff.hpp b/space_wolff.hpp
index 211e647..81ff776 100644
--- a/space_wolff.hpp
+++ b/space_wolff.hpp
@@ -245,22 +245,18 @@ public:
template <class U, int D, class S> class Model;
-/*
template <class U, int D, class S>
class measurement {
public:
virtual void pre_cluster(const Model<U, D, S>&, unsigned, const Euclidean<U, D>&) {};
- virtual void plain_bond_visited(const Model<U, D, S>&, const X_t&, double) {};
- virtual void plain_site_transformed(const system<R_t, X_t, G_t>&, const typename G_t::vertex&
-v, const X_t&) {};
+ virtual void plain_bond_visited(const Model<U, D, S>&, const Spin<U, D, S>*, const Spin<U, D, S>*, const Spin<U, D, S>& , double) {};
+ virtual void plain_site_transformed(const Model<U, D, S>&, const Spin<U, D, S>*, const Spin<U, D, S>&) {};
- virtual void ghost_bond_visited(const system<R_t, X_t, G_t>&, const typename G_t::vertex& v,
-const X_t&, const X_t&, double) {}; virtual void ghost_site_transformed(const system<R_t, X_t,
-G_t>&, const R_t&) {};
+ virtual void ghost_bond_visited(const Model<U, D, S>&, const Spin<U, D, S>&, const Spin<U, D, S>&, double) {};
+ virtual void ghost_site_transformed(const Model<U, D, S>&, const Euclidean<U, D>&) {};
- virtual void post_cluster(unsigned, unsigned, const system<R_t, X_t, G_t>&) {};
+ virtual void post_cluster(const Model<U, D, S>&) {};
};
- */
template <class U, int D, class S> class Model {
public:
@@ -275,6 +271,7 @@ public:
std::vector<Matrix<U, D>> mats;
std::vector<Vector<U, D>> steps;
double E;
+ measurement<U, D, S> &A;
void one_sequences(std::list<std::array<double, D>>& sequences, unsigned level) {
if (level > 0) {
@@ -290,8 +287,8 @@ public:
}
Model(U L, std::function<double(const Spin<U, D, S>&, const Spin<U, D, S>&)> Z,
- std::function<double(const Spin<U, D, S>&)> B, unsigned dDepth, unsigned nDepth)
- : L(L), s0(L), dict(L, dDepth), Z(Z), B(B), dDepth(dDepth), nDepth(nDepth) {
+ std::function<double(const Spin<U, D, S>&)> B, unsigned dDepth, unsigned nDepth, measurement<U, D, S>& A)
+ : L(L), s0(L), dict(L, dDepth), Z(Z), B(B), dDepth(dDepth), nDepth(nDepth), A(A) {
std::array<double, D> ini_sequence;
ini_sequence.fill(1);
std::list<std::array<double, D>> sequences;
@@ -383,11 +380,13 @@ public:
Spin<U, D, S> s0s_old = s0.inverse().act(ss);
Spin<U, D, S> s0s_new = s0_new.inverse().act(ss);
double p = 1.0 - exp(-(B(s0s_new) - B(s0s_old)) / T);
+ A.ghost_bond_visited(*this, s0s_old, s0s_new, p);
if (dist(rng) < p) {
queue.push(&ss);
}
- s0 = s0_new;
}
+ A.ghost_site_transformed(*this, s0_new);
+ s0 = s0_new;
} else {
Spin<U, D, S> si_new = r.act(*si);
std::set<Spin<U, D, S>*> all_neighbors;
@@ -404,14 +403,17 @@ public:
Spin<U, D, S> s0s_old = s0.inverse().act(*si);
Spin<U, D, S> s0s_new = s0.inverse().act(si_new);
p = 1.0 - exp(-(B(s0s_new) - B(s0s_old)) / T);
+ A.ghost_bond_visited(*this, s0s_old, s0s_new, p);
} else {
- p = 1.0 - exp(-(Z(si_new, *sj) - Z(*si, *sj)) / T);
+ p = 1.0 - exp(-(Z(*si, *sj) - Z(si_new, *sj)) / T);
+ A.plain_bond_visited(*this, si, sj, si_new, p);
}
if (dist(rng) < p) {
queue.push(sj);
}
}
}
+ A.plain_site_transformed(*this, si, si_new);
dict.remove(si);
*si = si_new;
dict.insert(si);
@@ -452,7 +454,13 @@ public:
Euclidean<U, D> g(L, t, m);
- this->step(T, ind_dist(rng), g, rng);
+ unsigned ind = ind_dist(rng);
+
+ A.pre_cluster(*this, ind, g);
+
+ this->step(T, ind, g, rng);
+
+ A.post_cluster(*this);
this->update_energy();
}