summaryrefslogtreecommitdiff
path: root/examples/discrete_gaussian.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/discrete_gaussian.cpp')
-rw-r--r--examples/discrete_gaussian.cpp41
1 files changed, 20 insertions, 21 deletions
diff --git a/examples/discrete_gaussian.cpp b/examples/discrete_gaussian.cpp
index 75ea0f9..a6d6ceb 100644
--- a/examples/discrete_gaussian.cpp
+++ b/examples/discrete_gaussian.cpp
@@ -3,19 +3,18 @@
#include <iostream>
#include <chrono>
-#include "simple_measurement.hpp"
-
-#include <wolff/models/height.hpp>
-#include <wolff/models/dihedral_inf.hpp>
-
+#include <wolff_models/height.hpp>
+#include <wolff_models/dihedral_inf.hpp>
#include <wolff.hpp>
+#include "simple_measurement.hpp"
+
int main(int argc, char *argv[]) {
// set defaults
- N_t N = (N_t)1e4;
- D_t D = 2;
- L_t L = 128;
+ unsigned N = (unsigned)1e4;
+ unsigned D = 2;
+ unsigned L = 128;
double T = 0.8;
double H = 0.0;
@@ -25,7 +24,7 @@ int main(int argc, char *argv[]) {
while ((opt = getopt(argc, argv, "N:D:L:T:H:")) != -1) {
switch (opt) {
case 'N': // number of steps
- N = (N_t)atof(optarg);
+ N = (unsigned)atof(optarg);
break;
case 'D': // dimension
D = atoi(optarg);
@@ -45,35 +44,35 @@ int main(int argc, char *argv[]) {
}
// define the spin-spin coupling
- std::function <double(const height_t<int64_t>&, const height_t<int64_t>&)> Z = [] (const height_t<int64_t>& s1, const height_t<int64_t>& s2) -> double {
+ std::function <double(const height_t<long long>&, const height_t<long long>&)> Z = [] (const height_t<long long>& s1, const height_t<long long>& s2) -> double {
return - pow(s1.x - s2.x, 2);
};
// define the spin-field coupling
- std::function <double(const height_t<int64_t>&)> B = [&] (const height_t<int64_t>& s) -> double {
+ std::function <double(const height_t<long long>&)> B = [&] (const height_t<long long>& s) -> double {
return - H * pow(s.x, 2);
};
// initialize the lattice
- graph G(D, L);
+ graph<> G(D, L);
// initialize the system
- system<dihedral_inf_t<int64_t>, height_t<int64_t>> S(G, T, Z, B);
+ system<dihedral_inf_t<long long>, height_t<long long>, graph<>> S(G, T, Z, B);
bool odd_run = false;
- std::function <dihedral_inf_t<int64_t>(std::mt19937&, const system<dihedral_inf_t<int64_t>, height_t<int64_t>>&, v_t)> gen_R_IH = [&](std::mt19937& r, const system<dihedral_inf_t<int64_t>, height_t<int64_t>>& S, v_t i0) -> dihedral_inf_t<int64_t> {
- dihedral_inf_t<int64_t> rot;
+ std::function <dihedral_inf_t<long long>(std::mt19937&, const system<dihedral_inf_t<long long>, height_t<long long>, graph<>>&, const graph<>::vertex&)> gen_R_IH = [&](std::mt19937& r, const system<dihedral_inf_t<long long>, height_t<long long>, graph<>>& S, const graph<>::vertex &v) -> dihedral_inf_t<long long> {
+ dihedral_inf_t<long long> rot;
rot.is_reflection = true;
if (odd_run) {
- std::uniform_int_distribution<v_t> dist(0, S.nv - 2);
- v_t j = i0;
+ std::uniform_int_distribution<unsigned> dist(0, S.nv - 2);
+ unsigned j = v.ind;
//while (S.s[j].x == S.s[i0].x) {
- v_t tmp = dist(r);
+ unsigned tmp = dist(r);
- if (tmp < i0) {
+ if (tmp < v.ind) {
j = tmp;
} else {
j = tmp + 1;
@@ -85,9 +84,9 @@ int main(int argc, char *argv[]) {
std::uniform_int_distribution<int> dist(0, 1);
int j = dist(r);
if (j) {
- rot.x = 2 * S.s[i0].x + 1;
+ rot.x = 2 * S.s[v.ind].x + 1;
} else {
- rot.x = 2 * S.s[i0].x - 1;
+ rot.x = 2 * S.s[v.ind].x - 1;
}
}