[Swift-commit] r8122 - demo/xsede.2014.0425/part04m
wilde at ci.uchicago.edu
wilde at ci.uchicago.edu
Wed Aug 13 10:34:52 CDT 2014
Author: wilde
Date: 2014-08-13 10:34:52 -0500 (Wed, 13 Aug 2014)
New Revision: 8122
Added:
demo/xsede.2014.0425/part04m/p4b.swift
Log:
Refined md demo.
Added: demo/xsede.2014.0425/part04m/p4b.swift
===================================================================
--- demo/xsede.2014.0425/part04m/p4b.swift (rev 0)
+++ demo/xsede.2014.0425/part04m/p4b.swift 2014-08-13 15:34:52 UTC (rev 8122)
@@ -0,0 +1,56 @@
+type file;
+
+(int result) randomInt ()
+{
+ float range = 9999999.0;
+ float rand = java("java.lang.Math","random");
+ string s[] = strsplit(toString(range*rand),"\\.");
+ result = toInt(s[0]);
+}
+
+app (file out, file traj) simulation (string npart, string steps, string mass)
+{
+# mdviz @out @traj 3 npart steps 50 ".0001" mass "0.1 1.0 0.2 0.05 50.0 0.1" 2.5 2.0 randomInt();
+ md 3 npart steps 10 ".0001" mass "0.1 1.0 0.2 0.05 50.0 0.1" 2.5 2.0 randomInt() @out @traj;
+}
+
+app (file o) analyze (file s[])
+{
+ mdstats filenames(s) stdout=filename(o);
+}
+
+app (file o) maxk (file s[])
+{
+ mdmaxk filenames(s) stdout=filename(o);
+}
+
+app (file o) analyze (file s[])
+{
+ mdstats filenames(s) stdout=filename(o);
+}
+
+app (file o) convert (file s[])
+{
+ convert filenames(s) filename(o);
+}
+
+int nsim = toInt(arg("nsim","10"));
+string npart = arg("npart","50");
+string steps = arg("steps","1000");
+string mass = arg("mass",".005");
+
+file sim[] <simple_mapper; prefix="output/sim_", suffix=".out">;
+file trj[] <simple_mapper; prefix="output/sim_", suffix=".trj.tgz">;
+
+foreach i in [0:nsim-1] {
+ (sim[i],trj[i]) = simulation(npart,steps,mass);
+}
+
+file stats_out<"output/average.out">;
+stats_out = analyze(sim);
+
+file ke_out<"output/kinetic.out">;
+ke_out = maxk(sim);
+
+#file viz_all<"output/all.gif">;
+#viz_all = convert(gifs);
More information about the Swift-commit
mailing list