[Swift-commit] r8142 - in demo/xsede.2014.0425: app part04m
wilde at ci.uchicago.edu
wilde at ci.uchicago.edu
Wed Aug 13 15:04:06 CDT 2014
Author: wilde
Date: 2014-08-13 15:04:05 -0500 (Wed, 13 Aug 2014)
New Revision: 8142
Added:
demo/xsede.2014.0425/app/genmovie
demo/xsede.2014.0425/app/gettrj.sh
demo/xsede.2014.0425/app/renderframe
Modified:
demo/xsede.2014.0425/app/mdmaxk
demo/xsede.2014.0425/app/mdtotk
demo/xsede.2014.0425/part04m/p4b.swift
Log:
First end-to-end movie-making workflow (p4b.swift) for mdlite.
Added: demo/xsede.2014.0425/app/genmovie
===================================================================
--- demo/xsede.2014.0425/app/genmovie (rev 0)
+++ demo/xsede.2014.0425/app/genmovie 2014-08-13 20:04:05 UTC (rev 8142)
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+movie=$1
+shift
+
+convert -delay 20 $* $movie
Added: demo/xsede.2014.0425/app/gettrj.sh
===================================================================
--- demo/xsede.2014.0425/app/gettrj.sh (rev 0)
+++ demo/xsede.2014.0425/app/gettrj.sh 2014-08-13 20:04:05 UTC (rev 8142)
@@ -0,0 +1,3 @@
+# awk "\$1 == ${1:-1} { print \$0 }"
+
+awk "\$1 == ${1:-1} { for (i=2; i<NF; i++) printf \$i \" \"; print $NF}"
Property changes on: demo/xsede.2014.0425/app/gettrj.sh
___________________________________________________________________
Added: svn:executable
+ *
Modified: demo/xsede.2014.0425/app/mdmaxk
===================================================================
--- demo/xsede.2014.0425/app/mdmaxk 2014-08-13 20:01:48 UTC (rev 8141)
+++ demo/xsede.2014.0425/app/mdmaxk 2014-08-13 20:04:05 UTC (rev 8142)
@@ -15,12 +15,12 @@
gawk '
-BEGIN { maxKe = 0.0; LASTFILE="";}
+BEGIN { maxKe = 0.0; LASTFILE=""; FILENUM=0; print("sim energy");}
{
if ( $1 == "Step" ) next;
if ( (LASTFILE != "") && (FILENAME != LASTFILE)) {
- printf("%s %f\n", LASTFILE, maxKe )
+ printf("%s %f\n", FILENUM++, maxKe )
maxKe = 0.0;
}
Ke = $3 + 0.0;
@@ -29,7 +29,7 @@
}
#END { printf("max Ke for %s is %f\n", LASTFILE, maxKe ) }
- END { printf("%s %f\n", LASTFILE, maxKe ) }
+ END { printf("%s %f\n", FILENUM, maxKe ) }
Modified: demo/xsede.2014.0425/app/mdtotk
===================================================================
--- demo/xsede.2014.0425/app/mdtotk 2014-08-13 20:01:48 UTC (rev 8141)
+++ demo/xsede.2014.0425/app/mdtotk 2014-08-13 20:04:05 UTC (rev 8142)
@@ -15,12 +15,12 @@
gawk '
-BEGIN { totKe = 0.0; LASTFILE="";}
+BEGIN { totKe = 0.0; LASTFILE=""; FILENUM=0}
{
if ( $1 == "Step" ) next;
if ( (LASTFILE != "") && (FILENAME != LASTFILE)) {
- printf("%s %f\n", LASTFILE, totKe )
+ printf("%s %f\n", FILENUM++, totKe )
totKe = 0.0;
}
totKe += $3 + 0.0;
@@ -28,7 +28,7 @@
}
#END { printf("tot Ke for %s is %f\n", LASTFILE, totKe ) }
- END { printf("%s %f\n", LASTFILE, totKe ) }
+ END { printf("%s %f\n", FILENUM, totKe ) }
Added: demo/xsede.2014.0425/app/renderframe
===================================================================
--- demo/xsede.2014.0425/app/renderframe (rev 0)
+++ demo/xsede.2014.0425/app/renderframe 2014-08-13 20:04:05 UTC (rev 8142)
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+mdtrj=$1
+vzout=$2
+frame=$3
+
+cat <<END >c-ray-trailer
+# walls
+s 0 -1000 2 99 0.2 0.2 0.2 0.0 0.0
+
+# lights
+l -50 100 -50
+
+# camera
+# position FOV target
+c 0 6 -17 45 0 -1 0
+END
+
+(
+ awk "\$1 == $frame {for (i=2; i<NF; i++) printf \$i \" \"; print \$NF}" <$mdtrj | sed -e 's/^[0-9]\+ //'
+
+ cat c-ray-trailer
+) | c-ray >t.ppm
+
+convert t.ppm $vzout
+
+
+
Property changes on: demo/xsede.2014.0425/app/renderframe
___________________________________________________________________
Added: svn:executable
+ *
Modified: demo/xsede.2014.0425/part04m/p4b.swift
===================================================================
--- demo/xsede.2014.0425/part04m/p4b.swift 2014-08-13 20:01:48 UTC (rev 8141)
+++ demo/xsede.2014.0425/part04m/p4b.swift 2014-08-13 20:04:05 UTC (rev 8142)
@@ -1,5 +1,10 @@
type file;
+type kineticInfo {
+ int sim;
+ float energy;
+}
+
(int result) randomInt ()
{
float range = 9999999.0;
@@ -8,10 +13,10 @@
result = toInt(s[0]);
}
-app (file out, file traj) simulation (string npart, string steps, string mass)
+app (file out, file traj) simulation (int npart, int steps, int trsnaps, float 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;
+ md 3 npart steps trsnaps ".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[])
@@ -19,38 +24,55 @@
mdstats filenames(s) stdout=filename(o);
}
-app (file o) maxk (file s[])
+app (file o) kinetic (file s[])
{
- mdmaxk filenames(s) stdout=filename(o);
+ mdmaxk 9999 filenames(s) stdout=filename(o);
}
-app (file o) analyze (file s[])
+app (file o) render (file traj, int frame)
{
- mdstats filenames(s) stdout=filename(o);
+ renderframe filename(traj) filename(o) frame;
}
app (file o) convert (file s[])
{
- convert filenames(s) filename(o);
+ convert "-delay" 20 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");
+int nsim = toInt(arg("nsim","10"));
+int npart = toInt(arg("npart","50"));
+int steps = toInt(arg("steps","1000"));
+int trsnaps = 10;
+float mass = toFloat(arg("mass",".005"));
file sim[] <simple_mapper; prefix="output/sim_", suffix=".out">;
-file trj[] <simple_mapper; prefix="output/sim_", suffix=".trj.tgz">;
+file trj[] <simple_mapper; prefix="output/sim_", suffix=".trj">;
foreach i in [0:nsim-1] {
- (sim[i],trj[i]) = simulation(npart,steps,mass);
+ (sim[i],trj[i]) = simulation(npart,steps,trsnaps,mass);
}
file stats_out<"output/average.out">;
stats_out = analyze(sim);
file ke_out<"output/kinetic.out">;
-ke_out = maxk(sim);
+ke_out = kinetic(sim);
-#file viz_all<"output/all.gif">;
-#viz_all = convert(gifs);
+kineticInfo kd[] = readData(ke_out);
+
+tracef("min eK simulation: %i eK: %f\n", kd[0].sim, kd[0].energy);
+tracef("max eK simulation: %i eK: %f\n", kd[nsim-1].sim, kd[nsim-1].energy);
+
+file mink[] <simple_mapper; prefix="output/mink/frame_", suffix=".png">;
+file maxk[] <simple_mapper; prefix="output/maxk/frame_", suffix=".png">;
+
+foreach i in [0:trsnaps-1] {
+ mink[i] = render(trj[kd[0].sim], i);
+ maxk[i] = render(trj[kd[nsim-1].sim], i);
+}
+
+file minkmovie <"output/mink.gif">;
+file maxkmovie <"output/maxk.gif">;
+
+minkmovie = convert(mink);
+maxkmovie = convert(maxk);
More information about the Swift-commit
mailing list