From 6b09f6d49032364b5cc0f4607a7a6c97d5955e0a Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Wed, 27 Mar 2019 15:51:10 -0600 Subject: [PATCH] bug fix for tiled communication at cutoffs near box size --- src/balance.cpp | 16 ++++++++-------- src/comm_tiled.cpp | 2 +- src/fix_balance.cpp | 9 +++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/balance.cpp b/src/balance.cpp index 2a953caf47..61ac895467 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -1255,14 +1255,14 @@ void Balance::dumpout(bigint tstep) int m = 0; for (int i = 0; i < nprocs; i++) { domain->lamda_box_corners(&boxall[i][0],&boxall[i][3]); - fprintf(fp,"%d %d %g %g %g\n",m+1,1,bc[0][0],bc[0][1],bc[0][1]); - fprintf(fp,"%d %d %g %g %g\n",m+2,1,bc[1][0],bc[1][1],bc[1][1]); - fprintf(fp,"%d %d %g %g %g\n",m+3,1,bc[2][0],bc[2][1],bc[2][1]); - fprintf(fp,"%d %d %g %g %g\n",m+4,1,bc[3][0],bc[3][1],bc[3][1]); - fprintf(fp,"%d %d %g %g %g\n",m+5,1,bc[4][0],bc[4][1],bc[4][1]); - fprintf(fp,"%d %d %g %g %g\n",m+6,1,bc[5][0],bc[5][1],bc[5][1]); - fprintf(fp,"%d %d %g %g %g\n",m+7,1,bc[6][0],bc[6][1],bc[6][1]); - fprintf(fp,"%d %d %g %g %g\n",m+8,1,bc[7][0],bc[7][1],bc[7][1]); + fprintf(fp,"%d %d %g %g %g\n",m+1,1,bc[0][0],bc[0][1],bc[0][2]); + fprintf(fp,"%d %d %g %g %g\n",m+2,1,bc[1][0],bc[1][1],bc[1][2]); + fprintf(fp,"%d %d %g %g %g\n",m+3,1,bc[2][0],bc[2][1],bc[2][2]); + fprintf(fp,"%d %d %g %g %g\n",m+4,1,bc[3][0],bc[3][1],bc[3][2]); + fprintf(fp,"%d %d %g %g %g\n",m+5,1,bc[4][0],bc[4][1],bc[4][2]); + fprintf(fp,"%d %d %g %g %g\n",m+6,1,bc[5][0],bc[5][1],bc[5][2]); + fprintf(fp,"%d %d %g %g %g\n",m+7,1,bc[6][0],bc[6][1],bc[6][2]); + fprintf(fp,"%d %d %g %g %g\n",m+8,1,bc[7][0],bc[7][1],bc[7][2]); m += 8; } } diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index d7d2e4725d..d1d625445a 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -512,7 +512,7 @@ void CommTiled::forward_comm(int /*dummy*/) MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); } if (sendother[iswap]) { - for (i = 0; i < nsendproc[iswap]; i++) { + for (i = 0; i < nsend; i++) { n = avec->pack_comm(sendnum[iswap][i],sendlist[iswap][i], buf_send,pbc_flag[iswap][i],pbc[iswap][i]); MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap][i],0,world); diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index 8995a57afe..ddaf42b49d 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -274,10 +274,6 @@ void FixBalance::rebalance() comm->layout = Comm::LAYOUT_TILED; } - // output of new decomposition - - if (balance->outflag) balance->dumpout(update->ntimestep); - // reset proc sub-domains // check and warn if any proc's subbox is smaller than neigh skin // since may lead to lost atoms in comm->exchange() @@ -286,12 +282,17 @@ void FixBalance::rebalance() domain->set_local_box(); domain->subbox_too_small_check(neighbor->skin); + // output of new decomposition + + if (balance->outflag) balance->dumpout(update->ntimestep); + // move atoms to new processors via irregular() // for non-RCB only needed if migrate_check() says an atom moves too far // else allow caller's comm->exchange() to do it // set disable = 0, so weights migrate with atoms // important to delay disable = 1 until after pre_neighbor imbfinal calc // b/c atoms may migrate again in comm->exchange() + // NOTE: for reproducible debug runs, set 1st arg of migrate_atoms() to 1 if (domain->triclinic) domain->x2lamda(atom->nlocal); if (wtflag) balance->fixstore->disable = 0;