Fix argon simulation

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
Rafael Ravedutti 2022-02-24 16:42:58 +01:00
parent 1a708f2d3b
commit fdd18df816

View File

@ -92,16 +92,15 @@ void setupNeighbor(Parameter *param, Atom *atom) {
MD_FLOAT atom_density = ((MD_FLOAT)(atom->Nlocal)) / ((xhi - xlo) * (yhi - ylo) * (zhi - zlo)); MD_FLOAT atom_density = ((MD_FLOAT)(atom->Nlocal)) / ((xhi - xlo) * (yhi - ylo) * (zhi - zlo));
MD_FLOAT atoms_in_cell = MAX(CLUSTER_DIM_M, CLUSTER_DIM_N); MD_FLOAT atoms_in_cell = MAX(CLUSTER_DIM_M, CLUSTER_DIM_N);
//MD_FLOAT atoms_in_cell = CLUSTER_DIM_M; MD_FLOAT targetsizex = cbrt(atoms_in_cell / atom_density);
binsizex = cbrt(atoms_in_cell / atom_density); MD_FLOAT targetsizey = cbrt(atoms_in_cell / atom_density);
binsizey = cbrt(atoms_in_cell / atom_density); nbinx = MAX(1, (int)ceil((xhi - xlo) / targetsizex));
cutneighsq = cutneigh * cutneigh; nbiny = MAX(1, (int)ceil((yhi - ylo) / targetsizey));
nbinx = (int)((xhi - xlo) / binsizex); binsizex = (xhi - xlo) / nbinx;
nbiny = (int)((yhi - ylo) / binsizey); binsizey = (yhi - ylo) / nbiny;
if(nbinx == 0) { nbinx = 1; }
if(nbiny == 0) { nbiny = 1; }
bininvx = 1.0 / binsizex; bininvx = 1.0 / binsizex;
bininvy = 1.0 / binsizey; bininvy = 1.0 / binsizey;
cutneighsq = cutneigh * cutneigh;
coord = xlo - cutneigh - SMALL * xprd; coord = xlo - cutneigh - SMALL * xprd;
mbinxlo = (int) (coord * bininvx); mbinxlo = (int) (coord * bininvx);
@ -161,6 +160,14 @@ void setupNeighbor(Parameter *param, Atom *atom) {
if (cluster_bins) { free(cluster_bins); } if (cluster_bins) { free(cluster_bins); }
cluster_bins = (int*) malloc(mbins * clusters_per_bin * sizeof(int)); cluster_bins = (int*) malloc(mbins * clusters_per_bin * sizeof(int));
/*
DEBUG_MESSAGE("lo, hi = (%e, %e, %e), (%e, %e, %e)\n", xlo, ylo, zlo, xhi, yhi, zhi);
DEBUG_MESSAGE("binsize = %e, %e\n", binsizex, binsizey);
DEBUG_MESSAGE("mbin lo, hi = (%d, %d), (%d, %d)\n", mbinxlo, mbinylo, mbinxhi, mbinyhi);
DEBUG_MESSAGE("mbins = %d (%d x %d)\n", mbins, mbinx, mbiny);
DEBUG_MESSAGE("nextx = %d, nexty = %d\n", nextx, nexty);
*/
} }
MD_FLOAT getBoundingBoxDistanceSq(Atom *atom, int ci, int cj) { MD_FLOAT getBoundingBoxDistanceSq(Atom *atom, int ci, int cj) {