diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-03-12 19:32:56 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-03-12 19:32:56 -0400 |
commit | 6bf9f10081c62809633528c4ef7fef7020cc03e9 (patch) | |
tree | ed9b8a19ae8c80533e2d61048da4d62d7c206ca4 /src | |
parent | c960d23a9e147c2043df852460427b95bf752583 (diff) | |
download | c++-6bf9f10081c62809633528c4ef7fef7020cc03e9.tar.gz c++-6bf9f10081c62809633528c4ef7fef7020cc03e9.tar.bz2 c++-6bf9f10081c62809633528c4ef7fef7020cc03e9.zip |
changes
Diffstat (limited to 'src')
-rw-r--r-- | src/wolff_potts.c | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/wolff_potts.c b/src/wolff_potts.c index 8dc4471..b525e0b 100644 --- a/src/wolff_potts.c +++ b/src/wolff_potts.c @@ -19,12 +19,14 @@ int main(int argc, char *argv[]) { bool pretend_ising = false; bool planar_potts = false; bool silent = false; + bool snapshots = false; + bool snapshot = false; int opt; q_t J_ind = 0; q_t H_ind = 0; - while ((opt = getopt(argc, argv, "N:n:D:L:q:T:J:H:m:e:Ips")) != -1) { + while ((opt = getopt(argc, argv, "N:n:D:L:q:T:J:H:m:e:IpsSP")) != -1) { switch (opt) { case 'N': N = (count_t)atof(optarg); @@ -67,6 +69,12 @@ int main(int argc, char *argv[]) { case 's': silent = true; break; + case 'S': + snapshots = true; + break; + case 'P': + snapshot = true; + break; default: exit(EXIT_FAILURE); } @@ -205,6 +213,26 @@ int main(int argc, char *argv[]) { } update_meas(clust, tmp_flips); + + if (snapshots) { + FILE *snapfile = fopen("snapshots.m", "a"); + fprintf(snapfile, "{{"); + for (L_t i = 0; i < L; i++) { + fprintf(snapfile, "{"); + for (L_t j = 0; j < L; j++) { + fprintf(snapfile, "%" PRIq, dihedral_inverse_act(q, s->R, s->spins[L * i + j])); + if (j != L - 1) { + fprintf(snapfile, ","); + } + } + fprintf(snapfile, "}"); + if (i != L - 1) { + fprintf(snapfile, ","); + } + } + fprintf(snapfile, "},{%" PRIq ",%d}} ", s->R->i, s->R->r); + fclose(snapfile); + } } for (q_t i = 0; i < q; i++) { @@ -231,6 +259,31 @@ int main(int argc, char *argv[]) { ", dH/H = %.4f, dM/M = %.4f, dC/C = %.4f, dX/X = %.4f, cps: %.1f\n", n_runs, fabs(E->dx / E->x), M[0]->dx / M[0]->x, E->dc / E->c, M[0]->dc / M[0]->c, h->nv / clust->x); + if (snapshots) { + FILE *snapfile = fopen("snapshots.m", "a"); + fprintf(snapfile, "\n"); + } + + if (snapshot) { + FILE *snapfile = fopen("snapshot.m", "a"); + fprintf(snapfile, "{{"); + for (L_t i = 0; i < L; i++) { + fprintf(snapfile, "{"); + for (L_t j = 0; j < L; j++) { + fprintf(snapfile, "%" PRIq, dihedral_inverse_act(q, s->R, s->spins[L * i + j])); + if (j != L - 1) { + fprintf(snapfile, ","); + } + } + fprintf(snapfile, "}"); + if (i != L - 1) { + fprintf(snapfile, ","); + } + } + fprintf(snapfile, "},{%" PRIq ",%d}}\n", s->R->i, s->R->r); + fclose(snapfile); + } + FILE *outfile = fopen("out.m", "a"); fprintf(outfile, "<|D->%" PRID ",L->%" PRIL ",q->%" PRIq ",T->%.15f,J->{", D, L, q, T); |