diff --git a/src/BODY/body_nparticle.cpp b/src/BODY/body_nparticle.cpp index a39a1c4c59..e2b8c9b020 100644 --- a/src/BODY/body_nparticle.cpp +++ b/src/BODY/body_nparticle.cpp @@ -17,6 +17,7 @@ #include "atom_vec_body.h" #include "atom.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -29,8 +30,8 @@ BodyNparticle::BodyNparticle(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3) error->all(FLERR,"Invalid body nparticle command"); - int nmin = atoi(arg[1]); - int nmax = atoi(arg[2]); + int nmin = force->inumeric(FLERR,arg[1]); + int nmax = force->inumeric(FLERR,arg[2]); if (nmin <= 0 || nmin > nmax) error->all(FLERR,"Invalid body nparticle command"); diff --git a/src/DIPOLE/pair_lj_cut_dipole_long.cpp b/src/DIPOLE/pair_lj_cut_dipole_long.cpp index cf51ec2603..2e85b0976a 100755 --- a/src/DIPOLE/pair_lj_cut_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_long.cpp @@ -352,9 +352,9 @@ void PairLJCutDipoleLong::settings(int narg, char **arg) if (narg < 1 || narg > 2) error->all(FLERR,"Incorrect args in pair_style command"); - cut_lj_global = atof(arg[0]); + cut_lj_global = force->numeric(FLERR,arg[0]); if (narg == 1) cut_coul = cut_lj_global; - else cut_coul = atof(arg[1]); + else cut_coul = force->numeric(FLERR,arg[1]); // reset cutoffs that have been explicitly set @@ -380,11 +380,11 @@ void PairLJCutDipoleLong::coeff(int narg, char **arg) force->bounds(arg[0],atom->ntypes,ilo,ihi); force->bounds(arg[1],atom->ntypes,jlo,jhi); - double epsilon_one = atof(arg[2]); - double sigma_one = atof(arg[3]); + double epsilon_one = force->numeric(FLERR,arg[2]); + double sigma_one = force->numeric(FLERR,arg[3]); double cut_lj_one = cut_lj_global; - if (narg == 5) cut_lj_one = atof(arg[4]); + if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/FLD/pair_brownian.cpp b/src/FLD/pair_brownian.cpp index 4f81110c20..3dd711edd6 100755 --- a/src/FLD/pair_brownian.cpp +++ b/src/FLD/pair_brownian.cpp @@ -375,18 +375,18 @@ void PairBrownian::settings(int narg, char **arg) { if (narg != 7 && narg != 9) error->all(FLERR,"Illegal pair_style command"); - mu = atof(arg[0]); - flaglog = atoi(arg[1]); - flagfld = atoi(arg[2]); - cut_inner_global = atof(arg[3]); - cut_global = atof(arg[4]); - t_target = atof(arg[5]); - seed = atoi(arg[6]); + mu = force->numeric(FLERR,arg[0]); + flaglog = force->inumeric(FLERR,arg[1]); + flagfld = force->inumeric(FLERR,arg[2]); + cut_inner_global = force->numeric(FLERR,arg[3]); + cut_global = force->numeric(FLERR,arg[4]); + t_target = force->numeric(FLERR,arg[5]); + seed = force->inumeric(FLERR,arg[6]); flagHI = flagVF = 1; if (narg == 9) { - flagHI = atoi(arg[7]); - flagVF = atoi(arg[8]); + flagHI = force->inumeric(FLERR,arg[7]); + flagVF = force->inumeric(FLERR,arg[8]); } if (flaglog == 1 && flagHI == 0) { @@ -431,8 +431,8 @@ void PairBrownian::coeff(int narg, char **arg) double cut_one = cut_global; if (narg == 4) { - cut_inner_one = atof(arg[2]); - cut_one = atof(arg[3]); + cut_inner_one = force->numeric(FLERR,arg[2]); + cut_one = force->numeric(FLERR,arg[3]); } int count = 0; diff --git a/src/FLD/pair_lubricate.cpp b/src/FLD/pair_lubricate.cpp index bf6fa47d0e..19f2b0d8ec 100755 --- a/src/FLD/pair_lubricate.cpp +++ b/src/FLD/pair_lubricate.cpp @@ -486,16 +486,16 @@ void PairLubricate::settings(int narg, char **arg) { if (narg != 5 && narg != 7) error->all(FLERR,"Illegal pair_style command"); - mu = atof(arg[0]); - flaglog = atoi(arg[1]); - flagfld = atoi(arg[2]); - cut_inner_global = atof(arg[3]); - cut_global = atof(arg[4]); + mu = force->numeric(FLERR,arg[0]); + flaglog = force->inumeric(FLERR,arg[1]); + flagfld = force->inumeric(FLERR,arg[2]); + cut_inner_global = force->numeric(FLERR,arg[3]); + cut_global = force->numeric(FLERR,arg[4]); flagHI = flagVF = 1; if (narg == 7) { - flagHI = atoi(arg[5]); - flagVF = atoi(arg[6]); + flagHI = force->inumeric(FLERR,arg[5]); + flagVF = force->inumeric(FLERR,arg[6]); } if (flaglog == 1 && flagHI == 0) { @@ -534,8 +534,8 @@ void PairLubricate::coeff(int narg, char **arg) double cut_inner_one = cut_inner_global; double cut_one = cut_global; if (narg == 4) { - cut_inner_one = atof(arg[2]); - cut_one = atof(arg[3]); + cut_inner_one = force->numeric(FLERR,arg[2]); + cut_one = force->numeric(FLERR,arg[3]); } int count = 0; diff --git a/src/FLD/pair_lubricateU.cpp b/src/FLD/pair_lubricateU.cpp index 64cde9e657..4fda281140 100644 --- a/src/FLD/pair_lubricateU.cpp +++ b/src/FLD/pair_lubricateU.cpp @@ -1761,16 +1761,16 @@ void PairLubricateU::settings(int narg, char **arg) { if (narg != 5 && narg != 7) error->all(FLERR,"Illegal pair_style command"); - mu = atof(arg[0]); - flaglog = atoi(arg[1]); - cut_inner_global = atof(arg[2]); - cut_global = atof(arg[3]); - gdot = atof(arg[4]); + mu = force->numeric(FLERR,arg[0]); + flaglog = force->inumeric(FLERR,arg[1]); + cut_inner_global = force->numeric(FLERR,arg[2]); + cut_global = force->numeric(FLERR,arg[3]); + gdot = force->numeric(FLERR,arg[4]); flagHI = flagVF = 1; if (narg == 7) { - flagHI = atoi(arg[5]); - flagVF = atoi(arg[6]); + flagHI = force->inumeric(FLERR,arg[5]); + flagVF = force->inumeric(FLERR,arg[6]); } if (flaglog == 1 && flagHI == 0) { @@ -1822,8 +1822,8 @@ void PairLubricateU::coeff(int narg, char **arg) double cut_inner_one = cut_inner_global; double cut_one = cut_global; if (narg == 4) { - cut_inner_one = atof(arg[2]); - cut_one = atof(arg[3]); + cut_inner_one = force->numeric(FLERR,arg[2]); + cut_one = force->numeric(FLERR,arg[3]); } int count = 0; diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index f3812f2a43..2d0e438f5b 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -53,9 +53,9 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : // required args - ninsert = atoi(arg[3]); - ntype = atoi(arg[4]); - seed = atoi(arg[5]); + ninsert = force->inumeric(FLERR,arg[3]); + ntype = force->inumeric(FLERR,arg[4]); + seed = force->inumeric(FLERR,arg[5]); if (seed <= 0) error->all(FLERR,"Illegal fix pour command"); @@ -86,20 +86,20 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"one") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); dstyle = ONE; - radius_one = 0.5 * atof(arg[iarg+2]); + radius_one = 0.5 * force->numeric(FLERR,arg[iarg+2]); radius_max = radius_one; iarg += 3; } else if (strcmp(arg[iarg+1],"range") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix pour command"); dstyle = RANGE; - radius_lo = 0.5 * atof(arg[iarg+2]); - radius_hi = 0.5 * atof(arg[iarg+3]); + radius_lo = 0.5 * force->numeric(FLERR,arg[iarg+2]); + radius_hi = 0.5 * force->numeric(FLERR,arg[iarg+3]); radius_max = radius_hi; iarg += 4; } else if (strcmp(arg[iarg+1],"poly") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); dstyle = POLY; - npoly = atoi(arg[iarg+2]); + npoly = force->inumeric(FLERR,arg[iarg+2]); if (npoly <= 0) error->all(FLERR,"Illegal fix pour command"); if (iarg+3 + 2*npoly > narg) error->all(FLERR,"Illegal fix pour command"); @@ -108,8 +108,8 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : iarg += 3; radius_max = 0.0; for (int i = 0; i < npoly; i++) { - radius_poly[i] = 0.5 * atof(arg[iarg++]); - frac_poly[i] = atof(arg[iarg++]); + radius_poly[i] = 0.5 * force->numeric(FLERR,arg[iarg++]); + frac_poly[i] = force->numeric(FLERR,arg[iarg++]); if (radius_poly[i] <= 0.0 || frac_poly[i] < 0.0) error->all(FLERR,"Illegal fix pour command"); radius_max = MAX(radius_max,radius_poly[i]); @@ -124,32 +124,32 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"dens") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); - density_lo = atof(arg[iarg+1]); - density_hi = atof(arg[iarg+2]); + density_lo = force->numeric(FLERR,arg[iarg+1]); + density_hi = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"vol") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); - volfrac = atof(arg[iarg+1]); - maxattempt = atoi(arg[iarg+2]); + volfrac = force->numeric(FLERR,arg[iarg+1]); + maxattempt = force->inumeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"rate") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command"); - rate = atof(arg[iarg+1]); + rate = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"vel") == 0) { if (domain->dimension == 3) { if (iarg+6 > narg) error->all(FLERR,"Illegal fix pour command"); - vxlo = atof(arg[iarg+1]); - vxhi = atof(arg[iarg+2]); - vylo = atof(arg[iarg+3]); - vyhi = atof(arg[iarg+4]); - vz = atof(arg[iarg+5]); + vxlo = force->numeric(FLERR,arg[iarg+1]); + vxhi = force->numeric(FLERR,arg[iarg+2]); + vylo = force->numeric(FLERR,arg[iarg+3]); + vyhi = force->numeric(FLERR,arg[iarg+4]); + vz = force->numeric(FLERR,arg[iarg+5]); iarg += 6; } else { if (iarg+4 > narg) error->all(FLERR,"Illegal fix pour command"); - vxlo = atof(arg[iarg+1]); - vxhi = atof(arg[iarg+2]); - vy = atof(arg[iarg+3]); + vxlo = force->numeric(FLERR,arg[iarg+1]); + vxhi = force->numeric(FLERR,arg[iarg+2]); + vy = force->numeric(FLERR,arg[iarg+3]); vz = 0.0; iarg += 4; } diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 5119df633b..c26283d8bc 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -enum{XPLANE,YPLANE,ZPLANE,ZCYLINDER}; // XYZ PLANE need to be 0,1,2 +enum{XPLANE=0,YPLANE=1,ZPLANE=2,ZCYLINDER}; // XYZ PLANE need to be 0,1,2 enum{HOOKE,HOOKE_HISTORY,HERTZ_HISTORY}; #define BIG 1.0e20 @@ -54,16 +54,16 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // wall/particle coefficients - kn = atof(arg[3]); + kn = force->numeric(FLERR,arg[3]); if (strcmp(arg[4],"NULL") == 0) kt = kn * 2.0/7.0; - else kt = atof(arg[4]); + else kt = force->numeric(FLERR,arg[4]); - gamman = atof(arg[5]); + gamman = force->numeric(FLERR,arg[5]); if (strcmp(arg[6],"NULL") == 0) gammat = 0.5 * gamman; - else gammat = atof(arg[6]); + else gammat = force->numeric(FLERR,arg[6]); - xmu = atof(arg[7]); - int dampflag = atoi(arg[8]); + xmu = force->numeric(FLERR,arg[7]); + int dampflag = force->inumeric(FLERR,arg[8]); if (dampflag == 0) gammat = 0.0; if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || @@ -84,31 +84,31 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); wallstyle = XPLANE; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; - else lo = atof(arg[iarg+1]); + else lo = force->numeric(FLERR,arg[iarg+1]); if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; - else hi = atof(arg[iarg+2]); + else hi = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"yplane") == 0) { if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); wallstyle = YPLANE; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; - else lo = atof(arg[iarg+1]); + else lo = force->numeric(FLERR,arg[iarg+1]); if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; - else hi = atof(arg[iarg+2]); + else hi = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"zplane") == 0) { if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); wallstyle = ZPLANE; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; - else lo = atof(arg[iarg+1]); + else lo = force->numeric(FLERR,arg[iarg+1]); if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; - else hi = atof(arg[iarg+2]); + else hi = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"zcylinder") == 0) { if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/gran command"); wallstyle = ZCYLINDER; lo = hi = 0.0; - cylradius = atof(arg[iarg+1]); + cylradius = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } @@ -124,8 +124,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg+1],"y") == 0) axis = 1; else if (strcmp(arg[iarg+1],"z") == 0) axis = 2; else error->all(FLERR,"Illegal fix wall/gran command"); - amplitude = atof(arg[iarg+2]); - period = atof(arg[iarg+3]); + amplitude = force->numeric(FLERR,arg[iarg+2]); + period = force->numeric(FLERR,arg[iarg+3]); wiggle = 1; iarg += 4; } else if (strcmp(arg[iarg],"shear") == 0) { @@ -134,7 +134,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg+1],"y") == 0) axis = 1; else if (strcmp(arg[iarg+1],"z") == 0) axis = 2; else error->all(FLERR,"Illegal fix wall/gran command"); - vshear = atof(arg[iarg+2]); + vshear = force->numeric(FLERR,arg[iarg+2]); wshear = 1; iarg += 3; } else error->all(FLERR,"Illegal fix wall/gran command"); diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index 5e8a8d6739..cf9ff2a635 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -48,7 +48,7 @@ Ewald::Ewald(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) group_group_enable = 1; group_allocate_flag = 0; - accuracy_relative = atof(arg[0]); + accuracy_relative = fabs(force->numeric(FLERR,arg[0])); kmax = 0; kxvecs = kyvecs = kzvecs = NULL; diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 07a34db639..9723363aa3 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -50,7 +50,7 @@ EwaldDisp::EwaldDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) if (narg!=1) error->all(FLERR,"Illegal kspace_style ewald/n command"); ewaldflag = dispersionflag = dipoleflag = 1; - accuracy_relative = fabs(atof(arg[0])); + accuracy_relative = fabs(force->numeric(FLERR,arg[0])); memset(function, 0, EWALD_NORDER*sizeof(int)); kenergy = kvirial = NULL; diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index f1c90ab4c6..dff62c8080 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -51,7 +51,7 @@ MSM::MSM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) msmflag = 1; - accuracy_relative = atof(arg[0]); + accuracy_relative = fabs(force->numeric(FLERR,arg[0])); nfactors = 1; factors = new int[nfactors]; @@ -298,7 +298,7 @@ double MSM::estimate_cutoff(double h, double prd) a = C_p*pow(h,(p-1))/accuracy; // include dependency of error on other terms - a *= q2/(prd*sqrt(atom->natoms)); + a *= q2/(prd*sqrt(double(atom->natoms))); a = pow(a,1.0/double(p)); @@ -349,7 +349,7 @@ double MSM::estimate_1d_error(double h, double prd) double error_1d = C_p*pow(h,(p-1))/pow(a,(p+1)); // include dependency of error on other terms - error_1d *= q2*a/(prd*sqrt(atom->natoms)); + error_1d *= q2*a/(prd*sqrt(double(atom->natoms))); return error_1d; } diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index 151b7ef91d..527000f651 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -50,7 +50,7 @@ MSMCG::MSMCG(LAMMPS *lmp, int narg, char **arg) : MSM(lmp, narg, arg) triclinic_support = 0; - if (narg == 2) smallq = atof(arg[1]); + if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1])); else smallq = SMALLQ; num_charged = -1; diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index b33371fd84..1f4b007374 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -72,7 +72,7 @@ PPPM::PPPM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) pppmflag = 1; group_group_enable = 1; - accuracy_relative = atof(arg[0]); + accuracy_relative = fabs(force->numeric(FLERR,arg[0])); nfactors = 3; factors = new int[nfactors]; diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index 91676ea285..4b5809a2fc 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -55,7 +55,7 @@ PPPMCG::PPPMCG(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg) triclinic_support = 0; - if (narg == 2) smallq = atof(arg[1]); + if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1])); else smallq = SMALLQ; num_charged = -1; diff --git a/src/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index ff6c52507c..0ae5ae94be 100755 --- a/src/MC/fix_bond_break.cpp +++ b/src/MC/fix_bond_break.cpp @@ -39,7 +39,7 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix bond/break command"); force_reneighbor = 1; @@ -49,8 +49,8 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 0; - btype = atoi(arg[4]); - double cutoff = atof(arg[5]); + btype = force->inumeric(FLERR,arg[4]); + double cutoff = force->numeric(FLERR,arg[5]); if (btype < 1 || btype > atom->nbondtypes) error->all(FLERR,"Invalid bond type in fix bond/break command"); @@ -67,8 +67,8 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"prob") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/break command"); - fraction = atof(arg[iarg+1]); - seed = atoi(arg[iarg+2]); + fraction = force->numeric(FLERR,arg[iarg+1]); + seed = force->inumeric(FLERR,arg[iarg+2]); if (fraction < 0.0 || fraction > 1.0) error->all(FLERR,"Illegal fix bond/break command"); if (seed <= 0) error->all(FLERR,"Illegal fix bond/break command"); diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index 1cf8a3cdec..7d0850c57e 100755 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -43,7 +43,7 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix bond/create command"); force_reneighbor = 1; @@ -53,10 +53,10 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 0; - iatomtype = atoi(arg[4]); - jatomtype = atoi(arg[5]); - double cutoff = atof(arg[6]); - btype = atoi(arg[7]); + iatomtype = force->inumeric(FLERR,arg[4]); + jatomtype = force->inumeric(FLERR,arg[5]); + double cutoff = force->numeric(FLERR,arg[6]); + btype = force->inumeric(FLERR,arg[7]); if (iatomtype < 1 || iatomtype > atom->ntypes || jatomtype < 1 || jatomtype > atom->ntypes) @@ -80,24 +80,24 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"iparam") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command"); - imaxbond = atoi(arg[iarg+1]); - inewtype = atoi(arg[iarg+2]); + imaxbond = force->inumeric(FLERR,arg[iarg+1]); + inewtype = force->inumeric(FLERR,arg[iarg+2]); if (imaxbond < 0) error->all(FLERR,"Illegal fix bond/create command"); if (inewtype < 1 || inewtype > atom->ntypes) error->all(FLERR,"Invalid atom type in fix bond/create command"); iarg += 3; } else if (strcmp(arg[iarg],"jparam") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command"); - jmaxbond = atoi(arg[iarg+1]); - jnewtype = atoi(arg[iarg+2]); + jmaxbond = force->inumeric(FLERR,arg[iarg+1]); + jnewtype = force->inumeric(FLERR,arg[iarg+2]); if (jmaxbond < 0) error->all(FLERR,"Illegal fix bond/create command"); if (jnewtype < 1 || jnewtype > atom->ntypes) error->all(FLERR,"Invalid atom type in fix bond/create command"); iarg += 3; } else if (strcmp(arg[iarg],"prob") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command"); - fraction = atof(arg[iarg+1]); - seed = atoi(arg[iarg+2]); + fraction = force->numeric(FLERR,arg[iarg+1]); + seed = force->inumeric(FLERR,arg[iarg+2]); if (fraction < 0.0 || fraction > 1.0) error->all(FLERR,"Illegal fix bond/create command"); if (seed <= 0) error->all(FLERR,"Illegal fix bond/create command"); diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index 85c1e23474..2215d044eb 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -49,13 +49,13 @@ FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 0; - fraction = atof(arg[3]); - double cutoff = atof(arg[4]); + fraction = force->numeric(FLERR,arg[3]); + double cutoff = force->numeric(FLERR,arg[4]); cutsq = cutoff*cutoff; // initialize Marsaglia RNG with processor-unique seed - int seed = atoi(arg[5]); + int seed = force->inumeric(FLERR,arg[5]); random = new RanMars(lmp,seed + comm->me); // create a new compute temp style diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index 730800e67c..baee0c7912 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -58,14 +58,14 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : // required args - nevery = atoi(arg[3]); - nexchanges = atoi(arg[4]); - nmcmoves = atoi(arg[5]); - ngcmc_type = atoi(arg[6]); - seed = atoi(arg[7]); - reservoir_temperature = atof(arg[8]); - chemical_potential = atof(arg[9]); - displace = atof(arg[10]); + nevery = force->inumeric(FLERR,arg[3]); + nexchanges = force->inumeric(FLERR,arg[4]); + nmcmoves = force->inumeric(FLERR,arg[5]); + ngcmc_type = force->inumeric(FLERR,arg[6]); + seed = force->inumeric(FLERR,arg[7]); + reservoir_temperature = force->numeric(FLERR,arg[8]); + chemical_potential = force->numeric(FLERR,arg[9]); + displace = force->numeric(FLERR,arg[10]); if (nexchanges < 0) error->all(FLERR,"Illegal fix gcmc command"); if (nmcmoves < 0) error->all(FLERR,"Illegal fix gcmc command"); @@ -199,17 +199,17 @@ void FixGCMC::options(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"maxangle") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - max_rotation_angle = atof(arg[iarg+1]); + max_rotation_angle = force->numeric(FLERR,arg[iarg+1]); max_rotation_angle *= MY_PI/180; iarg += 2; } else if (strcmp(arg[iarg],"pressure") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - pressure = atof(arg[iarg+1]); + pressure = force->numeric(FLERR,arg[iarg+1]); pressure_flag = true; iarg += 2; } else if (strcmp(arg[iarg],"fugacity_coeff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - fugacity_coeff = atof(arg[iarg+1]); + fugacity_coeff = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else error->all(FLERR,"Illegal fix gcmc command"); } diff --git a/src/MOLECULE/angle_cosine_periodic.cpp b/src/MOLECULE/angle_cosine_periodic.cpp index 4c02ec7bc5..034cfc4c11 100644 --- a/src/MOLECULE/angle_cosine_periodic.cpp +++ b/src/MOLECULE/angle_cosine_periodic.cpp @@ -207,9 +207,9 @@ void AngleCosinePeriodic::coeff(int narg, char **arg) int ilo,ihi; force->bounds(arg[0],atom->nangletypes,ilo,ihi); - double c_one = atof(arg[1]); - int b_one = atoi(arg[2]); - int n_one = atoi(arg[3]); + double c_one = force->numeric(FLERR,arg[1]); + int b_one = force->inumeric(FLERR,arg[2]); + int n_one = force->inumeric(FLERR,arg[3]); if (n_one <= 0) error->all(FLERR,"Incorrect args for angle coefficients"); int count = 0; diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 939566a24b..ef8c1a1352 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -260,8 +260,8 @@ void ImproperUmbrella::coeff(int narg, char **arg) int ilo,ihi; force->bounds(arg[0],atom->nimpropertypes,ilo,ihi); - double k_one = atof(arg[1]); - double w_one = atof(arg[2]); + double k_one = force->numeric(FLERR,arg[1]); + double w_one = force->numeric(FLERR,arg[2]); // convert w0 from degrees to radians diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index a553bf89be..6ef47b36f6 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -374,11 +374,11 @@ void PairPeriLPS::coeff(int narg, char **arg) force->bounds(arg[0],atom->ntypes,ilo,ihi); force->bounds(arg[1],atom->ntypes,jlo,jhi); - double bulkmodulus_one = atof(arg[2]); - double shearmodulus_one = atof(arg[3]); - double cut_one = atof(arg[4]); - double s00_one = atof(arg[5]); - double alpha_one = atof(arg[6]); + double bulkmodulus_one = force->numeric(FLERR,arg[2]); + double shearmodulus_one = force->numeric(FLERR,arg[3]); + double cut_one = force->numeric(FLERR,arg[4]); + double s00_one = force->numeric(FLERR,arg[5]); + double alpha_one = force->numeric(FLERR,arg[6]); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/REAX/fix_reax_bonds.cpp b/src/REAX/fix_reax_bonds.cpp index 1044a4f834..3e505c8d63 100644 --- a/src/REAX/fix_reax_bonds.cpp +++ b/src/REAX/fix_reax_bonds.cpp @@ -41,7 +41,7 @@ FixReaxBonds::FixReaxBonds(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery < 1) error->all(FLERR,"Illegal fix reax/bonds command"); if (me == 0) { diff --git a/src/REPLICA/compute_event_displace.cpp b/src/REPLICA/compute_event_displace.cpp index 45d4341270..7c74a45a51 100644 --- a/src/REPLICA/compute_event_displace.cpp +++ b/src/REPLICA/compute_event_displace.cpp @@ -26,6 +26,7 @@ #include "fix_event.h" #include "memory.h" #include "error.h" +#include "force.h" #include "update.h" using namespace LAMMPS_NS; @@ -42,7 +43,7 @@ ComputeEventDisplace::ComputeEventDisplace(LAMMPS *lmp, int narg, char **arg) : scalar_flag = 1; extscalar = 0; - double displace_dist = atof(arg[3]); + double displace_dist = force->numeric(FLERR,arg[3]); if (displace_dist <= 0.0) error->all(FLERR,"Distance must be > 0 for compute event/displace"); displace_distsq = displace_dist * displace_dist; diff --git a/src/REPLICA/fix_neb.cpp b/src/REPLICA/fix_neb.cpp index 6aabea3ebc..0fc7dfd5eb 100644 --- a/src/REPLICA/fix_neb.cpp +++ b/src/REPLICA/fix_neb.cpp @@ -24,6 +24,7 @@ #include "atom.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -35,7 +36,7 @@ FixNEB::FixNEB(LAMMPS *lmp, int narg, char **arg) : { if (narg != 4) error->all(FLERR,"Illegal fix neb command"); - kspring = atof(arg[3]); + kspring = force->numeric(FLERR,arg[3]); if (kspring <= 0.0) error->all(FLERR,"Illegal fix neb command"); // nreplica = number of partitions diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index b3f4264de7..e80f6ddbb7 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -161,7 +161,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[3],"group") == 0) { if (narg < 5) error->all(FLERR,"Illegal fix rigid command"); rstyle = GROUP; - nbody = atoi(arg[4]); + nbody = force->inumeric(FLERR,arg[4]); if (nbody <= 0) error->all(FLERR,"Illegal fix rigid command"); if (narg < 5+nbody) error->all(FLERR,"Illegal fix rigid command"); iarg = 5+nbody; @@ -330,10 +330,10 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (strcmp(style,"rigid") != 0 && strcmp(style,"rigid/nve") != 0) error->all(FLERR,"Illegal fix rigid command"); langflag = 1; - t_start = atof(arg[iarg+1]); - t_stop = atof(arg[iarg+2]); - t_period = atof(arg[iarg+3]); - seed = atoi(arg[iarg+4]); + t_start = force->numeric(FLERR,arg[iarg+1]); + t_stop = force->numeric(FLERR,arg[iarg+2]); + t_period = force->numeric(FLERR,arg[iarg+3]); + seed = force->inumeric(FLERR,arg[iarg+4]); if (t_period <= 0.0) error->all(FLERR,"Fix rigid langevin period must be > 0.0"); if (seed <= 0) error->all(FLERR,"Illegal fix rigid command"); @@ -344,9 +344,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (strcmp(style,"rigid/nvt") != 0 && strcmp(style,"rigid/npt") != 0) error->all(FLERR,"Illegal fix rigid command"); tstat_flag = 1; - t_start = atof(arg[iarg+1]); - t_stop = atof(arg[iarg+2]); - t_period = atof(arg[iarg+3]); + t_start = force->numeric(FLERR,arg[iarg+1]); + t_stop = force->numeric(FLERR,arg[iarg+2]); + t_period = force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"iso") == 0) { @@ -354,9 +354,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0) error->all(FLERR,"Illegal fix rigid command"); pcouple = XYZ; - p_start[0] = p_start[1] = p_start[2] = atof(arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = atof(arg[iarg+2]); - p_period[0] = p_period[1] = p_period[2] = atof(arg[iarg+3]); + p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); + p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -368,9 +368,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0) error->all(FLERR,"Illegal fix rigid command"); - p_start[0] = p_start[1] = p_start[2] = atof(arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = atof(arg[iarg+2]); - p_period[0] = p_period[1] = p_period[2] = atof(arg[iarg+3]); + p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); + p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -380,25 +380,25 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); - p_start[0] = atof(arg[iarg+1]); - p_stop[0] = atof(arg[iarg+2]); - p_period[0] = atof(arg[iarg+3]); + p_start[0] = force->numeric(FLERR,arg[iarg+1]); + p_stop[0] = force->numeric(FLERR,arg[iarg+2]); + p_period[0] = force->numeric(FLERR,arg[iarg+3]); p_flag[0] = 1; iarg += 4; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); - p_start[1] = atof(arg[iarg+1]); - p_stop[1] = atof(arg[iarg+2]); - p_period[1] = atof(arg[iarg+3]); + p_start[1] = force->numeric(FLERR,arg[iarg+1]); + p_stop[1] = force->numeric(FLERR,arg[iarg+2]); + p_period[1] = force->numeric(FLERR,arg[iarg+3]); p_flag[1] = 1; iarg += 4; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); - p_start[2] = atof(arg[iarg+1]); - p_stop[2] = atof(arg[iarg+2]); - p_period[2] = atof(arg[iarg+3]); + p_start[2] = force->numeric(FLERR,arg[iarg+1]); + p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_period[2] = force->numeric(FLERR,arg[iarg+3]); p_flag[2] = 1; iarg += 4; @@ -433,16 +433,16 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (strcmp(style,"rigid/nvt") != 0 && strcmp(style,"rigid/npt") != 0) error->all(FLERR,"Illegal fix rigid command"); - t_chain = atoi(arg[iarg+1]); - t_iter = atoi(arg[iarg+2]); - t_order = atoi(arg[iarg+3]); + t_chain = force->inumeric(FLERR,arg[iarg+1]); + t_iter = force->inumeric(FLERR,arg[iarg+2]); + t_order = force->inumeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"pchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid command"); if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0) error->all(FLERR,"Illegal fix rigid command"); - p_chain = atoi(arg[iarg+1]); + p_chain = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"infile") == 0) { @@ -901,7 +901,7 @@ void FixRigid::post_force(int vflag) void FixRigid::final_integrate() { int i,ibody; - double dtfm,xy,xz,yz; + double dtfm; // sum over atoms to get force and torque on rigid body @@ -994,7 +994,7 @@ void FixRigid::final_integrate() ------------------------------------------------------------------------- */ void FixRigid::no_squish_rotate(int k, double *p, double *q, - double *inertia, double dt) + double *inertia, double dt) const { double phi,c_phi,s_phi,kp[4],kq[4]; @@ -1239,7 +1239,7 @@ void FixRigid::deform(int flag) void FixRigid::set_xv() { - int ibody,itype; + int ibody; int xbox,ybox,zbox; double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone; double xy,xz,yz; @@ -1416,9 +1416,7 @@ void FixRigid::set_xv() void FixRigid::set_v() { - int ibody,itype; int xbox,ybox,zbox; - double dx,dy,dz; double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone; double xy,xz,yz; double ione[3],exone[3],eyone[3],ezone[3],delta[3],vr[6]; @@ -1445,7 +1443,7 @@ void FixRigid::set_v() for (int i = 0; i < nlocal; i++) { if (body[i] < 0) continue; - ibody = body[i]; + const int ibody = body[i]; MathExtra::matvec(ex_space[ibody],ey_space[ibody], ez_space[ibody],displace[i],delta); @@ -1519,7 +1517,7 @@ void FixRigid::set_v() for (int i = 0; i < nlocal; i++) { if (body[i] < 0) continue; - ibody = body[i]; + const int ibody = body[i]; if (eflags[i] & SPHERE) { omega_one[i][0] = omega[ibody][0]; @@ -1558,7 +1556,7 @@ void FixRigid::set_v() void FixRigid::setup_bodies() { - int i,itype,ibody; + int i,ibody; // extended = 1 if any particle in a rigid body is finite size // or has a dipole moment @@ -1721,7 +1719,7 @@ void FixRigid::setup_bodies() // dx,dy,dz = coords relative to center-of-mass // symmetric 3x3 inertia tensor stored in Voigt notation as 6-vector - double dx,dy,dz,rad; + double dx,dy,dz; for (ibody = 0; ibody < nbody; ibody++) for (i = 0; i < 6; i++) sum[ibody][i] = 0.0; diff --git a/src/RIGID/fix_rigid.h b/src/RIGID/fix_rigid.h index 6082cbce01..3c9b61bff9 100644 --- a/src/RIGID/fix_rigid.h +++ b/src/RIGID/fix_rigid.h @@ -127,7 +127,7 @@ class FixRigid : public Fix { int POINT,SPHERE,ELLIPSOID,LINE,TRIANGLE,DIPOLE; // bitmasks for eflags int OMEGA,ANGMOM,TORQUE; - void no_squish_rotate(int, double *, double *, double *, double); + void no_squish_rotate(int, double *, double *, double *, double) const; void set_xv(); void set_v(); void setup_bodies(); diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 31190dcd9d..753945d78c 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -108,10 +108,10 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : if (strcmp(style,"rigid/small") != 0) error->all(FLERR,"Illegal fix rigid/small command"); langflag = 1; - t_start = atof(arg[iarg+1]); - t_stop = atof(arg[iarg+2]); - t_period = atof(arg[iarg+3]); - seed = atoi(arg[iarg+4]); + t_start = force->numeric(FLERR,arg[iarg+1]); + t_stop = force->numeric(FLERR,arg[iarg+2]); + t_period = force->numeric(FLERR,arg[iarg+3]); + seed = force->inumeric(FLERR,arg[iarg+4]); if (t_period <= 0.0) error->all(FLERR,"Fix rigid/small langevin period must be > 0.0"); if (seed <= 0) error->all(FLERR,"Illegal fix rigid/small command"); @@ -151,7 +151,6 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : bodyown[i] = nlocal_body++; } else bodyown[i] = -1; - // bodysize = sizeof(Body) in doubles bodysize = sizeof(Body)/sizeof(double); @@ -218,11 +217,6 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : random = NULL; if (langflag) random = new RanMars(lmp,seed + comm->me); - // mass vector for granular pair styles - - mass_body = NULL; - nmax_mass = 0; - // firstflag = 1 triggers one-time initialization of rigid body attributes firstflag = 1; @@ -250,7 +244,6 @@ FixRigidSmall::~FixRigidSmall() delete random; memory->destroy(langextra); - memory->destroy(mass_body); } /* ---------------------------------------------------------------------- */ @@ -1296,7 +1289,10 @@ void FixRigidSmall::create_bodies() n = 0; for (i = 0; i < nlocal; i++) { if (!(mask[i] & groupbit)) continue; - if (hash->find(molecule[i]) == hash->end()) (*hash)[molecule[i]] = n++; + if (hash->find(molecule[i]) == hash->end()) { + hash->insert(std::pair (molecule[i],n)); + n++; + } } // bbox = bounding box of each rigid body my atoms are part of @@ -1556,7 +1552,7 @@ void FixRigidSmall::setup_bodies() atom->tri_flag || atom->mu_flag) { int flag = 0; for (i = 0; i < nlocal; i++) { - if (bodytag[i] == 0) continue; + if (atom2body[i] < 0) continue; if (radius && radius[i] > 0.0) flag = 1; if (ellipsoid && ellipsoid[i] >= 0) flag = 1; if (line && line[i] >= 0) flag = 1; @@ -1581,7 +1577,7 @@ void FixRigidSmall::setup_bodies() for (i = 0; i < nlocal; i++) { eflags[i] = 0; - if (bodytag[i] == 0) continue; + if (atom2body[i] < 0) continue; // set to POINT or SPHERE or ELLIPSOID or LINE @@ -2522,37 +2518,6 @@ void FixRigidSmall::reset_dt() dtq = 0.5 * update->dt; } -/* ---------------------------------------------------------------------- */ - -void *FixRigidSmall::extract(const char *str, int &dim) -{ - if (strcmp(str,"body") == 0) { - dim = 1; - return atom2body; - } - - // return vector of rigid body masses, for owned+ghost bodies - // used by granular pair styles, indexed by atom2body - - if (strcmp(str,"masstotal") == 0) { - dim = 1; - - if (nmax_mass < nmax_body) { - memory->destroy(mass_body); - nmax_mass = nmax_body; - memory->create(mass_body,nmax_mass,"rigid:mass_body"); - } - - int n = nlocal_body + nghost_body; - for (int i = 0; i < n; i++) - mass_body[i] = body[i].mass; - - return mass_body; - } - - return NULL; -} - /* ---------------------------------------------------------------------- return temperature of collection of rigid bodies non-active DOF are removed by fflag/tflag and in tfactor diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index b6095e420e..6ece30bb2c 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -107,7 +107,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Append boundary must be shrink/minimum"); } else if (strcmp(arg[iarg],"freq") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command"); - freq = atoi(arg[iarg+1]); + freq = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"spatial") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix append/atoms command"); @@ -116,7 +116,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : "Bad fix ID in fix append/atoms command"); spatflag = 1; int n = strlen(arg[iarg+1]); - spatlead = atof(arg[iarg+2]); + spatlead = force->numeric(FLERR,arg[iarg+2]); char *suffix = new char[n]; strcpy(suffix,&arg[iarg+1][2]); n = strlen(suffix) + 1; @@ -126,15 +126,15 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : iarg += 3; } else if (strcmp(arg[iarg],"basis") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix append/atoms command"); - int ibasis = atoi(arg[iarg+1]); - int itype = atoi(arg[iarg+2]); + int ibasis = force->inumeric(FLERR,arg[iarg+1]); + int itype = force->inumeric(FLERR,arg[iarg+2]); if (ibasis <= 0 || ibasis > nbasis || itype <= 0 || itype > atom->ntypes) error->all(FLERR,"Invalid basis setting in fix append/atoms command"); basistype[ibasis-1] = itype; iarg += 3; } else if (strcmp(arg[iarg],"size") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command"); - size = atof(arg[iarg+1]); + size = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"units") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command"); @@ -145,20 +145,20 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"random") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal fix append/atoms command"); ranflag = 1; - ranx = atof(arg[iarg+1]); - rany = atof(arg[iarg+2]); - ranz = atof(arg[iarg+3]); - xseed = atoi(arg[iarg+4]); + ranx = force->numeric(FLERR,arg[iarg+1]); + rany = force->numeric(FLERR,arg[iarg+2]); + ranz = force->numeric(FLERR,arg[iarg+3]); + xseed = force->inumeric(FLERR,arg[iarg+4]); if (xseed <= 0) error->all(FLERR,"Illegal fix append/atoms command"); randomx = new RanMars(lmp,xseed + comm->me); iarg += 5; } else if (strcmp(arg[iarg],"temp") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal fix append/atoms command"); tempflag = 1; - t_target = atof(arg[iarg+1]); - t_period = atof(arg[iarg+2]); - tseed = atoi(arg[iarg+3]); - t_extent = atof(arg[iarg+4]); + t_target = force->numeric(FLERR,arg[iarg+1]); + t_period = force->numeric(FLERR,arg[iarg+2]); + tseed = force->inumeric(FLERR,arg[iarg+3]); + t_extent = force->numeric(FLERR,arg[iarg+4]); if (t_target <= 0) error->all(FLERR,"Illegal fix append/atoms command"); if (t_period <= 0) error->all(FLERR,"Illegal fix append/atoms command"); if (t_extent <= 0) error->all(FLERR,"Illegal fix append/atoms command"); diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index 3ee57d060f..7fe6e8ec1e 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -80,31 +80,31 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix msst command"); } - velocity = atof(arg[4]); + velocity = force->numeric(FLERR,arg[4]); if ( velocity < 0 ) error->all(FLERR,"Illegal fix msst command"); for ( int iarg = 5; iarg < narg; iarg++ ) { if ( strcmp(arg[iarg],"q") == 0 ) { - qmass = atof(arg[iarg+1]); + qmass = force->numeric(FLERR,arg[iarg+1]); iarg++; } else if ( strcmp(arg[iarg],"mu") == 0 ) { - mu = atof(arg[iarg+1]); + mu = force->numeric(FLERR,arg[iarg+1]); iarg++; } else if ( strcmp(arg[iarg],"p0") == 0 ) { - p0 = atof(arg[iarg+1]); + p0 = force->numeric(FLERR,arg[iarg+1]); iarg++; p0_set = 1; } else if ( strcmp(arg[iarg],"v0") == 0 ) { - v0 = atof(arg[iarg+1]); + v0 = force->numeric(FLERR,arg[iarg+1]); v0_set = 1; iarg++; } else if ( strcmp(arg[iarg],"e0") == 0 ) { - e0 = atof(arg[iarg+1]); + e0 = force->numeric(FLERR,arg[iarg+1]); e0_set = 1; iarg++; } else if ( strcmp(arg[iarg],"tscale") == 0 ) { - tscale = atof(arg[iarg+1]); + tscale = force->numeric(FLERR,arg[iarg+1]); if (tscale < 0.0 || tscale > 1.0) error->all(FLERR,"Fix msst tscale must satisfy 0 <= tscale < 1"); iarg++; diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp index 48b33db4e6..72e6e6e621 100644 --- a/src/SHOCK/fix_nphug.cpp +++ b/src/SHOCK/fix_nphug.cpp @@ -442,17 +442,17 @@ int FixNPHug::modify_param(int narg, char **arg) { if (strcmp(arg[0],"e0") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix nphug command"); - e0 = atof(arg[1]); + e0 = force->numeric(FLERR,arg[1]); e0_set = 1; return 2; } else if (strcmp(arg[0],"v0") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix nphug command"); - v0 = atof(arg[1]); + v0 = force->numeric(FLERR,arg[1]); v0_set = 1; return 2; } else if (strcmp(arg[0],"p0") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix nphug command"); - p0 = atof(arg[1]); + p0 = force->numeric(FLERR,arg[1]); p0_set = 1; return 2; } diff --git a/src/SHOCK/fix_wall_piston.cpp b/src/SHOCK/fix_wall_piston.cpp index e8686c197d..465b4e1432 100644 --- a/src/SHOCK/fix_wall_piston.cpp +++ b/src/SHOCK/fix_wall_piston.cpp @@ -73,23 +73,23 @@ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix wall/piston command only available at zlo"); else if (strcmp(arg[iarg],"vel") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix wall/piston command"); - vx = atof(arg[iarg+1]); - vy = atof(arg[iarg+2]); - vz = atof(arg[iarg+3]); + vx = force->numeric(FLERR,arg[iarg+1]); + vy = force->numeric(FLERR,arg[iarg+2]); + vz = force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"pos") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix wall/piston command"); - x0 = atof(arg[iarg+1]); - y0 = atof(arg[iarg+2]); - z0 = atof(arg[iarg+3]); + x0 = force->numeric(FLERR,arg[iarg+1]); + y0 = force->numeric(FLERR,arg[iarg+2]); + z0 = force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"temp") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal fix wall/piston command"); tempflag = 1; - t_target = atof(arg[iarg+1]); - t_period = atof(arg[iarg+2]); - tseed = atoi(arg[iarg+3]); - t_extent = atof(arg[iarg+4]); + t_target = force->numeric(FLERR,arg[iarg+1]); + t_period = force->numeric(FLERR,arg[iarg+2]); + tseed = force->inumeric(FLERR,arg[iarg+3]); + t_extent = force->numeric(FLERR,arg[iarg+4]); if (t_target <= 0) error->all(FLERR,"Illegal fix wall/piston command"); if (t_period <= 0) error->all(FLERR,"Illegal fix wall/piston command"); if (t_extent <= 0) error->all(FLERR,"Illegal fix wall/piston command"); @@ -100,7 +100,7 @@ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) : iarg += 5; } else if (strcmp(arg[iarg],"rough") == 0) { roughflag = 1; - roughdist = atof(arg[iarg+1]); + roughdist = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"ramp") == 0) { rampflag = 1; diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index 8b45da664e..022c377d99 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -77,15 +77,15 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) global_freq = 1; extvector = 0; - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); bigexist = 1; if (strcmp(arg[4],"NULL") == 0) bigexist = 0; else biggroup = group->find(arg[4]); - temperature_srd = atof(arg[5]); - gridsrd = atof(arg[6]); - int seed = atoi(arg[7]); + temperature_srd = force->numeric(FLERR,arg[5]); + gridsrd = force->numeric(FLERR,arg[6]); + int seed = force->inumeric(FLERR,arg[7]); // parse options @@ -108,7 +108,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) while (iarg < narg) { if (strcmp(arg[iarg],"lamda") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); - lamda = atof(arg[iarg+1]); + lamda = force->numeric(FLERR,arg[iarg+1]); lamdaflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"collision") == 0) { @@ -138,22 +138,22 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) iarg += 2; } else if (strcmp(arg[iarg],"radius") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); - radfactor = atof(arg[iarg+1]); + radfactor = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"bounce") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); - maxbounceallow = atoi(arg[iarg+1]); + maxbounceallow = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"search") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); - gridsearch = atof(arg[iarg+1]); + gridsearch = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"cubic") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix srd command"); if (strcmp(arg[iarg+1],"error") == 0) cubicflag = CUBIC_ERROR; else if (strcmp(arg[iarg+1],"warn") == 0) cubicflag = CUBIC_WARN; else error->all(FLERR,"Illegal fix srd command"); - cubictol = atof(arg[iarg+2]); + cubictol = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"shift") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix srd command"); @@ -161,7 +161,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) else if (strcmp(arg[iarg+1],"yes") == 0) shiftuser = SHIFT_YES; else if (strcmp(arg[iarg+1],"possible") == 0) shiftuser = SHIFT_POSSIBLE; else error->all(FLERR,"Illegal fix srd command"); - shiftseed = atoi(arg[iarg+2]); + shiftseed = force->inumeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"tstat") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); diff --git a/src/SRD/fix_wall_srd.cpp b/src/SRD/fix_wall_srd.cpp index 2fd302c601..4c9655a278 100644 --- a/src/SRD/fix_wall_srd.cpp +++ b/src/SRD/fix_wall_srd.cpp @@ -25,6 +25,7 @@ #include "variable.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -77,7 +78,7 @@ FixWallSRD::FixWallSRD(LAMMPS *lmp, int narg, char **arg) : strcpy(varstr[nwall],&arg[iarg+1][2]); } else { wallstyle[nwall] = CONSTANT; - coord0[nwall] = atof(arg[iarg+1]); + coord0[nwall] = force->numeric(FLERR,arg[iarg+1]); } nwall++; diff --git a/src/USER-AWPMD/pair_awpmd_cut.cpp b/src/USER-AWPMD/pair_awpmd_cut.cpp index 5c21d684d7..e9e763b84f 100644 --- a/src/USER-AWPMD/pair_awpmd_cut.cpp +++ b/src/USER-AWPMD/pair_awpmd_cut.cpp @@ -501,7 +501,7 @@ void PairAWPMDCut::coeff(int narg, char **arg) force->bounds(arg[1],atom->ntypes,jlo,jhi); double cut_one = cut_global; - if (narg == 3) cut_one = atof(arg[2]); + if (narg == 3) cut_one = force->numeric(FLERR,arg[2]); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-CG-CMM/angle_cg_cmm.cpp b/src/USER-CG-CMM/angle_cg_cmm.cpp index dbeb04f50c..8f9ddd3d6c 100644 --- a/src/USER-CG-CMM/angle_cg_cmm.cpp +++ b/src/USER-CG-CMM/angle_cg_cmm.cpp @@ -302,14 +302,14 @@ void AngleCGCMM::coeff(int narg, char **arg) int ilo,ihi; force->bounds(arg[0],atom->nangletypes,ilo,ihi); - double k_one = atof(arg[1]); - double theta0_one = atof(arg[2]); + double k_one = force->numeric(FLERR,arg[1]); + double theta0_one = force->numeric(FLERR,arg[2]); int cg_type_one=find_cg_type(arg[3]); if (cg_type_one == CG_NOT_SET) error->all(FLERR,"Error reading CG type flag."); - double epsilon_one = atof(arg[4]); - double sigma_one = atof(arg[5]); + double epsilon_one = force->numeric(FLERR,arg[4]); + double sigma_one = force->numeric(FLERR,arg[5]); // find minimum of LJ potential. we only want to include // the repulsive part of the 1-3 LJ. diff --git a/src/USER-EFF/fix_temp_rescale_eff.cpp b/src/USER-EFF/fix_temp_rescale_eff.cpp index 0482ae36d5..18ba739e0f 100644 --- a/src/USER-EFF/fix_temp_rescale_eff.cpp +++ b/src/USER-EFF/fix_temp_rescale_eff.cpp @@ -42,17 +42,17 @@ FixTempRescaleEff::FixTempRescaleEff(LAMMPS *lmp, int narg, char **arg) : { if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale/eff command"); - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix temp/rescale/eff command"); scalar_flag = 1; global_freq = nevery; extscalar = 1; - t_start = atof(arg[4]); - t_stop = atof(arg[5]); - t_window = atof(arg[6]); - fraction = atof(arg[7]); + t_start = force->numeric(FLERR,arg[4]); + t_stop = force->numeric(FLERR,arg[5]); + t_window = force->numeric(FLERR,arg[6]); + fraction = force->numeric(FLERR,arg[7]); // create a new compute temp/eff // id = fix-ID + temp, compute group = fix group diff --git a/src/USER-EFF/pair_eff_cut.cpp b/src/USER-EFF/pair_eff_cut.cpp index ffd1b467e2..12467b57bc 100644 --- a/src/USER-EFF/pair_eff_cut.cpp +++ b/src/USER-EFF/pair_eff_cut.cpp @@ -897,7 +897,7 @@ void PairEffCut::coeff(int narg, char **arg) force->bounds(arg[1],atom->ntypes,jlo,jhi); double cut_one = cut_global; - if (narg == 3) cut_one = atof(arg[2]); + if (narg == 3) cut_one = force->numeric(FLERR,arg[2]); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/fix_addtorque.cpp b/src/USER-MISC/fix_addtorque.cpp index f4dcba3f82..8283870c1c 100644 --- a/src/USER-MISC/fix_addtorque.cpp +++ b/src/USER-MISC/fix_addtorque.cpp @@ -56,7 +56,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) : xstr = new char[n]; strcpy(xstr,&arg[3][2]); } else { - xvalue = atof(arg[3]); + xvalue = force->numeric(FLERR,arg[3]); xstyle = CONSTANT; } if (strstr(arg[4],"v_") == arg[4]) { @@ -64,7 +64,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) : ystr = new char[n]; strcpy(ystr,&arg[4][2]); } else { - yvalue = atof(arg[4]); + yvalue = force->numeric(FLERR,arg[4]); ystyle = CONSTANT; } if (strstr(arg[5],"v_") == arg[5]) { @@ -72,7 +72,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) : zstr = new char[n]; strcpy(zstr,&arg[5][2]); } else { - zvalue = atof(arg[5]); + zvalue = force->numeric(FLERR,arg[5]); zstyle = CONSTANT; } diff --git a/src/USER-MISC/fix_imd.cpp b/src/USER-MISC/fix_imd.cpp index 3cc48aafbb..677ea09321 100644 --- a/src/USER-MISC/fix_imd.cpp +++ b/src/USER-MISC/fix_imd.cpp @@ -42,7 +42,7 @@ negotiate an appropriate license for such distribution." ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Axel Kohlmeyer (TempleU) + Contributing author: Axel Kohlmeyer (Temple U) IMD API, hash, and socket code written by: John E. Stone, Justin Gullingsrud, and James Phillips, (TCBG, Beckman Institute, UIUC) ------------------------------------------------------------------------- */ @@ -53,6 +53,7 @@ negotiate an appropriate license for such distribution." #include "update.h" #include "respa.h" #include "domain.h" +#include "force.h" #include "error.h" #include "group.h" #include "memory.h" @@ -62,7 +63,7 @@ negotiate an appropriate license for such distribution." #include #include -#if defined(_MSC_VER) || defined(__MINGW32_VERSION) +#if defined(_MSC_VER) || defined(__MINGW32__) #include #else #include @@ -447,7 +448,7 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal fix imd command"); - imd_port = atoi(arg[3]); + imd_port = force->inumeric(FLERR,arg[3]); if (imd_port < 1024) error->all(FLERR,"Illegal fix imd parameter: port < 1024"); @@ -474,9 +475,9 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) : nowait_flag = 0; } } else if (0 == strcmp(arg[argsdone], "fscale")) { - imd_fscale = atof(arg[argsdone+1]); + imd_fscale = force->numeric(FLERR,arg[argsdone+1]); } else if (0 == strcmp(arg[argsdone], "trate")) { - imd_trate = atoi(arg[argsdone+1]); + imd_trate = force->inumeric(FLERR,arg[argsdone+1]); } else { error->all(FLERR,"Unknown fix imd parameter"); } @@ -1179,7 +1180,7 @@ double FixIMD::memory_usage(void) ***************************************************************************/ int imdsock_init(void) { -#if defined(_MSC_VER) || defined(__MINGW32_VERSION) +#if defined(_MSC_VER) || defined(__MINGW32__) int rc = 0; static int initialized=0; @@ -1258,7 +1259,7 @@ void *imdsock_accept(void * v) { int imdsock_write(void * v, const void *buf, int len) { imdsocket *s = (imdsocket *) v; -#if defined(_MSC_VER) || defined(__MINGW32_VERSION) +#if defined(_MSC_VER) || defined(__MINGW32__) return send(s->sd, (const char*) buf, len, 0); /* windows lacks the write() call */ #else return write(s->sd, buf, len); @@ -1267,7 +1268,7 @@ int imdsock_write(void * v, const void *buf, int len) { int imdsock_read(void * v, void *buf, int len) { imdsocket *s = (imdsocket *) v; -#if defined(_MSC_VER) || defined(__MINGW32_VERSION) +#if defined(_MSC_VER) || defined(__MINGW32__) return recv(s->sd, (char*) buf, len, 0); /* windows lacks the read() call */ #else return read(s->sd, buf, len); @@ -1280,7 +1281,7 @@ void imdsock_shutdown(void *v) { if (s == NULL) return; -#if defined(_MSC_VER) || defined(__MINGW32_VERSION) +#if defined(_MSC_VER) || defined(__MINGW32__) shutdown(s->sd, SD_SEND); #else shutdown(s->sd, 1); /* complete sends and send FIN */ @@ -1292,7 +1293,7 @@ void imdsock_destroy(void * v) { if (s == NULL) return; -#if defined(_MSC_VER) || defined(__MINGW32_VERSION) +#if defined(_MSC_VER) || defined(__MINGW32__) closesocket(s->sd); #else close(s->sd); diff --git a/src/USER-MISC/fix_smd.cpp b/src/USER-MISC/fix_smd.cpp index 76f30cb9c7..86ee3500cd 100644 --- a/src/USER-MISC/fix_smd.cpp +++ b/src/USER-MISC/fix_smd.cpp @@ -26,6 +26,7 @@ #include "respa.h" #include "domain.h" #include "error.h" +#include "force.h" #include "group.h" using namespace LAMMPS_NS; @@ -60,13 +61,13 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[argoffs],"cvel") == 0) { if (narg < argoffs+3) error->all(FLERR,"Illegal fix smd command"); styleflag |= SMD_CVEL; - k_smd = atof(arg[argoffs+1]); - v_smd = atof(arg[argoffs+2]); // to be multiplied by update->dt when used. + k_smd = force->numeric(FLERR,arg[argoffs+1]); + v_smd = force->numeric(FLERR,arg[argoffs+2]); // to be multiplied by update->dt when used. argoffs += 3; } else if (strcmp(arg[argoffs],"cfor") == 0) { if (narg < argoffs+2) error->all(FLERR,"Illegal fix smd command"); styleflag |= SMD_CFOR; - f_smd = atof(arg[argoffs+1]); + f_smd = force->numeric(FLERR,arg[argoffs+1]); argoffs += 2; } else error->all(FLERR,"Illegal fix smd command"); @@ -74,12 +75,12 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) : if (narg < argoffs+5) error->all(FLERR,"Illegal fix smd command"); styleflag |= SMD_TETHER; if (strcmp(arg[argoffs+1],"NULL") == 0) xflag = 0; - else xc = atof(arg[argoffs+1]); + else xc = force->numeric(FLERR,arg[argoffs+1]); if (strcmp(arg[argoffs+2],"NULL") == 0) yflag = 0; - else yc = atof(arg[argoffs+2]); + else yc = force->numeric(FLERR,arg[argoffs+2]); if (strcmp(arg[argoffs+3],"NULL") == 0) zflag = 0; - else zc = atof(arg[argoffs+3]); - r0 = atof(arg[argoffs+4]); + else zc = force->numeric(FLERR,arg[argoffs+3]); + r0 = force->numeric(FLERR,arg[argoffs+4]); if (r0 < 0) error->all(FLERR,"R0 < 0 for fix smd command"); argoffs += 5; } else if (strcmp(arg[argoffs],"couple") == 0) { @@ -94,15 +95,15 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[argoffs+2],"NULL") == 0) xflag = 0; else if (strcmp(arg[argoffs+2],"auto") == 0) styleflag |= SMD_AUTOX; - else xc = atof(arg[argoffs+2]); + else xc = force->numeric(FLERR,arg[argoffs+2]); if (strcmp(arg[argoffs+3],"NULL") == 0) yflag = 0; else if (strcmp(arg[argoffs+3],"auto") == 0) styleflag |= SMD_AUTOY; - else yc = atof(arg[argoffs+3]); + else yc = force->numeric(FLERR,arg[argoffs+3]); if (strcmp(arg[argoffs+4],"NULL") == 0) zflag = 0; else if (strcmp(arg[argoffs+4],"auto") == 0) styleflag |= SMD_AUTOZ; - else zc = atof(arg[argoffs+4]); + else zc = force->numeric(FLERR,arg[argoffs+4]); - r0 = atof(arg[argoffs+5]); + r0 = force->numeric(FLERR,arg[argoffs+5]); if (r0 < 0) error->all(FLERR,"R0 < 0 for fix smd command"); argoffs +=6; } else error->all(FLERR,"Illegal fix smd command"); diff --git a/src/USER-OMP/fix_nphug_omp.cpp b/src/USER-OMP/fix_nphug_omp.cpp index 273ba4c450..57bc1fc2a1 100644 --- a/src/USER-OMP/fix_nphug_omp.cpp +++ b/src/USER-OMP/fix_nphug_omp.cpp @@ -442,17 +442,17 @@ int FixNPHugOMP::modify_param(int narg, char **arg) { if (strcmp(arg[0],"e0") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix nphug/omp command"); - e0 = atof(arg[1]); + e0 = force->numeric(FLERR,arg[1]); e0_set = 1; return 2; } else if (strcmp(arg[0],"v0") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix nphug/omp command"); - v0 = atof(arg[1]); + v0 = force->numeric(FLERR,arg[1]); v0_set = 1; return 2; } else if (strcmp(arg[0],"p0") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix nphug/omp command"); - p0 = atof(arg[1]); + p0 = force->numeric(FLERR,arg[1]); p0_set = 1; return 2; } diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index e16066081b..a29451a2b1 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -80,7 +80,7 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) #pragma omp parallel default(none) shared(nthreads) nthreads = omp_get_num_threads(); else - nthreads = atoi(arg[3]); + nthreads = force->inumeric(FLERR,arg[3]); #endif } diff --git a/src/USER-OMP/msm_cg_omp.cpp b/src/USER-OMP/msm_cg_omp.cpp index 1c3369be76..5120cfb318 100644 --- a/src/USER-OMP/msm_cg_omp.cpp +++ b/src/USER-OMP/msm_cg_omp.cpp @@ -51,7 +51,7 @@ MSMCGOMP::MSMCGOMP(LAMMPS *lmp, int narg, char **arg) : MSMOMP(lmp, narg, arg) triclinic_support = 0; - if (narg == 2) smallq = atof(arg[1]); + if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1])); else smallq = SMALLQ; num_charged = -1; diff --git a/src/USER-PHONON/fix_phonon.cpp b/src/USER-PHONON/fix_phonon.cpp index da37819e59..ee01f7258f 100644 --- a/src/USER-PHONON/fix_phonon.cpp +++ b/src/USER-PHONON/fix_phonon.cpp @@ -51,10 +51,10 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (narg < 8) error->all(FLERR,"Illegal fix phonon command: number of arguments < 8"); - nevery = atoi(arg[3]); // Calculate this fix every n steps! + nevery = force->inumeric(FLERR,arg[3]); // Calculate this fix every n steps! if (nevery < 1) error->all(FLERR,"Illegal fix phonon command"); - nfreq = atoi(arg[4]); // frequency to output result + nfreq = force->inumeric(FLERR,arg[4]); // frequency to output result if (nfreq < 1) error->all(FLERR,"Illegal fix phonon command"); waitsteps = ATOBIGINT(arg[5]); // Wait this many timesteps before actually measuring @@ -78,11 +78,11 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) while (iarg < narg){ if (strcmp(arg[iarg],"sysdim") == 0){ if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command line options."); - sdim = atoi(arg[iarg]); + sdim = force->inumeric(FLERR,arg[iarg]); } else if (strcmp(arg[iarg],"nasr") == 0){ if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command line options."); - nasr = atoi(arg[iarg]); + nasr = force->inumeric(FLERR,arg[iarg]); } else { error->all(FLERR,"Illegal fix phonon command: unknown option read!"); diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 6d6d8982ef..8ebf8fcfd5 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -58,10 +58,10 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : { if (narg != 8) error->all(FLERR,"Illegal fix qeq/reax command"); - nevery = atoi(arg[3]); - swa = atof(arg[4]); - swb = atof(arg[5]); - tolerance = atof(arg[6]); + nevery = force->inumeric(FLERR,arg[3]); + swa = force->numeric(FLERR,arg[4]); + swb = force->numeric(FLERR,arg[5]); + tolerance = force->numeric(FLERR,arg[6]); pertype_parameters(arg[7]); shld = NULL; diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index 3b9cce52d2..92a542e1f2 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -53,7 +53,7 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : ntypes = atom->ntypes; nmax = atom->nmax; - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0 ) error->all(FLERR,"Illegal fix reax/c/bonds command"); @@ -158,6 +158,7 @@ void FixReaxCBonds::Output_ReaxC_Bonds(bigint ntimestep, FILE *fp) // allocate a temporary buffer for the snapshot info MPI_Allreduce(&numbonds,&numbonds_max,1,MPI_INT,MPI_MAX,world); MPI_Allreduce(&nlocal,&nlocal_max,1,MPI_INT,MPI_MAX,world); + nbuf = 1+(numbonds_max*2+10)*nlocal_max; memory->create(buf,nbuf,"reax/c/bonds:buf"); for (i = 0; i < nbuf; i ++) buf[i] = 0.0; diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index 3f07954342..56dd17f828 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -58,9 +58,9 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_size(world,&nprocs); ntypes = atom->ntypes; - nevery = atoi(arg[3]); - nrepeat = atoi(arg[4]); - global_freq = nfreq = atoi(arg[5]); + nevery = force->inumeric(FLERR,arg[3]); + nrepeat = force->inumeric(FLERR,arg[4]); + global_freq = nfreq = force->inumeric(FLERR,arg[5]); comm_forward = 1; @@ -127,9 +127,9 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : // set BO cutoff if (strcmp(arg[iarg],"cutoff") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix reax/c/species command"); - itype = atoi(arg[iarg+1]); - jtype = atoi(arg[iarg+2]); - bo_cut = atof(arg[iarg+3]); + itype = force->inumeric(FLERR,arg[iarg+1]); + jtype = force->inumeric(FLERR,arg[iarg+2]); + bo_cut = force->numeric(FLERR,arg[iarg+3]); if (itype > ntypes || jtype > ntypes) error->all(FLERR,"Illegal fix reax/c/species command"); if (itype <= 0 || jtype <= 0) @@ -154,7 +154,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"position") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix species command"); posflag = 1; - posfreq = atoi(arg[iarg+1]); + posfreq = force->inumeric(FLERR,arg[iarg+1]); filepos = new char[n]; strcpy(filepos,arg[iarg+2]); if (strchr(filepos,'*')) { diff --git a/src/USER-REAXC/pair_reax_c.cpp b/src/USER-REAXC/pair_reax_c.cpp index 1f5ee66a97..4c1eea4f53 100644 --- a/src/USER-REAXC/pair_reax_c.cpp +++ b/src/USER-REAXC/pair_reax_c.cpp @@ -228,14 +228,14 @@ void PairReaxC::settings(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"safezone") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); - system->safezone = atof(arg[iarg+1]); + system->safezone = force->numeric(FLERR,arg[iarg+1]); if (system->safezone < 0.0) error->all(FLERR,"Illegal pair_style reax/c safezone command"); system->saferzone = system->safezone + 0.2; iarg += 2; } else if (strcmp(arg[iarg],"mincap") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); - system->mincap = atoi(arg[iarg+1]); + system->mincap = force->inumeric(FLERR,arg[iarg+1]); if (system->mincap < 0) error->all(FLERR,"Illegal pair_style reax/c mincap command"); iarg += 2; diff --git a/src/XTC/dump_xtc.cpp b/src/XTC/dump_xtc.cpp index 4dd5e66dd0..25d0feebf9 100644 --- a/src/XTC/dump_xtc.cpp +++ b/src/XTC/dump_xtc.cpp @@ -34,6 +34,7 @@ #include "group.h" #include "output.h" #include "error.h" +#include "force.h" #include "memory.h" using namespace LAMMPS_NS; @@ -272,7 +273,7 @@ int DumpXTC::modify_param(int narg, char **arg) return 2; } else if (strcmp(arg[0],"precision") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - precision = atof(arg[1]); + precision = force->numeric(FLERR,arg[1]); if ((fabs(precision-10.0) > EPS) && (fabs(precision-100.0) > EPS) && (fabs(precision-1000.0) > EPS) && (fabs(precision-10000.0) > EPS) && (fabs(precision-100000.0) > EPS) &&