63 #define REDIRECT_OUTPUT 0
64 #define MIN(A,B) ((A) < (B) ? (A) : (B))
73 int doeam,
const char* potDir,
const char* potName,
const char* potType);
81 static void sanityChecks(
Command cmd,
double cutoff,
double latticeConst,
char latticeType[8]);
84 int main(
int argc,
char** argv)
109 const int nSteps = sim->
nSteps;
113 for (; iStep<nSteps;)
177 latticeConstant = sim->
pot->
lat;
185 globalExtent[0] = cmd.
nx * latticeConstant;
186 globalExtent[1] = cmd.
ny * latticeConstant;
187 globalExtent[2] = cmd.
nz * latticeConstant;
254 int doeam,
const char* potDir,
const char* potName,
const char* potType)
288 fprintf(
screenOut,
"Initial energy : %14.12f, atom count : %d \n",
305 fprintf(
screenOut,
"Simulation Validation:\n");
308 fprintf(
screenOut,
" Final energy : %14.12f\n", eFinal);
310 if ( nAtomsDelta == 0)
312 fprintf(
screenOut,
" Final atom count : %d, no atoms lost\n",
317 fprintf(
screenOut,
"#############################\n");
318 fprintf(
screenOut,
"# WARNING: %6d atoms lost #\n", nAtomsDelta);
319 fprintf(
screenOut,
"#############################\n");
345 static int iStepPrev = -1;
346 static int firstCall = 1;
348 int nEval = iStep - iStepPrev;
359 "# Loop Time(fs) Total Energy Potential Energy Kinetic Energy Temperature (us/atom) # Atoms\n");
369 double timePerAtom = 1.0e6*elapsedTime/(double)(nEval*s->
atoms->
nLocal);
371 fprintf(
screenOut,
" %6d %10.2f %18.12f %18.12f %18.12f %12.4f %10.4f %12d\n",
372 iStep, time, eTotal, eU, eK, Temp, timePerAtom, s->
atoms->
nGlobal);
386 fprintf(file,
"Simulation data: \n");
387 fprintf(file,
" Total atoms : %d\n",
389 fprintf(file,
" Min global bounds : [ %14.10f, %14.10f, %14.10f ]\n",
391 fprintf(file,
" Max global bounds : [ %14.10f, %14.10f, %14.10f ]\n",
394 fprintf(file,
"Decomposition data: \n");
395 fprintf(file,
" Processors : %6d,%6d,%6d\n",
397 fprintf(file,
" Local boxes : %6d,%6d,%6d = %8d\n",
400 fprintf(file,
" Box size : [ %14.10f, %14.10f, %14.10f ]\n",
402 fprintf(file,
" Box factor : [ %14.10f, %14.10f, %14.10f ] \n",
406 fprintf(file,
" Max Link Cell Occupancy: %d of %d\n",
409 fprintf(file,
"Potential data: \n");
427 "\nNumber of MPI ranks must match xproc * yproc * zproc\n");
431 double minx = 2*cutoff*cmd.
xproc;
432 double miny = 2*cutoff*cmd.
yproc;
433 double minz = 2*cutoff*cmd.
zproc;
434 double sizex = cmd.
nx*latticeConst;
435 double sizey = cmd.
ny*latticeConst;
436 double sizez = cmd.
nz*latticeConst;
438 if ( sizex < minx || sizey < miny || sizez < minz)
442 fprintf(
screenOut,
"\nSimulation too small.\n"
443 " Increase the number of unit cells to make the simulation\n"
444 " at least (%3.2f, %3.2f. %3.2f) Ansgstroms in size\n",
449 if (strcasecmp(latticeType,
"FCC") != 0)
454 "\nOnly FCC Lattice type supported, not %s. Fatal Error.\n",
457 int checkCode = failCode;
461 assert(checkCode == failCode);