[Swift-commit] r8137 - SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/05-md
wozniak at ci.uchicago.edu
wozniak at ci.uchicago.edu
Wed Aug 13 12:10:42 CDT 2014
Author: wozniak
Date: 2014-08-13 12:10:42 -0500 (Wed, 13 Aug 2014)
New Revision: 8137
Modified:
SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/05-md/Makefile
SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/05-md/md.c
Log:
Make TRJ output time an integer
Modified: SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/05-md/Makefile
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/05-md/Makefile 2014-08-13 16:59:15 UTC (rev 8136)
+++ SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/05-md/Makefile 2014-08-13 17:10:42 UTC (rev 8137)
@@ -1,18 +1,40 @@
bin = md
CC = gcc
+INCLUDES :=
OPTZ = -O0
OPTS = -O3 -ffast-math
-CFLAGS = $(OPTZ) -g -fPIC -std=gnu99
+CFLAGS = $(OPTZ) -g -fPIC -std=gnu99 $(INCLUDES)
SRC = main.c md.c
OBJ = $(patsubst %.c,%.o,$(SRC))
+
+
all: $(bin)
+# Link stand-alone executable:
$(bin): $(OBJ)
$(CC) -o $(@) $(OBJ) -lm
+# Swift/T integration:
+
+USE_SWIFT = 1
+ifeq ($(USE_SWIFT),1)
+
+TCL_HOME = $(HOME)/sfw/tcl-8.6.0
+INCLUDES += -I $(TCL_HOME)/include
+
+swift-pkg: libtclmd.so
+
+md_wrap.c: md.i
+ swig $(<)
+
+libtclmd.so: md_wrap.o $(OBJ)
+ gcc -shared -o $(@) $(^) -L $(TCL_HOME)/lib -l tcl8.6
+
+endif
+
.PHONY: clean
clean:
rm -f $(OBJ) $(bin)
@@ -24,3 +46,4 @@
.PHONY: uninstall
uninstall:
rm -f ../../bin/$(bin)
+
Modified: SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/05-md/md.c
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/05-md/md.c 2014-08-13 16:59:15 UTC (rev 8136)
+++ SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/05-md/md.c 2014-08-13 17:10:42 UTC (rev 8137)
@@ -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 snap_file_open(void);
@@ -103,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 );
}
@@ -596,14 +596,14 @@
snap_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;
for ( j = 0; j < np; j++ )
{
- fprintf(snap_file, "%f s %f %f %f %s\n",
+ fprintf(snap_file, "%i s %f %f %f %s\n",
t, scale(pos[0+j*nd]), scale(pos[1+j*nd]), scale(pos[2+j*nd]), printinfo);
}
More information about the Swift-commit
mailing list