[Swift-commit] r8138 - demo/xsede.2014.0425/src/md
wilde at ci.uchicago.edu
wilde at ci.uchicago.edu
Wed Aug 13 12:47:41 CDT 2014
Author: wilde
Date: 2014-08-13 12:47:41 -0500 (Wed, 13 Aug 2014)
New Revision: 8138
Modified:
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:
Renamed snap open/close functions. Disabled system(tar) stuff. Used integer snapid for trj file. Snapshot of trajectory is now done to a single .trj file.
Modified: demo/xsede.2014.0425/src/md/main.c
===================================================================
--- demo/xsede.2014.0425/src/md/main.c 2014-08-13 17:10:42 UTC (rev 8137)
+++ demo/xsede.2014.0425/src/md/main.c 2014-08-13 17:47:41 UTC (rev 8138)
@@ -12,7 +12,7 @@
char *outfile = "md.dat";
-char *trjfile = "md.trj.tgz";
+char *trjfile = "md.trj";
/******************************************************************************/
@@ -194,7 +194,7 @@
simulate (step_num, step_print_num, step_print, step_print_index,
np, nd, mass, potential, kinetic, e0,
- dt, seed, outfile);
+ dt, seed, outfile, trjfile);
ctime2 = cpu_time ( );
ctime = ctime2 - ctime1;
@@ -203,10 +203,12 @@
printf ( " Elapsed cpu time for main computation:\n" );
printf ( " %f seconds.\n", ctime );
-
+#ifdef NOTDEF
char tarcmd[2000];
sprintf(tarcmd,"tar zcf %s md??.trj",trjfile);
system(tarcmd);
+#endif
+
/*
Terminate.
*/
Modified: demo/xsede.2014.0425/src/md/md.c
===================================================================
--- demo/xsede.2014.0425/src/md/md.c 2014-08-13 17:10:42 UTC (rev 8137)
+++ demo/xsede.2014.0425/src/md/md.c 2014-08-13 17:47:41 UTC (rev 8138)
@@ -18,8 +18,8 @@
void snap ( int np, int nd, double t, double pos[], double vel[], double f[],
double acc[], double mass, double dt );
-static void snap_file_open(void);
-static void snap_file_close(void);
+static void trj_file_open(char *trjfile);
+static void trj_file_close(void);
void simulate (int step_num, int step_print_num,
int step_print, int step_print_index,
@@ -28,7 +28,8 @@
double potential, double kinetic, double e0,
double dt,
int seed,
- char* outfile)
+ char* outfile,
+ char* trjfile)
{
/*
Allocate memory.
@@ -49,7 +50,7 @@
printf ( "\n" );
printf ( " Initializing positions, velocities, and accelerations.\n" );
- snap_file_open();
+ trj_file_open(trjfile);
/*
Set initial positions, velocities, and accelerations.
@@ -115,7 +116,7 @@
free ( vel );
fclose(ofile);
- snap_file_close();
+ trj_file_close();
}
/******************************************************************************/
@@ -580,20 +581,22 @@
}
static int snapid = 0;
-static FILE *snap_file = NULL;
+static FILE *trj_file = NULL;
-static void snap_file_open()
+static void trj_file_open(char *trjfile)
{
+#ifdef NOTDEF
char snapfile[100];
sprintf(snapfile, "md%02d.trj", snapid);
- snap_file = fopen(snapfile, "w");
- assert(snap_file != NULL);
+#endif
+ trj_file = fopen(trjfile, "w");
+ assert(trj_file != NULL);
}
-static void snap_file_close()
+static void trj_file_close()
{
- fclose(snap_file);
- snap_file = NULL;
+ fclose(trj_file);
+ trj_file = NULL;
}
void snap ( int np, int nd, double t, double pos[], double vel[], double f[],
@@ -603,8 +606,8 @@
for ( j = 0; j < np; j++ )
{
- fprintf(snap_file, "%f s %f %f %f %s\n",
- t, scale(pos[0+j*nd]), scale(pos[1+j*nd]), scale(pos[2+j*nd]), printinfo);
+ fprintf(trj_file, "%d s %f %f %f %s\n",
+ snapid, scale(pos[0+j*nd]), scale(pos[1+j*nd]), scale(pos[2+j*nd]), printinfo);
}
snapid++;
Modified: demo/xsede.2014.0425/src/md/md.h
===================================================================
--- demo/xsede.2014.0425/src/md/md.h 2014-08-13 17:10:42 UTC (rev 8137)
+++ demo/xsede.2014.0425/src/md/md.h 2014-08-13 17:47:41 UTC (rev 8138)
@@ -28,6 +28,7 @@
double potential, double kinetic, double e0,
double dt,
int seed,
- char* outfile);
+ char* outfile,
+ char* trjfile);
#endif
More information about the Swift-commit
mailing list