Only malloc once at the beginning plus measurement csv
This commit is contained in:
15
src/main.c
15
src/main.c
@@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
@@ -44,7 +45,7 @@
|
||||
|
||||
#define HLINE "----------------------------------------------------------------------------\n"
|
||||
|
||||
extern double computeForce(Parameter*, Atom*, Neighbor*);
|
||||
extern double computeForce(bool, Parameter*, Atom*, Neighbor*);
|
||||
extern double computeForceTracing(Parameter*, Atom*, Neighbor*, Stats*, int, int);
|
||||
extern double computeForceEam(Eam* eam, Parameter*, Atom *atom, Neighbor *neighbor, Stats *stats, int first_exec, int timestep);
|
||||
|
||||
@@ -262,7 +263,7 @@ int main(int argc, char** argv)
|
||||
#if defined(MEM_TRACER) || defined(INDEX_TRACER) || defined(COMPUTE_STATS)
|
||||
computeForceTracing(¶m, &atom, &neighbor, &stats, 1, 0);
|
||||
#else
|
||||
computeForce(¶m, &atom, &neighbor);
|
||||
computeForce(true, ¶m, &atom, &neighbor);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -277,10 +278,12 @@ int main(int argc, char** argv)
|
||||
for(int n = 0; n < param.ntimes; n++) {
|
||||
initialIntegrate(¶m, &atom);
|
||||
|
||||
if((n + 1) % param.every) {
|
||||
updatePbc(&atom, ¶m);
|
||||
} else {
|
||||
const bool doReneighbour = (n + 1) % param.every == 0;
|
||||
|
||||
if(doReneighbour) {
|
||||
timer[NEIGH] += reneighbour(¶m, &atom, &neighbor);
|
||||
} else {
|
||||
updatePbc(&atom, ¶m);
|
||||
}
|
||||
|
||||
if(param.force_field == FF_EAM) {
|
||||
@@ -289,7 +292,7 @@ int main(int argc, char** argv)
|
||||
#if defined(MEM_TRACER) || defined(INDEX_TRACER) || defined(COMPUTE_STATS)
|
||||
timer[FORCE] += computeForceTracing(¶m, &atom, &neighbor, &stats, 0, n + 1);
|
||||
#else
|
||||
timer[FORCE] += computeForce(¶m, &atom, &neighbor);
|
||||
timer[FORCE] += computeForce(doReneighbour, ¶m, &atom, &neighbor);
|
||||
#endif
|
||||
}
|
||||
finalIntegrate(¶m, &atom);
|
||||
|
Reference in New Issue
Block a user