Fix errors to make gromacs approach compilable so far
Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
parent
6291709ae7
commit
cbe42b8149
@ -52,6 +52,7 @@ typedef struct {
|
|||||||
MD_FLOAT *cutforcesq;
|
MD_FLOAT *cutforcesq;
|
||||||
MD_FLOAT *cutneighsq;
|
MD_FLOAT *cutneighsq;
|
||||||
Cluster *clusters;
|
Cluster *clusters;
|
||||||
|
int *PBCx, *PBCy, *PBCz;
|
||||||
} Atom;
|
} Atom;
|
||||||
|
|
||||||
extern void initAtom(Atom*);
|
extern void initAtom(Atom*);
|
||||||
|
@ -101,7 +101,7 @@ double setup(
|
|||||||
if(param->input_file == NULL) { adjustThermo(param, atom); }
|
if(param->input_file == NULL) { adjustThermo(param, atom); }
|
||||||
setupPbc(atom, param);
|
setupPbc(atom, param);
|
||||||
updatePbc(atom, param);
|
updatePbc(atom, param);
|
||||||
buildNeighbor(atom, neighbor);
|
buildNeighbor(param, atom, neighbor);
|
||||||
E = getTimeStamp();
|
E = getTimeStamp();
|
||||||
|
|
||||||
return E-S;
|
return E-S;
|
||||||
@ -120,7 +120,7 @@ double reneighbour(
|
|||||||
setupPbc(atom, param);
|
setupPbc(atom, param);
|
||||||
updatePbc(atom, param);
|
updatePbc(atom, param);
|
||||||
//sortAtom(atom);
|
//sortAtom(atom);
|
||||||
buildNeighbor(atom, neighbor);
|
buildNeighbor(param, atom, neighbor);
|
||||||
LIKWID_MARKER_STOP("reneighbour");
|
LIKWID_MARKER_STOP("reneighbour");
|
||||||
E = getTimeStamp();
|
E = getTimeStamp();
|
||||||
|
|
||||||
|
@ -54,8 +54,6 @@ static MD_FLOAT binsizex, binsizey;
|
|||||||
static int coord2bin(MD_FLOAT, MD_FLOAT);
|
static int coord2bin(MD_FLOAT, MD_FLOAT);
|
||||||
static MD_FLOAT bindist(int, int);
|
static MD_FLOAT bindist(int, int);
|
||||||
|
|
||||||
extern int *PBCx, *PBCy, *PBCz;
|
|
||||||
|
|
||||||
/* exported subroutines */
|
/* exported subroutines */
|
||||||
void initNeighbor(Neighbor *neighbor, Parameter *param)
|
void initNeighbor(Neighbor *neighbor, Parameter *param)
|
||||||
{
|
{
|
||||||
@ -510,10 +508,10 @@ void binGhostClusters(Parameter *param, Atom *atom) {
|
|||||||
coord2bin2D(xtmp, ytmp, &nix, &niy);
|
coord2bin2D(xtmp, ytmp, &nix, &niy);
|
||||||
// Always put the cluster on the bin of its innermost atom so
|
// Always put the cluster on the bin of its innermost atom so
|
||||||
// the cluster should be closer to local clusters
|
// the cluster should be closer to local clusters
|
||||||
if(PBCx[ci] > 0 && ix > nix) { ix = nix; }
|
if(atom->PBCx[ci] > 0 && ix > nix) { ix = nix; }
|
||||||
if(PBCx[ci] < 0 && ix < nix) { ix = nix; }
|
if(atom->PBCx[ci] < 0 && ix < nix) { ix = nix; }
|
||||||
if(PBCy[ci] > 0 && iy > niy) { iy = niy; }
|
if(atom->PBCy[ci] > 0 && iy > niy) { iy = niy; }
|
||||||
if(PBCy[ci] < 0 && iy < niy) { iy = niy; }
|
if(atom->PBCy[ci] < 0 && iy < niy) { iy = niy; }
|
||||||
}
|
}
|
||||||
|
|
||||||
int bin = iy * mbinx + ix + 1;
|
int bin = iy * mbinx + ix + 1;
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#define DELTA 20000
|
#define DELTA 20000
|
||||||
|
|
||||||
static int NmaxGhost;
|
static int NmaxGhost;
|
||||||
static int *PBCx, *PBCy, *PBCz;
|
|
||||||
|
|
||||||
static void growPbc(Atom*);
|
static void growPbc(Atom*);
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ static void growPbc(Atom*);
|
|||||||
void initPbc(Atom* atom) {
|
void initPbc(Atom* atom) {
|
||||||
NmaxGhost = 0;
|
NmaxGhost = 0;
|
||||||
atom->border_map = NULL;
|
atom->border_map = NULL;
|
||||||
PBCx = NULL; PBCy = NULL; PBCz = NULL;
|
atom->PBCx = NULL; atom->PBCy = NULL; atom->PBCz = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update coordinates of ghost atoms */
|
/* update coordinates of ghost atoms */
|
||||||
@ -55,9 +54,9 @@ void updatePbc(Atom *atom, Parameter *param) {
|
|||||||
MD_FLOAT *bmap_cptr = cluster_ptr(border_map[ci]);
|
MD_FLOAT *bmap_cptr = cluster_ptr(border_map[ci]);
|
||||||
|
|
||||||
for(int cii = 0; cii < atom->clusters[ci].natoms; cii++) {
|
for(int cii = 0; cii < atom->clusters[ci].natoms; cii++) {
|
||||||
cluster_x(cptr, cii) = cluster_x(bmap_cptr, cii) + PBCx[ci] * xprd;
|
cluster_x(cptr, cii) = cluster_x(bmap_cptr, cii) + atom->PBCx[ci] * xprd;
|
||||||
cluster_y(cptr, cii) = cluster_y(bmap_cptr, cii) + PBCy[ci] * yprd;
|
cluster_y(cptr, cii) = cluster_y(bmap_cptr, cii) + atom->PBCy[ci] * yprd;
|
||||||
cluster_z(cptr, cii) = cluster_z(bmap_cptr, cii) + PBCz[ci] * zprd;
|
cluster_z(cptr, cii) = cluster_z(bmap_cptr, cii) + atom->PBCz[ci] * zprd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,6 +73,7 @@ void updateAtomsPbc(Atom *atom, Parameter *param) {
|
|||||||
atom_x(i) += xprd;
|
atom_x(i) += xprd;
|
||||||
} else if(atom_x(i) >= xprd) {
|
} else if(atom_x(i) >= xprd) {
|
||||||
atom_x(i) -= xprd;
|
atom_x(i) -= xprd;
|
||||||
|
}
|
||||||
|
|
||||||
if(atom_y(i) < 0.0) {
|
if(atom_y(i) < 0.0) {
|
||||||
atom_y(i) += yprd;
|
atom_y(i) += yprd;
|
||||||
@ -96,9 +96,9 @@ void updateAtomsPbc(Atom *atom, Parameter *param) {
|
|||||||
#define ADDGHOST(dx,dy,dz) \
|
#define ADDGHOST(dx,dy,dz) \
|
||||||
Nghost++; \
|
Nghost++; \
|
||||||
border_map[Nghost] = ci; \
|
border_map[Nghost] = ci; \
|
||||||
PBCx[Nghost] = dx; \
|
atom->PBCx[Nghost] = dx; \
|
||||||
PBCy[Nghost] = dy; \
|
atom->PBCy[Nghost] = dy; \
|
||||||
PBCz[Nghost] = dz; \
|
atom->PBCz[Nghost] = dz; \
|
||||||
copy_cluster_types(atom, atom->Nclusters_local + Nghost, ci)
|
copy_cluster_types(atom, atom->Nclusters_local + Nghost, ci)
|
||||||
|
|
||||||
void copy_cluster_types(Atom *atom, int dest, int src) {
|
void copy_cluster_types(Atom *atom, int dest, int src) {
|
||||||
@ -107,6 +107,17 @@ void copy_cluster_types(Atom *atom, int dest, int src) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* internal subroutines */
|
||||||
|
void growPbc(Atom* atom) {
|
||||||
|
int nold = NmaxGhost;
|
||||||
|
NmaxGhost += DELTA;
|
||||||
|
|
||||||
|
atom->border_map = (int*) reallocate(atom->border_map, ALIGNMENT, NmaxGhost * sizeof(int), nold * sizeof(int));
|
||||||
|
atom->PBCx = (int*) reallocate(atom->PBCx, ALIGNMENT, NmaxGhost * sizeof(int), nold * sizeof(int));
|
||||||
|
atom->PBCy = (int*) reallocate(atom->PBCy, ALIGNMENT, NmaxGhost * sizeof(int), nold * sizeof(int));
|
||||||
|
atom->PBCz = (int*) reallocate(atom->PBCz, ALIGNMENT, NmaxGhost * sizeof(int), nold * sizeof(int));
|
||||||
|
}
|
||||||
|
|
||||||
void setupPbc(Atom *atom, Parameter *param) {
|
void setupPbc(Atom *atom, Parameter *param) {
|
||||||
int *border_map = atom->border_map;
|
int *border_map = atom->border_map;
|
||||||
MD_FLOAT xprd = param->xprd;
|
MD_FLOAT xprd = param->xprd;
|
||||||
@ -131,7 +142,6 @@ void setupPbc(Atom *atom, Parameter *param) {
|
|||||||
MD_FLOAT bbmaxy = atom->clusters[ci].bbmaxy;
|
MD_FLOAT bbmaxy = atom->clusters[ci].bbmaxy;
|
||||||
MD_FLOAT bbminz = atom->clusters[ci].bbminz;
|
MD_FLOAT bbminz = atom->clusters[ci].bbminz;
|
||||||
MD_FLOAT bbmaxz = atom->clusters[ci].bbmaxz;
|
MD_FLOAT bbmaxz = atom->clusters[ci].bbmaxz;
|
||||||
|
|
||||||
/* Setup ghost atoms */
|
/* Setup ghost atoms */
|
||||||
/* 6 planes */
|
/* 6 planes */
|
||||||
if (bbminx < Cutneigh) { ADDGHOST(+1,0,0); }
|
if (bbminx < Cutneigh) { ADDGHOST(+1,0,0); }
|
||||||
@ -168,14 +178,3 @@ void setupPbc(Atom *atom, Parameter *param) {
|
|||||||
atom->Nclusters_ghost = Nghost + 1;
|
atom->Nclusters_ghost = Nghost + 1;
|
||||||
atom->Nclusters = atom->Nclusters_local + Nghost + 1;
|
atom->Nclusters = atom->Nclusters_local + Nghost + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* internal subroutines */
|
|
||||||
void growPbc(Atom* atom) {
|
|
||||||
int nold = NmaxGhost;
|
|
||||||
NmaxGhost += DELTA;
|
|
||||||
|
|
||||||
atom->border_map = (int*) reallocate(atom->border_map, ALIGNMENT, NmaxGhost * sizeof(int), nold * sizeof(int));
|
|
||||||
PBCx = (int*) reallocate(PBCx, ALIGNMENT, NmaxGhost * sizeof(int), nold * sizeof(int));
|
|
||||||
PBCy = (int*) reallocate(PBCy, ALIGNMENT, NmaxGhost * sizeof(int), nold * sizeof(int));
|
|
||||||
PBCz = (int*) reallocate(PBCz, ALIGNMENT, NmaxGhost * sizeof(int), nold * sizeof(int));
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user