From ce7dede594ea4ba8b0a1fa135238b1c89bcfa14d Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 8 Feb 2013 16:44:04 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9399 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/DIPOLE/atom_vec_dipole.cpp | 2 +- src/GRANULAR/fix_wall_gran.cpp | 2 +- src/GRANULAR/fix_wall_gran.h | 2 +- src/MC/fix_bond_create.cpp | 2 +- src/MC/fix_bond_create.h | 2 +- src/MOLECULE/atom_vec_angle.cpp | 2 +- src/MOLECULE/atom_vec_bond.cpp | 2 +- src/MOLECULE/atom_vec_full.cpp | 2 +- src/MOLECULE/atom_vec_molecular.cpp | 2 +- src/PERI/atom_vec_peri.cpp | 2 +- src/PERI/fix_peri_neigh.cpp | 2 +- src/PERI/fix_peri_neigh.h | 2 +- src/POEMS/fix_poems.cpp | 2 +- src/POEMS/fix_poems.h | 2 +- src/REPLICA/fix_event.cpp | 2 +- src/REPLICA/fix_event.h | 2 +- src/RIGID/fix_rigid.cpp | 4 +- src/RIGID/fix_rigid.h | 4 +- src/USER-ATC/fix_atc.cpp | 2 +- src/USER-ATC/fix_atc.h | 2 +- src/USER-AWPMD/atom_vec_wavepacket.cpp | 2 +- src/USER-CUDA/atom_vec_angle_cuda.cpp | 2 +- src/USER-CUDA/atom_vec_atomic_cuda.cpp | 2 +- src/USER-CUDA/atom_vec_charge_cuda.cpp | 2 +- src/USER-CUDA/atom_vec_full_cuda.cpp | 2 +- src/USER-CUDA/fix_shake_cuda.cpp | 2 +- src/USER-CUDA/fix_shake_cuda.h | 2 +- src/USER-EFF/atom_vec_electron.cpp | 2 +- src/USER-REAXC/fix_qeq_reax.cpp | 2 +- src/USER-REAXC/fix_qeq_reax.h | 2 +- src/USER-REAXC/fix_reax_c.cpp | 2 +- src/USER-REAXC/fix_reax_c.h | 2 +- src/USER-SPH/atom_vec_meso.cpp | 2 +- src/atom_vec_atomic.cpp | 2 +- src/atom_vec_body.cpp | 2 +- src/atom_vec_charge.cpp | 2 +- src/atom_vec_ellipsoid.cpp | 3 +- src/atom_vec_hybrid.cpp | 2 +- src/atom_vec_line.cpp | 2 +- src/atom_vec_sphere.cpp | 2 +- src/atom_vec_tri.cpp | 2 +- src/comm.cpp | 104 +++++++++++++++++++++++++ src/comm.h | 6 +- src/fix.h | 2 +- src/fix_ave_atom.cpp | 2 +- src/fix_ave_atom.h | 2 +- src/fix_external.cpp | 2 +- src/fix_external.h | 2 +- src/fix_minimize.cpp | 2 +- src/fix_minimize.h | 2 +- src/fix_move.cpp | 2 +- src/fix_move.h | 2 +- src/fix_read_restart.cpp | 2 +- src/fix_read_restart.h | 2 +- src/fix_respa.cpp | 2 +- src/fix_respa.h | 2 +- src/fix_shake.cpp | 2 +- src/fix_shake.h | 2 +- src/fix_shear_history.cpp | 2 +- src/fix_shear_history.h | 2 +- src/fix_spring_self.cpp | 2 +- src/fix_spring_self.h | 2 +- src/fix_store_state.cpp | 2 +- src/fix_store_state.h | 2 +- src/fix_tmd.cpp | 2 +- src/fix_tmd.h | 2 +- 66 files changed, 176 insertions(+), 67 deletions(-) diff --git a/src/DIPOLE/atom_vec_dipole.cpp b/src/DIPOLE/atom_vec_dipole.cpp index ef4f68a86c..7fd0bbc17f 100644 --- a/src/DIPOLE/atom_vec_dipole.cpp +++ b/src/DIPOLE/atom_vec_dipole.cpp @@ -113,7 +113,7 @@ void AtomVecDipole::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 549e8cc6c6..5119df633b 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -697,7 +697,7 @@ void FixWallGran::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixWallGran::copy_arrays(int i, int j) +void FixWallGran::copy_arrays(int i, int j, int delflag) { shear[j][0] = shear[i][0]; shear[j][1] = shear[i][1]; diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index 1d101ab3ca..eb6e9a3077 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -36,7 +36,7 @@ class FixWallGran : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); void set_arrays(int); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index 7b62d3c813..6f9a647dd2 100755 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -572,7 +572,7 @@ void FixBondCreate::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixBondCreate::copy_arrays(int i, int j) +void FixBondCreate::copy_arrays(int i, int j, int delflag) { bondcount[j] = bondcount[i]; } diff --git a/src/MC/fix_bond_create.h b/src/MC/fix_bond_create.h index 9f2d904ec3..36519d7741 100755 --- a/src/MC/fix_bond_create.h +++ b/src/MC/fix_bond_create.h @@ -40,7 +40,7 @@ class FixBondCreate : public Fix { int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); double compute_vector(int); diff --git a/src/MOLECULE/atom_vec_angle.cpp b/src/MOLECULE/atom_vec_angle.cpp index 9b42d6ef1b..c8883399fc 100644 --- a/src/MOLECULE/atom_vec_angle.cpp +++ b/src/MOLECULE/atom_vec_angle.cpp @@ -153,7 +153,7 @@ void AtomVecAngle::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_bond.cpp b/src/MOLECULE/atom_vec_bond.cpp index 2493533c44..ee02bec5c5 100644 --- a/src/MOLECULE/atom_vec_bond.cpp +++ b/src/MOLECULE/atom_vec_bond.cpp @@ -132,7 +132,7 @@ void AtomVecBond::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_full.cpp b/src/MOLECULE/atom_vec_full.cpp index d7cecabf71..dbda299f7a 100644 --- a/src/MOLECULE/atom_vec_full.cpp +++ b/src/MOLECULE/atom_vec_full.cpp @@ -212,7 +212,7 @@ void AtomVecFull::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_molecular.cpp b/src/MOLECULE/atom_vec_molecular.cpp index d85cc567ba..5dd00d5585 100644 --- a/src/MOLECULE/atom_vec_molecular.cpp +++ b/src/MOLECULE/atom_vec_molecular.cpp @@ -210,7 +210,7 @@ void AtomVecMolecular::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/atom_vec_peri.cpp b/src/PERI/atom_vec_peri.cpp index 21a1717d84..f1c1c790bf 100644 --- a/src/PERI/atom_vec_peri.cpp +++ b/src/PERI/atom_vec_peri.cpp @@ -121,7 +121,7 @@ void AtomVecPeri::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/fix_peri_neigh.cpp b/src/PERI/fix_peri_neigh.cpp index 12e7a2b47b..659f47c711 100644 --- a/src/PERI/fix_peri_neigh.cpp +++ b/src/PERI/fix_peri_neigh.cpp @@ -367,7 +367,7 @@ void FixPeriNeigh::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixPeriNeigh::copy_arrays(int i, int j) +void FixPeriNeigh::copy_arrays(int i, int j, int delflag) { npartner[j] = npartner[i]; for (int m = 0; m < npartner[j]; m++) { diff --git a/src/PERI/fix_peri_neigh.h b/src/PERI/fix_peri_neigh.h index e5715aa0a6..c38aada74f 100644 --- a/src/PERI/fix_peri_neigh.h +++ b/src/PERI/fix_peri_neigh.h @@ -42,7 +42,7 @@ class FixPeriNeigh : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); void write_restart(FILE *); diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index 4f54b55b9f..93296636be 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -1528,7 +1528,7 @@ void FixPOEMS::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixPOEMS::copy_arrays(int i, int j) +void FixPOEMS::copy_arrays(int i, int j, int delflag) { natom2body[j] = natom2body[i]; for (int k = 0; k < natom2body[j]; k++) atom2body[j][k] = atom2body[i][k]; diff --git a/src/POEMS/fix_poems.h b/src/POEMS/fix_poems.h index f1606ab7a7..a1a6a3700e 100644 --- a/src/POEMS/fix_poems.h +++ b/src/POEMS/fix_poems.h @@ -39,7 +39,7 @@ class FixPOEMS : public Fix { void final_integrate_respa(int, int); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); double memory_usage(); diff --git a/src/REPLICA/fix_event.cpp b/src/REPLICA/fix_event.cpp index f048ba3f12..4f80066885 100644 --- a/src/REPLICA/fix_event.cpp +++ b/src/REPLICA/fix_event.cpp @@ -193,7 +193,7 @@ void FixEvent::grow_arrays(int nmax) copy values within local atom-based array ------------------------------------------------------------------------- */ -void FixEvent::copy_arrays(int i, int j) +void FixEvent::copy_arrays(int i, int j, int delflag) { xevent[j][0] = xevent[i][0]; xevent[j][1] = xevent[i][1]; diff --git a/src/REPLICA/fix_event.h b/src/REPLICA/fix_event.h index 5f70ff9dca..f8fe5d2d81 100644 --- a/src/REPLICA/fix_event.h +++ b/src/REPLICA/fix_event.h @@ -26,7 +26,7 @@ class FixEvent : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); virtual void write_restart(FILE *); diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index 627cbe80c6..7fb0157365 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -2165,7 +2165,7 @@ double FixRigid::memory_usage() int nmax = atom->nmax; double bytes = nmax * sizeof(int); bytes += nmax*3 * sizeof(double); - bytes += maxvatom*6 * sizeof(double); + bytes += maxvatom*6 * sizeof(double); // vatom if (extended) { bytes += nmax * sizeof(int); if (orientflag) bytes = nmax*orientflag * sizeof(double); @@ -2193,7 +2193,7 @@ void FixRigid::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixRigid::copy_arrays(int i, int j) +void FixRigid::copy_arrays(int i, int j, int delflag) { body[j] = body[i]; displace[j][0] = displace[i][0]; diff --git a/src/RIGID/fix_rigid.h b/src/RIGID/fix_rigid.h index ecbb531a39..fa6c5a653f 100644 --- a/src/RIGID/fix_rigid.h +++ b/src/RIGID/fix_rigid.h @@ -1,4 +1,4 @@ -/* -*- c++ -*- ---------------------------------------------------------- +/* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov @@ -41,7 +41,7 @@ class FixRigid : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); void set_arrays(int); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/USER-ATC/fix_atc.cpp b/src/USER-ATC/fix_atc.cpp index 2aaf89ace6..5ae1f0f990 100644 --- a/src/USER-ATC/fix_atc.cpp +++ b/src/USER-ATC/fix_atc.cpp @@ -359,7 +359,7 @@ void FixATC::grow_arrays(int nmax) atcTransfer_->grow_arrays(nmax); } -void FixATC::copy_arrays(int i, int j) +void FixATC::copy_arrays(int i, int j, int delflag) { atcTransfer_->copy_arrays(i,j); } diff --git a/src/USER-ATC/fix_atc.h b/src/USER-ATC/fix_atc.h index 879b465bd3..33baeea75d 100644 --- a/src/USER-ATC/fix_atc.h +++ b/src/USER-ATC/fix_atc.h @@ -60,7 +60,7 @@ namespace LAMMPS_NS { void min_pre_exchange(); double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); int pack_comm(int , int *, double *, int, int *); diff --git a/src/USER-AWPMD/atom_vec_wavepacket.cpp b/src/USER-AWPMD/atom_vec_wavepacket.cpp index 92721e0d90..6023dc8f39 100644 --- a/src/USER-AWPMD/atom_vec_wavepacket.cpp +++ b/src/USER-AWPMD/atom_vec_wavepacket.cpp @@ -143,7 +143,7 @@ void AtomVecWavepacket::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CUDA/atom_vec_angle_cuda.cpp b/src/USER-CUDA/atom_vec_angle_cuda.cpp index 9fff3c9b6d..054bb68e0b 100644 --- a/src/USER-CUDA/atom_vec_angle_cuda.cpp +++ b/src/USER-CUDA/atom_vec_angle_cuda.cpp @@ -370,7 +370,7 @@ int AtomVecAngleCuda::pack_exchange(int dim, double *buf) int dm= modify->fix[atom->extra_grow[iextra]]->pack_exchange(i,&buf_p[m]); m+=dm; nextra+=dm; - if(ifix[atom->extra_grow[iextra]]->copy_arrays(copylist[j],i); + if(ifix[atom->extra_grow[iextra]]->copy_arrays(copylist[j],i,delflag); if(m>*maxsend) {grow_send(m,buf_pointer,1); buf_p=*buf_pointer;} } diff --git a/src/USER-CUDA/atom_vec_atomic_cuda.cpp b/src/USER-CUDA/atom_vec_atomic_cuda.cpp index a6840355d7..1a4dbad736 100644 --- a/src/USER-CUDA/atom_vec_atomic_cuda.cpp +++ b/src/USER-CUDA/atom_vec_atomic_cuda.cpp @@ -330,7 +330,7 @@ int AtomVecAtomicCuda::pack_exchange(int dim, double *buf) int dm = modify->fix[atom->extra_grow[iextra]]->pack_exchange(i,&((*buf_pointer)[m])); m+=dm; nextra+=dm; - if(ifix[atom->extra_grow[iextra]]->copy_arrays(copylist[j],i); + if(ifix[atom->extra_grow[iextra]]->copy_arrays(copylist[j],i,delflag); if(m>*maxsend) grow_send(m,buf_pointer,1); } (*buf_pointer)[j+1] = nextra; diff --git a/src/USER-CUDA/atom_vec_charge_cuda.cpp b/src/USER-CUDA/atom_vec_charge_cuda.cpp index 9e8a5ac373..86736c79e8 100644 --- a/src/USER-CUDA/atom_vec_charge_cuda.cpp +++ b/src/USER-CUDA/atom_vec_charge_cuda.cpp @@ -336,7 +336,7 @@ int AtomVecChargeCuda::pack_exchange(int dim, double *buf) int dm = modify->fix[atom->extra_grow[iextra]]->pack_exchange(i,&((*buf_pointer)[m])); m+=dm; nextra+=dm; - if(ifix[atom->extra_grow[iextra]]->copy_arrays(copylist[j],i); + if(ifix[atom->extra_grow[iextra]]->copy_arrays(copylist[j],i,delflag); if(m>*maxsend) grow_send(m,buf_pointer,1); } (*buf_pointer)[j+1] = nextra; diff --git a/src/USER-CUDA/atom_vec_full_cuda.cpp b/src/USER-CUDA/atom_vec_full_cuda.cpp index ce56c719cc..4aa4d1326b 100644 --- a/src/USER-CUDA/atom_vec_full_cuda.cpp +++ b/src/USER-CUDA/atom_vec_full_cuda.cpp @@ -393,7 +393,7 @@ int AtomVecFullCuda::pack_exchange(int dim, double *buf) int dm= modify->fix[atom->extra_grow[iextra]]->pack_exchange(i,&buf_p[m]); m+=dm; nextra+=dm; - if(ifix[atom->extra_grow[iextra]]->copy_arrays(copylist[j],i); + if(ifix[atom->extra_grow[iextra]]->copy_arrays(copylist[j],i,delflag); if(m>*maxsend) {grow_send(m,buf_pointer,1); buf_p=*buf_pointer;} } diff --git a/src/USER-CUDA/fix_shake_cuda.cpp b/src/USER-CUDA/fix_shake_cuda.cpp index 32905c153f..1a7826ae1a 100644 --- a/src/USER-CUDA/fix_shake_cuda.cpp +++ b/src/USER-CUDA/fix_shake_cuda.cpp @@ -2581,7 +2581,7 @@ void FixShakeCuda::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixShakeCuda::copy_arrays(int i, int j) +void FixShakeCuda::copy_arrays(int i, int j, int delflag) { int flag = shake_flag[j] = shake_flag[i]; diff --git a/src/USER-CUDA/fix_shake_cuda.h b/src/USER-CUDA/fix_shake_cuda.h index 03cd5aa086..1010210b64 100644 --- a/src/USER-CUDA/fix_shake_cuda.h +++ b/src/USER-CUDA/fix_shake_cuda.h @@ -39,7 +39,7 @@ class FixShakeCuda : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); void set_arrays(int); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/USER-EFF/atom_vec_electron.cpp b/src/USER-EFF/atom_vec_electron.cpp index f95ed825c6..d94ccd6533 100644 --- a/src/USER-EFF/atom_vec_electron.cpp +++ b/src/USER-EFF/atom_vec_electron.cpp @@ -123,7 +123,7 @@ void AtomVecElectron::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 889c961bc7..14ee83bf5e 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -745,7 +745,7 @@ void FixQEqReax::grow_arrays(int nmax) copy values within fictitious charge arrays ------------------------------------------------------------------------- */ -void FixQEqReax::copy_arrays(int i, int j) +void FixQEqReax::copy_arrays(int i, int j, int delflag) { for (int m = 0; m < nprev; m++) { s_hist[j][m] = s_hist[i][m]; diff --git a/src/USER-REAXC/fix_qeq_reax.h b/src/USER-REAXC/fix_qeq_reax.h index a9412b2f61..bab202c178 100644 --- a/src/USER-REAXC/fix_qeq_reax.h +++ b/src/USER-REAXC/fix_qeq_reax.h @@ -124,7 +124,7 @@ class FixQEqReax : public Fix { void unpack_reverse_comm(int, int *, double *); double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/USER-REAXC/fix_reax_c.cpp b/src/USER-REAXC/fix_reax_c.cpp index ebaa652ad1..e14ab945c5 100644 --- a/src/USER-REAXC/fix_reax_c.cpp +++ b/src/USER-REAXC/fix_reax_c.cpp @@ -105,7 +105,7 @@ void FixReaxC::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixReaxC::copy_arrays(int i, int j) +void FixReaxC::copy_arrays(int i, int j, int delflag) { num_bonds[j] = num_bonds[i]; num_hbonds[j] = num_hbonds[i]; diff --git a/src/USER-REAXC/fix_reax_c.h b/src/USER-REAXC/fix_reax_c.h index 8676f90f8b..14858bbf9b 100644 --- a/src/USER-REAXC/fix_reax_c.h +++ b/src/USER-REAXC/fix_reax_c.h @@ -44,7 +44,7 @@ class FixReaxC : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); int pack_comm(int, int *, double *, int, int *); diff --git a/src/USER-SPH/atom_vec_meso.cpp b/src/USER-SPH/atom_vec_meso.cpp index 57c71e353f..e44ab83b9b 100644 --- a/src/USER-SPH/atom_vec_meso.cpp +++ b/src/USER-SPH/atom_vec_meso.cpp @@ -129,7 +129,7 @@ void AtomVecMeso::copy(int i, int j, int delflag) { if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i, j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i, j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/atom_vec_atomic.cpp b/src/atom_vec_atomic.cpp index d3097b8556..72e25c4790 100644 --- a/src/atom_vec_atomic.cpp +++ b/src/atom_vec_atomic.cpp @@ -99,7 +99,7 @@ void AtomVecAtomic::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index a3f73519be..65711cf15d 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -226,7 +226,7 @@ void AtomVecBody::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- diff --git a/src/atom_vec_charge.cpp b/src/atom_vec_charge.cpp index 66efec1952..27caeed696 100644 --- a/src/atom_vec_charge.cpp +++ b/src/atom_vec_charge.cpp @@ -106,7 +106,7 @@ void AtomVecCharge::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index 36c7a1ffbe..31150bf05b 100755 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -160,7 +160,7 @@ void AtomVecEllipsoid::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- @@ -801,6 +801,7 @@ void AtomVecEllipsoid::unpack_border_vel(int n, int first, double *buf) ellipsoid[i] = static_cast (buf[m++]); if (ellipsoid[i] == 0) ellipsoid[i] = -1; else { + j = nlocal_bonus + nghost_bonus; if (j == nmax_bonus) grow_bonus(); shape = bonus[j].shape; quat = bonus[j].quat; diff --git a/src/atom_vec_hybrid.cpp b/src/atom_vec_hybrid.cpp index 0bda19c251..53246ea80d 100644 --- a/src/atom_vec_hybrid.cpp +++ b/src/atom_vec_hybrid.cpp @@ -187,7 +187,7 @@ void AtomVecHybrid::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index e0aba2ead9..27cab22b7d 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -170,7 +170,7 @@ void AtomVecLine::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- diff --git a/src/atom_vec_sphere.cpp b/src/atom_vec_sphere.cpp index 7cc92d5202..934cf3716d 100644 --- a/src/atom_vec_sphere.cpp +++ b/src/atom_vec_sphere.cpp @@ -145,7 +145,7 @@ void AtomVecSphere::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index 6d88a06ce3..6373e986ab 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -172,7 +172,7 @@ void AtomVecTri::copy(int i, int j, int delflag) if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); } /* ---------------------------------------------------------------------- diff --git a/src/comm.cpp b/src/comm.cpp index 70926dca58..d1610912eb 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -1160,6 +1160,7 @@ void Comm::reverse_comm_pair(Pair *pair) /* ---------------------------------------------------------------------- forward communication invoked by a Fix + n = constant number of datums per atom ------------------------------------------------------------------------- */ void Comm::forward_comm_fix(Fix *fix) @@ -1197,6 +1198,7 @@ void Comm::forward_comm_fix(Fix *fix) /* ---------------------------------------------------------------------- reverse communication invoked by a Fix + n = constant number of datums per atom ------------------------------------------------------------------------- */ void Comm::reverse_comm_fix(Fix *fix) @@ -1231,6 +1233,81 @@ void Comm::reverse_comm_fix(Fix *fix) } } +/* ---------------------------------------------------------------------- + forward communication invoked by a Fix + n = total datums for all atoms, allows for variable number/atom +------------------------------------------------------------------------- */ + +void Comm::forward_comm_variable_fix(Fix *fix) +{ + int iswap,n; + double *buf; + MPI_Request request; + MPI_Status status; + + for (iswap = 0; iswap < nswap; iswap++) { + + // pack buffer + + n = fix->pack_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,maxrecv,MPI_DOUBLE,recvproc[iswap],0, + world,&request); + if (sendnum[iswap]) + 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); + } +} + +/* ---------------------------------------------------------------------- + reverse communication invoked by a Fix + n = total datums for all atoms, allows for variable number/atom +------------------------------------------------------------------------- */ + +void Comm::reverse_comm_variable_fix(Fix *fix) +{ + int iswap,n; + double *buf; + MPI_Request request; + MPI_Status status; + + for (iswap = nswap-1; iswap >= 0; iswap--) { + + // pack buffer + + n = fix->pack_reverse_comm(recvnum[iswap],firstrecv[iswap],buf_send); + + // exchange with another proc + // if self, set recv buffer to send buffer + + if (sendproc[iswap] != me) { + if (sendnum[iswap]) + MPI_Irecv(buf_recv,maxrecv,MPI_DOUBLE,sendproc[iswap],0, + world,&request); + if (recvnum[iswap]) + 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); + } +} + /* ---------------------------------------------------------------------- forward communication invoked by a Compute ------------------------------------------------------------------------- */ @@ -1377,6 +1454,33 @@ void Comm::reverse_comm_dump(Dump *dump) } } +/* ---------------------------------------------------------------------- + reverse communication invoked by a Dump +------------------------------------------------------------------------- */ + +void Comm::ring(int n, int nmax, char *buf, char *bufcopy, int messtag, + void (*callback)(int, char *)) +{ + MPI_Request request; + MPI_Status status; + + int next = me + 1; + int prev = me - 1; + if (next == nprocs) next = 0; + if (prev < 0) prev = nprocs - 1; + + for (int loop = 0; loop < nprocs; loop++) { + if (me != next) { + MPI_Irecv(bufcopy,nmax,MPI_CHAR,prev,messtag,world,&request); + MPI_Send(buf,n,MPI_CHAR,next,messtag,world); + MPI_Wait(&request,&status); + MPI_Get_count(&status,MPI_CHAR,&n); + memcpy(buf,bufcopy,n); + callback(n,buf); + } + } +} + /* ---------------------------------------------------------------------- realloc the size of the send buffer as needed with BUFFACTOR & BUFEXTRA if flag = 1, realloc diff --git a/src/comm.h b/src/comm.h index 34ada04266..24f747dffc 100644 --- a/src/comm.h +++ b/src/comm.h @@ -53,10 +53,14 @@ class Comm : protected Pointers { virtual void reverse_comm_pair(class Pair *); // reverse comm from a Pair virtual void forward_comm_fix(class Fix *); // forward comm from a Fix virtual void reverse_comm_fix(class Fix *); // reverse comm from a Fix + virtual void forward_comm_variable_fix(class Fix *); // variable-size variant + virtual void reverse_comm_variable_fix(class Fix *); // variable-size variant virtual void forward_comm_compute(class Compute *); // forward from a Compute virtual void reverse_comm_compute(class Compute *); // reverse from a Compute virtual void forward_comm_dump(class Dump *); // forward comm from a Dump virtual void reverse_comm_dump(class Dump *); // reverse comm from a Dump + void ring(int, int, char *, char *, int, + void (*)(int, char *)); // ring communication virtual void set(int, char **); // set communication style void set_processors(int, char **); // set 3d processor grid attributes @@ -112,7 +116,7 @@ class Comm : protected Pointers { int updown(int, int, int, double, int, double *); // compare cutoff to procs - virtual void grow_send(int,int); // reallocate send buffer + virtual void grow_send(int, int); // reallocate send buffer virtual void grow_recv(int); // free/allocate recv buffer virtual void grow_list(int, int); // reallocate one sendlist virtual void grow_swap(int); // grow swap and multi arrays diff --git a/src/fix.h b/src/fix.h index f9aa2b6717..704c9821eb 100644 --- a/src/fix.h +++ b/src/fix.h @@ -105,7 +105,7 @@ class Fix : protected Pointers { virtual void restart(char *) {} virtual void grow_arrays(int) {} - virtual void copy_arrays(int, int) {} + virtual void copy_arrays(int, int, int) {} virtual void set_arrays(int) {} virtual int pack_exchange(int, double *) {return 0;} virtual int unpack_exchange(int, double *) {return 0;} diff --git a/src/fix_ave_atom.cpp b/src/fix_ave_atom.cpp index 79f521368e..c1fc8c901c 100644 --- a/src/fix_ave_atom.cpp +++ b/src/fix_ave_atom.cpp @@ -407,7 +407,7 @@ void FixAveAtom::grow_arrays(int nmax) copy values within local atom-based array ------------------------------------------------------------------------- */ -void FixAveAtom::copy_arrays(int i, int j) +void FixAveAtom::copy_arrays(int i, int j, int delflag) { for (int m = 0; m < nvalues; m++) array[j][m] = array[i][m]; diff --git a/src/fix_ave_atom.h b/src/fix_ave_atom.h index 2ea31e40b4..0daa87963c 100644 --- a/src/fix_ave_atom.h +++ b/src/fix_ave_atom.h @@ -36,7 +36,7 @@ class FixAveAtom : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); void reset_timestep(bigint); diff --git a/src/fix_external.cpp b/src/fix_external.cpp index 0356c4a696..c9083e0334 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -160,7 +160,7 @@ void FixExternal::grow_arrays(int nmax) copy values within local atom-based array ------------------------------------------------------------------------- */ -void FixExternal::copy_arrays(int i, int j) +void FixExternal::copy_arrays(int i, int j, int delflag) { fexternal[j][0] = fexternal[i][0]; fexternal[j][1] = fexternal[i][1]; diff --git a/src/fix_external.h b/src/fix_external.h index 9830c495fc..fdd32b7712 100644 --- a/src/fix_external.h +++ b/src/fix_external.h @@ -37,7 +37,7 @@ class FixExternal : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/fix_minimize.cpp b/src/fix_minimize.cpp index 26e2d7efc0..3b63cc948a 100644 --- a/src/fix_minimize.cpp +++ b/src/fix_minimize.cpp @@ -187,7 +187,7 @@ void FixMinimize::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixMinimize::copy_arrays(int i, int j) +void FixMinimize::copy_arrays(int i, int j, int delflag) { int m,iper,nper,ni,nj; diff --git a/src/fix_minimize.h b/src/fix_minimize.h index e4b1634b84..bc8a310a03 100644 --- a/src/fix_minimize.h +++ b/src/fix_minimize.h @@ -35,7 +35,7 @@ class FixMinimize : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/fix_move.cpp b/src/fix_move.cpp index bdf4e3ac3b..e00c8e3063 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -856,7 +856,7 @@ void FixMove::grow_arrays(int nmax) copy values within local atom-based array ------------------------------------------------------------------------- */ -void FixMove::copy_arrays(int i, int j) +void FixMove::copy_arrays(int i, int j, int delflag) { xoriginal[j][0] = xoriginal[i][0]; xoriginal[j][1] = xoriginal[i][1]; diff --git a/src/fix_move.h b/src/fix_move.h index 118a617ecd..8c3b093ed0 100644 --- a/src/fix_move.h +++ b/src/fix_move.h @@ -40,7 +40,7 @@ class FixMove : public Fix { void write_restart(FILE *); void restart(char *); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); void set_arrays(int); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/fix_read_restart.cpp b/src/fix_read_restart.cpp index 30ca3d3acb..fc85315720 100644 --- a/src/fix_read_restart.cpp +++ b/src/fix_read_restart.cpp @@ -96,7 +96,7 @@ void FixReadRestart::grow_arrays(int nmax) copy values within local atom-based array ------------------------------------------------------------------------- */ -void FixReadRestart::copy_arrays(int i, int j) +void FixReadRestart::copy_arrays(int i, int j, int delflag) { count[j] = count[i]; for (int m = 0; m < count[i]; m++) extra[j][m] = extra[i][m]; diff --git a/src/fix_read_restart.h b/src/fix_read_restart.h index 4a97d60afd..5160ef8b5d 100644 --- a/src/fix_read_restart.h +++ b/src/fix_read_restart.h @@ -35,7 +35,7 @@ class FixReadRestart : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/fix_respa.cpp b/src/fix_respa.cpp index 3a4afb09c2..591440f2ed 100644 --- a/src/fix_respa.cpp +++ b/src/fix_respa.cpp @@ -80,7 +80,7 @@ void FixRespa::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixRespa::copy_arrays(int i, int j) +void FixRespa::copy_arrays(int i, int j, int delflag) { for (int k = 0; k < nlevels; k++) { f_level[j][k][0] = f_level[i][k][0]; diff --git a/src/fix_respa.h b/src/fix_respa.h index 8eb6194028..052cef594b 100644 --- a/src/fix_respa.h +++ b/src/fix_respa.h @@ -36,7 +36,7 @@ class FixRespa : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/fix_shake.cpp b/src/fix_shake.cpp index 14b3250943..ac877f0bcc 100644 --- a/src/fix_shake.cpp +++ b/src/fix_shake.cpp @@ -2249,7 +2249,7 @@ void FixShake::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixShake::copy_arrays(int i, int j) +void FixShake::copy_arrays(int i, int j, int delflag) { int flag = shake_flag[j] = shake_flag[i]; if (flag == 1) { diff --git a/src/fix_shake.h b/src/fix_shake.h index e7db5b0794..c10d8c127f 100644 --- a/src/fix_shake.h +++ b/src/fix_shake.h @@ -37,7 +37,7 @@ class FixShake : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); void set_arrays(int); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/fix_shear_history.cpp b/src/fix_shear_history.cpp index 9f79970ac0..49108c31f9 100644 --- a/src/fix_shear_history.cpp +++ b/src/fix_shear_history.cpp @@ -228,7 +228,7 @@ void FixShearHistory::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixShearHistory::copy_arrays(int i, int j) +void FixShearHistory::copy_arrays(int i, int j, int delflag) { npartner[j] = npartner[i]; for (int m = 0; m < npartner[j]; m++) { diff --git a/src/fix_shear_history.h b/src/fix_shear_history.h index 22385d377e..7dbf953c42 100644 --- a/src/fix_shear_history.h +++ b/src/fix_shear_history.h @@ -41,7 +41,7 @@ class FixShearHistory : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); void set_arrays(int); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/fix_spring_self.cpp b/src/fix_spring_self.cpp index 043bd21e2e..0026f879c6 100644 --- a/src/fix_spring_self.cpp +++ b/src/fix_spring_self.cpp @@ -222,7 +222,7 @@ void FixSpringSelf::grow_arrays(int nmax) copy values within local atom-based array ------------------------------------------------------------------------- */ -void FixSpringSelf::copy_arrays(int i, int j) +void FixSpringSelf::copy_arrays(int i, int j, int delflag) { xoriginal[j][0] = xoriginal[i][0]; xoriginal[j][1] = xoriginal[i][1]; diff --git a/src/fix_spring_self.h b/src/fix_spring_self.h index aa6b546608..3eb5945abd 100644 --- a/src/fix_spring_self.h +++ b/src/fix_spring_self.h @@ -39,7 +39,7 @@ class FixSpringSelf : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); int pack_restart(int, double *); diff --git a/src/fix_store_state.cpp b/src/fix_store_state.cpp index 693d699c68..0fab57d7f9 100644 --- a/src/fix_store_state.cpp +++ b/src/fix_store_state.cpp @@ -481,7 +481,7 @@ void FixStoreState::grow_arrays(int nmax) copy values within local atom-based array ------------------------------------------------------------------------- */ -void FixStoreState::copy_arrays(int i, int j) +void FixStoreState::copy_arrays(int i, int j, int delflag) { for (int m = 0; m < nvalues; m++) values[j][m] = values[i][m]; } diff --git a/src/fix_store_state.h b/src/fix_store_state.h index 39eaf183a3..ae8483f817 100644 --- a/src/fix_store_state.h +++ b/src/fix_store_state.h @@ -35,7 +35,7 @@ class FixStoreState : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); int pack_restart(int, double *); diff --git a/src/fix_tmd.cpp b/src/fix_tmd.cpp index 127d7d4f75..4136f97f7d 100644 --- a/src/fix_tmd.cpp +++ b/src/fix_tmd.cpp @@ -338,7 +338,7 @@ void FixTMD::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixTMD::copy_arrays(int i, int j) +void FixTMD::copy_arrays(int i, int j, int delflag) { xf[j][0] = xf[i][0]; xf[j][1] = xf[i][1]; diff --git a/src/fix_tmd.h b/src/fix_tmd.h index 4bfae04ecb..a6b96fbb1c 100644 --- a/src/fix_tmd.h +++ b/src/fix_tmd.h @@ -36,7 +36,7 @@ class FixTMD : public Fix { double memory_usage(); void grow_arrays(int); - void copy_arrays(int, int); + void copy_arrays(int, int, int); int pack_exchange(int, double *); int unpack_exchange(int, double *); void reset_dt();