summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2018-07-17 22:37:57 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2018-07-17 22:37:57 -0400
commit8a6109a78a6f7b9e9585cd89e8a10d1f626b3af1 (patch)
treee92a3dd47173597f5f5e54668f98c2fe77b4d40f /src
parent6a3d9dbb3f5f1c242ada1ecbbdbb9c3cd865d4cf (diff)
downloadc++-8a6109a78a6f7b9e9585cd89e8a10d1f626b3af1.tar.gz
c++-8a6109a78a6f7b9e9585cd89e8a10d1f626b3af1.tar.bz2
c++-8a6109a78a6f7b9e9585cd89e8a10d1f626b3af1.zip
made many changes to implement alternate reflection generators, this is broken
Diffstat (limited to 'src')
-rw-r--r--src/analyze_correlations.cpp6
-rw-r--r--src/wolff_heisenberg.cpp26
-rw-r--r--src/wolff_planar.cpp27
3 files changed, 52 insertions, 7 deletions
diff --git a/src/analyze_correlations.cpp b/src/analyze_correlations.cpp
index 6b8d28d..cf8e740 100644
--- a/src/analyze_correlations.cpp
+++ b/src/analyze_correlations.cpp
@@ -239,7 +239,11 @@ int main (int argc, char *argv[]) {
for (q_t i = 0; i < q - 1; i++) {
fscanf(metadata, "%lf, ", &(H[i]));
}
- fscanf(metadata, "%lf} |>\n", &(H[q - 1]));
+ char *field = (char *)malloc(32 * sizeof(char));
+ double epsilon;
+ fscanf(metadata, "%lf}, \"GENERATOR\" -> \"%[^\"]\", \"EPS\" -> %lf |>\n", &(H[q - 1]), field, &epsilon);
+
+ free(field);
free(H);
char *filename_E = (char *)malloc(128 * sizeof(char));
diff --git a/src/wolff_heisenberg.cpp b/src/wolff_heisenberg.cpp
index aed4156..83ea503 100644
--- a/src/wolff_heisenberg.cpp
+++ b/src/wolff_heisenberg.cpp
@@ -13,12 +13,14 @@ int main(int argc, char *argv[]) {
double *H = (double *)calloc(MAX_Q, sizeof(double));
bool silent = false;
+ bool use_pert = false;
int opt;
q_t J_ind = 0;
q_t H_ind = 0;
+ double epsilon = 1;
- while ((opt = getopt(argc, argv, "N:q:D:L:T:J:H:s")) != -1) {
+ while ((opt = getopt(argc, argv, "N:q:D:L:T:J:H:spe:")) != -1) {
switch (opt) {
case 'N': // number of steps
N = (count_t)atof(optarg);
@@ -39,6 +41,12 @@ int main(int argc, char *argv[]) {
case 's': // don't print anything during simulation. speeds up slightly
silent = true;
break;
+ case 'p':
+ use_pert = true;
+ break;
+ case 'e':
+ epsilon = atof(optarg);
+ break;
default:
exit(EXIT_FAILURE);
}
@@ -52,6 +60,18 @@ int main(int argc, char *argv[]) {
timestamp = spec.tv_sec*1000000000LL + spec.tv_nsec;
}
+ std::function <orthogonal_t <3, double>(gsl_rng *, const state_t <orthogonal_t <3, double>, vector_t <3, double>> *)> gen_R;
+
+ const char *pert_type;
+
+ if (use_pert) {
+ gen_R = std::bind(generate_rotation_perturbation <3>, std::placeholders::_1, std::placeholders::_2, epsilon);
+ pert_type = "PERTURB";
+ } else {
+ gen_R = generate_rotation_uniform <3>;
+ pert_type = "UNIFORM";
+ }
+
FILE *outfile_info = fopen("wolff_metadata.txt", "a");
fprintf(outfile_info, "<| \"ID\" -> %lu, \"MODEL\" -> \"HEISENBERG\", \"q\" -> 3, \"D\" -> %" PRID ", \"L\" -> %" PRIL ", \"NV\" -> %" PRIv ", \"NE\" -> %" PRIv ", \"T\" -> %.15f, \"H\" -> {", timestamp, D, L, L * L, D * L * L, T);
@@ -63,12 +83,12 @@ int main(int argc, char *argv[]) {
}
}
- fprintf(outfile_info, "} |>\n");
+ fprintf(outfile_info, "}, \"GENERATOR\" -> \"%s\", \"EPS\" -> %g |>\n", pert_type, epsilon);
fclose(outfile_info);
- wolff <orthogonal_t <3, double>, vector_t <3, double>> (N, D, L, T, dot <3, double>, std::bind(H_vector <3, double>, std::placeholders::_1, H), timestamp, silent);
+ wolff <orthogonal_t <3, double>, vector_t <3, double>> (N, D, L, T, dot <3, double>, std::bind(H_vector <3, double>, std::placeholders::_1, H), gen_R, timestamp, silent);
free(H);
diff --git a/src/wolff_planar.cpp b/src/wolff_planar.cpp
index 02ededc..2a3d02b 100644
--- a/src/wolff_planar.cpp
+++ b/src/wolff_planar.cpp
@@ -13,12 +13,14 @@ int main(int argc, char *argv[]) {
double *H = (double *)calloc(MAX_Q, sizeof(double));
bool silent = false;
+ bool use_pert = false;
int opt;
q_t J_ind = 0;
q_t H_ind = 0;
+ double epsilon = 1;
- while ((opt = getopt(argc, argv, "N:q:D:L:T:J:H:s")) != -1) {
+ while ((opt = getopt(argc, argv, "N:q:D:L:T:J:H:spe:")) != -1) {
switch (opt) {
case 'N': // number of steps
N = (count_t)atof(optarg);
@@ -39,6 +41,12 @@ int main(int argc, char *argv[]) {
case 's': // don't print anything during simulation. speeds up slightly
silent = true;
break;
+ case 'p':
+ use_pert = true;
+ break;
+ case 'e':
+ epsilon = atof(optarg);
+ break;
default:
exit(EXIT_FAILURE);
}
@@ -52,6 +60,19 @@ int main(int argc, char *argv[]) {
timestamp = spec.tv_sec*1000000000LL + spec.tv_nsec;
}
+ const char *pert_type;
+
+ std::function <orthogonal_t <2, double>(gsl_rng *, const state_t <orthogonal_t <2, double>, vector_t <2, double>> *)> gen_R;
+
+ if (use_pert) {
+ gen_R = std::bind(generate_rotation_perturbation <2>, std::placeholders::_1, std::placeholders::_2, epsilon);
+ pert_type = "PERTURB";
+ } else {
+ gen_R = generate_rotation_uniform <2>;
+ pert_type = "UNIFORM";
+ }
+
+
FILE *outfile_info = fopen("wolff_metadata.txt", "a");
fprintf(outfile_info, "<| \"ID\" -> %lu, \"MODEL\" -> \"PLANAR\", \"q\" -> 2, \"D\" -> %" PRID ", \"L\" -> %" PRIL ", \"NV\" -> %" PRIv ", \"NE\" -> %" PRIv ", \"T\" -> %.15f, \"H\" -> {", timestamp, D, L, L * L, D * L * L, T);
@@ -63,12 +84,12 @@ int main(int argc, char *argv[]) {
}
}
- fprintf(outfile_info, "} |>\n");
+ fprintf(outfile_info, "}, \"GENERATOR\" -> \"%s\", \"EPS\" -> %g |>\n", pert_type, epsilon);
fclose(outfile_info);
- wolff <orthogonal_t <2, double>, vector_t <2, double>> (N, D, L, T, dot <2, double>, std::bind(H_vector <2, double>, std::placeholders::_1, H), timestamp, silent);
+ wolff <orthogonal_t <2, double>, vector_t <2, double>> (N, D, L, T, dot <2, double>, std::bind(H_vector <2, double>, std::placeholders::_1, H), gen_R, timestamp, silent);
free(H);