From 2cca3735154884865a034c008c5bca1f6c320a5c Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 6 Aug 2014 16:07:54 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12253 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/FLD/pair_lubricate.cpp | 8 +- src/FLD/pair_lubricate.h | 4 +- src/FLD/pair_lubricateU.cpp | 8 +- src/FLD/pair_lubricateU.h | 4 +- src/GPU/pair_eam_gpu.cpp | 8 +- src/GPU/pair_eam_gpu.h | 4 +- src/GRANULAR/pair_gran_hooke_history.cpp | 8 +- src/GRANULAR/pair_gran_hooke_history.h | 4 +- src/MANYBODY/fix_qeq_comb.cpp | 7 +- src/MANYBODY/fix_qeq_comb.h | 4 +- src/MANYBODY/pair_adp.cpp | 9 +- src/MANYBODY/pair_adp.h | 4 +- src/MANYBODY/pair_comb.cpp | 9 +- src/MANYBODY/pair_comb.h | 4 +- src/MANYBODY/pair_comb3.cpp | 9 +- src/MANYBODY/pair_comb3.h | 4 +- src/MANYBODY/pair_eam.cpp | 9 +- src/MANYBODY/pair_eam.h | 4 +- src/MANYBODY/pair_eim.cpp | 9 +- src/MANYBODY/pair_eim.h | 4 +- src/MC/fix_bond_break.cpp | 10 +- src/MC/fix_bond_break.h | 4 +- src/MC/fix_bond_create.cpp | 14 +-- src/MC/fix_bond_create.h | 4 +- src/MEAM/pair_meam.cpp | 10 +- src/MEAM/pair_meam.h | 4 +- src/MISC/fix_orient_fcc.cpp | 15 +-- src/MISC/fix_orient_fcc.h | 4 +- src/PERI/fix_peri_neigh.cpp | 8 +- src/PERI/fix_peri_neigh.h | 4 +- src/PERI/pair_peri_eps.cpp | 8 +- src/PERI/pair_peri_eps.h | 4 +- src/PERI/pair_peri_lps.cpp | 8 +- src/PERI/pair_peri_lps.h | 4 +- src/PERI/pair_peri_ves.cpp | 8 +- src/PERI/pair_peri_ves.h | 4 +- src/REAX/pair_reax.cpp | 9 +- src/REAX/pair_reax.h | 4 +- src/RIGID/fix_rigid_small.cpp | 6 +- src/RIGID/fix_rigid_small.h | 4 +- src/RIGID/fix_shake.cpp | 7 +- src/RIGID/fix_shake.h | 4 +- src/USER-ATC/fix_atc.cpp | 4 +- src/USER-ATC/fix_atc.h | 6 +- src/USER-CUDA/fix_shake_cuda.cpp | 9 +- src/USER-CUDA/fix_shake_cuda.h | 4 +- src/USER-CUDA/pair_eam_cuda.cpp | 9 +- src/USER-CUDA/pair_eam_cuda.h | 5 +- src/USER-MISC/pair_cdeam.cpp | 17 ++-- src/USER-MISC/pair_cdeam.h | 4 +- src/USER-MISC/pair_meam_spline.cpp | 7 +- src/USER-MISC/pair_meam_spline.h | 4 +- src/USER-MISC/pair_meam_sw_spline.cpp | 7 +- src/USER-MISC/pair_meam_sw_spline.h | 4 +- src/USER-REAXC/fix_qeq_reax.cpp | 10 +- src/USER-REAXC/fix_qeq_reax.h | 4 +- src/USER-REAXC/fix_reax_c.cpp | 8 +- src/USER-REAXC/fix_reax_c.h | 4 +- src/USER-REAXC/fix_reaxc_species.cpp | 8 +- src/USER-REAXC/fix_reaxc_species.h | 4 +- src/USER-SPH/pair_sph_rhosum.cpp | 8 +- src/USER-SPH/pair_sph_rhosum.h | 4 +- src/comm_brick.cpp | 47 +++++---- src/comm_tiled.cpp | 118 ++++++++++++++--------- src/fix.h | 4 +- src/pair.h | 4 +- 66 files changed, 306 insertions(+), 268 deletions(-) diff --git a/src/FLD/pair_lubricate.cpp b/src/FLD/pair_lubricate.cpp index 0f7880dd7c2..7feb915e673 100755 --- a/src/FLD/pair_lubricate.cpp +++ b/src/FLD/pair_lubricate.cpp @@ -752,8 +752,8 @@ void PairLubricate::read_restart_settings(FILE *fp) /* ---------------------------------------------------------------------- */ -int PairLubricate::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int PairLubricate::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -771,12 +771,12 @@ int PairLubricate::pack_comm(int n, int *list, double *buf, buf[m++] = omega[j][2]; } - return 6; + return m; } /* ---------------------------------------------------------------------- */ -void PairLubricate::unpack_comm(int n, int first, double *buf) +void PairLubricate::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/FLD/pair_lubricate.h b/src/FLD/pair_lubricate.h index 8df09c59346..f61cbca184b 100644 --- a/src/FLD/pair_lubricate.h +++ b/src/FLD/pair_lubricate.h @@ -40,8 +40,8 @@ class PairLubricate : public Pair { int pre_adapt(char *, int, int, int, int); void adapt(int, int, int, int, int, double); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); protected: double mu,cut_inner_global,cut_global; diff --git a/src/FLD/pair_lubricateU.cpp b/src/FLD/pair_lubricateU.cpp index 5f89f757b2e..2a4bbf7fe01 100644 --- a/src/FLD/pair_lubricateU.cpp +++ b/src/FLD/pair_lubricateU.cpp @@ -2009,8 +2009,8 @@ void PairLubricateU::copy_uo_vec(int inum, double **f, double **torque, /* ---------------------------------------------------------------------- */ -int PairLubricateU::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int PairLubricateU::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -2027,12 +2027,12 @@ int PairLubricateU::pack_comm(int n, int *list, double *buf, buf[m++] = omega[j][1]; buf[m++] = omega[j][2]; } - return 6; + return m; } /* ---------------------------------------------------------------------- */ -void PairLubricateU::unpack_comm(int n, int first, double *buf) +void PairLubricateU::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/FLD/pair_lubricateU.h b/src/FLD/pair_lubricateU.h index 009f5ac54bf..a1c9a936ca1 100644 --- a/src/FLD/pair_lubricateU.h +++ b/src/FLD/pair_lubricateU.h @@ -37,8 +37,8 @@ class PairLubricateU : public Pair { void read_restart(FILE *); void write_restart_settings(FILE *); void read_restart_settings(FILE *); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); protected: double cut_inner_global,cut_global; diff --git a/src/GPU/pair_eam_gpu.cpp b/src/GPU/pair_eam_gpu.cpp index 6664096da09..adb85900389 100644 --- a/src/GPU/pair_eam_gpu.cpp +++ b/src/GPU/pair_eam_gpu.cpp @@ -237,8 +237,8 @@ double PairEAMGPU::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -int PairEAMGPU::pack_comm(int n, int *list, double *buf, int pbc_flag, - int *pbc) +int PairEAMGPU::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag,int *pbc) { int i,j,m; @@ -258,12 +258,12 @@ int PairEAMGPU::pack_comm(int n, int *list, double *buf, int pbc_flag, } } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void PairEAMGPU::unpack_comm(int n, int first, double *buf) +void PairEAMGPU::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/GPU/pair_eam_gpu.h b/src/GPU/pair_eam_gpu.h index 0efc1a79f03..2d9f9e1fd9b 100644 --- a/src/GPU/pair_eam_gpu.h +++ b/src/GPU/pair_eam_gpu.h @@ -35,8 +35,8 @@ class PairEAMGPU : public PairEAM { double single(int, int, int, int, double, double, double, double &); double memory_usage(); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH }; diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 3cb864779f5..77d2f0d70a4 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -763,8 +763,8 @@ double PairGranHookeHistory::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -int PairGranHookeHistory::pack_comm(int n, int *list, - double *buf, int pbc_flag, int *pbc) +int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -773,12 +773,12 @@ int PairGranHookeHistory::pack_comm(int n, int *list, j = list[i]; buf[m++] = mass_rigid[j]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void PairGranHookeHistory::unpack_comm(int n, int first, double *buf) +void PairGranHookeHistory::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/GRANULAR/pair_gran_hooke_history.h b/src/GRANULAR/pair_gran_hooke_history.h index 7a98b19dc65..4e2e51a4cc5 100644 --- a/src/GRANULAR/pair_gran_hooke_history.h +++ b/src/GRANULAR/pair_gran_hooke_history.h @@ -42,8 +42,8 @@ class PairGranHookeHistory : public Pair { void read_restart_settings(FILE *); void reset_dt(); virtual double single(int, int, int, int, double, double, double, double &); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); void *extract(const char *, int &); double memory_usage(); diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index c40147f4673..b017acf2270 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -292,7 +292,8 @@ double FixQEQComb::memory_usage() } /* ---------------------------------------------------------------------- */ -int FixQEQComb::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int FixQEQComb::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -301,12 +302,12 @@ int FixQEQComb::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) j = list[i]; buf[m++] = atom->q[j]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void FixQEQComb::unpack_comm(int n, int first, double *buf) +void FixQEQComb::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/MANYBODY/fix_qeq_comb.h b/src/MANYBODY/fix_qeq_comb.h index 62a0aa21ab8..abaa73d6470 100644 --- a/src/MANYBODY/fix_qeq_comb.h +++ b/src/MANYBODY/fix_qeq_comb.h @@ -35,8 +35,8 @@ class FixQEQComb : public Fix { virtual void post_force(int); void post_force_respa(int,int,int); double memory_usage(); - int pack_comm(int , int *, double *, int, int *); - void unpack_comm(int , int , double *); + int pack_forward_comm(int , int *, double *, int, int *); + void unpack_forward_comm(int , int , double *); void min_post_force(int); diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index 5a60a5f5ddf..d19ffd1ff1c 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -933,7 +933,8 @@ void PairADP::grab(FILE *fp, int n, double *list) /* ---------------------------------------------------------------------- */ -int PairADP::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int PairADP::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -951,12 +952,12 @@ int PairADP::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) buf[m++] = lambda[j][4]; buf[m++] = lambda[j][5]; } - return 10; + return m; } /* ---------------------------------------------------------------------- */ -void PairADP::unpack_comm(int n, int first, double *buf) +void PairADP::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; @@ -996,7 +997,7 @@ int PairADP::pack_reverse_comm(int n, int first, double *buf) buf[m++] = lambda[i][4]; buf[m++] = lambda[i][5]; } - return 10; + return m; } /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_adp.h b/src/MANYBODY/pair_adp.h index 1c15abe9c12..cb157c993da 100644 --- a/src/MANYBODY/pair_adp.h +++ b/src/MANYBODY/pair_adp.h @@ -34,8 +34,8 @@ class PairADP : public Pair { void init_style(); double init_one(int, int); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); double memory_usage(); diff --git a/src/MANYBODY/pair_comb.cpp b/src/MANYBODY/pair_comb.cpp index d10307d5f82..83614d5e9c1 100644 --- a/src/MANYBODY/pair_comb.cpp +++ b/src/MANYBODY/pair_comb.cpp @@ -1991,7 +1991,8 @@ void PairComb::Over_cor(Param *param, double rsq1, int NCoi, /* ---------------------------------------------------------------------- */ -int PairComb::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int PairComb::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -2000,12 +2001,12 @@ int PairComb::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) j = list[i]; buf[m++] = qf[j]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void PairComb::unpack_comm(int n, int first, double *buf) +void PairComb::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; @@ -2023,7 +2024,7 @@ int PairComb::pack_reverse_comm(int n, int first, double *buf) m = 0; last = first + n; for (i = first; i < last; i++) buf[m++] = qf[i]; - return 1; + return m; } /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_comb.h b/src/MANYBODY/pair_comb.h index e9d2a9baa6a..5e7b243b783 100644 --- a/src/MANYBODY/pair_comb.h +++ b/src/MANYBODY/pair_comb.h @@ -149,8 +149,8 @@ class PairComb : public Pair { void Over_cor(Param *, double, int, double &, double &); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); - int pack_comm(int , int *, double *, int, int *); - void unpack_comm(int , int , double *); + int pack_forward_comm(int , int *, double *, int, int *); + void unpack_forward_comm(int , int , double *); void Short_neigh(); diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index 064cc8dac9e..2b26026d2da 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -3853,7 +3853,8 @@ double PairComb3::switching_d(double rr) /* ---------------------------------------------------------------------- */ -int PairComb3::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int PairComb3::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -3869,12 +3870,12 @@ int PairComb3::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) buf[m++] = NCo[j]; } } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void PairComb3::unpack_comm(int n, int first, double *buf) +void PairComb3::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; @@ -3904,7 +3905,7 @@ int PairComb3::pack_reverse_comm(int n, int first, double *buf) for (i = first; i < last; i++) buf[m++] = NCo[i]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_comb3.h b/src/MANYBODY/pair_comb3.h index 6dac64e5600..b3b10da1861 100644 --- a/src/MANYBODY/pair_comb3.h +++ b/src/MANYBODY/pair_comb3.h @@ -246,8 +246,8 @@ class PairComb3 : public Pair { // communication functions int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); - int pack_comm(int , int *, double *, int, int *); - void unpack_comm(int , int , double *); + int pack_forward_comm(int , int *, double *, int, int *); + void unpack_forward_comm(int , int , double *); // vector functions, inline for efficiency inline double vec3_dot(double *x, double *y) { diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index 892551b430b..f6d8f8c6dba 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -806,7 +806,8 @@ double PairEAM::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -int PairEAM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int PairEAM::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -815,12 +816,12 @@ int PairEAM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) j = list[i]; buf[m++] = fp[j]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void PairEAM::unpack_comm(int n, int first, double *buf) +void PairEAM::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; @@ -838,7 +839,7 @@ int PairEAM::pack_reverse_comm(int n, int first, double *buf) m = 0; last = first + n; for (i = first; i < last; i++) buf[m++] = rho[i]; - return 1; + return m; } /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_eam.h b/src/MANYBODY/pair_eam.h index 96c36b99d2a..461d27785e5 100644 --- a/src/MANYBODY/pair_eam.h +++ b/src/MANYBODY/pair_eam.h @@ -53,8 +53,8 @@ class PairEAM : public Pair { double init_one(int, int); double single(int, int, int, int, double, double, double, double &); - virtual int pack_comm(int, int *, double *, int, int *); - virtual void unpack_comm(int, int, double *); + virtual int pack_forward_comm(int, int *, double *, int, int *); + virtual void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); double memory_usage(); diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index 6f9be6fac16..52706e2a651 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -1083,7 +1083,8 @@ double PairEIM::funccoul(int i, int j, double r) /* ---------------------------------------------------------------------- */ -int PairEIM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int PairEIM::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -1100,12 +1101,12 @@ int PairEIM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) buf[m++] = fp[j]; } } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void PairEIM::unpack_comm(int n, int first, double *buf) +void PairEIM::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; @@ -1133,7 +1134,7 @@ int PairEIM::pack_reverse_comm(int n, int first, double *buf) if (rhofp == 2) { for (i = first; i < last; i++) buf[m++] = fp[i]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_eim.h b/src/MANYBODY/pair_eim.h index 687c61564b1..95f7cd47c85 100644 --- a/src/MANYBODY/pair_eim.h +++ b/src/MANYBODY/pair_eim.h @@ -35,8 +35,8 @@ class PairEIM : public Pair { void init_style(); double init_one(int, int); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); double memory_usage(); diff --git a/src/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index 05551cebe5d..d508b9f4180 100755 --- a/src/MC/fix_bond_break.cpp +++ b/src/MC/fix_bond_break.cpp @@ -702,8 +702,8 @@ void FixBondBreak::post_integrate_respa(int ilevel, int iloop) /* ---------------------------------------------------------------------- */ -int FixBondBreak::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int FixBondBreak::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,k,m,ns; @@ -714,7 +714,7 @@ int FixBondBreak::pack_comm(int n, int *list, double *buf, buf[m++] = ubuf(partner[j]).d; buf[m++] = probability[j]; } - return 2; + return m; } int **nspecial = atom->nspecial; @@ -734,7 +734,7 @@ int FixBondBreak::pack_comm(int n, int *list, double *buf, /* ---------------------------------------------------------------------- */ -void FixBondBreak::unpack_comm(int n, int first, double *buf) +void FixBondBreak::unpack_forward_comm(int n, int first, double *buf) { int i,j,m,ns,last; @@ -775,7 +775,7 @@ int FixBondBreak::pack_reverse_comm(int n, int first, double *buf) buf[m++] = ubuf(partner[i]).d; buf[m++] = distsq[i]; } - return 2; + return m; } /* ---------------------------------------------------------------------- */ diff --git a/src/MC/fix_bond_break.h b/src/MC/fix_bond_break.h index a7e8194bb7b..606eb250362 100755 --- a/src/MC/fix_bond_break.h +++ b/src/MC/fix_bond_break.h @@ -33,8 +33,8 @@ class FixBondBreak : public Fix { void post_integrate(); void post_integrate_respa(int,int); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); double compute_vector(int); diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index 670e0ccf30b..a6dab49d42d 100755 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -1211,8 +1211,8 @@ void FixBondCreate::post_integrate_respa(int ilevel, int iloop) /* ---------------------------------------------------------------------- */ -int FixBondCreate::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int FixBondCreate::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,k,m,ns; @@ -1223,7 +1223,7 @@ int FixBondCreate::pack_comm(int n, int *list, double *buf, j = list[i]; buf[m++] = ubuf(bondcount[j]).d; } - return 1; + return m; } if (commflag == 2) { @@ -1232,7 +1232,7 @@ int FixBondCreate::pack_comm(int n, int *list, double *buf, buf[m++] = ubuf(partner[j]).d; buf[m++] = probability[j]; } - return 2; + return m; } int **nspecial = atom->nspecial; @@ -1252,7 +1252,7 @@ int FixBondCreate::pack_comm(int n, int *list, double *buf, /* ---------------------------------------------------------------------- */ -void FixBondCreate::unpack_comm(int n, int first, double *buf) +void FixBondCreate::unpack_forward_comm(int n, int first, double *buf) { int i,j,m,ns,last; @@ -1298,14 +1298,14 @@ int FixBondCreate::pack_reverse_comm(int n, int first, double *buf) if (commflag == 1) { for (i = first; i < last; i++) buf[m++] = ubuf(bondcount[i]).d; - return 1; + return m; } for (i = first; i < last; i++) { buf[m++] = ubuf(partner[i]).d; buf[m++] = distsq[i]; } - return 2; + return m; } /* ---------------------------------------------------------------------- */ diff --git a/src/MC/fix_bond_create.h b/src/MC/fix_bond_create.h index 591d41916d1..0ff3565cef4 100755 --- a/src/MC/fix_bond_create.h +++ b/src/MC/fix_bond_create.h @@ -35,8 +35,8 @@ class FixBondCreate : public Fix { void post_integrate(); void post_integrate_respa(int, int); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); void grow_arrays(int); diff --git a/src/MEAM/pair_meam.cpp b/src/MEAM/pair_meam.cpp index aea02fde62b..2c5bef0461b 100644 --- a/src/MEAM/pair_meam.cpp +++ b/src/MEAM/pair_meam.cpp @@ -730,7 +730,8 @@ void PairMEAM::read_files(char *globalfile, char *userfile) /* ---------------------------------------------------------------------- */ -int PairMEAM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int PairMEAM::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,k,m; @@ -767,12 +768,13 @@ int PairMEAM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) buf[m++] = tsq_ave[j][1]; buf[m++] = tsq_ave[j][2]; } - return comm_forward; + + return m; } /* ---------------------------------------------------------------------- */ -void PairMEAM::unpack_comm(int n, int first, double *buf) +void PairMEAM::unpack_forward_comm(int n, int first, double *buf) { int i,k,m,last; @@ -843,7 +845,7 @@ int PairMEAM::pack_reverse_comm(int n, int first, double *buf) buf[m++] = tsq_ave[i][2]; } - return comm_reverse; + return m; } /* ---------------------------------------------------------------------- */ diff --git a/src/MEAM/pair_meam.h b/src/MEAM/pair_meam.h index 9d73ee04896..75e7060bd19 100644 --- a/src/MEAM/pair_meam.h +++ b/src/MEAM/pair_meam.h @@ -69,8 +69,8 @@ class PairMEAM : public Pair { void init_list(int, class NeighList *); double init_one(int, int); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); double memory_usage(); diff --git a/src/MISC/fix_orient_fcc.cpp b/src/MISC/fix_orient_fcc.cpp index bdf5cb4e056..70a18730163 100644 --- a/src/MISC/fix_orient_fcc.cpp +++ b/src/MISC/fix_orient_fcc.cpp @@ -478,8 +478,8 @@ double FixOrientFCC::compute_scalar() /* ---------------------------------------------------------------------- */ -int FixOrientFCC::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int FixOrientFCC::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,k,num; tagint id; @@ -508,18 +508,14 @@ int FixOrientFCC::pack_comm(int n, int *list, double *buf, if (k < nlocal) id = tag[id]; buf[m++] = id; } - - m += (12-num) * 3; - if (use_xismooth) m += 12-num; } - if (use_xismooth) return 62; - return 50; + return m; } /* ---------------------------------------------------------------------- */ -void FixOrientFCC::unpack_comm(int n, int first, double *buf) +void FixOrientFCC::unpack_forward_comm(int n, int first, double *buf) { int i,j,num; int last = first + n; @@ -536,9 +532,6 @@ void FixOrientFCC::unpack_comm(int n, int first, double *buf) nbr[i].dxi[j][2] = buf[m++]; nbr[i].id[j] = static_cast (buf[m++]); } - - m += (12-num) * 3; - if (use_xismooth) m += 12-num; } } diff --git a/src/MISC/fix_orient_fcc.h b/src/MISC/fix_orient_fcc.h index 399c34970ea..d3577787985 100644 --- a/src/MISC/fix_orient_fcc.h +++ b/src/MISC/fix_orient_fcc.h @@ -52,8 +52,8 @@ class FixOrientFCC : public Fix { void post_force(int); void post_force_respa(int, int, int); double compute_scalar(); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); double memory_usage(); private: diff --git a/src/PERI/fix_peri_neigh.cpp b/src/PERI/fix_peri_neigh.cpp index 967cd246100..2435d3d7a19 100644 --- a/src/PERI/fix_peri_neigh.cpp +++ b/src/PERI/fix_peri_neigh.cpp @@ -506,8 +506,8 @@ int FixPeriNeigh::unpack_exchange(int nlocal, double *buf) /* ---------------------------------------------------------------------- */ -int FixPeriNeigh::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int FixPeriNeigh::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -516,12 +516,12 @@ int FixPeriNeigh::pack_comm(int n, int *list, double *buf, j = list[i]; buf[m++] = wvolume[j]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void FixPeriNeigh::unpack_comm(int n, int first, double *buf) +void FixPeriNeigh::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/PERI/fix_peri_neigh.h b/src/PERI/fix_peri_neigh.h index 1c493457c67..2b02b5cdfb7 100644 --- a/src/PERI/fix_peri_neigh.h +++ b/src/PERI/fix_peri_neigh.h @@ -54,8 +54,8 @@ class FixPeriNeigh : public Fix { void unpack_restart(int, int); int size_restart(int); int maxsize_restart(); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); protected: diff --git a/src/PERI/pair_peri_eps.cpp b/src/PERI/pair_peri_eps.cpp index 9e06ff9f620..b3f701ea12d 100644 --- a/src/PERI/pair_peri_eps.cpp +++ b/src/PERI/pair_peri_eps.cpp @@ -799,8 +799,8 @@ double PairPeriEPS::compute_DeviatoricForceStateNorm(int i) communication routines ---------------------------------------------------------------------- */ -int PairPeriEPS::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int PairPeriEPS::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -809,12 +809,12 @@ int PairPeriEPS::pack_comm(int n, int *list, double *buf, j = list[i]; buf[m++] = theta[j]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void PairPeriEPS::unpack_comm(int n, int first, double *buf) +void PairPeriEPS::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/PERI/pair_peri_eps.h b/src/PERI/pair_peri_eps.h index bf20becc5de..9dbc0aaacd7 100644 --- a/src/PERI/pair_peri_eps.h +++ b/src/PERI/pair_peri_eps.h @@ -31,8 +31,8 @@ class PairPeriEPS : public Pair { PairPeriEPS(class LAMMPS *); virtual ~PairPeriEPS(); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); virtual void compute(int, int); void settings(int, char **); diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index cb17d026cf8..8020b6b9bd0 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -626,8 +626,8 @@ void PairPeriLPS::compute_dilatation() communication routines ---------------------------------------------------------------------- */ -int PairPeriLPS::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int PairPeriLPS::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -636,12 +636,12 @@ int PairPeriLPS::pack_comm(int n, int *list, double *buf, j = list[i]; buf[m++] = theta[j]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void PairPeriLPS::unpack_comm(int n, int first, double *buf) +void PairPeriLPS::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/PERI/pair_peri_lps.h b/src/PERI/pair_peri_lps.h index d28a2385b77..ba01f60f917 100644 --- a/src/PERI/pair_peri_lps.h +++ b/src/PERI/pair_peri_lps.h @@ -31,8 +31,8 @@ class PairPeriLPS : public Pair { PairPeriLPS(class LAMMPS *); virtual ~PairPeriLPS(); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); virtual void compute(int, int); void settings(int, char **); diff --git a/src/PERI/pair_peri_ves.cpp b/src/PERI/pair_peri_ves.cpp index b62130c40d8..243c0506872 100644 --- a/src/PERI/pair_peri_ves.cpp +++ b/src/PERI/pair_peri_ves.cpp @@ -696,8 +696,8 @@ void PairPeriVES::compute_dilatation() communication routines ---------------------------------------------------------------------- */ -int PairPeriVES::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int PairPeriVES::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -706,12 +706,12 @@ int PairPeriVES::pack_comm(int n, int *list, double *buf, j = list[i]; buf[m++] = theta[j]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void PairPeriVES::unpack_comm(int n, int first, double *buf) +void PairPeriVES::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/PERI/pair_peri_ves.h b/src/PERI/pair_peri_ves.h index 4e3db61d0ad..b2a3c59e6ff 100644 --- a/src/PERI/pair_peri_ves.h +++ b/src/PERI/pair_peri_ves.h @@ -31,8 +31,8 @@ class PairPeriVES : public Pair { PairPeriVES(class LAMMPS *); virtual ~PairPeriVES(); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); virtual void compute(int, int); void settings(int, char **); diff --git a/src/REAX/pair_reax.cpp b/src/REAX/pair_reax.cpp index e8db8a2a3d4..5d1a2d78d97 100644 --- a/src/REAX/pair_reax.cpp +++ b/src/REAX/pair_reax.cpp @@ -621,7 +621,8 @@ double PairREAX::init_one(int i, int j) /* ---------------------------------------------------------------------- */ -int PairREAX::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int PairREAX::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -640,12 +641,12 @@ int PairREAX::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) } } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void PairREAX::unpack_comm(int n, int first, double *buf) +void PairREAX::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; @@ -673,7 +674,7 @@ int PairREAX::pack_reverse_comm(int n, int first, double *buf) for (i = first; i < last; i++) buf[m++] = wcg[i]; - return 1; + return m; } /* ---------------------------------------------------------------------- */ diff --git a/src/REAX/pair_reax.h b/src/REAX/pair_reax.h index 4062dc7e118..347292e2b2d 100644 --- a/src/REAX/pair_reax.h +++ b/src/REAX/pair_reax.h @@ -36,8 +36,8 @@ class PairREAX : public Pair { double init_one(int, int); double memory_usage(); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 93c4144140a..9d9116a1e9e 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -2762,8 +2762,8 @@ int FixRigidSmall::unpack_exchange(int nlocal, double *buf) for FULL_BODY, send 0/1 flag with every atom ------------------------------------------------------------------------- */ -int FixRigidSmall::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int FixRigidSmall::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j; double *xcm,*vcm,*quat,*omega,*ex_space,*ey_space,*ez_space,*conjqm; @@ -2850,7 +2850,7 @@ int FixRigidSmall::pack_comm(int n, int *list, double *buf, for other commflag values, only unpack body info if atom owns it ------------------------------------------------------------------------- */ -void FixRigidSmall::unpack_comm(int n, int first, double *buf) +void FixRigidSmall::unpack_forward_comm(int n, int first, double *buf) { int i,j,last; double *xcm,*vcm,*quat,*omega,*ex_space,*ey_space,*ez_space,*conjqm; diff --git a/src/RIGID/fix_rigid_small.h b/src/RIGID/fix_rigid_small.h index 2346c789374..db274e24405 100644 --- a/src/RIGID/fix_rigid_small.h +++ b/src/RIGID/fix_rigid_small.h @@ -52,8 +52,8 @@ class FixRigidSmall : public Fix { int pack_exchange(int, double *); int unpack_exchange(int, double *); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index d3615b0b364..2aa99a82aae 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -2583,7 +2583,8 @@ int FixShake::unpack_exchange(int nlocal, double *buf) /* ---------------------------------------------------------------------- */ -int FixShake::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int FixShake::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; double dx,dy,dz; @@ -2613,12 +2614,12 @@ int FixShake::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) buf[m++] = xshake[j][2] + dz; } } - return 3; + return m; } /* ---------------------------------------------------------------------- */ -void FixShake::unpack_comm(int n, int first, double *buf) +void FixShake::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/RIGID/fix_shake.h b/src/RIGID/fix_shake.h index 18e3474205a..02dd1e92f18 100644 --- a/src/RIGID/fix_shake.h +++ b/src/RIGID/fix_shake.h @@ -44,8 +44,8 @@ class FixShake : public Fix { int pack_exchange(int, double *); int unpack_exchange(int, double *); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int dof(int); void reset_dt(); diff --git a/src/USER-ATC/fix_atc.cpp b/src/USER-ATC/fix_atc.cpp index 7e873b64d50..662ac2d8c27 100644 --- a/src/USER-ATC/fix_atc.cpp +++ b/src/USER-ATC/fix_atc.cpp @@ -679,13 +679,13 @@ int FixATC::unpack_exchange(int nlocal, double * buf) return num; } -int FixATC::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int FixATC::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int num = atc_->pack_comm(n, list, buf, pbc_flag, pbc); return num; } -void FixATC::unpack_comm(int n, int first, double *buf) +void FixATC::unpack_forward_comm(int n, int first, double *buf) { atc_->unpack_comm(n, first, buf); } diff --git a/src/USER-ATC/fix_atc.h b/src/USER-ATC/fix_atc.h index 61f29c10e68..4934df2bf6e 100644 --- a/src/USER-ATC/fix_atc.h +++ b/src/USER-ATC/fix_atc.h @@ -69,15 +69,15 @@ namespace LAMMPS_NS { atom received from another processor. */ int unpack_exchange(int, double *); - /** pack_comm called from comm->forward_comm_fix and + /** pack_forward_comm called from comm->forward_comm_fix and packs fix-specific data for a given ghost atom from exchange with another proc */ - int pack_comm(int , int *, double *, int, int *); + int pack_forward_comm(int , int *, double *, int, int *); /** unpack_comm called from comm->forward_comm_fix and unpacks fix-specific data for a given ghost atom from exchange with another proc */ - void unpack_comm(int, int, double *); + void unpack_forward_comm(int, int, double *); /** pre_neighbor is used to modify fix-specific data and is called before neighbor list is built in diff --git a/src/USER-CUDA/fix_shake_cuda.cpp b/src/USER-CUDA/fix_shake_cuda.cpp index 6a2ea8d6e4e..28b7192e0da 100644 --- a/src/USER-CUDA/fix_shake_cuda.cpp +++ b/src/USER-CUDA/fix_shake_cuda.cpp @@ -2793,7 +2793,8 @@ void FixShakeCuda::post_force_respa(int vflag, int ilevel, int iloop) /* ---------------------------------------------------------------------- */ -int FixShakeCuda::pack_comm(int n, int* list, double* buf, int pbc_flag, int* pbc) +int FixShakeCuda::pack_forward_comm(int n, int* list, double* buf, + int pbc_flag, int* pbc) { if(cuda->finished_setup) { int iswap = *list; @@ -2805,7 +2806,7 @@ int FixShakeCuda::pack_comm(int n, int* list, double* buf, int pbc_flag, int* pb } else Cuda_FixShakeCuda_PackComm(&cuda->shared_data, n, iswap, (void*) buf, pbc, pbc_flag); - return 3; + return 3*n; } int i, j, m; @@ -2839,12 +2840,12 @@ int FixShakeCuda::pack_comm(int n, int* list, double* buf, int pbc_flag, int* pb } } - return 3; + return m; } /* ---------------------------------------------------------------------- */ -void FixShakeCuda::unpack_comm(int n, int first, double* buf) +void FixShakeCuda::unpack_forward_comm(int n, int first, double* buf) { if(cuda->finished_setup) { Cuda_FixShakeCuda_UnpackComm(&cuda->shared_data, n, first, (void*)buf); diff --git a/src/USER-CUDA/fix_shake_cuda.h b/src/USER-CUDA/fix_shake_cuda.h index 1010210b647..90ceb3cb3d5 100644 --- a/src/USER-CUDA/fix_shake_cuda.h +++ b/src/USER-CUDA/fix_shake_cuda.h @@ -43,8 +43,8 @@ class FixShakeCuda : public Fix { void set_arrays(int); int pack_exchange(int, double *); int unpack_exchange(int, double *); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int dof(int); void reset_dt(); diff --git a/src/USER-CUDA/pair_eam_cuda.cpp b/src/USER-CUDA/pair_eam_cuda.cpp index 551313db125..7a3a9f0ce6b 100644 --- a/src/USER-CUDA/pair_eam_cuda.cpp +++ b/src/USER-CUDA/pair_eam_cuda.cpp @@ -231,17 +231,18 @@ void PairEAMCuda::array2spline() /* ---------------------------------------------------------------------- */ -int PairEAMCuda::pack_comm(int n, int* iswap, double* buf, int pbc_flag, int* pbc) +int PairEAMCuda::pack_forward_comm(int n, int* iswap, double* buf, + int pbc_flag, int* pbc) { Cuda_PairEAMCuda_PackComm(&cuda->shared_data, n, *iswap, buf); - if(sizeof(F_FLOAT) < sizeof(double)) return 1; - else return 1; + if(sizeof(F_FLOAT) < sizeof(double)) return n; + else return n; } /* ---------------------------------------------------------------------- */ -void PairEAMCuda::unpack_comm(int n, int first, double* buf) +void PairEAMCuda::unpack_forward_comm(int n, int first, double* buf) { Cuda_PairEAMCuda_UnpackComm(&cuda->shared_data, n, first, buf, cu_fp->dev_data()); } diff --git a/src/USER-CUDA/pair_eam_cuda.h b/src/USER-CUDA/pair_eam_cuda.h index 9d4a30ca0d1..c18151af429 100644 --- a/src/USER-CUDA/pair_eam_cuda.h +++ b/src/USER-CUDA/pair_eam_cuda.h @@ -57,8 +57,9 @@ class PairEAMCuda : public PairEAM void init_list(int, class NeighList *); void init_style(); void array2spline(); - int pack_comm(int n, int *iswap, double *buf, int pbc_flag, int *pbc); - void unpack_comm(int n, int first, double *buf); + int pack_forward_comm(int n, int *iswap, double *buf, + int pbc_flag, int *pbc); + void unpack_forward_comm(int n, int first, double *buf); protected: class Cuda *cuda; void allocate(); diff --git a/src/USER-MISC/pair_cdeam.cpp b/src/USER-MISC/pair_cdeam.cpp index dbfbac82350..67239119006 100644 --- a/src/USER-MISC/pair_cdeam.cpp +++ b/src/USER-MISC/pair_cdeam.cpp @@ -494,7 +494,8 @@ void PairCDEAM::read_h_coeff(char *filename) /* ---------------------------------------------------------------------- */ -int PairCDEAM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int PairCDEAM::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -508,7 +509,7 @@ int PairCDEAM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) buf[m++] = rhoB[j]; buf[m++] = D_values[j]; } - return 4; + return m; } else if(cdeamVersion == 2) { for (i = 0; i < n; i++) { @@ -517,7 +518,7 @@ int PairCDEAM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) buf[m++] = rho[j]; buf[m++] = rhoB[j]; } - return 3; + return m; } else { ASSERT(false); return 0; } } @@ -526,14 +527,14 @@ int PairCDEAM::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) j = list[i]; buf[m++] = D_values[j]; } - return 1; + return m; } else return 0; } /* ---------------------------------------------------------------------- */ -void PairCDEAM::unpack_comm(int n, int first, double *buf) +void PairCDEAM::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; @@ -580,14 +581,14 @@ int PairCDEAM::pack_reverse_comm(int n, int first, double *buf) buf[m++] = rhoB[i]; buf[m++] = D_values[i]; } - return 3; + return m; } else if(cdeamVersion == 2) { for(i = first; i < last; i++) { buf[m++] = rho[i]; buf[m++] = rhoB[i]; } - return 2; + return m; } else { ASSERT(false); return 0; } } @@ -595,7 +596,7 @@ int PairCDEAM::pack_reverse_comm(int n, int first, double *buf) for(i = first; i < last; i++) { buf[m++] = D_values[i]; } - return 1; + return m; } else return 0; } diff --git a/src/USER-MISC/pair_cdeam.h b/src/USER-MISC/pair_cdeam.h index efc1b580125..d8743973c85 100644 --- a/src/USER-MISC/pair_cdeam.h +++ b/src/USER-MISC/pair_cdeam.h @@ -41,8 +41,8 @@ class PairCDEAM : public PairEAMAlloy void coeff(int, char **); /// This is for MPI communication with neighbor nodes. - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index 8af973c861e..be0a8fdff88 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -526,18 +526,19 @@ double PairMEAMSpline::init_one(int i, int j) /* ---------------------------------------------------------------------- */ -int PairMEAMSpline::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int PairMEAMSpline::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int* list_iter = list; int* list_iter_end = list + n; while(list_iter != list_iter_end) *buf++ = Uprime_values[*list_iter++]; - return 1; + return n; } /* ---------------------------------------------------------------------- */ -void PairMEAMSpline::unpack_comm(int n, int first, double *buf) +void PairMEAMSpline::unpack_forward_comm(int n, int first, double *buf) { memcpy(&Uprime_values[first], buf, n * sizeof(buf[0])); } diff --git a/src/USER-MISC/pair_meam_spline.h b/src/USER-MISC/pair_meam_spline.h index 489b20c2455..a2b7ebc9cf7 100644 --- a/src/USER-MISC/pair_meam_spline.h +++ b/src/USER-MISC/pair_meam_spline.h @@ -47,8 +47,8 @@ class PairMEAMSpline : public Pair void init_list(int, class NeighList *); double init_one(int, int); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); double memory_usage(); diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index f23d52e3f19..9c275b9d4df 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -562,18 +562,19 @@ double PairMEAMSWSpline::init_one(int i, int j) /* ---------------------------------------------------------------------- */ -int PairMEAMSWSpline::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) +int PairMEAMSWSpline::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int* list_iter = list; int* list_iter_end = list + n; while(list_iter != list_iter_end) *buf++ = Uprime_values[*list_iter++]; - return 1; + return n; } /* ---------------------------------------------------------------------- */ -void PairMEAMSWSpline::unpack_comm(int n, int first, double *buf) +void PairMEAMSWSpline::unpack_forward_comm(int n, int first, double *buf) { memcpy(&Uprime_values[first], buf, n * sizeof(buf[0])); } diff --git a/src/USER-MISC/pair_meam_sw_spline.h b/src/USER-MISC/pair_meam_sw_spline.h index 0cad6e74266..2413ac7bfce 100644 --- a/src/USER-MISC/pair_meam_sw_spline.h +++ b/src/USER-MISC/pair_meam_sw_spline.h @@ -47,8 +47,8 @@ class PairMEAMSWSpline : public Pair void init_list(int, class NeighList *); double init_one(int, int); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); double memory_usage(); diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index c49f5d98e19..d62893b81e9 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -802,8 +802,8 @@ void FixQEqReax::calculate_Q() /* ---------------------------------------------------------------------- */ -int FixQEqReax::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int FixQEqReax::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int m; @@ -816,12 +816,12 @@ int FixQEqReax::pack_comm(int n, int *list, double *buf, else if( pack_flag == 4 ) for(m = 0; m < n; m++) buf[m] = atom->q[list[m]]; - return 1; + return n; } /* ---------------------------------------------------------------------- */ -void FixQEqReax::unpack_comm(int n, int first, double *buf) +void FixQEqReax::unpack_forward_comm(int n, int first, double *buf) { int i, m; @@ -841,7 +841,7 @@ int FixQEqReax::pack_reverse_comm(int n, int first, double *buf) { int i, m; for(m = 0, i = first; m < n; m++, i++) buf[m] = q[i]; - return 1; + return n; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/fix_qeq_reax.h b/src/USER-REAXC/fix_qeq_reax.h index 8aeecd7bb45..4e0cc702b02 100644 --- a/src/USER-REAXC/fix_qeq_reax.h +++ b/src/USER-REAXC/fix_qeq_reax.h @@ -120,8 +120,8 @@ class FixQEqReax : public Fix { //int GMRES(double*,double*); void sparse_matvec(sparse_matrix*,double*,double*); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); double memory_usage(); diff --git a/src/USER-REAXC/fix_reax_c.cpp b/src/USER-REAXC/fix_reax_c.cpp index e14ab945c5c..e1cc4e340ef 100644 --- a/src/USER-REAXC/fix_reax_c.cpp +++ b/src/USER-REAXC/fix_reax_c.cpp @@ -135,8 +135,8 @@ int FixReaxC::unpack_exchange(int nlocal, double *buf) /* ---------------------------------------------------------------------- */ -int FixReaxC::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int FixReaxC::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -145,12 +145,12 @@ int FixReaxC::pack_comm(int n, int *list, double *buf, j = list[i]; buf[m++] = num_bonds[j]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void FixReaxC::unpack_comm(int n, int first, double *buf) +void FixReaxC::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/USER-REAXC/fix_reax_c.h b/src/USER-REAXC/fix_reax_c.h index 14858bbf9b1..789a35e6438 100644 --- a/src/USER-REAXC/fix_reax_c.h +++ b/src/USER-REAXC/fix_reax_c.h @@ -47,8 +47,8 @@ class FixReaxC : public Fix { void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); private: int maxbonds; // max # of bonds for any atom diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index f68d92ae69a..5d3fe51e82a 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -927,8 +927,8 @@ int FixReaxCSpecies::nint(const double &r) /* ---------------------------------------------------------------------- */ -int FixReaxCSpecies::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int FixReaxCSpecies::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i,j,m; @@ -942,12 +942,12 @@ int FixReaxCSpecies::pack_comm(int n, int *list, double *buf, buf[m+4] = x0[j].z; m += 5; } - return 5; + return m; } /* ---------------------------------------------------------------------- */ -void FixReaxCSpecies::unpack_comm(int n, int first, double *buf) +void FixReaxCSpecies::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; diff --git a/src/USER-REAXC/fix_reaxc_species.h b/src/USER-REAXC/fix_reaxc_species.h index 6690f4be83c..721eb79acc4 100644 --- a/src/USER-REAXC/fix_reaxc_species.h +++ b/src/USER-REAXC/fix_reaxc_species.h @@ -74,8 +74,8 @@ class FixReaxCSpecies : public Fix { int CheckExistence(int, int); int nint(const double &); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); void OpenPos(); void WritePos(int, int); double memory_usage(); diff --git a/src/USER-SPH/pair_sph_rhosum.cpp b/src/USER-SPH/pair_sph_rhosum.cpp index 678ad1bcd45..c4b4a8e1158 100644 --- a/src/USER-SPH/pair_sph_rhosum.cpp +++ b/src/USER-SPH/pair_sph_rhosum.cpp @@ -287,8 +287,8 @@ double PairSPHRhoSum::single(int i, int j, int itype, int jtype, double rsq, /* ---------------------------------------------------------------------- */ -int PairSPHRhoSum::pack_comm(int n, int *list, double *buf, int pbc_flag, - int *pbc) { +int PairSPHRhoSum::pack_forward_comm(int n, int *list, double *buf, + int pbc_flag, int *pbc) { int i, j, m; double *rho = atom->rho; @@ -297,12 +297,12 @@ int PairSPHRhoSum::pack_comm(int n, int *list, double *buf, int pbc_flag, j = list[i]; buf[m++] = rho[j]; } - return 1; + return m; } /* ---------------------------------------------------------------------- */ -void PairSPHRhoSum::unpack_comm(int n, int first, double *buf) { +void PairSPHRhoSum::unpack_forward_comm(int n, int first, double *buf) { int i, m, last; double *rho = atom->rho; diff --git a/src/USER-SPH/pair_sph_rhosum.h b/src/USER-SPH/pair_sph_rhosum.h index 57639ff3786..35cf73c5528 100644 --- a/src/USER-SPH/pair_sph_rhosum.h +++ b/src/USER-SPH/pair_sph_rhosum.h @@ -34,8 +34,8 @@ class PairSPHRhoSum : public Pair { void coeff(int, char **); virtual double init_one(int, int); virtual double single(int, int, int, int, double, double, double, double &); - int pack_comm(int, int *, double *, int, int *); - void unpack_comm(int, int, double *); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); protected: double **cut; diff --git a/src/comm_brick.cpp b/src/comm_brick.cpp index a86b044afa7..e35e9c150f2 100644 --- a/src/comm_brick.cpp +++ b/src/comm_brick.cpp @@ -911,7 +911,6 @@ void CommBrick::borders() /* ---------------------------------------------------------------------- forward communication invoked by a Pair - n = constant number of datums per atom ------------------------------------------------------------------------- */ void CommBrick::forward_comm_pair(Pair *pair) @@ -921,29 +920,31 @@ void CommBrick::forward_comm_pair(Pair *pair) MPI_Request request; MPI_Status status; + int nsize = pair->comm_forward; + for (iswap = 0; iswap < nswap; iswap++) { // pack buffer - n = pair->pack_comm(sendnum[iswap],sendlist[iswap], - buf_send,pbc_flag[iswap],pbc[iswap]); + n = pair->pack_forward_comm(sendnum[iswap],sendlist[iswap], + buf_send,pbc_flag[iswap],pbc[iswap]); // exchange with another proc // if self, set recv buffer to send buffer if (sendproc[iswap] != me) { if (recvnum[iswap]) - MPI_Irecv(buf_recv,n*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0, - world,&request); + MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE, + recvproc[iswap],0,world,&request); if (sendnum[iswap]) - MPI_Send(buf_send,n*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0,world); + MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap],0,world); if (recvnum[iswap]) MPI_Wait(&request,&status); buf = buf_recv; } else buf = buf_send; // unpack buffer - pair->unpack_comm(recvnum[iswap],firstrecv[iswap],buf); + pair->unpack_forward_comm(recvnum[iswap],firstrecv[iswap],buf); } } @@ -959,6 +960,8 @@ void CommBrick::reverse_comm_pair(Pair *pair) MPI_Request request; MPI_Status status; + int nsize = MAX(pair->comm_reverse,pair->comm_reverse_off); + for (iswap = nswap-1; iswap >= 0; iswap--) { // pack buffer @@ -970,10 +973,10 @@ void CommBrick::reverse_comm_pair(Pair *pair) if (sendproc[iswap] != me) { if (sendnum[iswap]) - MPI_Irecv(buf_recv,n*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0, + MPI_Irecv(buf_recv,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0, world,&request); if (recvnum[iswap]) - MPI_Send(buf_send,n*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0,world); + MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap],0,world); if (sendnum[iswap]) MPI_Wait(&request,&status); buf = buf_recv; } else buf = buf_send; @@ -996,29 +999,31 @@ void CommBrick::forward_comm_fix(Fix *fix) MPI_Request request; MPI_Status status; + int nsize = fix->comm_forward; + for (iswap = 0; iswap < nswap; iswap++) { // pack buffer - n = fix->pack_comm(sendnum[iswap],sendlist[iswap], - buf_send,pbc_flag[iswap],pbc[iswap]); + n = fix->pack_forward_comm(sendnum[iswap],sendlist[iswap], + buf_send,pbc_flag[iswap],pbc[iswap]); // exchange with another proc // if self, set recv buffer to send buffer if (sendproc[iswap] != me) { if (recvnum[iswap]) - MPI_Irecv(buf_recv,n*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0, + MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0, world,&request); if (sendnum[iswap]) - MPI_Send(buf_send,n*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0,world); + MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap],0,world); if (recvnum[iswap]) MPI_Wait(&request,&status); buf = buf_recv; } else buf = buf_send; // unpack buffer - fix->unpack_comm(recvnum[iswap],firstrecv[iswap],buf); + fix->unpack_forward_comm(recvnum[iswap],firstrecv[iswap],buf); } } @@ -1034,6 +1039,8 @@ void CommBrick::reverse_comm_fix(Fix *fix) MPI_Request request; MPI_Status status; + int nsize = fix->comm_reverse; + for (iswap = nswap-1; iswap >= 0; iswap--) { // pack buffer @@ -1045,14 +1052,14 @@ void CommBrick::reverse_comm_fix(Fix *fix) if (sendproc[iswap] != me) { if (sendnum[iswap]) - MPI_Irecv(buf_recv,n*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0, + MPI_Irecv(buf_recv,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0, world,&request); if (recvnum[iswap]) - MPI_Send(buf_send,n*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0,world); + MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap],0,world); if (sendnum[iswap]) MPI_Wait(&request,&status); buf = buf_recv; } else buf = buf_send; - + // unpack buffer fix->unpack_reverse_comm(sendnum[iswap],sendlist[iswap],buf); @@ -1075,8 +1082,8 @@ void CommBrick::forward_comm_variable_fix(Fix *fix) // pack buffer - n = fix->pack_comm(sendnum[iswap],sendlist[iswap], - buf_send,pbc_flag[iswap],pbc[iswap]); + n = fix->pack_forward_comm(sendnum[iswap],sendlist[iswap], + buf_send,pbc_flag[iswap],pbc[iswap]); // exchange with another proc // if self, set recv buffer to send buffer @@ -1093,7 +1100,7 @@ void CommBrick::forward_comm_variable_fix(Fix *fix) // unpack buffer - fix->unpack_comm(recvnum[iswap],firstrecv[iswap],buf); + fix->unpack_forward_comm(recvnum[iswap],firstrecv[iswap],buf); } } diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index 07c38d18f5f..930d9177e2a 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -1273,7 +1273,6 @@ void CommTiled::borders() /* ---------------------------------------------------------------------- forward communication invoked by a Pair - n = constant number of datums per atom ------------------------------------------------------------------------- */ void CommTiled::forward_comm_pair(Pair *pair) @@ -1281,8 +1280,7 @@ void CommTiled::forward_comm_pair(Pair *pair) int i,irecv,n,nsend,nrecv; MPI_Status status; - // NOTE: what to do about nsize ??? - int nsize = 1; + int nsize = pair->comm_forward; for (int iswap = 0; iswap < nswap; iswap++) { nsend = nsendproc[iswap] - sendself[iswap]; @@ -1296,22 +1294,24 @@ void CommTiled::forward_comm_pair(Pair *pair) } if (sendother[iswap]) { for (i = 0; i < nsendproc[iswap]; i++) { - n = pair->pack_comm(sendnum[iswap][i],sendlist[iswap][i], - buf_send,pbc_flag[iswap][i],pbc[iswap][i]); + n = pair->pack_forward_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); } } if (sendself[iswap]) { - pair->pack_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], - buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]); - pair->unpack_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); + pair->pack_forward_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], + buf_send,pbc_flag[iswap][nsend], + pbc[iswap][nsend]); + pair->unpack_forward_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], + buf_send); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { MPI_Waitany(nrecv,requests,&irecv,&status); - pair->unpack_comm(recvnum[iswap][irecv],firstrecv[iswap][irecv], - &buf_recv[nsize*forward_recv_offset[iswap][irecv]]); + pair->unpack_forward_comm(recvnum[iswap][irecv],firstrecv[iswap][irecv], + &buf_recv[nsize* + forward_recv_offset[iswap][irecv]]); } } } @@ -1327,8 +1327,7 @@ void CommTiled::reverse_comm_pair(Pair *pair) int i,irecv,n,nsend,nrecv; MPI_Status status; - // NOTE: what to do about nsize ??? - int nsize = 1; + int nsize = MAX(pair->comm_reverse,pair->comm_reverse_off); for (int iswap = nswap-1; iswap >= 0; iswap--) { nsend = nsendproc[iswap] - sendself[iswap]; @@ -1371,31 +1370,42 @@ void CommTiled::reverse_comm_pair(Pair *pair) void CommTiled::forward_comm_fix(Fix *fix) { - int i,irecv,n; + int i,irecv,n,nsend,nrecv; MPI_Status status; + int nsize = fix->comm_forward; + for (int iswap = 0; iswap < nswap; iswap++) { - if (sendproc[iswap][0] != me) { - for (i = 0; i < nrecvproc[iswap]; i++) - MPI_Irecv(&buf_recv[forward_recv_offset[iswap][i]], - size_forward_recv[iswap][i], + nsend = nsendproc[iswap] - sendself[iswap]; + nrecv = nrecvproc[iswap] - sendself[iswap]; + + if (recvother[iswap]) { + for (i = 0; i < nrecv; i++) + MPI_Irecv(&buf_recv[nsize*forward_recv_offset[iswap][i]], + nsize*recvnum[iswap][i], MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); + } + if (sendother[iswap]) { for (i = 0; i < nsendproc[iswap]; i++) { - n = fix->pack_comm(sendnum[iswap][i],sendlist[iswap][i], - buf_send,pbc_flag[iswap][i],pbc[iswap][i]); - MPI_Send(buf_send,n*sendnum[iswap][i],MPI_DOUBLE, - sendproc[iswap][i],0,world); + n = fix->pack_forward_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); } - for (i = 0; i < nrecvproc[iswap]; i++) { - MPI_Waitany(nrecvproc[iswap],requests,&irecv,&status); - fix->unpack_comm(recvnum[iswap][irecv],firstrecv[iswap][irecv], - &buf_recv[forward_recv_offset[iswap][irecv]]); + } + if (sendself[iswap]) { + fix->pack_forward_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], + buf_send,pbc_flag[iswap][nsend], + pbc[iswap][nsend]); + fix->unpack_forward_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], + buf_send); + } + if (recvother[iswap]) { + for (i = 0; i < nrecv; i++) { + MPI_Waitany(nrecv,requests,&irecv,&status); + fix->unpack_forward_comm(recvnum[iswap][irecv],firstrecv[iswap][irecv], + &buf_recv[nsize* + forward_recv_offset[iswap][irecv]]); } - - } else { - n = fix->pack_comm(sendnum[iswap][0],sendlist[iswap][0], - buf_send,pbc_flag[iswap][0],pbc[iswap][0]); - fix->unpack_comm(recvnum[iswap][0],firstrecv[iswap][0],buf_send); } } } @@ -1407,31 +1417,41 @@ void CommTiled::forward_comm_fix(Fix *fix) void CommTiled::reverse_comm_fix(Fix *fix) { - int i,irecv,n; + int i,irecv,n,nsend,nrecv; MPI_Status status; + int nsize = fix->comm_reverse; + for (int iswap = nswap-1; iswap >= 0; iswap--) { - if (sendproc[iswap][0] != me) { - for (i = 0; i < nsendproc[iswap]; i++) - MPI_Irecv(&buf_recv[reverse_recv_offset[iswap][i]], - size_reverse_recv[iswap][i],MPI_DOUBLE, + nsend = nsendproc[iswap] - sendself[iswap]; + nrecv = nrecvproc[iswap] - sendself[iswap]; + + if (sendother[iswap]) { + for (i = 0; i < nsend; i++) + MPI_Irecv(&buf_recv[nsize*reverse_recv_offset[iswap][i]], + nsize*sendnum[iswap][i],MPI_DOUBLE, sendproc[iswap][i],0,world,&requests[i]); - for (i = 0; i < nrecvproc[iswap]; i++) { + } + if (recvother[iswap]) { + for (i = 0; i < nrecv; i++) { n = fix->pack_reverse_comm(recvnum[iswap][i],firstrecv[iswap][i], buf_send); - MPI_Send(buf_send,n*recvnum[iswap][i],MPI_DOUBLE, - recvproc[iswap][i],0,world); + MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap][i],0,world); } - for (i = 0; i < nsendproc[iswap]; i++) { - MPI_Waitany(nsendproc[iswap],requests,&irecv,&status); + } + if (sendself[iswap]) { + fix->pack_reverse_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], + buf_send); + fix->unpack_reverse_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], + buf_send); + } + if (sendother[iswap]) { + for (i = 0; i < nsend; i++) { + MPI_Waitany(nsend,requests,&irecv,&status); fix->unpack_reverse_comm(sendnum[iswap][irecv],sendlist[iswap][irecv], - &buf_recv[reverse_recv_offset[iswap][irecv]]); + &buf_recv[nsize* + reverse_recv_offset[iswap][irecv]]); } - - } else { - n = fix->pack_reverse_comm(recvnum[iswap][0],firstrecv[iswap][0], - buf_send); - fix->unpack_reverse_comm(sendnum[iswap][0],sendlist[iswap][0],buf_send); } } } @@ -1616,6 +1636,8 @@ void CommTiled::forward_comm_array(int nsize, double **array) nsend = nsendproc[iswap] - sendself[iswap]; nrecv = nrecvproc[iswap] - sendself[iswap]; + MPI_Barrier(world); + if (recvother[iswap]) { for (i = 0; i < nrecv; i++) MPI_Irecv(&buf_recv[nsize*forward_recv_offset[iswap][i]], @@ -1651,7 +1673,7 @@ void CommTiled::forward_comm_array(int nsize, double **array) if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { MPI_Waitany(nrecv,requests,&irecv,&status); - m = 0; + m = nsize*forward_recv_offset[iswap][irecv]; last = firstrecv[iswap][irecv] + recvnum[iswap][irecv]; for (iatom = firstrecv[iswap][irecv]; iatom < last; iatom++) for (k = 0; k < nsize; k++) diff --git a/src/fix.h b/src/fix.h index f5c3c4c3b26..77c1b5322f7 100644 --- a/src/fix.h +++ b/src/fix.h @@ -162,8 +162,8 @@ class Fix : protected Pointers { virtual double max_alpha(double *) {return 0.0;} virtual int min_dof() {return 0;} - virtual int pack_comm(int, int *, double *, int, int *) {return 0;} - virtual void unpack_comm(int, int, double *) {} + virtual int pack_forward_comm(int, int *, double *, int, int *) {return 0;} + virtual void unpack_forward_comm(int, int, double *) {} virtual int pack_reverse_comm(int, int, double *) {return 0;} virtual void unpack_reverse_comm(int, int *, double *) {} diff --git a/src/pair.h b/src/pair.h index 182b22704ec..a29186ff4ce 100644 --- a/src/pair.h +++ b/src/pair.h @@ -163,8 +163,8 @@ class Pair : protected Pointers { virtual void write_data(FILE *) {} virtual void write_data_all(FILE *) {} - virtual int pack_comm(int, int *, double *, int, int *) {return 0;} - virtual void unpack_comm(int, int, double *) {} + virtual int pack_forward_comm(int, int *, double *, int, int *) {return 0;} + virtual void unpack_forward_comm(int, int, double *) {} virtual int pack_reverse_comm(int, int, double *) {return 0;} virtual void unpack_reverse_comm(int, int *, double *) {} virtual double memory_usage();