From cca9f02ab3c366602af4ebd4595f6d6083b29de5 Mon Sep 17 00:00:00 2001 From: James Osborn Date: Wed, 12 Jun 2024 16:14:00 -0500 Subject: [PATCH] add some output --- src/examples/harmonic.nim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/examples/harmonic.nim b/src/examples/harmonic.nim index affae60..8d5bbbb 100644 --- a/src/examples/harmonic.nim +++ b/src/examples/harmonic.nim @@ -22,6 +22,10 @@ var globalRng: MRG32k3a # global RNG globalRng.seed(seed, 987654321) +echo "ntraj: ", ntraj +echo "nsteps: ", nsteps +echo "tau: ", tau + proc refreshMomentum(p: auto) = threads: p.gaussian rng @@ -70,6 +74,7 @@ proc printObservables(x: auto) = threads: x := 0 +var ds2 = 0.0 for traj in 1..ntraj: refreshMomentum(p) threads: @@ -79,6 +84,7 @@ for traj in 1..ntraj: evolve(p, x) let s1 = action(p, x) let ds = s1 - s0 + ds2 += ds*ds let pacc = exp(-ds) let r = globalRng.uniform if r <= pacc: # accept @@ -93,4 +99,5 @@ for traj in 1..ntraj: printObservables(x) echo "Acceptance ratio: ", nAccept/ntraj +echo "ds2: ", ds2/ntraj qexFinalize()