Serial md code
/* system.h - defines the system_t type and its mpi type */
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include "system.h"
bool sanity_check(system_t* sys, double rc, bool verbose)
{
/* make sure the system definition makes sense physically and
computationally. */
bool sane = true;
if (sys->Ntot <= 0) {
fprintf(stderr,
"\nLJHPC PARAMETER ERROR: Incorrect number of particles (N=%d). "
"N must be positive\n",
sys->N);
sane = false;
}
if (sys->rho <= 0.0) {
fprintf(stderr,
"\nLJHPC PARAMETER ERROR: Incorrect density (rho=%f). "
"rho must be positive\n",
sys->rho);
sane = false;
}
if (sys->L < 2*rc) {
fprintf(stderr,
"\nLJHPC PARAMETER ERROR: Incorrect linear system size (L=%f). "
"L must be at least two times the interaction range (rc=%f)\n",
sys->L, rc);
sane = false;
}
if (sys->dt <= 0.0) {
fprintf(stderr,
"\nLJHPC PARAMETER ERROR: Incorrect time step (dt=%f). "
"dt must be positive\n",
sys->dt);
sane = false;
}
if (sys->runtime <= 0.0) {
fprintf(stderr,
"\nLJHPC PARAMETER ERROR: Incorrect runtime (runtime=%f). "
"runtime must be positive\n",
sys->runtime);
sane = false;
}
if (sys->seed == 0) {
fprintf(stderr,
"\nLJHPC PARAMETER ERROR: Incorrect random number seed (seed=%ld). "
"seed must not be zero\n",
sys->seed);
sane = false;
}
if (sys->equil > sys->runtime) {
fprintf(stderr,
"\nLJHPC PARAMETER ERROR: Incorrect equilibration time (equil=%f). "
"equil must be less then the runtime (%f)\n",
sys->equil, sys->runtime);
sane = false;
}
return sane;
}