diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index 81dbc98b47..bdbe80c67f 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -1428,6 +1428,9 @@ void MSM::particle_map() int flag = 0; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions. Simulation unstable."); + for (int i = 0; i < nlocal; i++) { // (nx,ny,nz) = global coords of grid pt to "lower left" of charge diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index e1f1262c9f..07177324dc 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -309,6 +309,9 @@ void MSMCG::particle_map() int flag = 0; int i; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions. Simulation unstable."); + for (int j = 0; j < num_charged; j++) { i = is_charged[j]; diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index a5697910c4..faa6b9a248 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -1875,6 +1875,10 @@ void PPPM::particle_map() int nlocal = atom->nlocal; int flag = 0; + + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions. Simulation unstable."); + for (int i = 0; i < nlocal; i++) { // (nx,ny,nz) = global coords of grid pt to "lower left" of charge diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index d071c3993a..9651ac7aa6 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -282,6 +282,9 @@ void PPPMCG::particle_map() double **x = atom->x; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions. Simulation unstable."); + int flag = 0; for (int j = 0; j < num_charged; j++) { int i = is_charged[j]; diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 1dfea3bf77..d565ce00cf 100755 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -4209,6 +4209,9 @@ void PPPMDisp::particle_map(double delx, double dely, double delz, double **x = atom->x; int nlocal = atom->nlocal; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions. Simulation unstable."); + int flag = 0; for (int i = 0; i < nlocal; i++) { diff --git a/src/KSPACE/pppm_disp_tip4p.cpp b/src/KSPACE/pppm_disp_tip4p.cpp index 0875c881d6..aa4f3607c6 100755 --- a/src/KSPACE/pppm_disp_tip4p.cpp +++ b/src/KSPACE/pppm_disp_tip4p.cpp @@ -78,6 +78,9 @@ void PPPMDispTIP4P::particle_map_c(double delx, double dely, double delz, double **x = atom->x; int nlocal = atom->nlocal; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions. Simulation unstable."); + int flag = 0; for (int i = 0; i < nlocal; i++) { if (type[i] == typeO) { diff --git a/src/KSPACE/pppm_stagger.cpp b/src/KSPACE/pppm_stagger.cpp index 3863f41f89..62db9d6441 100755 --- a/src/KSPACE/pppm_stagger.cpp +++ b/src/KSPACE/pppm_stagger.cpp @@ -679,6 +679,9 @@ void PPPMStagger::particle_map() double **x = atom->x; int nlocal = atom->nlocal; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions. Simulation unstable."); + int flag = 0; for (int i = 0; i < nlocal; i++) { diff --git a/src/KSPACE/pppm_tip4p.cpp b/src/KSPACE/pppm_tip4p.cpp index decdb1bad4..4345786339 100644 --- a/src/KSPACE/pppm_tip4p.cpp +++ b/src/KSPACE/pppm_tip4p.cpp @@ -73,6 +73,9 @@ void PPPMTIP4P::particle_map() double **x = atom->x; int nlocal = atom->nlocal; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions. Simulation unstable."); + int flag = 0; for (int i = 0; i < nlocal; i++) { if (type[i] == typeO) { diff --git a/src/MISC/fix_gld.cpp b/src/MISC/fix_gld.cpp index 66944502f7..998d7f4ebe 100644 --- a/src/MISC/fix_gld.cpp +++ b/src/MISC/fix_gld.cpp @@ -57,16 +57,16 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : // 1 = Group ID (e.g., all) // 2 = gld (name of this fix) // 3 = t_start (Starting target temperature) - t_start = atof(arg[3]); + t_start = force->numeric(FLERR,arg[3]); // 4 = t_stop (Stopping target temperature) - t_stop = atof(arg[4]); + t_stop = force->numeric(FLERR,arg[4]); // 5 = prony_terms (number of terms in Prony series) - prony_terms = atoi(arg[5]); + prony_terms = force->inumeric(FLERR,arg[5]); // 6 = seed (random seed) - int seed = atoi(arg[6]); + int seed = force->inumeric(FLERR,arg[6]); // 7 = series type if(strcmp(arg[7],"pprony") == 0) { @@ -101,8 +101,8 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : int iarg = narg_min; int icoeff = 0; while (iarg < narg && icoeff < prony_terms) { - double pc = atof(arg[iarg]); - double ptau = atof(arg[iarg+1]); + double pc = force->numeric(FLERR,arg[iarg]); + double ptau = force->numeric(FLERR,arg[iarg+1]); if (pc < 0) error->all(FLERR,"Fix gld c coefficients must be >= 0"); diff --git a/src/SHOCK/fix_wall_piston.cpp b/src/SHOCK/fix_wall_piston.cpp index 25c3b6dd3c..2f908bccb4 100644 --- a/src/SHOCK/fix_wall_piston.cpp +++ b/src/SHOCK/fix_wall_piston.cpp @@ -135,14 +135,7 @@ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) : // setup scaling - double xscale,yscale,zscale; - if (scaleflag) { - xscale = domain->lattice->xlattice; - yscale = domain->lattice->ylattice; - zscale = domain->lattice->zlattice; - } - else xscale = yscale = zscale = 1.0; - + const double zscale = (scaleflag) ? domain->lattice->zlattice : 1.0; vz *= zscale; z0 *= zscale; roughdist *= zscale; diff --git a/src/USER-OMP/pppm_disp_omp.cpp b/src/USER-OMP/pppm_disp_omp.cpp index 21ba45e91d..b22b553341 100644 --- a/src/USER-OMP/pppm_disp_omp.cpp +++ b/src/USER-OMP/pppm_disp_omp.cpp @@ -354,6 +354,9 @@ void PPPMDispOMP::particle_map(double dxinv, double dyinv, const int nyhi_out = nyhi_o; const int nzhi_out = nzhi_o; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions. Simulation unstable."); + int i, flag = 0; #if defined(_OPENMP) #pragma omp parallel for private(i) default(none) reduction(+:flag) schedule(static) diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index 71b169eaaf..816ab5e959 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -775,11 +775,10 @@ void CommTiled::exchange() void CommTiled::borders() { - int i,m,n,irecv,nlast,nsend,nrecv,ngroup,ncount,ncountall; + int i,m,n,nlast,nsend,nrecv,ngroup,ncount,ncountall; double xlo,xhi,ylo,yhi,zlo,zhi; double *bbox; double **x; - MPI_Status status; AtomVec *avec = atom->avec; // send/recv max one = max # of atoms in single send/recv for any swap @@ -1371,7 +1370,7 @@ void CommTiled::reverse_comm_dump(Dump *dump) void CommTiled::forward_comm_array(int nsize, double **array) { - int i,j,k,m,n,iatom,last,irecv,nsend,nrecv; + int i,j,k,m,iatom,last,irecv,nsend,nrecv; MPI_Status status; // insure send/recv bufs are big enough for nsize @@ -1732,7 +1731,6 @@ int CommTiled::point_drop_tiled(int idim, double *x) if (!done) proc = point_drop_tiled_recurse(xnew,0,nprocs-1); } } else if (idim == 1) { - int done = 1; if (rcbinfo[proc].mysplit[2][0] == rcbinfo[me].mysplit[2][1]) { xnew[2] -= EPSILON * (subhi[2]-sublo[2]); proc = point_drop_tiled_recurse(xnew,0,nprocs-1); diff --git a/src/compute_temp_partial.cpp b/src/compute_temp_partial.cpp index baa316e847..4fcb27dd45 100644 --- a/src/compute_temp_partial.cpp +++ b/src/compute_temp_partial.cpp @@ -38,9 +38,9 @@ ComputeTempPartial::ComputeTempPartial(LAMMPS *lmp, int narg, char **arg) : tempflag = 1; tempbias = 1; - xflag = atoi(arg[3]); - yflag = atoi(arg[4]); - zflag = atoi(arg[5]); + xflag = force->inumeric(FLERR,arg[3]); + yflag = force->inumeric(FLERR,arg[4]); + zflag = force->inumeric(FLERR,arg[5]); if (zflag && domain->dimension == 2) error->all(FLERR,"Compute temp/partial cannot use vz for 2d systemx"); diff --git a/src/compute_temp_profile.cpp b/src/compute_temp_profile.cpp index 268162a463..d1e107a822 100644 --- a/src/compute_temp_profile.cpp +++ b/src/compute_temp_profile.cpp @@ -41,9 +41,9 @@ ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : tempflag = 1; tempbias = 1; - xflag = atoi(arg[3]); - yflag = atoi(arg[4]); - zflag = atoi(arg[5]); + xflag = force->inumeric(FLERR,arg[3]); + yflag = force->inumeric(FLERR,arg[4]); + zflag = force->inumeric(FLERR,arg[5]); if (zflag && domain->dimension == 2) error->all(FLERR,"Compute temp/profile cannot use vz for 2d systemx"); @@ -59,44 +59,44 @@ ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : int iarg = 6; if (strcmp(arg[iarg],"x") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/profile command"); - nbinx = atoi(arg[iarg+1]); + nbinx = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/profile command"); - nbiny = atoi(arg[iarg+1]); + nbiny = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/profile command"); if (domain->dimension == 2) error->all(FLERR,"Compute temp/profile cannot bin z for 2d systems"); - nbinz = atoi(arg[iarg+1]); + nbinz = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"xy") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal compute temp/profile command"); - nbinx = atoi(arg[iarg+1]); - nbiny = atoi(arg[iarg+2]); + nbinx = force->inumeric(FLERR,arg[iarg+1]); + nbiny = force->inumeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"yz") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal compute temp/profile command"); if (domain->dimension == 2) error->all(FLERR,"Compute temp/profile cannot bin z for 2d systems"); - nbiny = atoi(arg[iarg+1]); - nbinz = atoi(arg[iarg+2]); + nbiny = force->inumeric(FLERR,arg[iarg+1]); + nbinz = force->inumeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"xz") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal compute temp/profile command"); if (domain->dimension == 2) error->all(FLERR,"Compute temp/profile cannot bin z for 2d systems"); - nbinx = atoi(arg[iarg+1]); - nbinz = atoi(arg[iarg+2]); + nbinx = force->inumeric(FLERR,arg[iarg+1]); + nbinz = force->inumeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"xyz") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal compute temp/profile command"); if (domain->dimension == 2) error->all(FLERR,"Compute temp/profile cannot bin z for 2d systems"); - nbinx = atoi(arg[iarg+1]); - nbiny = atoi(arg[iarg+2]); - nbinz = atoi(arg[iarg+3]); + nbinx = force->inumeric(FLERR,arg[iarg+1]); + nbiny = force->inumeric(FLERR,arg[iarg+2]); + nbinz = force->inumeric(FLERR,arg[iarg+3]); iarg += 4; } else error->all(FLERR,"Illegal compute temp/profile command"); diff --git a/src/compute_temp_ramp.cpp b/src/compute_temp_ramp.cpp index 288bc30abe..33a89229f8 100644 --- a/src/compute_temp_ramp.cpp +++ b/src/compute_temp_ramp.cpp @@ -74,14 +74,14 @@ ComputeTempRamp::ComputeTempRamp(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal compute temp/ramp command"); if (v_dim == 0) { - v_lo = xscale*atof(arg[4]); - v_hi = xscale*atof(arg[5]); + v_lo = xscale*force->numeric(FLERR,arg[4]); + v_hi = xscale*force->numeric(FLERR,arg[5]); } else if (v_dim == 1) { - v_lo = yscale*atof(arg[4]); - v_hi = yscale*atof(arg[5]); + v_lo = yscale*force->numeric(FLERR,arg[4]); + v_hi = yscale*force->numeric(FLERR,arg[5]); } else if (v_dim == 2) { - v_lo = zscale*atof(arg[4]); - v_hi = zscale*atof(arg[5]); + v_lo = zscale*force->numeric(FLERR,arg[4]); + v_hi = zscale*force->numeric(FLERR,arg[5]); } if (strcmp(arg[6],"x") == 0) coord_dim = 0; @@ -90,14 +90,14 @@ ComputeTempRamp::ComputeTempRamp(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal compute temp/ramp command"); if (coord_dim == 0) { - coord_lo = xscale*atof(arg[7]); - coord_hi = xscale*atof(arg[8]); + coord_lo = xscale*force->numeric(FLERR,arg[7]); + coord_hi = xscale*force->numeric(FLERR,arg[8]); } else if (coord_dim == 1) { - coord_lo = yscale*atof(arg[7]); - coord_hi = yscale*atof(arg[8]); + coord_lo = yscale*force->numeric(FLERR,arg[7]); + coord_hi = yscale*force->numeric(FLERR,arg[8]); } else if (coord_dim == 2) { - coord_lo = zscale*atof(arg[7]); - coord_hi = zscale*atof(arg[8]); + coord_lo = zscale*force->numeric(FLERR,arg[7]); + coord_hi = zscale*force->numeric(FLERR,arg[8]); } maxbias = 0; diff --git a/src/delete_bonds.cpp b/src/delete_bonds.cpp index b380508ee9..6ed4d211d1 100644 --- a/src/delete_bonds.cpp +++ b/src/delete_bonds.cpp @@ -25,6 +25,8 @@ #include "special.h" #include "error.h" +#include + using namespace LAMMPS_NS; enum{MULTI,ATOM,BOND,ANGLE,DIHEDRAL,IMPROPER,STATS}; @@ -80,7 +82,6 @@ void DeleteBonds::command(int narg, char **arg) int *tlist = NULL; int iarg = 2; - int which; if (style != MULTI && style != STATS) { if (narg < 3) error->all(FLERR,"Illegal delete_bonds command"); diff --git a/src/rcb.cpp b/src/rcb.cpp index 61cb44bd3f..d46766e45b 100644 --- a/src/rcb.cpp +++ b/src/rcb.cpp @@ -176,7 +176,6 @@ void RCB::compute(int dimension, int n, double **x, double *wt, // procmid = 1st proc in upper half of partition int procpartner,procpartner2; - int readnumber; int procmid; int proclower = 0; @@ -656,7 +655,6 @@ void median_merge(void *in, void *inout, int *len, MPI_Datatype *dptr) void RCB::invert(int sortflag) { - Invert *sbuf,*rbuf; // only create Irregular if not previously created // allows Irregular to persist for multiple RCB calls by fix balance diff --git a/src/read_restart.cpp b/src/read_restart.cpp index 441ecbfcd2..d49c271ac9 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -459,7 +459,10 @@ void ReadRestart::command(int narg, char **arg) // in case read by different proc than wrote restart file // first do map_init() since irregular->migrate_atoms() will do map_clear() - if (atom->map_style) atom->map_init(); + if (atom->map_style) { + atom->map_init(); + atom->map_set(); + } if (domain->triclinic) domain->x2lamda(atom->nlocal); Irregular *irregular = new Irregular(lmp); irregular->migrate_atoms(1);