aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2016-02-21 23:43:40 +0100
committerRahiel Kasim <rahielkasim@gmail.com>2016-02-21 23:43:40 +0100
commit5b23fd22b795d6109643e5d68a2d5d53a85fb61c (patch)
tree42dca59e3cccff797155c21fc733cc4f4b9c71e5
parentca517c670e3b606366b265173e34a1efeaa9cede (diff)
plot energy drift
-rw-r--r--Run/plots.py19
-rwxr-xr-xRun/run_deltat_efficiency_leapfrog31
2 files changed, 49 insertions, 1 deletions
diff --git a/Run/plots.py b/Run/plots.py
index 2d135b2..3069fc3 100644
--- a/Run/plots.py
+++ b/Run/plots.py
@@ -79,5 +79,22 @@ def plot_efficiency():
plt.ylabel(r"$\eta$")
plt.legend(ncol=3, loc="upper left")
plt.grid()
- # plt.show()
plt.savefig("efficiency", dpi=600)
+
+
+def plot_energy_drift():
+ """Plot results generated by run_energy_drift (like figure 15.2)."""
+ data = (("energy_drift_leapfrog.txt", "Leapfrog", 1),
+ ("energy_drift_multi_n3.txt", "MTS n = 3", 3),
+ ("energy_drift_multi_n4.txt", "MTS n = 4", 4),
+ ("energy_drift_multi_n10.txt", "MTS n = 10", 10))
+ for (s, label, n) in data:
+ dt, energy_drft = np.genfromtxt(s).T
+ dt = dt * n # big time step for MTS
+ plt.loglog(dt, energy_drft, label=label)
+ plt.title("Energy Drift vs Time step")
+ plt.xlabel(r"$\Delta t$")
+ plt.ylabel("E")
+ plt.grid()
+ plt.legend(loc="lower right", ncol=2)
+ plt.savefig("energy_drft", dpi=400)
diff --git a/Run/run_deltat_efficiency_leapfrog b/Run/run_deltat_efficiency_leapfrog
new file mode 100755
index 0000000..6e5d5d0
--- /dev/null
+++ b/Run/run_deltat_efficiency_leapfrog
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+rmin=$(python -c 'print 2 ** (1/6.)')
+rv2=$(python -c "print 1.05 * 2 ** (1/6.)")
+temp=0.7238
+stepsizes="0.001 0.0005 0.0001 0.00005 0.00001 0.000005 0.000001"
+f="deltat_efficiency_leapfrog.txt"
+
+
+for delt in $stepsizes; do
+ cat > fort.15 <<endofdata
+ ibeg , delt tmax tequil nsamp
+ 0 ${delt} 5 1.00 1
+npart temp rho iseed
+108 ${temp} 0.8442 123456
+ scale temp
+ .true. 0.728
+iout igr iout2 ivacf t0vacf t0stress iout3 iout4
+33 10 34 10000000 100 100000 35 36
+samp1 samp2 tdifmax
+.true. .false. 100
+rcp rv rc2 rv2
+2.5 2.625 ${rmin} ${rv2}
+multi n drift
+.false. 1 .false.
+endofdata
+ cp lj.res fort.11
+ printf "%s\t" "$delt" >> "$f"
+ /usr/bin/time -f "%e\t%U\t%S" -o "$f" -a ../Source/MD
+ rm fort.*
+done