[Swift-commit] r8139 - demo/xsede.2014.0425/src/md

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Wed Aug 13 14:50:12 CDT 2014


Author: wozniak
Date: 2014-08-13 14:50:12 -0500 (Wed, 13 Aug 2014)
New Revision: 8139

Added:
   demo/xsede.2014.0425/src/md/make-package.tcl
   demo/xsede.2014.0425/src/md/md.i
   demo/xsede.2014.0425/src/md/md.tcl
   demo/xsede.2014.0425/src/md/test-md.tcl
Modified:
   demo/xsede.2014.0425/src/md/Makefile
   demo/xsede.2014.0425/src/md/main.c
   demo/xsede.2014.0425/src/md/md.c
   demo/xsede.2014.0425/src/md/md.h
Log:
Tcl binding and test

Modified: demo/xsede.2014.0425/src/md/Makefile
===================================================================
--- demo/xsede.2014.0425/src/md/Makefile	2014-08-13 17:47:41 UTC (rev 8138)
+++ demo/xsede.2014.0425/src/md/Makefile	2014-08-13 19:50:12 UTC (rev 8139)
@@ -24,20 +24,30 @@
 
 TCL_HOME = $(HOME)/sfw/tcl-8.6.0
 INCLUDES += -I $(TCL_HOME)/include
+TCLSH = $(TCL_HOME)/bin/tclsh8.6
 
-swift-pkg: libtclmd.so
+swift-pkg: pkgIndex.tcl
 
-md_wrap.c: md.i
+md_wrap.c: md.i md.h
 	swig $(<)
+	sed -i s/Md_Init/Tclmd_Init/ $(@)
 
 libtclmd.so: md_wrap.o $(OBJ)
 	gcc -shared -o $(@) $(^) -L $(TCL_HOME)/lib -l tcl8.6 
 
-endif
+pkgIndex.tcl: libtclmd.so
+	LEAF_PKG=md LEAF_VERSION=0.0 \
+	LEAF_SO=$(<) LEAF_TCL=md.tcl \
+	$(TCLSH) ./make-package.tcl > $(@)
 
+clean:: 
+	rm -fv pkgIndex.tcl libtclmd.so md_wrap.c
+
+endif # Swift/T
+
 .PHONY: clean
-clean:
-	rm -f $(OBJ) $(bin)
+clean::
+	rm -fv $(OBJ) $(bin)
 
 .PHONY: install
 install:

Modified: demo/xsede.2014.0425/src/md/main.c
===================================================================
--- demo/xsede.2014.0425/src/md/main.c	2014-08-13 17:47:41 UTC (rev 8138)
+++ demo/xsede.2014.0425/src/md/main.c	2014-08-13 19:50:12 UTC (rev 8139)
@@ -71,16 +71,12 @@
   double ctime1;
   double ctime2;
   double dt = 0.0001;
-  double e0;
-  double *force;
   int i;
   int id;
-  double kinetic;
   double mass = 1.0 * .0001;
   int nd;
   int np;
 
-  double potential;
   int seed = 123456789;
   int step;
   int step_num;
@@ -193,7 +189,7 @@
   ctime1 = cpu_time ( );
 
   simulate (step_num, step_print_num, step_print, step_print_index,
-            np, nd, mass, potential, kinetic, e0,
+            np, nd, mass,
             dt, seed, outfile, trjfile);
 
   ctime2 = cpu_time ( );

Added: demo/xsede.2014.0425/src/md/make-package.tcl
===================================================================
--- demo/xsede.2014.0425/src/md/make-package.tcl	                        (rev 0)
+++ demo/xsede.2014.0425/src/md/make-package.tcl	2014-08-13 19:50:12 UTC (rev 8139)
@@ -0,0 +1,9 @@
+
+set name     $env(LEAF_PKG)
+set version  $env(LEAF_VERSION)
+set leaf_so  $env(LEAF_SO)
+set leaf_tcl $env(LEAF_TCL)
+
+puts [ ::pkg::create -name $name -version $version \
+           -load $leaf_so -source $leaf_tcl ]
+


Property changes on: demo/xsede.2014.0425/src/md/make-package.tcl
___________________________________________________________________
Added: svn:executable
   + *

Modified: demo/xsede.2014.0425/src/md/md.c
===================================================================
--- demo/xsede.2014.0425/src/md/md.c	2014-08-13 17:47:41 UTC (rev 8138)
+++ demo/xsede.2014.0425/src/md/md.c	2014-08-13 19:50:12 UTC (rev 8139)
@@ -15,7 +15,7 @@
 double r8_uniform_01 ( int *seed );
 void update ( int np, int nd, double pos[], double vel[], double f[],
   double acc[], double mass, double dt );
-void snap ( int np, int nd, double t, double pos[], double vel[], double f[],
+void snap ( int np, int nd, int t, double pos[], double vel[], double f[],
   double acc[], double mass, double dt );
 
 static void trj_file_open(char *trjfile);
@@ -25,7 +25,6 @@
                int step_print, int step_print_index,
                int np, int nd,
                double mass,
-               double potential, double kinetic, double e0,
                double dt,
                int seed,
                char* outfile,
@@ -62,9 +61,9 @@
     printf ( "\n" );
     printf ( "  Computing initial forces and energies.\n" );
 
+    double potential, kinetic;
     compute ( np, nd, pos, vel, mass, force, &potential, &kinetic );
-
-    e0 = potential + kinetic;
+    double e0 = potential + kinetic;
   /*
     This is the main time stepping loop:
       Compute forces and energies,
@@ -104,7 +103,7 @@
                 ( potential + kinetic - e0 ) / e0 );
       step_print_index = step_print_index + 1;
       step_print = ( step_print_index * step_num ) / step_print_num;
-      snap (np, nd, step*dt, pos, vel, force, acc, mass, dt );
+      snap (np, nd, step, pos, vel, force, acc, mass, dt );
     }
     update ( np, nd, pos, vel, force, acc, mass, dt );
   }
@@ -599,7 +598,7 @@
   trj_file = NULL;
 }
 
-void snap ( int np, int nd, double t, double pos[], double vel[], double f[],
+void snap ( int np, int nd, int t, double pos[], double vel[], double f[],
   double acc[], double mass, double dt )
 {
   int j;

Modified: demo/xsede.2014.0425/src/md/md.h
===================================================================
--- demo/xsede.2014.0425/src/md/md.h	2014-08-13 17:47:41 UTC (rev 8138)
+++ demo/xsede.2014.0425/src/md/md.h	2014-08-13 19:50:12 UTC (rev 8139)
@@ -25,7 +25,6 @@
                int step_print, int step_print_index,
                int np, int nd,
                double mass,
-               double potential, double kinetic, double e0,
                double dt,
                int seed,
                char* outfile,

Added: demo/xsede.2014.0425/src/md/md.i
===================================================================
--- demo/xsede.2014.0425/src/md/md.i	                        (rev 0)
+++ demo/xsede.2014.0425/src/md/md.i	2014-08-13 19:50:12 UTC (rev 8139)
@@ -0,0 +1,6 @@
+
+%module md
+%include "md.h"
+%{
+  #include "md.h"
+%}

Added: demo/xsede.2014.0425/src/md/md.tcl
===================================================================
--- demo/xsede.2014.0425/src/md/md.tcl	                        (rev 0)
+++ demo/xsede.2014.0425/src/md/md.tcl	2014-08-13 19:50:12 UTC (rev 8139)
@@ -0,0 +1,4 @@
+
+namespace eval md { 
+    # Nothing 
+}

Added: demo/xsede.2014.0425/src/md/test-md.tcl
===================================================================
--- demo/xsede.2014.0425/src/md/test-md.tcl	                        (rev 0)
+++ demo/xsede.2014.0425/src/md/test-md.tcl	2014-08-13 19:50:12 UTC (rev 8139)
@@ -0,0 +1,7 @@
+#!/usr/bin/env tclsh8.6
+
+lappend auto_path $env(PWD)
+package require md 0.0
+
+simulate 4 2 0 0 10 2 1  0.1 9 out.txt
+


Property changes on: demo/xsede.2014.0425/src/md/test-md.tcl
___________________________________________________________________
Added: svn:executable
   + *




More information about the Swift-commit mailing list