[Swift-commit] r7806 - in demo/xsede.2014.0425: . app part04m src/md

wilde at ci.uchicago.edu wilde at ci.uchicago.edu
Sun Apr 27 16:16:52 CDT 2014


Author: wilde
Date: 2014-04-27 16:16:51 -0500 (Sun, 27 Apr 2014)
New Revision: 7806

Added:
   demo/xsede.2014.0425/app/mdmaxk
Modified:
   demo/xsede.2014.0425/part04m/p4.swift
   demo/xsede.2014.0425/setup.midway.sh
   demo/xsede.2014.0425/src/md/md.c
Log:
Improvements: added app to find most energetic sim. Make md put trajectory in tarfile. IMprive setup for midway demo/test.

Added: demo/xsede.2014.0425/app/mdmaxk
===================================================================
--- demo/xsede.2014.0425/app/mdmaxk	                        (rev 0)
+++ demo/xsede.2014.0425/app/mdmaxk	2014-04-27 21:16:51 UTC (rev 7806)
@@ -0,0 +1,37 @@
+#! /bin/sh
+
+log() {
+  printf "\nCalled as: $0: $cmdargs\n\n"
+  printf "Start time: "; /bin/date
+  printf "Running as user: "; /usr/bin/id
+  printf "Running on node: "; /bin/hostname
+  printf "Node IP address: "; /bin/hostname -I
+  printf "\nEnvironment:\n\n"
+  printenv | sort
+}
+
+nfiles=$1
+shift
+
+gawk '
+
+BEGIN { maxKe = 0.0; LASTFILE="";}
+
+{
+  if ( $1 == "Step" ) next;
+  if ( (LASTFILE != "") && (FILENAME != LASTFILE)) {
+     printf("%s %f\n", LASTFILE, maxKe )
+     maxKe = 0.0;
+  }
+  Ke = $3 + 0.0;
+  if ( Ke > maxKe ) maxKe = Ke;
+  LASTFILE=FILENAME
+}
+
+END { printf("max Ke for %s is %f\n", LASTFILE, maxKe ) }
+
+
+
+' $* | sort -n -k2 | tail -$nfiles
+
+# log 1>&2


Property changes on: demo/xsede.2014.0425/app/mdmaxk
___________________________________________________________________
Added: svn:executable
   + *

Modified: demo/xsede.2014.0425/part04m/p4.swift
===================================================================
--- demo/xsede.2014.0425/part04m/p4.swift	2014-04-26 21:11:04 UTC (rev 7805)
+++ demo/xsede.2014.0425/part04m/p4.swift	2014-04-27 21:16:51 UTC (rev 7806)
@@ -8,10 +8,10 @@
   result = toInt(s[0]);
 }
 
-app (file o, file v) simulation (string npart, string steps, string mass)
+app (file out, file traj) simulation (string npart, string steps, string mass)
 {
-# mdviz  @o @v 3 npart steps 50 ".0001" mass "0.1 1.0 0.2 0.05 50.0 0.1" 2.5 2.0 randomInt();
-  mdviz  @o @v 3 npart steps 10 ".0001" mass "0.1 1.0 0.2 0.05 50.0 0.1" 2.5 2.0 randomInt();
+# 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[])
@@ -29,15 +29,15 @@
 string steps  = arg("steps","1000");
 string mass   = arg("mass",".005");
 
-file sims[] <simple_mapper; prefix="output/sim_", suffix=".out">;
-file gifs[] <simple_mapper; prefix="output/sim_", suffix=".gif">;
+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] {
-  (sims[i],gifs[i]) = simulation(npart,steps,mass);
+  (sim[i],trj[i]) = simulation(npart,steps,mass);
 }
 
 file stats_out<"output/average.out">;
-stats_out = analyze(sims);
+stats_out = analyze(sim);
 
-file viz_all<"output/all.gif">;
-viz_all = convert(gifs);
+#file viz_all<"output/all.gif">;
+#viz_all = convert(gifs);

Modified: demo/xsede.2014.0425/setup.midway.sh
===================================================================
--- demo/xsede.2014.0425/setup.midway.sh	2014-04-26 21:11:04 UTC (rev 7805)
+++ demo/xsede.2014.0425/setup.midway.sh	2014-04-27 21:16:51 UTC (rev 7806)
@@ -1,6 +1,11 @@
 # Load modules
-module unload swift
-module load swift/0.95-RC1
+#module unload swift
+#module load swift/0.95-RC1
+
+module load ant
+
+PATH=/home/wilde/swift/src/trunk/cog/modules/swift/dist/swift-svn/bin:$PATH
+
 echo Swift version is $(swift -version)
 
 # Add applications to $PATH

Modified: demo/xsede.2014.0425/src/md/md.c
===================================================================
--- demo/xsede.2014.0425/src/md/md.c	2014-04-26 21:11:04 UTC (rev 7805)
+++ demo/xsede.2014.0425/src/md/md.c	2014-04-27 21:16:51 UTC (rev 7806)
@@ -18,9 +18,11 @@
   double acc[], double mass, double dt );
 
 double scale_factor = 2.5, scale_offset = -2.0;
-char default_printinfo[100] = "0.05 1.0 0.2 0.05 50.0 0.1";
-char *printinfo = default_printinfo;
+char *printinfo = "0.05 1.0 0.2 0.05 50.0 0.1";
+char *outfile = "md.dat";
+char *trjfile = "md.trj.tgz";
 
+
 /******************************************************************************/
 
 int main ( int argc, char *argv[] )
@@ -41,7 +43,7 @@
 
   Usage:
 
-    md nd np step_num print_step_num dt mass printinfo scale_factor scale_offset
+    md nd np step_num print_step_num dt mass printinfo scale_factor scale_offset seed outFile trajectoryFile
     where
     * nd is the spatial dimension (2 or 3);
     * np is the number of particles (500, for instance);
@@ -51,6 +53,8 @@
     * mass is particle mass;
     * printinfo is a string to append to each particle coord
     * scale_offset and scale_factor are used to scale particle positions for logging/rendering (FIXME)
+    * seed sets the initial configuration
+    
 
   Licensing:
 
@@ -140,7 +144,7 @@
   }
   /*
 	Get any additional args (command-line only)
-	md nd np step_num [ step__print_num dt mass printinfo scale_factor scale_offset ]
+	md nd np step_num [ step__print_num dt mass printinfo scale_factor scale_offset randomseed outfile trjfile ]
   */
   if ( 4 < argc )
   {
@@ -170,6 +174,14 @@
   {
     seed = atof ( argv[10] );
   }
+  if ( 11 < argc )
+  {
+    outfile = argv[11];
+  }
+  if ( 12 < argc )
+  {
+    trjfile = argv[12];
+  }
 
 /*
   Report.
@@ -232,7 +244,7 @@
   printf ( "                Energy P        Energy K       Relative Energy Error\n" );
   printf ( "\n" );
 
-  FILE *ofile = fopen("md.dat","w");
+  FILE *ofile = fopen(outfile,"w");
   fprintf (ofile, "      Step      Potential       Kinetic        RelativeErr\n" );
 
   step_print = 0;
@@ -276,6 +288,9 @@
   free ( force );
   free ( pos );
   free ( vel );
+  char tarcmd[2000];
+  sprintf(tarcmd,"tar zcf %s md??.trj",trjfile);
+  system(tarcmd);
 /*
   Terminate.
 */




More information about the Swift-commit mailing list