From 0e045500433faebfd2848e860c28f1250ce154ee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 23 Jun 2013 14:34:38 +0200 Subject: [PATCH] massive patch to flag non-numeric input --- src/BODY/body_nparticle.cpp | 5 +- src/DIPOLE/pair_lj_cut_dipole_long.cpp | 10 +-- src/FLD/pair_brownian.cpp | 22 ++--- src/FLD/pair_lubricate.cpp | 18 ++-- src/FLD/pair_lubricateU.cpp | 18 ++-- src/FLD/pair_lubricateU_poly.cpp | 14 ++-- src/GPU/fix_gpu.cpp | 10 +-- src/GRANULAR/fix_pour.cpp | 44 +++++----- src/GRANULAR/fix_wall_gran.cpp | 32 +++---- src/KSPACE/ewald.cpp | 2 +- src/KSPACE/ewald_disp.cpp | 2 +- src/KSPACE/fix_tune_kspace.cpp | 2 +- src/KSPACE/msm.cpp | 2 +- src/KSPACE/msm_cg.cpp | 2 +- src/KSPACE/pppm.cpp | 2 +- src/KSPACE/pppm_cg.cpp | 2 +- src/KSPACE/pppm_disp.cpp | 2 +- src/KSPACE/pppm_old.cpp | 2 +- src/MC/fix_bond_break.cpp | 10 +-- src/MC/fix_bond_create.cpp | 22 ++--- src/MC/fix_bond_swap.cpp | 6 +- src/MC/fix_gcmc.cpp | 22 ++--- src/MOLECULE/angle_cosine_periodic.cpp | 6 +- src/MOLECULE/improper_umbrella.cpp | 4 +- src/PERI/pair_peri_lps.cpp | 10 +-- src/REAX/fix_reax_bonds.cpp | 2 +- src/REPLICA/compute_event_displace.cpp | 3 +- src/REPLICA/fix_neb.cpp | 3 +- src/REPLICA/neb.cpp | 11 +-- src/REPLICA/prd.cpp | 22 ++--- src/REPLICA/tad.cpp | 30 +++---- src/REPLICA/temper.cpp | 12 +-- src/RIGID/fix_rigid.cpp | 54 ++++++------ src/RIGID/fix_rigid_small.cpp | 8 +- src/SHOCK/fix_append_atoms.cpp | 26 +++--- src/SHOCK/fix_msst.cpp | 14 ++-- src/SHOCK/fix_nphug.cpp | 6 +- src/SHOCK/fix_wall_piston.cpp | 22 ++--- src/SRD/fix_srd.cpp | 20 ++--- src/SRD/fix_wall_srd.cpp | 3 +- src/USER-AWPMD/pair_awpmd_cut.cpp | 2 +- src/USER-CG-CMM/angle_cg_cmm.cpp | 8 +- src/USER-COLVARS/fix_colvars.cpp | 2 +- src/USER-CUDA/compute_temp_partial_cuda.cpp | 6 +- src/USER-CUDA/cuda.cpp | 12 +-- src/USER-CUDA/fix_addforce_cuda.cpp | 7 +- src/USER-CUDA/fix_aveforce_cuda.cpp | 7 +- src/USER-CUDA/fix_gravity_cuda.cpp | 23 ++--- src/USER-CUDA/fix_nh_cuda.cpp | 74 ++++++++-------- src/USER-CUDA/fix_set_force_cuda.cpp | 7 +- src/USER-CUDA/fix_shake_cuda.cpp | 14 ++-- src/USER-CUDA/fix_temp_berendsen_cuda.cpp | 6 +- src/USER-CUDA/fix_temp_rescale_cuda.cpp | 10 +-- src/USER-CUDA/fix_temp_rescale_limit_cuda.cpp | 12 +-- src/USER-CUDA/pppm_cuda.cpp | 2 +- src/USER-EFF/fix_temp_rescale_eff.cpp | 10 +-- src/USER-EFF/pair_eff_cut.cpp | 2 +- src/USER-MISC/fix_addtorque.cpp | 6 +- src/USER-MISC/fix_imd.cpp | 7 +- src/USER-MISC/fix_smd.cpp | 23 ++--- src/USER-MISC/fix_spring_pull.cpp | 20 +++-- src/USER-OMP/fix_nphug_omp.cpp | 6 +- src/USER-OMP/fix_omp.cpp | 2 +- src/USER-OMP/msm_cg_omp.cpp | 2 +- src/USER-PHONON/fix_phonon.cpp | 8 +- src/USER-REAXC/fix_qeq_reax.cpp | 8 +- src/USER-REAXC/fix_reaxc_bonds.cpp | 2 +- src/USER-REAXC/fix_reaxc_species.cpp | 14 ++-- src/USER-REAXC/pair_reax_c.cpp | 4 +- src/XTC/dump_xtc.cpp | 3 +- src/balance.cpp | 4 +- src/change_box.cpp | 15 ++-- src/comm.cpp | 20 ++--- src/compute.cpp | 3 +- src/compute_centro_atom.cpp | 2 +- src/compute_cluster_atom.cpp | 2 +- src/compute_cna_atom.cpp | 2 +- src/compute_coord_atom.cpp | 2 +- src/compute_rdf.cpp | 2 +- src/compute_slice.cpp | 7 +- src/compute_temp_partial.cpp | 6 +- src/compute_temp_profile.cpp | 30 +++---- src/compute_temp_ramp.cpp | 24 +++--- src/create_atoms.cpp | 17 ++-- src/create_box.cpp | 2 +- src/delete_atoms.cpp | 6 +- src/delete_bonds.cpp | 2 +- src/displace_atoms.cpp | 53 ++++++------ src/dump.cpp | 11 +-- src/dump_custom.cpp | 4 +- src/dump_image.cpp | 48 +++++------ src/dump_local.cpp | 3 +- src/fix_adapt.cpp | 2 +- src/fix_addforce.cpp | 7 +- src/fix_ave_atom.cpp | 7 +- src/fix_ave_correlate.cpp | 11 +-- src/fix_ave_histo.cpp | 17 ++-- src/fix_ave_spatial.cpp | 12 +-- src/fix_ave_time.cpp | 13 +-- src/fix_aveforce.cpp | 7 +- src/fix_balance.cpp | 6 +- src/fix_box_relax.cpp | 28 +++---- src/fix_deform.cpp | 36 ++++---- src/fix_deposit.cpp | 42 +++++----- src/fix_drag.cpp | 11 +-- src/fix_dt_reset.cpp | 8 +- src/fix_efield.cpp | 6 +- src/fix_evaporate.cpp | 6 +- src/fix_external.cpp | 7 +- src/fix_gravity.cpp | 15 ++-- src/fix_heat.cpp | 4 +- src/fix_indent.cpp | 27 +++--- src/fix_langevin.cpp | 12 +-- src/fix_lineforce.cpp | 7 +- src/fix_momentum.cpp | 9 +- src/fix_move.cpp | 28 +++---- src/fix_nh.cpp | 80 +++++++++--------- src/fix_nve_limit.cpp | 2 +- src/fix_orient_fcc.cpp | 13 +-- src/fix_planeforce.cpp | 7 +- src/fix_press_berendsen.cpp | 32 +++---- src/fix_print.cpp | 3 +- src/fix_read_restart.cpp | 5 +- src/fix_recenter.cpp | 7 +- src/fix_respa.cpp | 3 +- src/fix_restrain.cpp | 18 ++-- src/fix_setforce.cpp | 7 +- src/fix_shake.cpp | 14 ++-- src/fix_spring.cpp | 21 ++--- src/fix_spring_rg.cpp | 5 +- src/fix_spring_self.cpp | 3 +- src/fix_store.cpp | 5 +- src/fix_store_state.cpp | 3 +- src/fix_temp_berendsen.cpp | 6 +- src/fix_temp_rescale.cpp | 10 +-- src/fix_thermal_conductivity.cpp | 6 +- src/fix_tmd.cpp | 4 +- src/fix_ttm.cpp | 22 ++--- src/fix_viscosity.cpp | 9 +- src/fix_viscous.cpp | 7 +- src/fix_wall.cpp | 9 +- src/fix_wall_reflect.cpp | 3 +- src/fix_wall_region.cpp | 7 +- src/force.cpp | 20 ++--- src/group.cpp | 4 +- src/image.cpp | 15 ++-- src/input.cpp | 6 +- src/kspace.cpp | 26 +++--- src/min.cpp | 2 +- src/minimize.cpp | 9 +- src/neighbor.cpp | 16 ++-- src/output.cpp | 8 +- src/pair.cpp | 22 ++--- src/pair_beck.cpp | 14 ++-- src/pair_born.cpp | 2 +- src/pair_gauss.cpp | 8 +- src/pair_hybrid.cpp | 2 +- src/pair_hybrid_overlay.cpp | 2 +- src/pair_lj96_cut.cpp | 6 +- src/pair_lj_smooth_linear.cpp | 8 +- src/region.cpp | 13 +-- src/region_block.cpp | 13 +-- src/region_cone.cpp | 37 ++++---- src/region_cylinder.cpp | 27 +++--- src/region_intersect.cpp | 3 +- src/region_plane.cpp | 13 +-- src/region_prism.cpp | 18 ++-- src/region_sphere.cpp | 9 +- src/region_union.cpp | 3 +- src/replicate.cpp | 6 +- src/rerun.cpp | 5 +- src/respa.cpp | 30 +++---- src/run.cpp | 3 +- src/set.cpp | 84 +++++++++---------- src/thermo.cpp | 2 +- src/universe.cpp | 3 +- src/variable.cpp | 9 +- src/velocity.cpp | 36 ++++---- 178 files changed, 1134 insertions(+), 1070 deletions(-) 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 100644 --- 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 100644 --- 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/FLD/pair_lubricateU_poly.cpp b/src/FLD/pair_lubricateU_poly.cpp index ae26bee060..894c778789 100644 --- a/src/FLD/pair_lubricateU_poly.cpp +++ b/src/FLD/pair_lubricateU_poly.cpp @@ -1127,15 +1127,15 @@ void PairLubricateUPoly::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 >= 6) flagHI = atoi(arg[5]); - if (narg == 7) flagVF = atoi(arg[6]); + if (narg >= 6) flagHI = force->inumeric(FLERR,arg[5]); + if (narg == 7) flagVF = force->inumeric(FLERR,arg[6]); if (flaglog == 1 && flagHI == 0) { error->warning(FLERR,"Cannot include log terms without 1/r terms; " diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index 5cc6f5d52f..f15709e8b9 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -68,8 +68,8 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix GPU command"); - first_gpu = atoi(arg[4]); - last_gpu = atoi(arg[5]); + first_gpu = force->inumeric(FLERR,arg[4]); + last_gpu = force->inumeric(FLERR,arg[5]); _particle_split = force->numeric(FLERR,arg[6]); if (_particle_split==0 || _particle_split>1) @@ -84,11 +84,11 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix GPU command"); if (strcmp(arg[iarg],"threads_per_atom") == 0) - threads_per_atom = atoi(arg[iarg+1]); + threads_per_atom = force->inumeric(FLERR,arg[iarg+1]); else if (strcmp(arg[iarg],"nthreads") == 0) - nthreads = atoi(arg[iarg+1]); + nthreads = force->inumeric(FLERR,arg[iarg+1]); else if (strcmp(arg[iarg],"cellsize") == 0) - cell_size = atof(arg[iarg+1]); + cell_size = force->numeric(FLERR,arg[iarg+1]); else error->all(FLERR,"Illegal fix GPU command"); 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 cf4618ace7..c26283d8bc 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -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/fix_tune_kspace.cpp b/src/KSPACE/fix_tune_kspace.cpp index 93cf7208c2..ec630db068 100644 --- a/src/KSPACE/fix_tune_kspace.cpp +++ b/src/KSPACE/fix_tune_kspace.cpp @@ -63,7 +63,7 @@ FixTuneKspace::FixTuneKspace(LAMMPS *lmp, int narg, char **arg) : // parse arguments - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); // set up reneighboring diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index 1c473ac201..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]; 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 5bacae48be..de82016891 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/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 8379bb4078..13ee4679c2 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -70,7 +70,7 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) triclinic_support = 0; pppmflag = dispersionflag = 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_old.cpp b/src/KSPACE/pppm_old.cpp index f050c734c9..911e296b1c 100644 --- a/src/KSPACE/pppm_old.cpp +++ b/src/KSPACE/pppm_old.cpp @@ -64,7 +64,7 @@ PPPMOld::PPPMOld(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/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index ff6c52507c..0ae5ae94be 100644 --- 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 100644 --- 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/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 6adf05e4af..3bd5809e2f 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -31,6 +31,7 @@ #include "timer.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -105,11 +106,11 @@ void NEB::command(int narg, char **arg) if (narg != 6) error->universe_all(FLERR,"Illegal NEB command"); - etol = atof(arg[0]); - ftol = atof(arg[1]); - n1steps = atoi(arg[2]); - n2steps = atoi(arg[3]); - nevery = atoi(arg[4]); + etol = force->numeric(FLERR,arg[0]); + ftol = force->numeric(FLERR,arg[1]); + n1steps = force->inumeric(FLERR,arg[2]); + n2steps = force->inumeric(FLERR,arg[3]); + nevery = force->inumeric(FLERR,arg[4]); infile = arg[5]; // error checks diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index 5dd7e90b9a..5a434b9499 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -73,15 +73,15 @@ void PRD::command(int narg, char **arg) if (narg < 7) error->universe_all(FLERR,"Illegal prd command"); - nsteps = atoi(arg[0]); - t_event = atoi(arg[1]); - n_dephase = atoi(arg[2]); - t_dephase = atoi(arg[3]); - t_corr = atoi(arg[4]); + nsteps = force->inumeric(FLERR,arg[0]); + t_event = force->inumeric(FLERR,arg[1]); + n_dephase = force->inumeric(FLERR,arg[2]); + t_dephase = force->inumeric(FLERR,arg[3]); + t_corr = force->inumeric(FLERR,arg[4]); char *id_compute = new char[strlen(arg[5])+1]; strcpy(id_compute,arg[5]); - int seed = atoi(arg[6]); + int seed = force->inumeric(FLERR,arg[6]); options(narg-7,&arg[7]); @@ -800,17 +800,17 @@ void PRD::options(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"min") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal prd command"); - etol = atof(arg[iarg+1]); - ftol = atof(arg[iarg+2]); - maxiter = atoi(arg[iarg+3]); - maxeval = atoi(arg[iarg+4]); + etol = force->numeric(FLERR,arg[iarg+1]); + ftol = force->numeric(FLERR,arg[iarg+2]); + maxiter = force->inumeric(FLERR,arg[iarg+3]); + maxeval = force->inumeric(FLERR,arg[iarg+4]); if (maxiter < 0) error->all(FLERR,"Illegal prd command"); iarg += 5; } else if (strcmp(arg[iarg],"temp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal prd command"); temp_flag = 1; - temp_dephase = atof(arg[iarg+1]); + temp_dephase = force->numeric(FLERR,arg[iarg+1]); if (temp_dephase <= 0.0) error->all(FLERR,"Illegal prd command"); iarg += 2; diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index 15ed1dd35d..9084d08a06 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -91,12 +91,12 @@ void TAD::command(int narg, char **arg) if (narg < 7) error->universe_all(FLERR,"Illegal tad command"); - nsteps = atoi(arg[0]); - t_event = atoi(arg[1]); - templo = atof(arg[2]); - temphi = atof(arg[3]); - delta_conf = atof(arg[4]); - tmax = atof(arg[5]); + nsteps = force->inumeric(FLERR,arg[0]); + t_event = force->inumeric(FLERR,arg[1]); + templo = force->numeric(FLERR,arg[2]); + temphi = force->numeric(FLERR,arg[3]); + delta_conf = force->numeric(FLERR,arg[4]); + tmax = force->numeric(FLERR,arg[5]); char *id_compute = new char[strlen(arg[6])+1]; strcpy(id_compute,arg[6]); @@ -596,10 +596,10 @@ void TAD::options(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"min") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal tad command"); - etol = atof(arg[iarg+1]); - ftol = atof(arg[iarg+2]); - maxiter = atoi(arg[iarg+3]); - maxeval = atoi(arg[iarg+4]); + etol = force->numeric(FLERR,arg[iarg+1]); + ftol = force->numeric(FLERR,arg[iarg+2]); + maxiter = force->inumeric(FLERR,arg[iarg+3]); + maxeval = force->inumeric(FLERR,arg[iarg+4]); if (maxiter < 0 || maxeval < 0 || etol < 0.0 || ftol < 0.0 ) error->all(FLERR,"Illegal tad command"); @@ -607,11 +607,11 @@ void TAD::options(int narg, char **arg) } else if (strcmp(arg[iarg],"neb") == 0) { if (iarg+6 > narg) error->all(FLERR,"Illegal tad command"); - etol_neb = atof(arg[iarg+1]); - ftol_neb = atof(arg[iarg+2]); - n1steps_neb = atoi(arg[iarg+3]); - n2steps_neb = atoi(arg[iarg+4]); - nevery_neb = atoi(arg[iarg+5]); + etol_neb = force->numeric(FLERR,arg[iarg+1]); + ftol_neb = force->numeric(FLERR,arg[iarg+2]); + n1steps_neb = force->inumeric(FLERR,arg[iarg+3]); + n2steps_neb = force->inumeric(FLERR,arg[iarg+4]); + nevery_neb = force->inumeric(FLERR,arg[iarg+5]); if (etol_neb < 0.0 || ftol_neb < 0.0 || n1steps_neb < 0 || n2steps_neb < 0 || nevery_neb < 0) error->all(FLERR,"Illegal tad command"); diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 9a229495fa..d23181dc72 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -70,20 +70,20 @@ void Temper::command(int narg, char **arg) if (narg != 6 && narg != 7) error->universe_all(FLERR,"Illegal temper command"); - int nsteps = atoi(arg[0]); - nevery = atoi(arg[1]); - double temp = atof(arg[2]); + int nsteps = force->inumeric(FLERR,arg[0]); + nevery = force->inumeric(FLERR,arg[1]); + double temp = force->numeric(FLERR,arg[2]); for (whichfix = 0; whichfix < modify->nfix; whichfix++) if (strcmp(arg[3],modify->fix[whichfix]->id) == 0) break; if (whichfix == modify->nfix) error->universe_all(FLERR,"Tempering fix ID is not defined"); - seed_swap = atoi(arg[4]); - seed_boltz = atoi(arg[5]); + seed_swap = force->inumeric(FLERR,arg[4]); + seed_boltz = force->inumeric(FLERR,arg[5]); my_set_temp = universe->iworld; - if (narg == 7) my_set_temp = atoi(arg[6]); + if (narg == 7) my_set_temp = force->inumeric(FLERR,arg[6]); // swap frequency must evenly divide total # of timesteps diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index 69431394ea..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) { diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index dba76f60da..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"); 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-COLVARS/fix_colvars.cpp b/src/USER-COLVARS/fix_colvars.cpp index 78173b809d..9968f193d3 100644 --- a/src/USER-COLVARS/fix_colvars.cpp +++ b/src/USER-COLVARS/fix_colvars.cpp @@ -325,7 +325,7 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) : } else if (0 == strcmp(arg[argsdone], "output")) { out_name = strdup(arg[argsdone+1]); } else if (0 == strcmp(arg[argsdone], "seed")) { - rng_seed = atoi(arg[argsdone+1]); + rng_seed = force->inumeric(FLERR,arg[argsdone+1]); } else if (0 == strcmp(arg[argsdone], "unwrap")) { if (0 == strcmp(arg[argsdone+1], "yes")) { unwrap_flag = 1; diff --git a/src/USER-CUDA/compute_temp_partial_cuda.cpp b/src/USER-CUDA/compute_temp_partial_cuda.cpp index f3448a407d..4d5a2fa9df 100644 --- a/src/USER-CUDA/compute_temp_partial_cuda.cpp +++ b/src/USER-CUDA/compute_temp_partial_cuda.cpp @@ -71,9 +71,9 @@ ComputeTempPartialCuda::ComputeTempPartialCuda(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/USER-CUDA/cuda.cpp b/src/USER-CUDA/cuda.cpp index b4515716ad..ccd6927a46 100644 --- a/src/USER-CUDA/cuda.cpp +++ b/src/USER-CUDA/cuda.cpp @@ -213,14 +213,14 @@ void Cuda::accelerator(int narg, char** arg) if(++i == narg) error->all(FLERR, "Invalid Options for 'accelerator' command. Expecting a number after 'gpu/node' option."); - pppn = atoi(arg[i]); + pppn = force->inumeric(FLERR,arg[i]); } if(strcmp(arg[i], "gpu/node/special") == 0) { if(++i == narg) error->all(FLERR, "Invalid Options for 'accelerator' command. Expecting number of GPUs to be used per node after keyword 'gpu/node/special'."); - pppn = atoi(arg[i]); + pppn = force->inumeric(FLERR,arg[i]); if(pppn < 1) error->all(FLERR, "Invalid Options for 'accelerator' command. Expecting number of GPUs to be used per node after keyword 'gpu/node special'."); @@ -231,7 +231,7 @@ void Cuda::accelerator(int narg, char** arg) for(int k = 0; k < pppn; k++) { i++; - devicelist[k] = atoi(arg[i]); + devicelist[k] = force->inumeric(FLERR,arg[i]); } } @@ -239,7 +239,7 @@ void Cuda::accelerator(int narg, char** arg) if(++i == narg) error->all(FLERR, "Invalid Options for 'accelerator' command. Expecting a number after 'pinned' option."); - pinned = atoi(arg[i]) == 0 ? false : true; + pinned = force->inumeric(FLERR,arg[i]) == 0 ? false : true; if((pinned == false) && (universe->me == 0)) printf(" #CUDA: Pinned memory is not used for communication\n"); } @@ -263,7 +263,7 @@ void Cuda::accelerator(int narg, char** arg) if(++i == narg) error->all(FLERR, "Invalid Options for 'accelerator' command. Expecting a number after 'test' option."); - testatom = atof(arg[i]); + testatom = force->numeric(FLERR,arg[i]); dotestatom = true; } @@ -271,7 +271,7 @@ void Cuda::accelerator(int narg, char** arg) if(++i == narg) error->all(FLERR, "Invalid Options for 'accelerator' command. Expecting a number after 'override/bpa' option."); - shared_data.pair.override_block_per_atom = atoi(arg[i]); + shared_data.pair.override_block_per_atom = force->inumeric(FLERR,arg[i]); } } diff --git a/src/USER-CUDA/fix_addforce_cuda.cpp b/src/USER-CUDA/fix_addforce_cuda.cpp index 03519b80a9..9503e1d828 100644 --- a/src/USER-CUDA/fix_addforce_cuda.cpp +++ b/src/USER-CUDA/fix_addforce_cuda.cpp @@ -30,6 +30,7 @@ #include "update.h" #include "respa.h" #include "error.h" +#include "force.h" #include "domain.h" #include "cuda.h" #include "memory.h" @@ -58,9 +59,9 @@ FixAddForceCuda::FixAddForceCuda(LAMMPS *lmp, int narg, char **arg) : extscalar = 1; extvector = 1; - xvalue = atof(arg[3]); - yvalue = atof(arg[4]); - zvalue = atof(arg[5]); + xvalue = force->numeric(FLERR,arg[3]); + yvalue = force->numeric(FLERR,arg[4]); + zvalue = force->numeric(FLERR,arg[5]); // optional args diff --git a/src/USER-CUDA/fix_aveforce_cuda.cpp b/src/USER-CUDA/fix_aveforce_cuda.cpp index 8c332ee8a8..b6b9cb705a 100644 --- a/src/USER-CUDA/fix_aveforce_cuda.cpp +++ b/src/USER-CUDA/fix_aveforce_cuda.cpp @@ -38,6 +38,7 @@ #include "modify.h" #include "atom_masks.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -72,7 +73,7 @@ FixAveForceCuda::FixAveForceCuda(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[3],"NULL") == 0) { xstyle = NONE; } else { - xvalue = atof(arg[3]); + xvalue = force->numeric(FLERR,arg[3]); xstyle = CONSTANT; } if (strstr(arg[4],"v_") == arg[4]) { @@ -82,7 +83,7 @@ FixAveForceCuda::FixAveForceCuda(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[4],"NULL") == 0) { ystyle = NONE; } else { - yvalue = atof(arg[4]); + yvalue = force->numeric(FLERR,arg[4]); ystyle = CONSTANT; } if (strstr(arg[5],"v_") == arg[5]) { @@ -92,7 +93,7 @@ FixAveForceCuda::FixAveForceCuda(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[5],"NULL") == 0) { zstyle = NONE; } else { - zvalue = atof(arg[5]); + zvalue = force->numeric(FLERR,arg[5]); zstyle = CONSTANT; } diff --git a/src/USER-CUDA/fix_gravity_cuda.cpp b/src/USER-CUDA/fix_gravity_cuda.cpp index 549f95edbf..a7234512d3 100644 --- a/src/USER-CUDA/fix_gravity_cuda.cpp +++ b/src/USER-CUDA/fix_gravity_cuda.cpp @@ -34,6 +34,7 @@ #include "cuda_modify_flags.h" #include "math_const.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -53,31 +54,31 @@ FixGravityCuda::FixGravityCuda(LAMMPS *lmp, int narg, char **arg) : if (narg < 5) error->all(FLERR,"Illegal fix gravity command"); - magnitude = atof(arg[3]); + magnitude = force->numeric(FLERR,arg[3]); if (strcmp(arg[4],"chute") == 0) { if (narg != 6) error->all(FLERR,"Illegal fix gravity command"); style = CHUTE; phi = 0.0; - theta = 180.0 - atof(arg[5]); + theta = 180.0 - force->numeric(FLERR,arg[5]); } else if (strcmp(arg[4],"spherical") == 0) { if (narg != 7) error->all(FLERR,"Illegal fix gravity command"); style = SPHERICAL; - phi = atof(arg[5]); - theta = atof(arg[6]); + phi = force->numeric(FLERR,arg[5]); + theta = force->numeric(FLERR,arg[6]); } else if (strcmp(arg[4],"gradient") == 0) { if (narg != 9) error->all(FLERR,"Illegal fix gravity command"); style = GRADIENT; - phi = atof(arg[5]); - theta = atof(arg[6]); - phigrad = atof(arg[7]); - thetagrad = atof(arg[8]); + phi = force->numeric(FLERR,arg[5]); + theta = force->numeric(FLERR,arg[6]); + phigrad = force->numeric(FLERR,arg[7]); + thetagrad = force->numeric(FLERR,arg[8]); } else if (strcmp(arg[4],"vector") == 0) { if (narg != 8) error->all(FLERR,"Illegal fix gravity command"); style = VECTOR; - xdir = atof(arg[5]); - ydir = atof(arg[6]); - zdir = atof(arg[7]); + xdir = force->numeric(FLERR,arg[5]); + ydir = force->numeric(FLERR,arg[6]); + zdir = force->numeric(FLERR,arg[7]); } else error->all(FLERR,"Illegal fix gravity command"); degree2rad = MY_PI/180.0; diff --git a/src/USER-CUDA/fix_nh_cuda.cpp b/src/USER-CUDA/fix_nh_cuda.cpp index 6a426dd50c..252f260885 100644 --- a/src/USER-CUDA/fix_nh_cuda.cpp +++ b/src/USER-CUDA/fix_nh_cuda.cpp @@ -99,9 +99,9 @@ FixNHCuda::FixNHCuda(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (strcmp(arg[iarg],"temp") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph 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]); if (t_start < 0.0 || t_stop <= 0.0) error->all(FLERR,"Target T for fix nvt/npt/nph cannot be 0.0"); iarg += 4; @@ -109,9 +109,9 @@ FixNHCuda::FixNHCuda(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg],"iso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph 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; @@ -121,9 +121,9 @@ FixNHCuda::FixNHCuda(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg],"aniso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); pcouple = NONE; - 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; @@ -133,13 +133,13 @@ FixNHCuda::FixNHCuda(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg],"tri") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); pcouple = NONE; - 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; p_start[3] = p_start[4] = p_start[5] = 0.0; p_stop[3] = p_stop[4] = p_stop[5] = 0.0; - p_period[3] = p_period[4] = p_period[5] = atof(arg[iarg+3]); + p_period[3] = p_period[4] = p_period[5] = force->numeric(FLERR,arg[iarg+3]); p_flag[3] = p_flag[4] = p_flag[5] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -153,25 +153,25 @@ FixNHCuda::FixNHCuda(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph 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; deviatoric_flag = 1; iarg += 4; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph 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; deviatoric_flag = 1; iarg += 4; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph 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; deviatoric_flag = 1; iarg += 4; @@ -180,9 +180,9 @@ FixNHCuda::FixNHCuda(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg],"yz") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[3] = atof(arg[iarg+1]); - p_stop[3] = atof(arg[iarg+2]); - p_period[3] = atof(arg[iarg+3]); + p_start[3] = force->numeric(FLERR,arg[iarg+1]); + p_stop[3] = force->numeric(FLERR,arg[iarg+2]); + p_period[3] = force->numeric(FLERR,arg[iarg+3]); p_flag[3] = 1; deviatoric_flag = 1; iarg += 4; @@ -190,9 +190,9 @@ FixNHCuda::FixNHCuda(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation"); } else if (strcmp(arg[iarg],"xz") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[4] = atof(arg[iarg+1]); - p_stop[4] = atof(arg[iarg+2]); - p_period[4] = atof(arg[iarg+3]); + p_start[4] = force->numeric(FLERR,arg[iarg+1]); + p_stop[4] = force->numeric(FLERR,arg[iarg+2]); + p_period[4] = force->numeric(FLERR,arg[iarg+3]); p_flag[4] = 1; deviatoric_flag = 1; iarg += 4; @@ -200,9 +200,9 @@ FixNHCuda::FixNHCuda(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation"); } else if (strcmp(arg[iarg],"xy") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[5] = atof(arg[iarg+1]); - p_stop[5] = atof(arg[iarg+2]); - p_period[5] = atof(arg[iarg+3]); + p_start[5] = force->numeric(FLERR,arg[iarg+1]); + p_stop[5] = force->numeric(FLERR,arg[iarg+2]); + p_period[5] = force->numeric(FLERR,arg[iarg+3]); p_flag[5] = 1; deviatoric_flag = 1; iarg += 4; @@ -219,7 +219,7 @@ FixNHCuda::FixNHCuda(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg],"drag") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - drag = atof(arg[iarg+1]); + drag = force->numeric(FLERR,arg[iarg+1]); if (drag < 0.0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"dilate") == 0) { @@ -230,12 +230,12 @@ FixNHCuda::FixNHCuda(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) iarg += 2; } else if (strcmp(arg[iarg],"tchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - mtchain = atoi(arg[iarg+1]); + mtchain = force->inumeric(FLERR,arg[iarg+1]); if (mtchain < 1) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"pchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - mpchain = atoi(arg[iarg+1]); + mpchain = force->inumeric(FLERR,arg[iarg+1]); if (mpchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"mtk") == 0) { @@ -246,17 +246,17 @@ FixNHCuda::FixNHCuda(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) iarg += 2; } else if (strcmp(arg[iarg],"tloop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - nc_tchain = atoi(arg[iarg+1]); + nc_tchain = force->inumeric(FLERR,arg[iarg+1]); if (nc_tchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"ploop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - nc_pchain = atoi(arg[iarg+1]); + nc_pchain = force->inumeric(FLERR,arg[iarg+1]); if (nc_pchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"nreset") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - nreset_h0 = atoi(arg[iarg+1]); + nreset_h0 = force->inumeric(FLERR,arg[iarg+1]); if (nreset_h0 < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else error->all(FLERR,"Illegal fix nvt/npt/nph command"); diff --git a/src/USER-CUDA/fix_set_force_cuda.cpp b/src/USER-CUDA/fix_set_force_cuda.cpp index 1010c087ad..afaf5c7e88 100644 --- a/src/USER-CUDA/fix_set_force_cuda.cpp +++ b/src/USER-CUDA/fix_set_force_cuda.cpp @@ -28,6 +28,7 @@ #include "update.h" #include "respa.h" #include "error.h" +#include "force.h" #include "cuda.h" #include "memory.h" #include "cuda_modify_flags.h" @@ -55,11 +56,11 @@ FixSetForceCuda::FixSetForceCuda(LAMMPS *lmp, int narg, char **arg) : flagx = flagy = flagz = 1; if (strcmp(arg[3],"NULL") == 0) flagx = 0; - else xvalue = atof(arg[3]); + else xvalue = force->numeric(FLERR,arg[3]); if (strcmp(arg[4],"NULL") == 0) flagy = 0; - else yvalue = atof(arg[4]); + else yvalue = force->numeric(FLERR,arg[4]); if (strcmp(arg[5],"NULL") == 0) flagz = 0; - else zvalue = atof(arg[5]); + else zvalue = force->numeric(FLERR,arg[5]); force_flag = 0; foriginal[0] = foriginal[1] = foriginal[2] = 0.0; diff --git a/src/USER-CUDA/fix_shake_cuda.cpp b/src/USER-CUDA/fix_shake_cuda.cpp index 1a7826ae1a..4f47a816fc 100644 --- a/src/USER-CUDA/fix_shake_cuda.cpp +++ b/src/USER-CUDA/fix_shake_cuda.cpp @@ -95,9 +95,9 @@ FixShakeCuda::FixShakeCuda(LAMMPS* lmp, int narg, char** arg) : if(narg < 8) error->all(FLERR, "Illegal fix shake command"); - tolerance = atof(arg[3]); - max_iter = atoi(arg[4]); - output_every = atoi(arg[5]); + tolerance = force->numeric(FLERR,arg[3]); + max_iter = force->inumeric(FLERR,arg[4]); + output_every = force->inumeric(FLERR,arg[5]); // parse SHAKE args for bond and angle types // will be used by find_clusters @@ -133,7 +133,7 @@ FixShakeCuda::FixShakeCuda(LAMMPS* lmp, int narg, char** arg) : atom->check_mass(); } else if(mode == 'b') { - int i = atoi(arg[next]); + int i = force->inumeric(FLERR,arg[next]); if(i < 1 || i > atom->nbondtypes) error->all(FLERR, "Invalid bond type index for fix shake"); @@ -141,7 +141,7 @@ FixShakeCuda::FixShakeCuda(LAMMPS* lmp, int narg, char** arg) : bond_flag[i] = 1; } else if(mode == 'a') { - int i = atoi(arg[next]); + int i = force->inumeric(FLERR,arg[next]); if(i < 1 || i > atom->nangletypes) error->all(FLERR, "Invalid angle type index for fix shake"); @@ -149,7 +149,7 @@ FixShakeCuda::FixShakeCuda(LAMMPS* lmp, int narg, char** arg) : angle_flag[i] = 1; } else if(mode == 't') { - int i = atoi(arg[next]); + int i = force->inumeric(FLERR,arg[next]); if(i < 1 || i > atom->ntypes) error->all(FLERR, "Invalid atom type index for fix shake"); @@ -157,7 +157,7 @@ FixShakeCuda::FixShakeCuda(LAMMPS* lmp, int narg, char** arg) : type_flag[i] = 1; } else if(mode == 'm') { - double massone = atof(arg[next]); + double massone = force->numeric(FLERR,arg[next]); if(massone == 0.0) error->all(FLERR, "Invalid atom mass for fix shake"); diff --git a/src/USER-CUDA/fix_temp_berendsen_cuda.cpp b/src/USER-CUDA/fix_temp_berendsen_cuda.cpp index 5f5e13dd3c..1e29de8db2 100644 --- a/src/USER-CUDA/fix_temp_berendsen_cuda.cpp +++ b/src/USER-CUDA/fix_temp_berendsen_cuda.cpp @@ -71,9 +71,9 @@ FixTempBerendsenCuda::FixTempBerendsenCuda(LAMMPS *lmp, int narg, char **arg) : nevery = 1; - t_start = atof(arg[3]); - t_stop = atof(arg[4]); - t_period = atof(arg[5]); + t_start = force->numeric(FLERR,arg[3]); + t_stop = force->numeric(FLERR,arg[4]); + t_period = force->numeric(FLERR,arg[5]); // error checks diff --git a/src/USER-CUDA/fix_temp_rescale_cuda.cpp b/src/USER-CUDA/fix_temp_rescale_cuda.cpp index 85684d9b46..36c75d446b 100644 --- a/src/USER-CUDA/fix_temp_rescale_cuda.cpp +++ b/src/USER-CUDA/fix_temp_rescale_cuda.cpp @@ -56,17 +56,17 @@ FixTempRescaleCuda::FixTempRescaleCuda(LAMMPS *lmp, int narg, char **arg) : if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale/cuda command"); - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix temp/rescale/cuda 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 // id = fix-ID + temp, compute group = fix group diff --git a/src/USER-CUDA/fix_temp_rescale_limit_cuda.cpp b/src/USER-CUDA/fix_temp_rescale_limit_cuda.cpp index a7d4aaa4d7..3675ca0160 100644 --- a/src/USER-CUDA/fix_temp_rescale_limit_cuda.cpp +++ b/src/USER-CUDA/fix_temp_rescale_limit_cuda.cpp @@ -56,18 +56,18 @@ FixTempRescaleLimitCuda::FixTempRescaleLimitCuda(LAMMPS *lmp, int narg, char **a if (narg < 9) error->all(FLERR,"Illegal fix temp/rescale/limit/cuda command"); - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix temp/rescale/limit/cuda 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]); - limit = atof(arg[8]); + 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]); + limit = force->numeric(FLERR,arg[8]); if (limit <= 1.0) error->all(FLERR,"Illegal fix temp/rescale/limit/cuda command (limit must be > 1.0)"); diff --git a/src/USER-CUDA/pppm_cuda.cpp b/src/USER-CUDA/pppm_cuda.cpp index 2052582c48..aaeb0b6fd4 100644 --- a/src/USER-CUDA/pppm_cuda.cpp +++ b/src/USER-CUDA/pppm_cuda.cpp @@ -111,7 +111,7 @@ PPPMCuda::PPPMCuda(LAMMPS *lmp, int narg, char **arg) : #endif triclinic_support = 0; - accuracy_relative = atof(arg[0]); + accuracy_relative = fabs(force->numeric(FLERR,arg[0])); nfactors = 3; factors = new int[nfactors]; 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 91e611bce2..677ea09321 100644 --- a/src/USER-MISC/fix_imd.cpp +++ b/src/USER-MISC/fix_imd.cpp @@ -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" @@ -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"); } 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-MISC/fix_spring_pull.cpp b/src/USER-MISC/fix_spring_pull.cpp index 85ada66502..387d46f307 100644 --- a/src/USER-MISC/fix_spring_pull.cpp +++ b/src/USER-MISC/fix_spring_pull.cpp @@ -12,7 +12,8 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Paul Crozier (SNL) + Contributing author: Axel Kohlmeyer (Temple U) + based on fix spring by: Paul Crozier (SNL) ------------------------------------------------------------------------- */ #include "math.h" @@ -24,6 +25,7 @@ #include "respa.h" #include "domain.h" #include "error.h" +#include "force.h" #include "group.h" using namespace LAMMPS_NS; @@ -45,18 +47,18 @@ FixSpringPull::FixSpringPull(LAMMPS *lmp, int narg, char **arg) : extscalar = 1; extvector = 1; - k_spring = atof(arg[3]); + k_spring = force->numeric(FLERR,arg[3]); xflag = yflag = zflag = 1; if (strcmp(arg[4],"NULL") == 0) xflag = 0; - else xc = atof(arg[4]); + else xc = force->numeric(FLERR,arg[4]); if (strcmp(arg[5],"NULL") == 0) yflag = 0; - else yc = atof(arg[5]); + else yc = force->numeric(FLERR,arg[5]); if (strcmp(arg[6],"NULL") == 0) zflag = 0; - else zc = atof(arg[6]); - xv = atof(arg[7]); - yv = atof(arg[8]); - zv = atof(arg[9]); - r0 = atof(arg[10]); + else zc = force->numeric(FLERR,arg[6]); + xv = force->numeric(FLERR,arg[7]); + yv = force->numeric(FLERR,arg[8]); + zv = force->numeric(FLERR,arg[9]); + r0 = force->numeric(FLERR,arg[10]); if (r0 < 0) error->all(FLERR,"R0 < 0 for fix spring/pull command"); ftotal[0] = ftotal[1] = ftotal[2] = ftotal[3] = 0.0; 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 8105b728d3..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"); 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) && diff --git a/src/balance.cpp b/src/balance.cpp index 4638599f0a..b315a4454b 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -163,9 +163,9 @@ void Balance::command(int narg, char **arg) if (dimension == 3) zflag = DYNAMIC; if (strlen(arg[iarg+1]) > 3) error->all(FLERR,"Illegal balance command"); strcpy(bstr,arg[iarg+1]); - nitermax = atoi(arg[iarg+2]); + nitermax = force->inumeric(FLERR,arg[iarg+2]); if (nitermax <= 0) error->all(FLERR,"Illegal balance command"); - thresh = atof(arg[iarg+3]); + thresh = force->numeric(FLERR,arg[iarg+3]); if (thresh < 1.0) error->all(FLERR,"Illegal balance command"); iarg += 4; diff --git a/src/change_box.cpp b/src/change_box.cpp index 240bf93343..fe6566446b 100644 --- a/src/change_box.cpp +++ b/src/change_box.cpp @@ -27,6 +27,7 @@ #include "output.h" #include "group.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -86,23 +87,23 @@ void ChangeBox::command(int narg, char **arg) if (strcmp(arg[iarg+1],"final") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal change_box command"); ops[nops].flavor = FINAL; - ops[nops].flo = atof(arg[iarg+2]); - ops[nops].fhi = atof(arg[iarg+3]); + ops[nops].flo = force->numeric(FLERR,arg[iarg+2]); + ops[nops].fhi = force->numeric(FLERR,arg[iarg+3]); ops[nops].vdim1 = ops[nops].vdim2 = -1; nops++; iarg += 4; } else if (strcmp(arg[iarg+1],"delta") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal change_box command"); ops[nops].flavor = DELTA; - ops[nops].dlo = atof(arg[iarg+2]); - ops[nops].dhi = atof(arg[iarg+3]); + ops[nops].dlo = force->numeric(FLERR,arg[iarg+2]); + ops[nops].dhi = force->numeric(FLERR,arg[iarg+3]); ops[nops].vdim1 = ops[nops].vdim2 = -1; nops++; iarg += 4; } else if (strcmp(arg[iarg+1],"scale") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal change_box command"); ops[nops].flavor = SCALE; - ops[nops].scale = atof(arg[iarg+2]); + ops[nops].scale = force->numeric(FLERR,arg[iarg+2]); ops[nops].vdim1 = ops[nops].vdim2 = -1; nops++; iarg += 3; @@ -132,13 +133,13 @@ void ChangeBox::command(int narg, char **arg) if (strcmp(arg[iarg+1],"final") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal change_box command"); ops[nops].flavor = FINAL; - ops[nops].ftilt = atof(arg[iarg+2]); + ops[nops].ftilt = force->numeric(FLERR,arg[iarg+2]); nops++; iarg += 3; } else if (strcmp(arg[iarg+1],"delta") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal change_box command"); ops[nops].flavor = DELTA; - ops[nops].dtilt = atof(arg[iarg+2]); + ops[nops].dtilt = force->numeric(FLERR,arg[iarg+2]); nops++; iarg += 3; } else error->all(FLERR,"Illegal change_box command"); diff --git a/src/comm.cpp b/src/comm.cpp index b15fc5a285..4090fc2cea 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -1699,7 +1699,7 @@ void Comm::set(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"cutoff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal communicate command"); - cutghostuser = atof(arg[iarg+1]); + cutghostuser = force->numeric(FLERR,arg[iarg+1]); if (cutghostuser < 0.0) error->all(FLERR,"Invalid cutoff in communicate command"); iarg += 2; @@ -1723,11 +1723,11 @@ void Comm::set_processors(int narg, char **arg) if (narg < 3) error->all(FLERR,"Illegal processors command"); if (strcmp(arg[0],"*") == 0) user_procgrid[0] = 0; - else user_procgrid[0] = atoi(arg[0]); + else user_procgrid[0] = force->inumeric(FLERR,arg[0]); if (strcmp(arg[1],"*") == 0) user_procgrid[1] = 0; - else user_procgrid[1] = atoi(arg[1]); + else user_procgrid[1] = force->inumeric(FLERR,arg[1]); if (strcmp(arg[2],"*") == 0) user_procgrid[2] = 0; - else user_procgrid[2] = atoi(arg[2]); + else user_procgrid[2] = force->inumeric(FLERR,arg[2]); if (user_procgrid[0] < 0 || user_procgrid[1] < 0 || user_procgrid[2] < 0) error->all(FLERR,"Illegal processors command"); @@ -1748,13 +1748,13 @@ void Comm::set_processors(int narg, char **arg) if (iarg+6 > narg) error->all(FLERR,"Illegal processors command"); gridflag = TWOLEVEL; - ncores = atoi(arg[iarg+2]); + ncores = force->inumeric(FLERR,arg[iarg+2]); if (strcmp(arg[iarg+3],"*") == 0) user_coregrid[0] = 0; - else user_coregrid[0] = atoi(arg[iarg+3]); + else user_coregrid[0] = force->inumeric(FLERR,arg[iarg+3]); if (strcmp(arg[iarg+4],"*") == 0) user_coregrid[1] = 0; - else user_coregrid[1] = atoi(arg[iarg+4]); + else user_coregrid[1] = force->inumeric(FLERR,arg[iarg+4]); if (strcmp(arg[iarg+5],"*") == 0) user_coregrid[2] = 0; - else user_coregrid[2] = atoi(arg[iarg+5]); + else user_coregrid[2] = force->inumeric(FLERR,arg[iarg+5]); if (ncores <= 0 || user_coregrid[0] < 0 || user_coregrid[1] < 0 || user_coregrid[2] < 0) @@ -1797,8 +1797,8 @@ void Comm::set_processors(int narg, char **arg) error->all(FLERR, "Cannot use processors part command " "without using partitions"); - int isend = atoi(arg[iarg+1]); - int irecv = atoi(arg[iarg+2]); + int isend = force->inumeric(FLERR,arg[iarg+1]); + int irecv = force->inumeric(FLERR,arg[iarg+2]); if (isend < 1 || isend > universe->nworlds || irecv < 1 || irecv > universe->nworlds || isend == irecv) error->all(FLERR,"Invalid partitions in processors part command"); diff --git a/src/compute.cpp b/src/compute.cpp index d37b1a4899..9be14029dc 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -24,6 +24,7 @@ #include "atom_masks.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -111,7 +112,7 @@ void Compute::modify_params(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"extra") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute_modify command"); - extra_dof = atoi(arg[iarg+1]); + extra_dof = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"dynamic") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute_modify command"); diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index f5fad86bd2..fa0d3ce4af 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -41,7 +41,7 @@ ComputeCentroAtom::ComputeCentroAtom(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"fcc") == 0) nnn = 12; else if (strcmp(arg[3],"bcc") == 0) nnn = 8; - else nnn = atoi(arg[3]); + else nnn = force->inumeric(FLERR,arg[3]); if (nnn <= 0 || nnn % 2) error->all(FLERR,"Illegal neighbor value for compute centro/atom command"); diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 3e5def23d4..030090dcb2 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -36,7 +36,7 @@ ComputeClusterAtom::ComputeClusterAtom(LAMMPS *lmp, int narg, char **arg) : { if (narg != 4) error->all(FLERR,"Illegal compute cluster/atom command"); - double cutoff = atof(arg[3]); + double cutoff = force->numeric(FLERR,arg[3]); cutsq = cutoff*cutoff; peratom_flag = 1; diff --git a/src/compute_cna_atom.cpp b/src/compute_cna_atom.cpp index 5b274a33d3..b053b9fb64 100644 --- a/src/compute_cna_atom.cpp +++ b/src/compute_cna_atom.cpp @@ -49,7 +49,7 @@ ComputeCNAAtom::ComputeCNAAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; size_peratom_cols = 0; - double cutoff = atof(arg[3]); + double cutoff = force->numeric(FLERR,arg[3]); if (cutoff < 0.0) error->all(FLERR,"Illegal compute cna/atom command"); cutsq = cutoff*cutoff; diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index fd28b75515..caa40575ae 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -36,7 +36,7 @@ ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) : { if (narg < 4) error->all(FLERR,"Illegal compute coord/atom command"); - double cutoff = atof(arg[3]); + double cutoff = force->numeric(FLERR,arg[3]); cutsq = cutoff*cutoff; ncol = narg-4 + 1; diff --git a/src/compute_rdf.cpp b/src/compute_rdf.cpp index 7511e1b5c3..ca194dc86a 100644 --- a/src/compute_rdf.cpp +++ b/src/compute_rdf.cpp @@ -45,7 +45,7 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) : array_flag = 1; extarray = 0; - nbin = atoi(arg[3]); + nbin = force->inumeric(FLERR,arg[3]); if (nbin < 1) error->all(FLERR,"Illegal compute rdf command"); if (narg == 4) npairs = 1; else npairs = (narg-4)/2; diff --git a/src/compute_slice.cpp b/src/compute_slice.cpp index 76763dc50f..e28e9d5bce 100644 --- a/src/compute_slice.cpp +++ b/src/compute_slice.cpp @@ -20,6 +20,7 @@ #include "group.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -37,9 +38,9 @@ ComputeSlice::ComputeSlice(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nstart = atoi(arg[3]); - nstop = atoi(arg[4]); - nskip = atoi(arg[5]); + nstart = force->inumeric(FLERR,arg[3]); + nstop = force->inumeric(FLERR,arg[4]); + nskip = force->inumeric(FLERR,arg[5]); if (nstart < 1 || nstop < nstart || nskip < 1) error->all(FLERR,"Illegal compute slice command"); diff --git a/src/compute_temp_partial.cpp b/src/compute_temp_partial.cpp index 60fe397164..36c5dfacd1 100644 --- a/src/compute_temp_partial.cpp +++ b/src/compute_temp_partial.cpp @@ -40,9 +40,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 4042a3bdd3..b615067119 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 319c53e5ac..a4c9f4ec23 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/create_atoms.cpp b/src/create_atoms.cpp index 336d18fe2f..8a1c1c6d32 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -25,6 +25,7 @@ #include "region.h" #include "random_park.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -50,7 +51,7 @@ void CreateAtoms::command(int narg, char **arg) // parse arguments if (narg < 2) error->all(FLERR,"Illegal create_atoms command"); - itype = atoi(arg[0]); + itype = force->inumeric(FLERR,arg[0]); if (itype <= 0 || itype > atom->ntypes) error->all(FLERR,"Invalid atom type in create_atoms command"); @@ -68,15 +69,15 @@ void CreateAtoms::command(int narg, char **arg) } else if (strcmp(arg[1],"single") == 0) { style = SINGLE; if (narg < 5) error->all(FLERR,"Illegal create_atoms command"); - xone[0] = atof(arg[2]); - xone[1] = atof(arg[3]); - xone[2] = atof(arg[4]); + xone[0] = force->numeric(FLERR,arg[2]); + xone[1] = force->numeric(FLERR,arg[3]); + xone[2] = force->numeric(FLERR,arg[4]); iarg = 5; } else if (strcmp(arg[1],"random") == 0) { style = RANDOM; if (narg < 5) error->all(FLERR,"Illegal create_atoms command"); - nrandom = atoi(arg[2]); - seed = atoi(arg[3]); + nrandom = force->inumeric(FLERR,arg[2]); + seed = force->inumeric(FLERR,arg[3]); if (strcmp(arg[4],"NULL") == 0) nregion = -1; else { nregion = domain->find_region(arg[4]); @@ -98,8 +99,8 @@ void CreateAtoms::command(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"basis") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command"); - int ibasis = atoi(arg[iarg+1]); - itype = atoi(arg[iarg+2]); + int ibasis = force->inumeric(FLERR,arg[iarg+1]); + itype = force->inumeric(FLERR,arg[iarg+2]); if (ibasis <= 0 || ibasis > nbasis || itype <= 0 || itype > atom->ntypes) error->all(FLERR,"Invalid basis setting in create_atoms command"); diff --git a/src/create_box.cpp b/src/create_box.cpp index b8d5349419..5c62d2bd5e 100644 --- a/src/create_box.cpp +++ b/src/create_box.cpp @@ -94,7 +94,7 @@ void CreateBox::command(int narg, char **arg) // set atom and topology type quantities - atom->ntypes = atoi(arg[0]); + atom->ntypes = force->inumeric(FLERR,arg[0]); atom->nbondtypes = 0; atom->nangletypes = 0; atom->ndihedraltypes = 0; diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index d2fa42192b..f16cc4ce3c 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -228,7 +228,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) // read args - double cut = atof(arg[1]); + double cut = force->numeric(FLERR,arg[1]); double cutsq = cut*cut; int igroup1 = group->find(arg[2]); @@ -375,8 +375,8 @@ void DeleteAtoms::delete_porosity(int narg, char **arg) int iregion = domain->find_region(arg[1]); if (iregion == -1) error->all(FLERR,"Could not find delete_atoms region ID"); - double porosity_fraction = atof(arg[2]); - int seed = atoi(arg[3]); + double porosity_fraction = force->numeric(FLERR,arg[2]); + int seed = force->inumeric(FLERR,arg[3]); options(narg-4,&arg[4]); RanMars *random = new RanMars(lmp,seed + comm->me); diff --git a/src/delete_bonds.cpp b/src/delete_bonds.cpp index 078e935ef7..9e33b472b0 100644 --- a/src/delete_bonds.cpp +++ b/src/delete_bonds.cpp @@ -76,7 +76,7 @@ void DeleteBonds::command(int narg, char **arg) int which; if (style != MULTI && style != STATS) { if (narg < 3) error->all(FLERR,"Illegal delete_bonds command"); - which = atoi(arg[2]); + which = force->inumeric(FLERR,arg[2]); iarg++; } diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index d9f5ce55c0..3076bb2ded 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -26,6 +26,7 @@ #include "math_const.h" #include "random_park.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -89,9 +90,9 @@ void DisplaceAtoms::command(int narg, char **arg) if (style == MOVE) { - double delx = xscale*atof(arg[2]); - double dely = yscale*atof(arg[3]); - double delz = zscale*atof(arg[4]); + double delx = xscale*force->numeric(FLERR,arg[2]); + double dely = yscale*force->numeric(FLERR,arg[3]); + double delz = zscale*force->numeric(FLERR,arg[4]); double **x = atom->x; int *mask = atom->mask; @@ -118,14 +119,14 @@ void DisplaceAtoms::command(int narg, char **arg) double d_lo,d_hi; if (d_dim == 0) { - d_lo = xscale*atof(arg[3]); - d_hi = xscale*atof(arg[4]); + d_lo = xscale*force->numeric(FLERR,arg[3]); + d_hi = xscale*force->numeric(FLERR,arg[4]); } else if (d_dim == 1) { - d_lo = yscale*atof(arg[3]); - d_hi = yscale*atof(arg[4]); + d_lo = yscale*force->numeric(FLERR,arg[3]); + d_hi = yscale*force->numeric(FLERR,arg[4]); } else if (d_dim == 2) { - d_lo = zscale*atof(arg[3]); - d_hi = zscale*atof(arg[4]); + d_lo = zscale*force->numeric(FLERR,arg[3]); + d_hi = zscale*force->numeric(FLERR,arg[4]); } int coord_dim; @@ -136,14 +137,14 @@ void DisplaceAtoms::command(int narg, char **arg) double coord_lo,coord_hi; if (coord_dim == 0) { - coord_lo = xscale*atof(arg[6]); - coord_hi = xscale*atof(arg[7]); + coord_lo = xscale*force->numeric(FLERR,arg[6]); + coord_hi = xscale*force->numeric(FLERR,arg[7]); } else if (coord_dim == 1) { - coord_lo = yscale*atof(arg[6]); - coord_hi = yscale*atof(arg[7]); + coord_lo = yscale*force->numeric(FLERR,arg[6]); + coord_hi = yscale*force->numeric(FLERR,arg[7]); } else if (coord_dim == 2) { - coord_lo = zscale*atof(arg[6]); - coord_hi = zscale*atof(arg[7]); + coord_lo = zscale*force->numeric(FLERR,arg[6]); + coord_hi = zscale*force->numeric(FLERR,arg[7]); } double **x = atom->x; @@ -169,10 +170,10 @@ void DisplaceAtoms::command(int narg, char **arg) if (style == RANDOM) { RanPark *random = new RanPark(lmp,1); - double dx = xscale*atof(arg[2]); - double dy = yscale*atof(arg[3]); - double dz = zscale*atof(arg[4]); - int seed = atoi(arg[5]); + double dx = xscale*force->numeric(FLERR,arg[2]); + double dy = yscale*force->numeric(FLERR,arg[3]); + double dz = zscale*force->numeric(FLERR,arg[4]); + int seed = force->inumeric(FLERR,arg[5]); if (seed <= 0) error->all(FLERR,"Illegal displace_atoms random command"); double **x = atom->x; @@ -207,13 +208,13 @@ void DisplaceAtoms::command(int narg, char **arg) double a[3],b[3],c[3],d[3],disp[3],runit[3]; int dim = domain->dimension; - point[0] = xscale*atof(arg[2]); - point[1] = yscale*atof(arg[3]); - point[2] = zscale*atof(arg[4]); - axis[0] = atof(arg[5]); - axis[1] = atof(arg[6]); - axis[2] = atof(arg[7]); - double theta = atof(arg[8]); + point[0] = xscale*force->numeric(FLERR,arg[2]); + point[1] = yscale*force->numeric(FLERR,arg[3]); + point[2] = zscale*force->numeric(FLERR,arg[4]); + axis[0] = force->numeric(FLERR,arg[5]); + axis[1] = force->numeric(FLERR,arg[6]); + axis[2] = force->numeric(FLERR,arg[7]); + double theta = force->numeric(FLERR,arg[8]); if (dim == 2 and (axis[0] != 0.0 || axis[1] != 0.0)) error->all(FLERR,"Invalid displace_atoms rotate axis for 2d"); diff --git a/src/dump.cpp b/src/dump.cpp index 8bee56a0de..551cde0ad4 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -25,6 +25,7 @@ #include "output.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -667,7 +668,7 @@ void Dump::modify_params(int narg, char **arg) strcpy(output->var_dump[idump],&arg[iarg+1][2]); n = 0; } else { - n = atoi(arg[iarg+1]); + n = force->inumeric(FLERR,arg[iarg+1]); if (n <= 0) error->all(FLERR,"Illegal dump_modify command"); } output->every_dump[idump] = n; @@ -684,7 +685,7 @@ void Dump::modify_params(int narg, char **arg) if (!multiproc) error->all(FLERR,"Cannot use dump_modify fileper " "without % in dump file name"); - int nper = atoi(arg[iarg+1]); + int nper = force->inumeric(FLERR,arg[iarg+1]); if (nper <= 0) error->all(FLERR,"Illegal dump_modify command"); multiproc = nprocs/nper; @@ -730,7 +731,7 @@ void Dump::modify_params(int narg, char **arg) if (!multiproc) error->all(FLERR,"Cannot use dump_modify nfile " "without % in dump file name"); - int nfile = atoi(arg[iarg+1]); + int nfile = force->inumeric(FLERR,arg[iarg+1]); if (nfile <= 0) error->all(FLERR,"Illegal dump_modify command"); nfile = MIN(nfile,nprocs); @@ -760,7 +761,7 @@ void Dump::modify_params(int narg, char **arg) } else if (strcmp(arg[iarg],"pad") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); - padflag = atoi(arg[iarg+1]); + padflag = force->inumeric(FLERR,arg[iarg+1]); if (padflag < 0) error->all(FLERR,"Illegal dump_modify command"); iarg += 2; } else if (strcmp(arg[iarg],"sort") == 0) { @@ -772,7 +773,7 @@ void Dump::modify_params(int narg, char **arg) sortorder = ASCEND; } else { sort_flag = 1; - sortcol = atoi(arg[iarg+1]); + sortcol = force->inumeric(FLERR,arg[iarg+1]); sortorder = ASCEND; if (sortcol == 0) error->all(FLERR,"Illegal dump_modify command"); if (sortcol < 0) { diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 1146660511..38ea537281 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -57,7 +57,7 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : clearstep = 1; - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); // size_one may be shrunk below if additional optional args exist @@ -1565,7 +1565,7 @@ int DumpCustom::modify_param(int narg, char **arg) // set threshhold value - thresh_value[nthresh] = atof(arg[3]); + thresh_value[nthresh] = force->numeric(FLERR,arg[3]); nthresh++; return 4; diff --git a/src/dump_image.cpp b/src/dump_image.cpp index c06b35e6c2..c4aa25b9c4 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -113,7 +113,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"adiam") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command"); adiam = NUMERIC; - adiamvalue = atof(arg[iarg+1]); + adiamvalue = force->numeric(FLERR,arg[iarg+1]); if (adiamvalue <= 0.0) error->all(FLERR,"Illegal dump image command"); iarg += 2; @@ -135,7 +135,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal dump image command"); if (!islower(arg[iarg+2][0])) { bdiam = NUMERIC; - bdiamvalue = atof(arg[iarg+2]); + bdiamvalue = force->numeric(FLERR,arg[iarg+2]); if (bdiamvalue <= 0.0) error->all(FLERR,"Illegal dump image command"); } else if (strcmp(arg[iarg+2],"atom") == 0) bdiam = ATOM; else if (strcmp(arg[iarg+2],"type") == 0) bdiam = TYPE; @@ -145,8 +145,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"size") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command"); - int width = atoi(arg[iarg+1]); - int height = atoi(arg[iarg+2]); + int width = force->inumeric(FLERR,arg[iarg+1]); + int height = force->inumeric(FLERR,arg[iarg+2]); if (width <= 0 || height <= 0) error->all(FLERR,"Illegal dump image command"); image->width = width; @@ -160,7 +160,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : thetastr = new char[n]; strcpy(thetastr,&arg[iarg+1][2]); } else { - double theta = atof(arg[iarg+1]); + double theta = force->numeric(FLERR,arg[iarg+1]); if (theta < 0.0 || theta > 180.0) error->all(FLERR,"Invalid dump image theta value"); theta *= MY_PI/180.0; @@ -171,7 +171,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : phistr = new char[n]; strcpy(phistr,&arg[iarg+2][2]); } else { - double phi = atof(arg[iarg+2]); + double phi = force->numeric(FLERR,arg[iarg+2]); phi *= MY_PI/180.0; image->phi = phi; } @@ -187,19 +187,19 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : cxstr = new char[n]; strcpy(cxstr,&arg[iarg+2][2]); cflag = DYNAMIC; - } else cx = atof(arg[iarg+2]); + } else cx = force->numeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; cystr = new char[n]; strcpy(cystr,&arg[iarg+3][2]); cflag = DYNAMIC; - } else cy = atof(arg[iarg+3]); + } else cy = force->numeric(FLERR,arg[iarg+3]); if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) { int n = strlen(&arg[iarg+4][2]) + 1; czstr = new char[n]; strcpy(czstr,&arg[iarg+4][2]); cflag = DYNAMIC; - } else cz = atof(arg[iarg+4]); + } else cz = force->numeric(FLERR,arg[iarg+4]); iarg += 5; } else if (strcmp(arg[iarg],"up") == 0) { @@ -208,17 +208,17 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : int n = strlen(&arg[iarg+1][2]) + 1; upxstr = new char[n]; strcpy(upxstr,&arg[iarg+1][2]); - } else image->up[0] = atof(arg[iarg+1]); + } else image->up[0] = force->numeric(FLERR,arg[iarg+1]); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { int n = strlen(&arg[iarg+2][2]) + 1; upystr = new char[n]; strcpy(upystr,&arg[iarg+2][2]); - } else image->up[1] = atof(arg[iarg+2]); + } else image->up[1] = force->numeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; upzstr = new char[n]; strcpy(upzstr,&arg[iarg+3][2]); - } else image->up[2] = atof(arg[iarg+3]); + } else image->up[2] = force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"zoom") == 0) { @@ -228,7 +228,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : zoomstr = new char[n]; strcpy(zoomstr,&arg[iarg+1][2]); } else { - double zoom = atof(arg[iarg+1]); + double zoom = force->numeric(FLERR,arg[iarg+1]); if (zoom <= 0.0) error->all(FLERR,"Illegal dump image command"); image->zoom = zoom; } @@ -242,7 +242,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : perspstr = new char[n]; strcpy(perspstr,&arg[iarg+1][2]); } else { - double persp = atof(arg[iarg+1]); + double persp = force->numeric(FLERR,arg[iarg+1]); if (persp < 0.0) error->all(FLERR,"Illegal dump image command"); image->persp = persp; } @@ -253,7 +253,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"yes") == 0) boxflag = YES; else if (strcmp(arg[iarg+1],"no") == 0) boxflag = NO; else error->all(FLERR,"Illegal dump image command"); - boxdiam = atof(arg[iarg+2]); + boxdiam = force->numeric(FLERR,arg[iarg+2]); if (boxdiam < 0.0) error->all(FLERR,"Illegal dump image command"); iarg += 3; @@ -262,15 +262,15 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"yes") == 0) axesflag = YES; else if (strcmp(arg[iarg+1],"no") == 0) axesflag = NO; else error->all(FLERR,"Illegal dump image command"); - axeslen = atof(arg[iarg+2]); - axesdiam = atof(arg[iarg+3]); + axeslen = force->numeric(FLERR,arg[iarg+2]); + axesdiam = force->numeric(FLERR,arg[iarg+3]); if (axeslen < 0.0 || axesdiam < 0.0) error->all(FLERR,"Illegal dump image command"); iarg += 4; } else if (strcmp(arg[iarg],"shiny") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command"); - double shiny = atof(arg[iarg+1]); + double shiny = force->numeric(FLERR,arg[iarg+1]); if (shiny < 0.0 || shiny > 1.0) error->all(FLERR,"Illegal dump image command"); image->shiny = shiny; @@ -281,10 +281,10 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"yes") == 0) image->ssao = YES; else if (strcmp(arg[iarg+1],"no") == 0) image->ssao = NO; else error->all(FLERR,"Illegal dump image command"); - int seed = atoi(arg[iarg+2]); + int seed = force->inumeric(FLERR,arg[iarg+2]); if (seed <= 0) error->all(FLERR,"Illegal dump image command"); image->seed = seed; - double ssaoint = atof(arg[iarg+3]); + double ssaoint = force->numeric(FLERR,arg[iarg+3]); if (ssaoint < 0.0 || ssaoint > 1.0) error->all(FLERR,"Illegal dump image command"); image->ssaoint = ssaoint; @@ -929,7 +929,7 @@ int DumpImage::modify_param(int narg, char **arg) if (narg < 3) error->all(FLERR,"Illegal dump_modify command"); int nlo,nhi; force->bounds(arg[1],atom->ntypes,nlo,nhi); - double diam = atof(arg[2]); + double diam = force->numeric(FLERR,arg[2]); if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command"); for (int i = nlo; i <= nhi; i++) diamtype[i] = diam; return 3; @@ -940,7 +940,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strlen(arg[3]) != 2) error->all(FLERR,"Illegal dump_modify command"); int factor = 2; if (arg[3][0] == 's') factor = 1; - int nentry = atoi(arg[5]); + int nentry = force->inumeric(FLERR,arg[5]); if (nentry < 1) error->all(FLERR,"Illegal dump_modify command"); int n = 6 + factor*nentry; if (narg < n) error->all(FLERR,"Illegal dump_modify command"); @@ -991,7 +991,7 @@ int DumpImage::modify_param(int narg, char **arg) error->all(FLERR,"Dump modify bdiam not allowed with no bond types"); int nlo,nhi; force->bounds(arg[1],atom->ntypes,nlo,nhi); - double diam = atof(arg[2]); + double diam = force->numeric(FLERR,arg[2]); if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command"); for (int i = nlo; i <= nhi; i++) bdiamtype[i] = diam; return 3; @@ -1017,7 +1017,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"color") == 0) { if (narg < 5) error->all(FLERR,"Illegal dump_modify command"); - int flag = image->addcolor(arg[1],atof(arg[2]),atof(arg[3]),atof(arg[4])); + int flag = image->addcolor(arg[1],force->numeric(FLERR,arg[2]),force->numeric(FLERR,arg[3]),force->numeric(FLERR,arg[4])); if (flag) error->all(FLERR,"Illegal dump_modify command"); return 5; } diff --git a/src/dump_local.cpp b/src/dump_local.cpp index e865a3f70b..2812fb9a5c 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -23,6 +23,7 @@ #include "update.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -39,7 +40,7 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : clearstep = 1; - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); size_one = nfield = narg-5; pack_choice = new FnPtrPack[nfield]; diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 49684020c8..2f1793dfba 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -40,7 +40,7 @@ enum{DIAMETER,CHARGE}; FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 5) error->all(FLERR,"Illegal fix adapt command"); - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery < 0) error->all(FLERR,"Illegal fix adapt command"); // count # of adaptations diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index 8ec546bb01..27dc6c426a 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -24,6 +24,7 @@ #include "variable.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -51,7 +52,7 @@ FixAddForce::FixAddForce(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]) { @@ -59,7 +60,7 @@ FixAddForce::FixAddForce(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]) { @@ -67,7 +68,7 @@ FixAddForce::FixAddForce(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/fix_ave_atom.cpp b/src/fix_ave_atom.cpp index c1fc8c901c..fabf33038e 100644 --- a/src/fix_ave_atom.cpp +++ b/src/fix_ave_atom.cpp @@ -23,6 +23,7 @@ #include "variable.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -38,9 +39,9 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : { if (narg < 7) error->all(FLERR,"Illegal fix ave/atom command"); - nevery = atoi(arg[3]); - nrepeat = atoi(arg[4]); - peratom_freq = atoi(arg[5]); + nevery = force->inumeric(FLERR,arg[3]); + nrepeat = force->inumeric(FLERR,arg[4]); + peratom_freq = force->inumeric(FLERR,arg[5]); // parse remaining values diff --git a/src/fix_ave_correlate.cpp b/src/fix_ave_correlate.cpp index 15171abf31..6002dc7f4a 100644 --- a/src/fix_ave_correlate.cpp +++ b/src/fix_ave_correlate.cpp @@ -28,6 +28,7 @@ #include "variable.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -49,9 +50,9 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): MPI_Comm_rank(world,&me); - nevery = atoi(arg[3]); - nrepeat = atoi(arg[4]); - nfreq = atoi(arg[5]); + nevery = force->inumeric(FLERR,arg[3]); + nrepeat = force->inumeric(FLERR,arg[4]); + nfreq = force->inumeric(FLERR,arg[5]); global_freq = nfreq; // parse values until one isn't recognized @@ -124,11 +125,11 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): iarg += 2; } else if (strcmp(arg[iarg],"start") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate command"); - startstep = atoi(arg[iarg+1]); + startstep = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"prefactor") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate command"); - prefactor = atof(arg[iarg+1]); + prefactor = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"file") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate command"); diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index f4ca9e0ade..256179a625 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -23,6 +23,7 @@ #include "variable.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -49,9 +50,9 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = atoi(arg[3]); - nrepeat = atoi(arg[4]); - nfreq = atoi(arg[5]); + nevery = force->inumeric(FLERR,arg[3]); + nrepeat = force->inumeric(FLERR,arg[4]); + nfreq = force->inumeric(FLERR,arg[5]); global_freq = nfreq; vector_flag = 1; @@ -61,9 +62,9 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : size_array_cols = 3; extarray = 0; - lo = atof(arg[6]); - hi = atof(arg[7]); - nbins = atoi(arg[8]); + lo = force->numeric(FLERR,arg[6]); + hi = force->numeric(FLERR,arg[7]); + nbins = force->inumeric(FLERR,arg[8]); // scan values to count them // then read options so know mode = SCALAR/VECTOR before re-reading values @@ -939,14 +940,14 @@ void FixAveHisto::options(int narg, char **arg) else error->all(FLERR,"Illegal fix ave/histo command"); if (ave == WINDOW) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix ave/histo command"); - nwindow = atoi(arg[iarg+2]); + nwindow = force->inumeric(FLERR,arg[iarg+2]); if (nwindow <= 0) error->all(FLERR,"Illegal fix ave/histo command"); } iarg += 2; if (ave == WINDOW) iarg++; } else if (strcmp(arg[iarg],"start") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/histo command"); - startstep = atoi(arg[iarg+1]); + startstep = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"mode") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/histo command"); diff --git a/src/fix_ave_spatial.cpp b/src/fix_ave_spatial.cpp index 6cfb753ffd..a644aab323 100644 --- a/src/fix_ave_spatial.cpp +++ b/src/fix_ave_spatial.cpp @@ -52,9 +52,9 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = atoi(arg[3]); - nrepeat = atoi(arg[4]); - nfreq = atoi(arg[5]); + nevery = force->inumeric(FLERR,arg[3]); + nrepeat = force->inumeric(FLERR,arg[4]); + nfreq = force->inumeric(FLERR,arg[5]); global_freq = nfreq; no_change_box = 1; @@ -75,9 +75,9 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg+1],"center") == 0) originflag[ndim] = CENTER; else if (strcmp(arg[iarg+1],"upper") == 0) originflag[ndim] = UPPER; else originflag[ndim] = COORD; - if (originflag[ndim] == COORD) origin[ndim] = atof(arg[iarg+1]); + if (originflag[ndim] == COORD) origin[ndim] = force->numeric(FLERR,arg[iarg+1]); - delta[ndim] = atof(arg[iarg+2]); + delta[ndim] = force->numeric(FLERR,arg[iarg+2]); ndim++; iarg += 3; } @@ -213,7 +213,7 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal fix ave/spatial command"); if (ave == WINDOW) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix ave/spatial command"); - nwindow = atoi(arg[iarg+2]); + nwindow = force->inumeric(FLERR,arg[iarg+2]); if (nwindow <= 0) error->all(FLERR,"Illegal fix ave/spatial command"); } iarg += 2; diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index 18003af66c..ed6a47539e 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -26,6 +26,7 @@ #include "variable.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -47,9 +48,9 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = atoi(arg[3]); - nrepeat = atoi(arg[4]); - nfreq = atoi(arg[5]); + nevery = force->inumeric(FLERR,arg[3]); + nrepeat = force->inumeric(FLERR,arg[4]); + nfreq = force->inumeric(FLERR,arg[5]); global_freq = nfreq; @@ -855,14 +856,14 @@ void FixAveTime::options(int narg, char **arg) else error->all(FLERR,"Illegal fix ave/time command"); if (ave == WINDOW) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix ave/time command"); - nwindow = atoi(arg[iarg+2]); + nwindow = force->inumeric(FLERR,arg[iarg+2]); if (nwindow <= 0) error->all(FLERR,"Illegal fix ave/time command"); } iarg += 2; if (ave == WINDOW) iarg++; } else if (strcmp(arg[iarg],"start") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command"); - startstep = atoi(arg[iarg+1]); + startstep = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"mode") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command"); @@ -873,7 +874,7 @@ void FixAveTime::options(int narg, char **arg) } else if (strcmp(arg[iarg],"off") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command"); memory->grow(offlist,noff+1,"ave/time:offlist"); - offlist[noff++] = atoi(arg[iarg+1]); + offlist[noff++] = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"overwrite") == 0) { overwrite = 1; diff --git a/src/fix_aveforce.cpp b/src/fix_aveforce.cpp index e833823357..6b4bf40bc8 100644 --- a/src/fix_aveforce.cpp +++ b/src/fix_aveforce.cpp @@ -24,6 +24,7 @@ #include "input.h" #include "variable.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -51,7 +52,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[3],"NULL") == 0) { xstyle = NONE; } else { - xvalue = atof(arg[3]); + xvalue = force->numeric(FLERR,arg[3]); xstyle = CONSTANT; } if (strstr(arg[4],"v_") == arg[4]) { @@ -61,7 +62,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[4],"NULL") == 0) { ystyle = NONE; } else { - yvalue = atof(arg[4]); + yvalue = force->numeric(FLERR,arg[4]); ystyle = CONSTANT; } if (strstr(arg[5],"v_") == arg[5]) { @@ -71,7 +72,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[5],"NULL") == 0) { zstyle = NONE; } else { - zvalue = atof(arg[5]); + zvalue = force->numeric(FLERR,arg[5]); zstyle = CONSTANT; } diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index f19356d57c..5ee057ab5f 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -46,11 +46,11 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) : int dimension = domain->dimension; - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (strlen(arg[4]) > 3) error->all(FLERR,"Illegal fix balance command"); strcpy(bstr,arg[4]); - nitermax = atoi(arg[5]); - thresh = atof(arg[6]); + nitermax = force->inumeric(FLERR,arg[5]); + thresh = force->numeric(FLERR,arg[6]); if (nevery < 0 || nitermax <= 0 || thresh < 1.0) error->all(FLERR,"Illegal fix balance command"); diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp index 1660b20b1f..dea4e507a3 100644 --- a/src/fix_box_relax.cpp +++ b/src/fix_box_relax.cpp @@ -89,7 +89,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"iso") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); pcouple = XYZ; - p_target[0] = p_target[1] = p_target[2] = atof(arg[iarg+1]); + p_target[0] = p_target[1] = p_target[2] = force->numeric(FLERR,arg[iarg+1]); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_target[2] = 0.0; @@ -99,7 +99,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"aniso") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); pcouple = NONE; - p_target[0] = p_target[1] = p_target[2] = atof(arg[iarg+1]); + p_target[0] = p_target[1] = p_target[2] = force->numeric(FLERR,arg[iarg+1]); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_target[2] = 0.0; @@ -110,7 +110,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); pcouple = NONE; scalexy = scalexz = scaleyz = 0; - p_target[0] = p_target[1] = p_target[2] = atof(arg[iarg+1]); + p_target[0] = p_target[1] = p_target[2] = force->numeric(FLERR,arg[iarg+1]); p_flag[0] = p_flag[1] = p_flag[2] = 1; p_target[3] = p_target[4] = p_target[5] = 0.0; p_flag[3] = p_flag[4] = p_flag[5] = 1; @@ -122,19 +122,19 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[0] = atof(arg[iarg+1]); + p_target[0] = force->numeric(FLERR,arg[iarg+1]); p_flag[0] = 1; deviatoric_flag = 1; iarg += 2; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[1] = atof(arg[iarg+1]); + p_target[1] = force->numeric(FLERR,arg[iarg+1]); p_flag[1] = 1; deviatoric_flag = 1; iarg += 2; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[2] = atof(arg[iarg+1]); + p_target[2] = force->numeric(FLERR,arg[iarg+1]); p_flag[2] = 1; deviatoric_flag = 1; iarg += 2; @@ -143,7 +143,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"yz") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[3] = atof(arg[iarg+1]); + p_target[3] = force->numeric(FLERR,arg[iarg+1]); p_flag[3] = 1; deviatoric_flag = 1; scaleyz = 0; @@ -152,7 +152,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Invalid fix box/relax command for a 2d simulation"); } else if (strcmp(arg[iarg],"xz") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[4] = atof(arg[iarg+1]); + p_target[4] = force->numeric(FLERR,arg[iarg+1]); p_flag[4] = 1; deviatoric_flag = 1; scalexz = 0; @@ -161,7 +161,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Invalid fix box/relax command for a 2d simulation"); } else if (strcmp(arg[iarg],"xy") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[5] = atof(arg[iarg+1]); + p_target[5] = force->numeric(FLERR,arg[iarg+1]); p_flag[5] = 1; deviatoric_flag = 1; scalexy = 0; @@ -185,11 +185,11 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"vmax") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - vmax = atof(arg[iarg+1]); + vmax = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"nreset") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - nreset_h0 = atoi(arg[iarg+1]); + nreset_h0 = force->inumeric(FLERR,arg[iarg+1]); if (nreset_h0 < 0) error->all(FLERR,"Illegal fix box/relax command"); iarg += 2; } else if (strcmp(arg[iarg],"scalexy") == 0) { @@ -212,9 +212,9 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"fixedpoint") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix box/relax command"); - fixedpoint[0] = atof(arg[iarg+1]); - fixedpoint[1] = atof(arg[iarg+2]); - fixedpoint[2] = atof(arg[iarg+3]); + fixedpoint[0] = force->numeric(FLERR,arg[iarg+1]); + fixedpoint[1] = force->numeric(FLERR,arg[iarg+2]); + fixedpoint[2] = force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else error->all(FLERR,"Illegal fix box/relax command"); } diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index 78b5e99313..74bb8fa3e9 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -53,7 +53,7 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) box_change = 1; no_change_box = 1; - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix deform command"); // set defaults @@ -85,34 +85,34 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (strcmp(arg[iarg+1],"final") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = FINAL; - set[index].flo = atof(arg[iarg+2]); - set[index].fhi = atof(arg[iarg+3]); + set[index].flo = force->numeric(FLERR,arg[iarg+2]); + set[index].fhi = force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg+1],"delta") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = DELTA; - set[index].dlo = atof(arg[iarg+2]); - set[index].dhi = atof(arg[iarg+3]); + set[index].dlo = force->numeric(FLERR,arg[iarg+2]); + set[index].dhi = force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg+1],"scale") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = SCALE; - set[index].scale = atof(arg[iarg+2]); + set[index].scale = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg+1],"vel") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = VEL; - set[index].vel = atof(arg[iarg+2]); + set[index].vel = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg+1],"erate") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = ERATE; - set[index].rate = atof(arg[iarg+2]); + set[index].rate = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg+1],"trate") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = TRATE; - set[index].rate = atof(arg[iarg+2]); + set[index].rate = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg+1],"volume") == 0) { set[index].style = VOLUME; @@ -120,8 +120,8 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg+1],"wiggle") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = WIGGLE; - set[index].amplitude = atof(arg[iarg+2]); - set[index].tperiod = atof(arg[iarg+3]); + set[index].amplitude = force->numeric(FLERR,arg[iarg+2]); + set[index].tperiod = force->numeric(FLERR,arg[iarg+3]); if (set[index].tperiod <= 0.0) error->all(FLERR,"Illegal fix deform command"); iarg += 4; @@ -157,33 +157,33 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (strcmp(arg[iarg+1],"final") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = FINAL; - set[index].ftilt = atof(arg[iarg+2]); + set[index].ftilt = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg+1],"delta") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = DELTA; - set[index].dtilt = atof(arg[iarg+2]); + set[index].dtilt = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg+1],"vel") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = VEL; - set[index].vel = atof(arg[iarg+2]); + set[index].vel = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg+1],"erate") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = ERATE; - set[index].rate = atof(arg[iarg+2]); + set[index].rate = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg+1],"trate") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = TRATE; - set[index].rate = atof(arg[iarg+2]); + set[index].rate = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg+1],"wiggle") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = WIGGLE; - set[index].amplitude = atof(arg[iarg+2]); - set[index].tperiod = atof(arg[iarg+3]); + set[index].amplitude = force->numeric(FLERR,arg[iarg+2]); + set[index].tperiod = force->numeric(FLERR,arg[iarg+3]); if (set[index].tperiod <= 0.0) error->all(FLERR,"Illegal fix deform command"); iarg += 4; diff --git a/src/fix_deposit.cpp b/src/fix_deposit.cpp index c708a8fdbe..9ee902e0c2 100644 --- a/src/fix_deposit.cpp +++ b/src/fix_deposit.cpp @@ -44,10 +44,10 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) : // required args - ninsert = atoi(arg[3]); - ntype = atoi(arg[4]); - nfreq = atoi(arg[5]); - seed = atoi(arg[6]); + ninsert = force->inumeric(FLERR,arg[3]); + ntype = force->inumeric(FLERR,arg[4]); + nfreq = force->inumeric(FLERR,arg[5]); + seed = force->inumeric(FLERR,arg[6]); if (seed <= 0) error->all(FLERR,"Illegal fix deposit command"); @@ -414,44 +414,44 @@ void FixDeposit::options(int narg, char **arg) if (iarg+3 > narg) error->all(FLERR,"Illegal fix deposit command"); globalflag = 1; localflag = 0; - lo = atof(arg[iarg+1]); - hi = atof(arg[iarg+2]); + lo = force->numeric(FLERR,arg[iarg+1]); + hi = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"local") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deposit command"); localflag = 1; globalflag = 0; - lo = atof(arg[iarg+1]); - hi = atof(arg[iarg+2]); - deltasq = atof(arg[iarg+3])*atof(arg[iarg+3]); + lo = force->numeric(FLERR,arg[iarg+1]); + hi = force->numeric(FLERR,arg[iarg+2]); + deltasq = force->numeric(FLERR,arg[iarg+3])*force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"near") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command"); - nearsq = atof(arg[iarg+1])*atof(arg[iarg+1]); + nearsq = force->numeric(FLERR,arg[iarg+1])*force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"attempt") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command"); - maxattempt = atoi(arg[iarg+1]); + maxattempt = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"rate") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command"); rateflag = 1; - rate = atof(arg[iarg+1]); + rate = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"vx") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deposit command"); - vxlo = atof(arg[iarg+1]); - vxhi = atof(arg[iarg+2]); + vxlo = force->numeric(FLERR,arg[iarg+1]); + vxhi = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"vy") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deposit command"); - vylo = atof(arg[iarg+1]); - vyhi = atof(arg[iarg+2]); + vylo = force->numeric(FLERR,arg[iarg+1]); + vyhi = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"vz") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deposit command"); - vzlo = atof(arg[iarg+1]); - vzhi = atof(arg[iarg+2]); + vzlo = force->numeric(FLERR,arg[iarg+1]); + vzhi = force->numeric(FLERR,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg],"units") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command"); @@ -461,9 +461,9 @@ void FixDeposit::options(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"target") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deposit command"); - tx = atof(arg[iarg+1]); - ty = atof(arg[iarg+2]); - tz = atof(arg[iarg+3]); + tx = force->numeric(FLERR,arg[iarg+1]); + ty = force->numeric(FLERR,arg[iarg+2]); + tz = force->numeric(FLERR,arg[iarg+3]); targetflag = 1; iarg += 4; } else error->all(FLERR,"Illegal fix deposit command"); diff --git a/src/fix_drag.cpp b/src/fix_drag.cpp index 0abdf0d3d2..1771be42c8 100644 --- a/src/fix_drag.cpp +++ b/src/fix_drag.cpp @@ -20,6 +20,7 @@ #include "respa.h" #include "domain.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -39,14 +40,14 @@ FixDrag::FixDrag(LAMMPS *lmp, int narg, char **arg) : xflag = yflag = zflag = 1; if (strcmp(arg[3],"NULL") == 0) xflag = 0; - else xc = atof(arg[3]); + else xc = force->numeric(FLERR,arg[3]); if (strcmp(arg[4],"NULL") == 0) yflag = 0; - else yc = atof(arg[4]); + else yc = force->numeric(FLERR,arg[4]); if (strcmp(arg[5],"NULL") == 0) zflag = 0; - else zc = atof(arg[5]); + else zc = force->numeric(FLERR,arg[5]); - f_mag = atof(arg[6]); - delta = atof(arg[7]); + f_mag = force->numeric(FLERR,arg[6]); + delta = force->numeric(FLERR,arg[7]); force_flag = 0; ftotal[0] = ftotal[1] = ftotal[2] = 0.0; diff --git a/src/fix_dt_reset.cpp b/src/fix_dt_reset.cpp index 553e6ee04d..53fbf6e105 100644 --- a/src/fix_dt_reset.cpp +++ b/src/fix_dt_reset.cpp @@ -51,16 +51,16 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) : extscalar = 0; extvector = 0; - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix dt/reset command"); minbound = maxbound = 1; tmin = tmax = 0.0; if (strcmp(arg[4],"NULL") == 0) minbound = 0; - else tmin = atof(arg[4]); + else tmin = force->numeric(FLERR,arg[4]); if (strcmp(arg[5],"NULL") == 0) maxbound = 0; - else tmax = atof(arg[5]); - xmax = atof(arg[6]); + else tmax = force->numeric(FLERR,arg[5]); + xmax = force->numeric(FLERR,arg[6]); if (minbound && tmin < 0.0) error->all(FLERR,"Illegal fix dt/reset command"); if (maxbound && tmax < 0.0) error->all(FLERR,"Illegal fix dt/reset command"); diff --git a/src/fix_efield.cpp b/src/fix_efield.cpp index 7fca5850a6..f328a3f294 100644 --- a/src/fix_efield.cpp +++ b/src/fix_efield.cpp @@ -59,7 +59,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : xstr = new char[n]; strcpy(xstr,&arg[3][2]); } else { - ex = qe2f * atof(arg[3]); + ex = qe2f * force->numeric(FLERR,arg[3]); xstyle = CONSTANT; } @@ -68,7 +68,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : ystr = new char[n]; strcpy(ystr,&arg[4][2]); } else { - ey = qe2f * atof(arg[4]); + ey = qe2f * force->numeric(FLERR,arg[4]); ystyle = CONSTANT; } @@ -77,7 +77,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : zstr = new char[n]; strcpy(zstr,&arg[5][2]); } else { - ez = qe2f * atof(arg[5]); + ez = qe2f * force->numeric(FLERR,arg[5]); zstyle = CONSTANT; } diff --git a/src/fix_evaporate.cpp b/src/fix_evaporate.cpp index 7eb5093d3f..5fe5c1412f 100644 --- a/src/fix_evaporate.cpp +++ b/src/fix_evaporate.cpp @@ -42,13 +42,13 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extscalar = 0; - nevery = atoi(arg[3]); - nflux = atoi(arg[4]); + nevery = force->inumeric(FLERR,arg[3]); + nflux = force->inumeric(FLERR,arg[4]); iregion = domain->find_region(arg[5]); int n = strlen(arg[5]) + 1; idregion = new char[n]; strcpy(idregion,arg[5]); - int seed = atoi(arg[6]); + int seed = force->inumeric(FLERR,arg[6]); if (nevery <= 0 || nflux <= 0) error->all(FLERR,"Illegal fix evaporate command"); diff --git a/src/fix_external.cpp b/src/fix_external.cpp index 8cddd0dbce..fffc57c72c 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -19,6 +19,7 @@ #include "update.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -35,14 +36,14 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"pf/callback") == 0) { if (narg != 6) error->all(FLERR,"Illegal fix external command"); mode = PF_CALLBACK; - ncall = atoi(arg[4]); - napply = atoi(arg[5]); + ncall = force->inumeric(FLERR,arg[4]); + napply = force->inumeric(FLERR,arg[5]); if (ncall <= 0 || napply <= 0) error->all(FLERR,"Illegal fix external command"); } else if (strcmp(arg[3],"pf/array") == 0) { if (narg != 5) error->all(FLERR,"Illegal fix external command"); mode = PF_ARRAY; - napply = atoi(arg[4]); + napply = force->inumeric(FLERR,arg[4]); if (napply <= 0) error->all(FLERR,"Illegal fix external command"); } else error->all(FLERR,"Illegal fix external command"); diff --git a/src/fix_gravity.cpp b/src/fix_gravity.cpp index bc72f5b113..37e605f74d 100644 --- a/src/fix_gravity.cpp +++ b/src/fix_gravity.cpp @@ -25,6 +25,7 @@ #include "variable.h" #include "math_const.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -53,7 +54,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(mstr,&arg[3][2]); mstyle = EQUAL; } else { - magnitude = atof(arg[3]); + magnitude = force->numeric(FLERR,arg[3]); mstyle = CONSTANT; } @@ -66,7 +67,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(vstr,&arg[5][2]); vstyle = EQUAL; } else { - vert = atof(arg[5]); + vert = force->numeric(FLERR,arg[5]); vstyle = CONSTANT; } @@ -79,7 +80,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(pstr,&arg[5][2]); pstyle = EQUAL; } else { - phi = atof(arg[5]); + phi = force->numeric(FLERR,arg[5]); pstyle = CONSTANT; } if (strstr(arg[6],"v_") == arg[6]) { @@ -88,7 +89,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(tstr,&arg[6][2]); tstyle = EQUAL; } else { - theta = atof(arg[6]); + theta = force->numeric(FLERR,arg[6]); tstyle = CONSTANT; } @@ -101,7 +102,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(xstr,&arg[5][2]); xstyle = EQUAL; } else { - xdir = atof(arg[5]); + xdir = force->numeric(FLERR,arg[5]); xstyle = CONSTANT; } if (strstr(arg[6],"v_") == arg[6]) { @@ -110,7 +111,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(ystr,&arg[6][2]); ystyle = EQUAL; } else { - ydir = atof(arg[6]); + ydir = force->numeric(FLERR,arg[6]); ystyle = CONSTANT; } if (strstr(arg[7],"v_") == arg[7]) { @@ -119,7 +120,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(zstr,&arg[7][2]); zstyle = EQUAL; } else { - zdir = atof(arg[7]); + zdir = force->numeric(FLERR,arg[7]); zstyle = CONSTANT; } diff --git a/src/fix_heat.cpp b/src/fix_heat.cpp index 50b7a7ab81..e4220c5557 100644 --- a/src/fix_heat.cpp +++ b/src/fix_heat.cpp @@ -46,7 +46,7 @@ FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) global_freq = 1; extscalar = 0; - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix heat command"); hstr = NULL; @@ -56,7 +56,7 @@ FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) hstr = new char[n]; strcpy(hstr,&arg[4][2]); } else { - heat_input = atof(arg[4]); + heat_input = force->numeric(FLERR,arg[4]); hstyle = CONSTANT; } diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index 558121697b..9e214de763 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -29,6 +29,7 @@ #include "output.h" #include "respa.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -50,7 +51,7 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) : extscalar = 1; extvector = 1; - k = atof(arg[3]); + k = force->numeric(FLERR,arg[3]); k3 = k/3.0; // read options from end of input line @@ -416,22 +417,22 @@ void FixIndent::options(int narg, char **arg) int n = strlen(&arg[iarg+1][2]) + 1; xstr = new char[n]; strcpy(xstr,&arg[iarg+1][2]); - } else xvalue = atof(arg[iarg+1]); + } else xvalue = force->numeric(FLERR,arg[iarg+1]); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { int n = strlen(&arg[iarg+2][2]) + 1; ystr = new char[n]; strcpy(ystr,&arg[iarg+2][2]); - } else yvalue = atof(arg[iarg+2]); + } else yvalue = force->numeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; zstr = new char[n]; strcpy(zstr,&arg[iarg+3][2]); - } else zvalue = atof(arg[iarg+3]); + } else zvalue = force->numeric(FLERR,arg[iarg+3]); if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) { int n = strlen(&arg[iarg+4][2]) + 1; rstr = new char[n]; strcpy(rstr,&arg[iarg+4][2]); - } else rvalue = atof(arg[iarg+4]); + } else rvalue = force->numeric(FLERR,arg[iarg+4]); istyle = SPHERE; iarg += 5; @@ -445,43 +446,43 @@ void FixIndent::options(int narg, char **arg) int n = strlen(&arg[iarg+2][2]) + 1; ystr = new char[n]; strcpy(ystr,&arg[iarg+2][2]); - } else yvalue = atof(arg[iarg+2]); + } else yvalue = force->numeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; zstr = new char[n]; strcpy(zstr,&arg[iarg+3][2]); - } else zvalue = atof(arg[iarg+3]); + } else zvalue = force->numeric(FLERR,arg[iarg+3]); } else if (strcmp(arg[iarg+1],"y") == 0) { cdim = 1; if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { int n = strlen(&arg[iarg+2][2]) + 1; xstr = new char[n]; strcpy(xstr,&arg[iarg+2][2]); - } else xvalue = atof(arg[iarg+2]); + } else xvalue = force->numeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; zstr = new char[n]; strcpy(zstr,&arg[iarg+3][2]); - } else zvalue = atof(arg[iarg+3]); + } else zvalue = force->numeric(FLERR,arg[iarg+3]); } else if (strcmp(arg[iarg+1],"z") == 0) { cdim = 2; if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { int n = strlen(&arg[iarg+2][2]) + 1; xstr = new char[n]; strcpy(xstr,&arg[iarg+2][2]); - } else xvalue = atof(arg[iarg+2]); + } else xvalue = force->numeric(FLERR,arg[iarg+2]); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; ystr = new char[n]; strcpy(ystr,&arg[iarg+3][2]); - } else yvalue = atof(arg[iarg+3]); + } else yvalue = force->numeric(FLERR,arg[iarg+3]); } else error->all(FLERR,"Illegal fix indent command"); if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) { int n = strlen(&arg[iarg+4][2]) + 1; rstr = new char[n]; strcpy(rstr,&arg[iarg+4][2]); - } else rvalue = atof(arg[iarg+4]); + } else rvalue = force->numeric(FLERR,arg[iarg+4]); istyle = CYLINDER; iarg += 5; @@ -497,7 +498,7 @@ void FixIndent::options(int narg, char **arg) int n = strlen(&arg[iarg+2][2]) + 1; pstr = new char[n]; strcpy(pstr,&arg[iarg+2][2]); - } else pvalue = atof(arg[iarg+2]); + } else pvalue = force->numeric(FLERR,arg[iarg+2]); if (strcmp(arg[iarg+3],"lo") == 0) planeside = -1; else if (strcmp(arg[iarg+3],"hi") == 0) planeside = 1; diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 6f11342a36..dd55d1c3ad 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -66,14 +66,14 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : tstr = new char[n]; strcpy(tstr,&arg[3][2]); } else { - t_start = atof(arg[3]); + t_start = force->numeric(FLERR,arg[3]); t_target = t_start; tstyle = CONSTANT; } - t_stop = atof(arg[4]); - t_period = atof(arg[5]); - int seed = atoi(arg[6]); + t_stop = force->numeric(FLERR,arg[4]); + t_period = force->numeric(FLERR,arg[5]); + int seed = force->inumeric(FLERR,arg[6]); if (t_period <= 0.0) error->all(FLERR,"Fix langevin period must be > 0.0"); if (seed <= 0) error->all(FLERR,"Illegal fix langevin command"); @@ -118,8 +118,8 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"scale") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix langevin command"); - int itype = atoi(arg[iarg+1]); - double scale = atof(arg[iarg+2]); + int itype = force->inumeric(FLERR,arg[iarg+1]); + double scale = force->numeric(FLERR,arg[iarg+2]); if (itype <= 0 || itype > atom->ntypes) error->all(FLERR,"Illegal fix langevin command"); ratio[itype] = scale; diff --git a/src/fix_lineforce.cpp b/src/fix_lineforce.cpp index a778ac13c5..7128d24572 100644 --- a/src/fix_lineforce.cpp +++ b/src/fix_lineforce.cpp @@ -19,6 +19,7 @@ #include "update.h" #include "respa.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -29,9 +30,9 @@ FixLineForce::FixLineForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg != 6) error->all(FLERR,"Illegal fix lineforce command"); - xdir = atof(arg[3]); - ydir = atof(arg[4]); - zdir = atof(arg[5]); + xdir = force->numeric(FLERR,arg[3]); + ydir = force->numeric(FLERR,arg[4]); + zdir = force->numeric(FLERR,arg[5]); double len = sqrt(xdir*xdir + ydir*ydir + zdir*zdir); if (len == 0.0) error->all(FLERR,"Illegal fix lineforce command"); diff --git a/src/fix_momentum.cpp b/src/fix_momentum.cpp index 6f9da4427b..ff4ea79888 100644 --- a/src/fix_momentum.cpp +++ b/src/fix_momentum.cpp @@ -18,6 +18,7 @@ #include "domain.h" #include "group.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -32,7 +33,7 @@ FixMomentum::FixMomentum(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 4) error->all(FLERR,"Illegal fix momentum command"); - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix momentum command"); linear = angular = 0; @@ -42,9 +43,9 @@ FixMomentum::FixMomentum(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"linear") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix momentum command"); linear = 1; - xflag = atoi(arg[iarg+1]); - yflag = atoi(arg[iarg+2]); - zflag = atoi(arg[iarg+3]); + xflag = force->inumeric(FLERR,arg[iarg+1]); + yflag = force->inumeric(FLERR,arg[iarg+2]); + zflag = force->inumeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"angular") == 0) { angular = 1; diff --git a/src/fix_move.cpp b/src/fix_move.cpp index 0e241b8882..aeb1a27e96 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -65,17 +65,17 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[4],"NULL") == 0) vxflag = 0; else { vxflag = 1; - vx = atof(arg[4]); + vx = force->numeric(FLERR,arg[4]); } if (strcmp(arg[5],"NULL") == 0) vyflag = 0; else { vyflag = 1; - vy = atof(arg[5]); + vy = force->numeric(FLERR,arg[5]); } if (strcmp(arg[6],"NULL") == 0) vzflag = 0; else { vzflag = 1; - vz = atof(arg[6]); + vz = force->numeric(FLERR,arg[6]); } } else if (strcmp(arg[3],"wiggle") == 0) { @@ -85,31 +85,31 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[4],"NULL") == 0) axflag = 0; else { axflag = 1; - ax = atof(arg[4]); + ax = force->numeric(FLERR,arg[4]); } if (strcmp(arg[5],"NULL") == 0) ayflag = 0; else { ayflag = 1; - ay = atof(arg[5]); + ay = force->numeric(FLERR,arg[5]); } if (strcmp(arg[6],"NULL") == 0) azflag = 0; else { azflag = 1; - az = atof(arg[6]); + az = force->numeric(FLERR,arg[6]); } - period = atof(arg[7]); + period = force->numeric(FLERR,arg[7]); } else if (strcmp(arg[3],"rotate") == 0) { if (narg < 11) error->all(FLERR,"Illegal fix move command"); iarg = 11; mstyle = ROTATE; - point[0] = atof(arg[4]); - point[1] = atof(arg[5]); - point[2] = atof(arg[6]); - axis[0] = atof(arg[7]); - axis[1] = atof(arg[8]); - axis[2] = atof(arg[9]); - period = atof(arg[10]); + point[0] = force->numeric(FLERR,arg[4]); + point[1] = force->numeric(FLERR,arg[5]); + point[2] = force->numeric(FLERR,arg[6]); + axis[0] = force->numeric(FLERR,arg[7]); + axis[1] = force->numeric(FLERR,arg[8]); + axis[2] = force->numeric(FLERR,arg[9]); + period = force->numeric(FLERR,arg[10]); } else if (strcmp(arg[3],"variable") == 0) { if (narg < 10) error->all(FLERR,"Illegal fix move command"); diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 72c8a897e5..5fc51a8e5e 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -115,10 +115,10 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (strcmp(arg[iarg],"temp") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); tstat_flag = 1; - t_start = atof(arg[iarg+1]); + t_start = force->numeric(FLERR,arg[iarg+1]); t_target = t_start; - t_stop = atof(arg[iarg+2]); - t_period = atof(arg[iarg+3]); + t_stop = force->numeric(FLERR,arg[iarg+2]); + t_period = force->numeric(FLERR,arg[iarg+3]); if (t_start < 0.0 || t_stop <= 0.0) error->all(FLERR, "Target temperature for fix nvt/npt/nph cannot be 0.0"); @@ -127,9 +127,9 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg],"iso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph 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; @@ -139,9 +139,9 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg],"aniso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); pcouple = NONE; - 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; @@ -152,13 +152,13 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); pcouple = NONE; scalexy = scalexz = scaleyz = 0; - 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; p_start[3] = p_start[4] = p_start[5] = 0.0; p_stop[3] = p_stop[4] = p_stop[5] = 0.0; - p_period[3] = p_period[4] = p_period[5] = atof(arg[iarg+3]); + p_period[3] = p_period[4] = p_period[5] = force->numeric(FLERR,arg[iarg+3]); p_flag[3] = p_flag[4] = p_flag[5] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -171,25 +171,25 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) iarg += 4; } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph 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; deviatoric_flag = 1; iarg += 4; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph 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; deviatoric_flag = 1; iarg += 4; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph 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; deviatoric_flag = 1; iarg += 4; @@ -198,9 +198,9 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg],"yz") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[3] = atof(arg[iarg+1]); - p_stop[3] = atof(arg[iarg+2]); - p_period[3] = atof(arg[iarg+3]); + p_start[3] = force->numeric(FLERR,arg[iarg+1]); + p_stop[3] = force->numeric(FLERR,arg[iarg+2]); + p_period[3] = force->numeric(FLERR,arg[iarg+3]); p_flag[3] = 1; deviatoric_flag = 1; scaleyz = 0; @@ -209,9 +209,9 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation"); } else if (strcmp(arg[iarg],"xz") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[4] = atof(arg[iarg+1]); - p_stop[4] = atof(arg[iarg+2]); - p_period[4] = atof(arg[iarg+3]); + p_start[4] = force->numeric(FLERR,arg[iarg+1]); + p_stop[4] = force->numeric(FLERR,arg[iarg+2]); + p_period[4] = force->numeric(FLERR,arg[iarg+3]); p_flag[4] = 1; deviatoric_flag = 1; scalexz = 0; @@ -220,9 +220,9 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation"); } else if (strcmp(arg[iarg],"xy") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[5] = atof(arg[iarg+1]); - p_stop[5] = atof(arg[iarg+2]); - p_period[5] = atof(arg[iarg+3]); + p_start[5] = force->numeric(FLERR,arg[iarg+1]); + p_stop[5] = force->numeric(FLERR,arg[iarg+2]); + p_period[5] = force->numeric(FLERR,arg[iarg+3]); p_flag[5] = 1; deviatoric_flag = 1; scalexy = 0; @@ -240,7 +240,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg],"drag") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - drag = atof(arg[iarg+1]); + drag = force->numeric(FLERR,arg[iarg+1]); if (drag < 0.0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"dilate") == 0) { @@ -260,14 +260,14 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else if (strcmp(arg[iarg],"tchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - mtchain = atoi(arg[iarg+1]); + mtchain = force->inumeric(FLERR,arg[iarg+1]); // used by FixNVTSllod to preserve non-default value mtchain_default_flag = 0; if (mtchain < 1) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"pchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - mpchain = atoi(arg[iarg+1]); + mpchain = force->inumeric(FLERR,arg[iarg+1]); if (mpchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"mtk") == 0) { @@ -278,17 +278,17 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) iarg += 2; } else if (strcmp(arg[iarg],"tloop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - nc_tchain = atoi(arg[iarg+1]); + nc_tchain = force->inumeric(FLERR,arg[iarg+1]); if (nc_tchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"ploop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - nc_pchain = atoi(arg[iarg+1]); + nc_pchain = force->inumeric(FLERR,arg[iarg+1]); if (nc_pchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"nreset") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - nreset_h0 = atoi(arg[iarg+1]); + nreset_h0 = force->inumeric(FLERR,arg[iarg+1]); if (nreset_h0 < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"scalexy") == 0) { @@ -317,9 +317,9 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) iarg += 2; } else if (strcmp(arg[iarg],"fixedpoint") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - fixedpoint[0] = atof(arg[iarg+1]); - fixedpoint[1] = atof(arg[iarg+2]); - fixedpoint[2] = atof(arg[iarg+3]); + fixedpoint[0] = force->numeric(FLERR,arg[iarg+1]); + fixedpoint[1] = force->numeric(FLERR,arg[iarg+2]); + fixedpoint[2] = force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else error->all(FLERR,"Illegal fix nvt/npt/nph command"); } diff --git a/src/fix_nve_limit.cpp b/src/fix_nve_limit.cpp index 13cf558002..29d287f185 100644 --- a/src/fix_nve_limit.cpp +++ b/src/fix_nve_limit.cpp @@ -37,7 +37,7 @@ FixNVELimit::FixNVELimit(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extscalar = 1; - xlimit = atof(arg[3]); + xlimit = force->numeric(FLERR,arg[3]); ncount = 0; } diff --git a/src/fix_orient_fcc.cpp b/src/fix_orient_fcc.cpp index d1ba81bf87..3611478308 100644 --- a/src/fix_orient_fcc.cpp +++ b/src/fix_orient_fcc.cpp @@ -31,6 +31,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -55,12 +56,12 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 2; peratom_freq = 1; - nstats = atoi(arg[3]); - direction_of_motion = atoi(arg[4]); - a = atof(arg[5]); - Vxi = atof(arg[6]); - uxif_low = atof(arg[7]); - uxif_high = atof(arg[8]); + nstats = force->inumeric(FLERR,arg[3]); + direction_of_motion = force->inumeric(FLERR,arg[4]); + a = force->numeric(FLERR,arg[5]); + Vxi = force->numeric(FLERR,arg[6]); + uxif_low = force->numeric(FLERR,arg[7]); + uxif_high = force->numeric(FLERR,arg[8]); if (direction_of_motion == 0) { int n = strlen(arg[9]) + 1; diff --git a/src/fix_planeforce.cpp b/src/fix_planeforce.cpp index 7f12590cf4..217aec9c36 100644 --- a/src/fix_planeforce.cpp +++ b/src/fix_planeforce.cpp @@ -19,6 +19,7 @@ #include "update.h" #include "respa.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -29,9 +30,9 @@ FixPlaneForce::FixPlaneForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg != 6) error->all(FLERR,"Illegal fix planeforce command"); - xdir = atof(arg[3]); - ydir = atof(arg[4]); - zdir = atof(arg[5]); + xdir = force->numeric(FLERR,arg[3]); + ydir = force->numeric(FLERR,arg[4]); + zdir = force->numeric(FLERR,arg[5]); double len = sqrt(xdir*xdir + ydir*ydir + zdir*zdir); if (len == 0.0) error->all(FLERR,"Illegal fix planeforce command"); diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index 5015804006..cb6ab21542 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -71,9 +71,9 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix press/berendsen 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; @@ -84,9 +84,9 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix press/berendsen command"); pcouple = NONE; - 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; @@ -97,25 +97,25 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix press/berendsen 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 press/berendsen 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 press/berendsen 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; if (dimension == 2) @@ -135,7 +135,7 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"modulus") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix press/berendsen command"); - bulkmodulus = atof(arg[iarg+1]); + bulkmodulus = force->numeric(FLERR,arg[iarg+1]); if (bulkmodulus <= 0.0) error->all(FLERR,"Illegal fix press/berendsen command"); iarg += 2; diff --git a/src/fix_print.cpp b/src/fix_print.cpp index 5db6b096da..f93356c043 100644 --- a/src/fix_print.cpp +++ b/src/fix_print.cpp @@ -20,6 +20,7 @@ #include "variable.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -30,7 +31,7 @@ FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 5) error->all(FLERR,"Illegal fix print command"); - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix print command"); MPI_Comm_rank(world,&me); diff --git a/src/fix_read_restart.cpp b/src/fix_read_restart.cpp index fc85315720..a1d1b7c655 100644 --- a/src/fix_read_restart.cpp +++ b/src/fix_read_restart.cpp @@ -15,6 +15,7 @@ #include "fix_read_restart.h" #include "atom.h" #include "memory.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -24,8 +25,8 @@ using namespace FixConst; FixReadRestart::FixReadRestart(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - nextra = atoi(arg[3]); - int nfix = atoi(arg[4]); + nextra = force->inumeric(FLERR,arg[3]); + int nfix = force->inumeric(FLERR,arg[4]); // perform initial allocation of atom-based array // register with Atom class diff --git a/src/fix_recenter.cpp b/src/fix_recenter.cpp index 50ea9c2303..29e77b2555 100644 --- a/src/fix_recenter.cpp +++ b/src/fix_recenter.cpp @@ -25,6 +25,7 @@ #include "modify.h" #include "comm.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -44,13 +45,13 @@ FixRecenter::FixRecenter(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"NULL") == 0) xflag = 0; else if (strcmp(arg[3],"INIT") == 0) xinitflag = 1; - else xcom = atof(arg[3]); + else xcom = force->numeric(FLERR,arg[3]); if (strcmp(arg[4],"NULL") == 0) yflag = 0; else if (strcmp(arg[4],"INIT") == 0) yinitflag = 1; - else ycom = atof(arg[4]); + else ycom = force->numeric(FLERR,arg[4]); if (strcmp(arg[5],"NULL") == 0) zflag = 0; else if (strcmp(arg[5],"INIT") == 0) zinitflag = 1; - else zcom = atof(arg[5]); + else zcom = force->numeric(FLERR,arg[5]); // optional args diff --git a/src/fix_respa.cpp b/src/fix_respa.cpp index 591440f2ed..d346712b9d 100644 --- a/src/fix_respa.cpp +++ b/src/fix_respa.cpp @@ -16,6 +16,7 @@ #include "atom.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -27,7 +28,7 @@ FixRespa::FixRespa(LAMMPS *lmp, int narg, char **arg) : { // nlevels = # of rRESPA levels - nlevels = atoi(arg[3]); + nlevels = force->inumeric(FLERR,arg[3]); // perform initial allocation of atom-based arrays // register with Atom class diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index bd1d39f471..33f717c896 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -76,8 +76,8 @@ FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"bond") == 0) { if (iarg+6 > narg) error->all(FLERR,"Illegal fix restrain command"); rstyle[nrestrain] = BOND; - ids[nrestrain][0] = atoi(arg[iarg+1]); - ids[nrestrain][1] = atoi(arg[iarg+2]); + ids[nrestrain][0] = force->inumeric(FLERR,arg[iarg+1]); + ids[nrestrain][1] = force->inumeric(FLERR,arg[iarg+2]); kstart[nrestrain] = force->numeric(FLERR,arg[iarg+3]); kstop[nrestrain] = force->numeric(FLERR,arg[iarg+4]); target[nrestrain] = force->numeric(FLERR,arg[iarg+5]); @@ -85,9 +85,9 @@ FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"angle") == 0) { if (iarg+7 > narg) error->all(FLERR,"Illegal fix restrain command"); rstyle[nrestrain] = ANGLE; - ids[nrestrain][0] = atoi(arg[iarg+1]); - ids[nrestrain][1] = atoi(arg[iarg+2]); - ids[nrestrain][2] = atoi(arg[iarg+3]); + ids[nrestrain][0] = force->inumeric(FLERR,arg[iarg+1]); + ids[nrestrain][1] = force->inumeric(FLERR,arg[iarg+2]); + ids[nrestrain][2] = force->inumeric(FLERR,arg[iarg+3]); kstart[nrestrain] = force->numeric(FLERR,arg[iarg+4]); kstop[nrestrain] = force->numeric(FLERR,arg[iarg+5]); target[nrestrain] = force->numeric(FLERR,arg[iarg+6]); @@ -96,10 +96,10 @@ FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"dihedral") == 0) { if (iarg+8 > narg) error->all(FLERR,"Illegal fix restrain command"); rstyle[nrestrain] = DIHEDRAL; - ids[nrestrain][0] = atoi(arg[iarg+1]); - ids[nrestrain][1] = atoi(arg[iarg+2]); - ids[nrestrain][2] = atoi(arg[iarg+3]); - ids[nrestrain][3] = atoi(arg[iarg+4]); + ids[nrestrain][0] = force->inumeric(FLERR,arg[iarg+1]); + ids[nrestrain][1] = force->inumeric(FLERR,arg[iarg+2]); + ids[nrestrain][2] = force->inumeric(FLERR,arg[iarg+3]); + ids[nrestrain][3] = force->inumeric(FLERR,arg[iarg+4]); kstart[nrestrain] = force->numeric(FLERR,arg[iarg+5]); kstop[nrestrain] = force->numeric(FLERR,arg[iarg+6]); target[nrestrain] = force->numeric(FLERR,arg[iarg+7]); diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index 6522e59579..1759ed9e92 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -24,6 +24,7 @@ #include "variable.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -51,7 +52,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[3],"NULL") == 0) { xstyle = NONE; } else { - xvalue = atof(arg[3]); + xvalue = force->numeric(FLERR,arg[3]); xstyle = CONSTANT; } if (strstr(arg[4],"v_") == arg[4]) { @@ -61,7 +62,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[4],"NULL") == 0) { ystyle = NONE; } else { - yvalue = atof(arg[4]); + yvalue = force->numeric(FLERR,arg[4]); ystyle = CONSTANT; } if (strstr(arg[5],"v_") == arg[5]) { @@ -71,7 +72,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[5],"NULL") == 0) { zstyle = NONE; } else { - zvalue = atof(arg[5]); + zvalue = force->numeric(FLERR,arg[5]); zstyle = CONSTANT; } diff --git a/src/fix_shake.cpp b/src/fix_shake.cpp index 16c137dd12..a66c8d554a 100644 --- a/src/fix_shake.cpp +++ b/src/fix_shake.cpp @@ -79,9 +79,9 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : if (narg < 8) error->all(FLERR,"Illegal fix shake command"); - tolerance = atof(arg[3]); - max_iter = atoi(arg[4]); - output_every = atoi(arg[5]); + tolerance = force->numeric(FLERR,arg[3]); + max_iter = force->inumeric(FLERR,arg[4]); + output_every = force->inumeric(FLERR,arg[5]); // parse SHAKE args for bond and angle types // will be used by find_clusters @@ -110,25 +110,25 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : atom->check_mass(); } else if (mode == 'b') { - int i = atoi(arg[next]); + int i = force->inumeric(FLERR,arg[next]); if (i < 1 || i > atom->nbondtypes) error->all(FLERR,"Invalid bond type index for fix shake"); bond_flag[i] = 1; } else if (mode == 'a') { - int i = atoi(arg[next]); + int i = force->inumeric(FLERR,arg[next]); if (i < 1 || i > atom->nangletypes) error->all(FLERR,"Invalid angle type index for fix shake"); angle_flag[i] = 1; } else if (mode == 't') { - int i = atoi(arg[next]); + int i = force->inumeric(FLERR,arg[next]); if (i < 1 || i > atom->ntypes) error->all(FLERR,"Invalid atom type index for fix shake"); type_flag[i] = 1; } else if (mode == 'm') { - double massone = atof(arg[next]); + double massone = force->numeric(FLERR,arg[next]); if (massone == 0.0) error->all(FLERR,"Invalid atom mass for fix shake"); if (nmass == atom->ntypes) error->all(FLERR,"Too many masses for fix shake"); diff --git a/src/fix_spring.cpp b/src/fix_spring.cpp index 7b214074ca..d80d2cb170 100644 --- a/src/fix_spring.cpp +++ b/src/fix_spring.cpp @@ -24,6 +24,7 @@ #include "respa.h" #include "domain.h" #include "error.h" +#include "force.h" #include "group.h" using namespace LAMMPS_NS; @@ -52,15 +53,15 @@ FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"tether") == 0) { if (narg != 9) error->all(FLERR,"Illegal fix spring command"); styleflag = TETHER; - k_spring = atof(arg[4]); + k_spring = force->numeric(FLERR,arg[4]); xflag = yflag = zflag = 1; if (strcmp(arg[5],"NULL") == 0) xflag = 0; - else xc = atof(arg[5]); + else xc = force->numeric(FLERR,arg[5]); if (strcmp(arg[6],"NULL") == 0) yflag = 0; - else yc = atof(arg[6]); + else yc = force->numeric(FLERR,arg[6]); if (strcmp(arg[7],"NULL") == 0) zflag = 0; - else zc = atof(arg[7]); - r0 = atof(arg[8]); + else zc = force->numeric(FLERR,arg[7]); + r0 = force->numeric(FLERR,arg[8]); if (r0 < 0) error->all(FLERR,"R0 < 0 for fix spring command"); } else if (strcmp(arg[3],"couple") == 0) { @@ -77,15 +78,15 @@ FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Two groups cannot be the same in fix spring couple"); group2bit = group->bitmask[igroup2]; - k_spring = atof(arg[5]); + k_spring = force->numeric(FLERR,arg[5]); xflag = yflag = zflag = 1; if (strcmp(arg[6],"NULL") == 0) xflag = 0; - else xc = atof(arg[6]); + else xc = force->numeric(FLERR,arg[6]); if (strcmp(arg[7],"NULL") == 0) yflag = 0; - else yc = atof(arg[7]); + else yc = force->numeric(FLERR,arg[7]); if (strcmp(arg[8],"NULL") == 0) zflag = 0; - else zc = atof(arg[8]); - r0 = atof(arg[9]); + else zc = force->numeric(FLERR,arg[8]); + r0 = force->numeric(FLERR,arg[9]); if (r0 < 0) error->all(FLERR,"R0 < 0 for fix spring command"); } else error->all(FLERR,"Illegal fix spring command"); diff --git a/src/fix_spring_rg.cpp b/src/fix_spring_rg.cpp index 0d93c4b628..c3d65829b2 100644 --- a/src/fix_spring_rg.cpp +++ b/src/fix_spring_rg.cpp @@ -26,6 +26,7 @@ #include "respa.h" #include "domain.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -37,10 +38,10 @@ FixSpringRG::FixSpringRG(LAMMPS *lmp, int narg, char **arg) : { if (narg != 5) error->all(FLERR,"Illegal fix spring/rg command"); - k = atof(arg[3]); + k = force->numeric(FLERR,arg[3]); rg0_flag = 0; if (strcmp(arg[4],"NULL") == 0) rg0_flag = 1; - else rg0 = atof(arg[4]); + else rg0 = force->numeric(FLERR,arg[4]); } /* ---------------------------------------------------------------------- */ diff --git a/src/fix_spring_self.cpp b/src/fix_spring_self.cpp index 0026f879c6..3ad5c2c72e 100644 --- a/src/fix_spring_self.cpp +++ b/src/fix_spring_self.cpp @@ -24,6 +24,7 @@ #include "respa.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -41,7 +42,7 @@ FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extscalar = 1; - k = atof(arg[3]); + k = force->numeric(FLERR,arg[3]); if (k <= 0.0) error->all(FLERR,"Illegal fix spring/self command"); xflag = yflag = zflag = 1; diff --git a/src/fix_store.cpp b/src/fix_store.cpp index be80e0ebf2..9da5f6870d 100644 --- a/src/fix_store.cpp +++ b/src/fix_store.cpp @@ -17,6 +17,7 @@ #include "atom.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -29,8 +30,8 @@ FixStore::FixStore(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // syntax: id group style 0/1 nvalue - restart_peratom = atoi(arg[3]); - nvalues = atoi(arg[4]); + restart_peratom = force->inumeric(FLERR,arg[3]); + nvalues = force->inumeric(FLERR,arg[4]); vecflag = 0; if (nvalues == 1) vecflag = 1; diff --git a/src/fix_store_state.cpp b/src/fix_store_state.cpp index 1fade845d7..067edd0a3d 100644 --- a/src/fix_store_state.cpp +++ b/src/fix_store_state.cpp @@ -25,6 +25,7 @@ #include "variable.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -43,7 +44,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) : restart_peratom = 1; peratom_freq = 1; - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery < 0) error->all(FLERR,"Illegal fix store/state command"); // parse values until one isn't recognized diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp index 52bd4bc3a5..5aac690735 100644 --- a/src/fix_temp_berendsen.cpp +++ b/src/fix_temp_berendsen.cpp @@ -53,13 +53,13 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : strcpy(tstr,&arg[3][2]); tstyle = EQUAL; } else { - t_start = atof(arg[3]); + t_start = force->numeric(FLERR,arg[3]); t_target = t_start; tstyle = CONSTANT; } - t_stop = atof(arg[4]); - t_period = atof(arg[5]); + t_stop = force->numeric(FLERR,arg[4]); + t_period = force->numeric(FLERR,arg[5]); // error checks diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index 69e74eeb02..38cbe8a33c 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -41,7 +41,7 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : { if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale command"); - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix temp/rescale command"); scalar_flag = 1; @@ -55,14 +55,14 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : strcpy(tstr,&arg[4][2]); tstyle = EQUAL; } else { - t_start = atof(arg[4]); + t_start = force->numeric(FLERR,arg[4]); t_target = t_start; tstyle = CONSTANT; } - t_stop = atof(arg[5]); - t_window = atof(arg[6]); - fraction = atof(arg[7]); + 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 // id = fix-ID + temp, compute group = fix group diff --git a/src/fix_thermal_conductivity.cpp b/src/fix_thermal_conductivity.cpp index 6d077f5306..b653e34864 100644 --- a/src/fix_thermal_conductivity.cpp +++ b/src/fix_thermal_conductivity.cpp @@ -42,7 +42,7 @@ FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp, MPI_Comm_rank(world,&me); - nevery = atoi(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix thermal/conductivity command"); scalar_flag = 1; @@ -54,7 +54,7 @@ FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp, else if (strcmp(arg[4],"z") == 0) edim = 2; else error->all(FLERR,"Illegal fix thermal/conductivity command"); - nbin = atoi(arg[5]); + nbin = force->inumeric(FLERR,arg[5]); if (nbin % 2 || nbin <= 2) error->all(FLERR,"Illegal fix thermal/conductivity command"); @@ -67,7 +67,7 @@ FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp, if (strcmp(arg[iarg],"swap") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix thermal/conductivity command"); - nswap = atoi(arg[iarg+1]); + nswap = force->inumeric(FLERR,arg[iarg+1]); if (nswap <= 0) error->all(FLERR, "Fix thermal/conductivity swap value must be positive"); diff --git a/src/fix_tmd.cpp b/src/fix_tmd.cpp index 4136f97f7d..e8ab940d6f 100644 --- a/src/fix_tmd.cpp +++ b/src/fix_tmd.cpp @@ -44,8 +44,8 @@ FixTMD::FixTMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 6) error->all(FLERR,"Illegal fix tmd command"); - rho_stop = atof(arg[3]); - nfileevery = atoi(arg[5]); + rho_stop = force->numeric(FLERR,arg[3]); + nfileevery = force->inumeric(FLERR,arg[5]); if (rho_stop < 0 || nfileevery < 0) error->all(FLERR,"Illegal fix tmd command"); if (nfileevery && narg != 7) error->all(FLERR,"Illegal fix tmd command"); diff --git a/src/fix_ttm.cpp b/src/fix_ttm.cpp index 405842d6a4..abd145a092 100644 --- a/src/fix_ttm.cpp +++ b/src/fix_ttm.cpp @@ -53,16 +53,16 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : restart_peratom = 1; restart_global = 1; - seed = atoi(arg[3]); - electronic_specific_heat = atof(arg[4]); - electronic_density = atof(arg[5]); - electronic_thermal_conductivity = atof(arg[6]); - gamma_p = atof(arg[7]); - gamma_s = atof(arg[8]); - v_0 = atof(arg[9]); - nxnodes = atoi(arg[10]); - nynodes = atoi(arg[11]); - nznodes = atoi(arg[12]); + seed = force->inumeric(FLERR,arg[3]); + electronic_specific_heat = force->numeric(FLERR,arg[4]); + electronic_density = force->numeric(FLERR,arg[5]); + electronic_thermal_conductivity = force->numeric(FLERR,arg[6]); + gamma_p = force->numeric(FLERR,arg[7]); + gamma_s = force->numeric(FLERR,arg[8]); + v_0 = force->numeric(FLERR,arg[9]); + nxnodes = force->inumeric(FLERR,arg[10]); + nynodes = force->inumeric(FLERR,arg[11]); + nznodes = force->inumeric(FLERR,arg[12]); fpr = fopen(arg[13],"r"); if (fpr == NULL) { @@ -71,7 +71,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : error->one(FLERR,str); } - nfileevery = atoi(arg[14]); + nfileevery = force->inumeric(FLERR,arg[14]); if (nfileevery) { if (narg != 16) error->all(FLERR,"Illegal fix ttm command"); diff --git a/src/fix_viscosity.cpp b/src/fix_viscosity.cpp index 24f0a911c5..8006c93a75 100644 --- a/src/fix_viscosity.cpp +++ b/src/fix_viscosity.cpp @@ -25,6 +25,7 @@ #include "domain.h" #include "modify.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -42,7 +43,7 @@ FixViscosity::FixViscosity(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 viscosity command"); scalar_flag = 1; @@ -59,7 +60,7 @@ FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[5],"z") == 0) pdim = 2; else error->all(FLERR,"Illegal fix viscosity command"); - nbin = atoi(arg[6]); + nbin = force->inumeric(FLERR,arg[6]); if (nbin % 2 || nbin <= 2) error->all(FLERR,"Illegal fix viscosity command"); // optional keywords @@ -71,13 +72,13 @@ FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"swap") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix viscosity command"); - nswap = atoi(arg[iarg+1]); + nswap = force->inumeric(FLERR,arg[iarg+1]); if (nswap <= 0) error->all(FLERR,"Fix viscosity swap value must be positive"); iarg += 2; } else if (strcmp(arg[iarg],"vtarget") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix viscosity command"); if (strcmp(arg[iarg+1],"INF") == 0) vtarget = BIG; - else vtarget = atof(arg[iarg+1]); + else vtarget = force->numeric(FLERR,arg[iarg+1]); if (vtarget <= 0.0) error->all(FLERR,"Fix viscosity vtarget value must be positive"); iarg += 2; diff --git a/src/fix_viscous.cpp b/src/fix_viscous.cpp index f6a6f2d66a..f1ad471404 100644 --- a/src/fix_viscous.cpp +++ b/src/fix_viscous.cpp @@ -19,6 +19,7 @@ #include "update.h" #include "respa.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -30,7 +31,7 @@ FixViscous::FixViscous(LAMMPS *lmp, int narg, char **arg) : { if (narg < 4) error->all(FLERR,"Illegal fix viscous command"); - double gamma_one = atof(arg[3]); + double gamma_one = force->numeric(FLERR,arg[3]); gamma = new double[atom->ntypes+1]; for (int i = 1; i <= atom->ntypes; i++) gamma[i] = gamma_one; @@ -40,8 +41,8 @@ FixViscous::FixViscous(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"scale") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix viscous command"); - int itype = atoi(arg[iarg+1]); - double scale = atof(arg[iarg+2]); + int itype = force->inumeric(FLERR,arg[iarg+1]); + double scale = force->numeric(FLERR,arg[iarg+2]); if (itype <= 0 || itype > atom->ntypes) error->all(FLERR,"Illegal fix viscous command"); gamma[itype] = gamma_one * scale; diff --git a/src/fix_wall.cpp b/src/fix_wall.cpp index 3d8683f77c..90fca0a981 100644 --- a/src/fix_wall.cpp +++ b/src/fix_wall.cpp @@ -24,6 +24,7 @@ #include "modify.h" #include "respa.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -84,7 +85,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : strcpy(xstr[nwall],&arg[iarg+1][2]); } else { xstyle[nwall] = CONSTANT; - coord0[nwall] = atof(arg[iarg+1]); + coord0[nwall] = force->numeric(FLERR,arg[iarg+1]); } if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { @@ -93,7 +94,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : strcpy(estr[nwall],&arg[iarg+2][2]); estyle[nwall] = VARIABLE; } else { - epsilon[nwall] = atof(arg[iarg+2]); + epsilon[nwall] = force->numeric(FLERR,arg[iarg+2]); estyle[nwall] = CONSTANT; } @@ -103,11 +104,11 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : strcpy(sstr[nwall],&arg[iarg+3][2]); sstyle[nwall] = VARIABLE; } else { - sigma[nwall] = atof(arg[iarg+3]); + sigma[nwall] = force->numeric(FLERR,arg[iarg+3]); sstyle[nwall] = CONSTANT; } - cutoff[nwall] = atof(arg[iarg+4]); + cutoff[nwall] = force->numeric(FLERR,arg[iarg+4]); nwall++; iarg += 5; diff --git a/src/fix_wall_reflect.cpp b/src/fix_wall_reflect.cpp index 0a5186a223..adcb893a4e 100644 --- a/src/fix_wall_reflect.cpp +++ b/src/fix_wall_reflect.cpp @@ -23,6 +23,7 @@ #include "input.h" #include "variable.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -75,7 +76,7 @@ FixWallReflect::FixWallReflect(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/fix_wall_region.cpp b/src/fix_wall_region.cpp index e4572e8fed..ea36893fc0 100644 --- a/src/fix_wall_region.cpp +++ b/src/fix_wall_region.cpp @@ -24,6 +24,7 @@ #include "output.h" #include "respa.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -59,9 +60,9 @@ FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[4],"harmonic") == 0) style = HARMONIC; else error->all(FLERR,"Illegal fix wall/region command"); - epsilon = atof(arg[5]); - sigma = atof(arg[6]); - cutoff = atof(arg[7]); + epsilon = force->numeric(FLERR,arg[5]); + sigma = force->numeric(FLERR,arg[6]); + cutoff = force->numeric(FLERR,arg[7]); if (cutoff <= 0.0) error->all(FLERR,"Fix wall/region cutoff <= 0.0"); diff --git a/src/force.cpp b/src/force.cpp index 1a31016d8b..1f6403a415 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -591,21 +591,21 @@ void Force::set_special(int narg, char **arg) iarg += 1; } else if (strcmp(arg[iarg],"lj/coul") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_lj[1] = special_coul[1] = atof(arg[iarg+1]); - special_lj[2] = special_coul[2] = atof(arg[iarg+2]); - special_lj[3] = special_coul[3] = atof(arg[iarg+3]); + special_lj[1] = special_coul[1] = numeric(FLERR,arg[iarg+1]); + special_lj[2] = special_coul[2] = numeric(FLERR,arg[iarg+2]); + special_lj[3] = special_coul[3] = numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"lj") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_lj[1] = atof(arg[iarg+1]); - special_lj[2] = atof(arg[iarg+2]); - special_lj[3] = atof(arg[iarg+3]); + special_lj[1] = numeric(FLERR,arg[iarg+1]); + special_lj[2] = numeric(FLERR,arg[iarg+2]); + special_lj[3] = numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"coul") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_coul[1] = atof(arg[iarg+1]); - special_coul[2] = atof(arg[iarg+2]); - special_coul[3] = atof(arg[iarg+3]); + special_coul[1] = numeric(FLERR,arg[iarg+1]); + special_coul[2] = numeric(FLERR,arg[iarg+2]); + special_coul[3] = numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"angle") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command"); @@ -621,7 +621,7 @@ void Force::set_special(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"extra") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_extra = atoi(arg[iarg+1]); + special_extra = inumeric(FLERR,arg[iarg+1]); iarg += 2; } else error->all(FLERR,"Illegal special_bonds command"); } diff --git a/src/group.cpp b/src/group.cpp index a84b3a8bee..7d270b634f 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -185,12 +185,12 @@ void Group::assign(int narg, char **arg) else if (strcmp(arg[2],"<>") == 0) condition = BETWEEN; else error->all(FLERR,"Illegal group command"); - bound1 = atoi(arg[3]); + bound1 = force->inumeric(FLERR,arg[3]); bound2 = -1; if (condition == BETWEEN) { if (narg != 5) error->all(FLERR,"Illegal group command"); - bound2 = atoi(arg[4]); + bound2 = force->inumeric(FLERR,arg[4]); } else if (narg != 4) error->all(FLERR,"Illegal group command"); int *attribute; diff --git a/src/image.cpp b/src/image.cpp index 2302140e49..4cbacf56c8 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -25,6 +25,7 @@ #include "random_mars.h" #include "math_const.h" #include "error.h" +#include "force.h" #include "memory.h" #ifdef LAMMPS_JPEG @@ -1098,13 +1099,13 @@ int Image::colormap(int narg, char **arg) { if (!islower(arg[0][0])) { mlo = NUMERIC; - mlovalue = atof(arg[0]); + mlovalue = force->numeric(FLERR,arg[0]); } else if (strcmp(arg[0],"min") == 0) mlo = MINVALUE; else return 1; if (!islower(arg[1][0])) { mhi = NUMERIC; - mhivalue = atof(arg[1]); + mhivalue = force->numeric(FLERR,arg[1]); } else if (strcmp(arg[1],"max") == 0) mhi = MAXVALUE; else return 1; @@ -1120,12 +1121,12 @@ int Image::colormap(int narg, char **arg) else return 1; if (mstyle == SEQUENTIAL) { - mbinsize = atof(arg[3]); + mbinsize = force->numeric(FLERR,arg[3]); if (mbinsize <= 0.0) return 1; mbinsizeinv = 1.0/mbinsize; } - nentry = atoi(arg[4]); + nentry = force->inumeric(FLERR,arg[4]); if (nentry < 1) return 1; mentry = new MapEntry[nentry]; @@ -1135,7 +1136,7 @@ int Image::colormap(int narg, char **arg) if (n+2 > narg) return 1; if (!islower(arg[n][0])) { mentry[i].single = NUMERIC; - mentry[i].svalue = atof(arg[n]); + mentry[i].svalue = force->numeric(FLERR,arg[n]); } else if (strcmp(arg[n],"min") == 0) mentry[i].single = MINVALUE; else if (strcmp(arg[n],"max") == 0) mentry[i].single = MAXVALUE; else return 1; @@ -1145,13 +1146,13 @@ int Image::colormap(int narg, char **arg) if (n+3 > narg) return 1; if (!islower(arg[n][0])) { mentry[i].lo = NUMERIC; - mentry[i].lvalue = atof(arg[n]); + mentry[i].lvalue = force->numeric(FLERR,arg[n]); } else if (strcmp(arg[n],"min") == 0) mentry[i].single = MINVALUE; else if (strcmp(arg[n],"max") == 0) mentry[i].single = MAXVALUE; else return 1; if (!islower(arg[n+1][0])) { mentry[i].hi = NUMERIC; - mentry[i].hvalue = atof(arg[n+1]); + mentry[i].hvalue = force->numeric(FLERR,arg[n+1]); } else if (strcmp(arg[n+1],"min") == 0) mentry[i].single = MINVALUE; else if (strcmp(arg[n+1],"max") == 0) mentry[i].single = MAXVALUE; else return 1; diff --git a/src/input.cpp b/src/input.cpp index bdb3fbafd2..0a5be3a9a6 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1087,7 +1087,7 @@ void Input::compute_modify() void Input::dielectric() { if (narg != 1) error->all(FLERR,"Illegal dielectric command"); - force->dielectric = atof(arg[0]); + force->dielectric = force->numeric(FLERR,arg[0]); } /* ---------------------------------------------------------------------- */ @@ -1121,7 +1121,7 @@ void Input::dimension() if (narg != 1) error->all(FLERR,"Illegal dimension command"); if (domain->box_exist) error->all(FLERR,"Dimension command after simulation box is defined"); - domain->dimension = atoi(arg[0]); + domain->dimension = force->inumeric(FLERR,arg[0]); if (domain->dimension != 2 && domain->dimension != 3) error->all(FLERR,"Illegal dimension command"); @@ -1482,7 +1482,7 @@ void Input::thermo_style() void Input::timestep() { if (narg != 1) error->all(FLERR,"Illegal timestep command"); - update->dt = atof(arg[0]); + update->dt = force->numeric(FLERR,arg[0]); } /* ---------------------------------------------------------------------- */ diff --git a/src/kspace.cpp b/src/kspace.cpp index ef6015887d..d4aed88d13 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -346,31 +346,31 @@ void KSpace::modify_params(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"mesh") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal kspace_modify command"); - nx_pppm = nx_msm_max = atoi(arg[iarg+1]); - ny_pppm = ny_msm_max = atoi(arg[iarg+2]); - nz_pppm = nz_msm_max = atoi(arg[iarg+3]); + nx_pppm = nx_msm_max = force->inumeric(FLERR,arg[iarg+1]); + ny_pppm = ny_msm_max = force->inumeric(FLERR,arg[iarg+2]); + nz_pppm = nz_msm_max = force->inumeric(FLERR,arg[iarg+3]); if (nx_pppm == 0 && ny_pppm == 0 && nz_pppm == 0) gridflag = 0; else gridflag = 1; iarg += 4; } else if (strcmp(arg[iarg],"mesh/disp") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal kspace_modify command"); - nx_pppm_6 = atoi(arg[iarg+1]); - ny_pppm_6 = atoi(arg[iarg+2]); - nz_pppm_6 = atoi(arg[iarg+3]); + nx_pppm_6 = force->inumeric(FLERR,arg[iarg+1]); + ny_pppm_6 = force->inumeric(FLERR,arg[iarg+2]); + nz_pppm_6 = force->inumeric(FLERR,arg[iarg+3]); if (nx_pppm_6 == 0 || ny_pppm_6 == 0 || nz_pppm_6 == 0) gridflag_6 = 0; else gridflag_6 = 1; iarg += 4; } else if (strcmp(arg[iarg],"order") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - order = atoi(arg[iarg+1]); + order = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"order/disp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - order_6 = atoi(arg[iarg+1]); + order_6 = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"minorder") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - minorder = atoi(arg[iarg+1]); + minorder = force->inumeric(FLERR,arg[iarg+1]); if (minorder < 2) error->all(FLERR,"Illegal kspace_modify command"); iarg += 2; } else if (strcmp(arg[iarg],"overlap") == 0) { @@ -381,17 +381,17 @@ void KSpace::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"force") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - accuracy_absolute = atof(arg[iarg+1]); + accuracy_absolute = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"gewald") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - g_ewald = atof(arg[iarg+1]); + g_ewald = force->numeric(FLERR,arg[iarg+1]); if (g_ewald == 0.0) gewaldflag = 0; else gewaldflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"gewald/disp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - g_ewald_6 = atof(arg[iarg+1]); + g_ewald_6 = force->numeric(FLERR,arg[iarg+1]); if (g_ewald_6 == 0.0) gewaldflag_6 = 0; else gewaldflag_6 = 1; iarg += 2; @@ -401,7 +401,7 @@ void KSpace::modify_params(int narg, char **arg) slabflag = 2; } else { slabflag = 1; - slab_volfactor = atof(arg[iarg+1]); + slab_volfactor = force->numeric(FLERR,arg[iarg+1]); if (slab_volfactor <= 1.0) error->all(FLERR,"Bad kspace_modify slab parameter"); if (slab_volfactor < 2.0 && comm->me == 0) diff --git a/src/min.cpp b/src/min.cpp index e8904f21f8..e9690a65db 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -618,7 +618,7 @@ void Min::modify_params(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"dmax") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - dmax = atof(arg[iarg+1]); + dmax = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"line") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); diff --git a/src/minimize.cpp b/src/minimize.cpp index 02e15042c9..d8a4de831b 100644 --- a/src/minimize.cpp +++ b/src/minimize.cpp @@ -19,6 +19,7 @@ #include "finish.h" #include "timer.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -35,10 +36,10 @@ void Minimize::command(int narg, char **arg) if (domain->box_exist == 0) error->all(FLERR,"Minimize command before simulation box is defined"); - update->etol = atof(arg[0]); - update->ftol = atof(arg[1]); - update->nsteps = atoi(arg[2]); - update->max_eval = atoi(arg[3]); + update->etol = force->numeric(FLERR,arg[0]); + update->ftol = force->numeric(FLERR,arg[1]); + update->nsteps = force->inumeric(FLERR,arg[2]); + update->max_eval = force->inumeric(FLERR,arg[3]); if (update->etol < 0.0 || update->ftol < 0.0) error->all(FLERR,"Illegal minimize command"); diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 4c8f200605..2afb7de38f 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -1635,7 +1635,7 @@ void Neighbor::set(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal neighbor command"); - skin = atof(arg[0]); + skin = force->numeric(FLERR,arg[0]); if (skin < 0.0) error->all(FLERR,"Illegal neighbor command"); if (strcmp(arg[1],"nsq") == 0) style = NSQ; @@ -1654,12 +1654,12 @@ void Neighbor::modify_params(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"every") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); - every = atoi(arg[iarg+1]); + every = force->inumeric(FLERR,arg[iarg+1]); if (every <= 0) error->all(FLERR,"Illegal neigh_modify command"); iarg += 2; } else if (strcmp(arg[iarg],"delay") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); - delay = atoi(arg[iarg+1]); + delay = force->inumeric(FLERR,arg[iarg+1]); if (delay < 0) error->all(FLERR,"Illegal neigh_modify command"); iarg += 2; } else if (strcmp(arg[iarg],"check") == 0) { @@ -1676,15 +1676,15 @@ void Neighbor::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"page") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); - pgsize = atoi(arg[iarg+1]); + pgsize = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"one") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); - oneatom = atoi(arg[iarg+1]); + oneatom = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"binsize") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); - binsize_user = atof(arg[iarg+1]); + binsize_user = force->numeric(FLERR,arg[iarg+1]); if (binsize_user <= 0.0) binsizeflag = 0; else binsizeflag = 1; iarg += 2; @@ -1716,8 +1716,8 @@ void Neighbor::modify_params(int narg, char **arg) memory->grow(ex1_type,maxex_type,"neigh:ex1_type"); memory->grow(ex2_type,maxex_type,"neigh:ex2_type"); } - ex1_type[nex_type] = atoi(arg[iarg+2]); - ex2_type[nex_type] = atoi(arg[iarg+3]); + ex1_type[nex_type] = force->inumeric(FLERR,arg[iarg+2]); + ex2_type[nex_type] = force->inumeric(FLERR,arg[iarg+3]); nex_type++; iarg += 4; diff --git a/src/output.cpp b/src/output.cpp index d07e18abcd..d988d07e1a 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -543,7 +543,7 @@ void Output::add_dump(int narg, char **arg) error->all(FLERR,"Reuse of dump ID"); int igroup = group->find(arg[1]); if (igroup == -1) error->all(FLERR,"Could not find dump group ID"); - if (atoi(arg[3]) <= 0) error->all(FLERR,"Invalid dump frequency"); + if (force->inumeric(FLERR,arg[3]) <= 0) error->all(FLERR,"Invalid dump frequency"); // extend Dump list if necessary @@ -571,7 +571,7 @@ void Output::add_dump(int narg, char **arg) else error->all(FLERR,"Invalid dump style"); - every_dump[ndump] = atoi(arg[3]); + every_dump[ndump] = force->inumeric(FLERR,arg[3]); if (every_dump[ndump] <= 0) error->all(FLERR,"Illegal dump command"); last_dump[ndump] = -1; var_dump[ndump] = NULL; @@ -639,7 +639,7 @@ void Output::set_thermo(int narg, char **arg) var_thermo = new char[n]; strcpy(var_thermo,&arg[0][2]); } else { - thermo_every = atoi(arg[0]); + thermo_every = force->inumeric(FLERR,arg[0]); if (thermo_every < 0) error->all(FLERR,"Illegal thermo command"); } } @@ -683,7 +683,7 @@ void Output::create_restart(int narg, char **arg) int varflag = 0; if (strstr(arg[0],"v_") == arg[0]) varflag = 1; - else every = atoi(arg[0]); + else every = force->inumeric(FLERR,arg[0]); if (!varflag && every == 0) { if (narg != 1) error->all(FLERR,"Illegal restart command"); diff --git a/src/pair.cpp b/src/pair.cpp index 5b11ffc0c6..8e51095449 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -126,23 +126,23 @@ void Pair::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"table") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); - ncoultablebits = atoi(arg[iarg+1]); + ncoultablebits = force->inumeric(FLERR,arg[iarg+1]); if (ncoultablebits > sizeof(float)*CHAR_BIT) error->all(FLERR,"Too many total bits for bitmapped lookup table"); iarg += 2; } else if (strcmp(arg[iarg],"table/disp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); - ndisptablebits = atoi(arg[iarg+1]); + ndisptablebits = force->inumeric(FLERR,arg[iarg+1]); if (ndisptablebits > sizeof(float)*CHAR_BIT) error->all(FLERR,"Too many total bits for bitmapped lookup table"); iarg += 2; } else if (strcmp(arg[iarg],"tabinner") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); - tabinner = atof(arg[iarg+1]); + tabinner = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"tabinner/disp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); - tabinner_disp = atof(arg[iarg+1]); + tabinner_disp = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"tail") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); @@ -1454,12 +1454,12 @@ void Pair::write_file(int narg, char **arg) // parse arguments - int itype = atoi(arg[0]); - int jtype = atoi(arg[1]); + int itype = force->inumeric(FLERR,arg[0]); + int jtype = force->inumeric(FLERR,arg[1]); if (itype < 1 || itype > atom->ntypes || jtype < 1 || jtype > atom->ntypes) error->all(FLERR,"Invalid atom types in pair_write command"); - int n = atoi(arg[2]); + int n = force->inumeric(FLERR,arg[2]); int style; if (strcmp(arg[3],"r") == 0) style = RLINEAR; @@ -1467,8 +1467,8 @@ void Pair::write_file(int narg, char **arg) else if (strcmp(arg[3],"bitmap") == 0) style = BMP; else error->all(FLERR,"Invalid style in pair_write command"); - double inner = atof(arg[4]); - double outer = atof(arg[5]); + double inner = force->numeric(FLERR,arg[4]); + double outer = force->numeric(FLERR,arg[5]); if (inner <= 0.0 || inner >= outer) error->all(FLERR,"Invalid cutoffs in pair_write command"); @@ -1508,8 +1508,8 @@ void Pair::write_file(int narg, char **arg) double q[2]; q[0] = q[1] = 1.0; if (narg == 10) { - q[0] = atof(arg[8]); - q[1] = atof(arg[9]); + q[0] = force->numeric(FLERR,arg[8]); + q[1] = force->numeric(FLERR,arg[9]); } double *q_hold; diff --git a/src/pair_beck.cpp b/src/pair_beck.cpp index d41b7e6931..986a6c74ff 100644 --- a/src/pair_beck.cpp +++ b/src/pair_beck.cpp @@ -174,7 +174,7 @@ void PairBeck::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = atof(arg[0]); + cut_global = force->numeric(FLERR,arg[0]); // reset cutoffs that have been explicitly set @@ -202,14 +202,14 @@ void PairBeck::coeff(int narg, char **arg) force->bounds(arg[0],atom->ntypes,ilo,ihi); force->bounds(arg[1],atom->ntypes,jlo,jhi); - double AA_one = atof(arg[2]); - double BB_one = atof(arg[3]); - double aa_one = atof(arg[4]); - double alpha_one = atof(arg[5]); - double beta_one = atof(arg[6]); + double AA_one = force->numeric(FLERR,arg[2]); + double BB_one = force->numeric(FLERR,arg[3]); + double aa_one = force->numeric(FLERR,arg[4]); + double alpha_one = force->numeric(FLERR,arg[5]); + double beta_one = force->numeric(FLERR,arg[6]); double cut_one = cut_global; - if (narg == 8) cut_one = atof(arg[7]); + if (narg == 8) cut_one = force->numeric(FLERR,arg[7]); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_born.cpp b/src/pair_born.cpp index 289661e032..043a7404b2 100644 --- a/src/pair_born.cpp +++ b/src/pair_born.cpp @@ -175,7 +175,7 @@ void PairBorn::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = atof(arg[0]); + cut_global = force->numeric(FLERR,arg[0]); // reset cutoffs that have been explicitly set diff --git a/src/pair_gauss.cpp b/src/pair_gauss.cpp index 45eb77da37..94d74d3c67 100644 --- a/src/pair_gauss.cpp +++ b/src/pair_gauss.cpp @@ -165,7 +165,7 @@ void PairGauss::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = atof(arg[0]); + cut_global = force->numeric(FLERR,arg[0]); // reset cutoffs that have been explicity set @@ -191,11 +191,11 @@ void PairGauss::coeff(int narg, char **arg) force->bounds(arg[0],atom->ntypes,ilo,ihi); force->bounds(arg[1],atom->ntypes,jlo,jhi); - double a_one = atof(arg[2]); - double b_one = atof(arg[3]); + double a_one = force->numeric(FLERR,arg[2]); + double b_one = force->numeric(FLERR,arg[3]); double cut_one = cut_global; - if (narg == 5) cut_one = atof(arg[4]); + if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 8821c2cb4b..c8c95c4e38 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -344,7 +344,7 @@ void PairHybrid::coeff(int narg, char **arg) if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients"); if (!isdigit(arg[3][0])) error->all(FLERR,"Incorrect args for pair coefficients"); - int index = atoi(arg[3]); + int index = force->inumeric(FLERR,arg[3]); if (index == multiple[m]) break; else continue; } else break; diff --git a/src/pair_hybrid_overlay.cpp b/src/pair_hybrid_overlay.cpp index 327c395b22..cf48dc14a0 100644 --- a/src/pair_hybrid_overlay.cpp +++ b/src/pair_hybrid_overlay.cpp @@ -55,7 +55,7 @@ void PairHybridOverlay::coeff(int narg, char **arg) if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients"); if (!isdigit(arg[3][0])) error->all(FLERR,"Incorrect args for pair coefficients"); - int index = atoi(arg[3]); + int index = force->inumeric(FLERR,arg[3]); if (index == multiple[m]) break; else continue; } else break; diff --git a/src/pair_lj96_cut.cpp b/src/pair_lj96_cut.cpp index 907a74efc5..0e3026b593 100644 --- a/src/pair_lj96_cut.cpp +++ b/src/pair_lj96_cut.cpp @@ -460,11 +460,11 @@ void PairLJ96Cut::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_one = cut_global; - if (narg == 5) cut_one = atof(arg[4]); + if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_lj_smooth_linear.cpp b/src/pair_lj_smooth_linear.cpp index 8769f9977f..ed0eeeb6bc 100644 --- a/src/pair_lj_smooth_linear.cpp +++ b/src/pair_lj_smooth_linear.cpp @@ -169,7 +169,7 @@ void PairLJSmoothLinear::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = atof(arg[0]); + cut_global = force->numeric(FLERR,arg[0]); // reset cutoffs that have been explicitly set @@ -196,12 +196,12 @@ void PairLJSmoothLinear::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_one = cut_global; if (narg == 5) { - cut_one = atof(arg[4]); + cut_one = force->numeric(FLERR,arg[4]); } int count = 0; diff --git a/src/region.cpp b/src/region.cpp index a6b5022ca8..2d26369980 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -21,6 +21,7 @@ #include "input.h" #include "variable.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -349,12 +350,12 @@ void Region::options(int narg, char **arg) int n = strlen(&arg[iarg+1][2]) + 1; tstr = new char[n]; strcpy(tstr,&arg[iarg+1][2]); - point[0] = atof(arg[iarg+2]); - point[1] = atof(arg[iarg+3]); - point[2] = atof(arg[iarg+4]); - axis[0] = atof(arg[iarg+5]); - axis[1] = atof(arg[iarg+6]); - axis[2] = atof(arg[iarg+7]); + point[0] = force->numeric(FLERR,arg[iarg+2]); + point[1] = force->numeric(FLERR,arg[iarg+3]); + point[2] = force->numeric(FLERR,arg[iarg+4]); + axis[0] = force->numeric(FLERR,arg[iarg+5]); + axis[1] = force->numeric(FLERR,arg[iarg+6]); + axis[2] = force->numeric(FLERR,arg[iarg+7]); rotateflag = 1; iarg += 8; } else error->all(FLERR,"Illegal region command"); diff --git a/src/region_block.cpp b/src/region_block.cpp index 3a295472f9..0325ae4b1c 100644 --- a/src/region_block.cpp +++ b/src/region_block.cpp @@ -16,6 +16,7 @@ #include "region_block.h" #include "domain.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -33,7 +34,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[2],"INF") == 0) xlo = -BIG; else if (domain->triclinic == 0) xlo = domain->boxlo[0]; else xlo = domain->boxlo_bound[0]; - } else xlo = xscale*atof(arg[2]); + } else xlo = xscale*force->numeric(FLERR,arg[2]); if (strcmp(arg[3],"INF") == 0 || strcmp(arg[3],"EDGE") == 0) { if (domain->box_exist == 0) @@ -41,7 +42,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[3],"INF") == 0) xhi = BIG; else if (domain->triclinic == 0) xhi = domain->boxhi[0]; else xhi = domain->boxhi_bound[0]; - } else xhi = xscale*atof(arg[3]); + } else xhi = xscale*force->numeric(FLERR,arg[3]); if (strcmp(arg[4],"INF") == 0 || strcmp(arg[4],"EDGE") == 0) { if (domain->box_exist == 0) @@ -49,7 +50,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[4],"INF") == 0) ylo = -BIG; else if (domain->triclinic == 0) ylo = domain->boxlo[1]; else ylo = domain->boxlo_bound[1]; - } else ylo = yscale*atof(arg[4]); + } else ylo = yscale*force->numeric(FLERR,arg[4]); if (strcmp(arg[5],"INF") == 0 || strcmp(arg[5],"EDGE") == 0) { if (domain->box_exist == 0) @@ -57,7 +58,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[5],"INF") == 0) yhi = BIG; else if (domain->triclinic == 0) yhi = domain->boxhi[1]; else yhi = domain->boxhi_bound[1]; - } else yhi = yscale*atof(arg[5]); + } else yhi = yscale*force->numeric(FLERR,arg[5]); if (strcmp(arg[6],"INF") == 0 || strcmp(arg[6],"EDGE") == 0) { if (domain->box_exist == 0) @@ -65,7 +66,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[6],"INF") == 0) zlo = -BIG; else if (domain->triclinic == 0) zlo = domain->boxlo[2]; else zlo = domain->boxlo_bound[2]; - } else zlo = zscale*atof(arg[6]); + } else zlo = zscale*force->numeric(FLERR,arg[6]); if (strcmp(arg[7],"INF") == 0 || strcmp(arg[7],"EDGE") == 0) { if (domain->box_exist == 0) @@ -73,7 +74,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[7],"INF") == 0) zhi = BIG; else if (domain->triclinic == 0) zhi = domain->boxhi[2]; else zhi = domain->boxhi_bound[2]; - } else zhi = zscale*atof(arg[7]); + } else zhi = zscale*force->numeric(FLERR,arg[7]); // error check diff --git a/src/region_cone.cpp b/src/region_cone.cpp index f692839c8f..09408c8d93 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -21,6 +21,7 @@ #include "region_cone.h" #include "domain.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -38,20 +39,20 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : axis = arg[2][0]; if (axis == 'x') { - c1 = yscale*atof(arg[3]); - c2 = zscale*atof(arg[4]); - radiuslo = yscale*atof(arg[5]); - radiushi = yscale*atof(arg[6]); + c1 = yscale*force->numeric(FLERR,arg[3]); + c2 = zscale*force->numeric(FLERR,arg[4]); + radiuslo = yscale*force->numeric(FLERR,arg[5]); + radiushi = yscale*force->numeric(FLERR,arg[6]); } else if (axis == 'y') { - c1 = xscale*atof(arg[3]); - c2 = zscale*atof(arg[4]); - radiuslo = xscale*atof(arg[5]); - radiushi = xscale*atof(arg[6]); + c1 = xscale*force->numeric(FLERR,arg[3]); + c2 = zscale*force->numeric(FLERR,arg[4]); + radiuslo = xscale*force->numeric(FLERR,arg[5]); + radiushi = xscale*force->numeric(FLERR,arg[6]); } else if (axis == 'z') { - c1 = xscale*atof(arg[3]); - c2 = yscale*atof(arg[4]); - radiuslo = xscale*atof(arg[5]); - radiushi = xscale*atof(arg[6]); + c1 = xscale*force->numeric(FLERR,arg[3]); + c2 = yscale*force->numeric(FLERR,arg[4]); + radiuslo = xscale*force->numeric(FLERR,arg[5]); + radiushi = xscale*force->numeric(FLERR,arg[6]); } if (strcmp(arg[7],"INF") == 0 || strcmp(arg[7],"EDGE") == 0) { @@ -73,9 +74,9 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : else lo = domain->boxlo_bound[2]; } } else { - if (axis == 'x') lo = xscale*atof(arg[7]); - if (axis == 'y') lo = yscale*atof(arg[7]); - if (axis == 'z') lo = zscale*atof(arg[7]); + if (axis == 'x') lo = xscale*force->numeric(FLERR,arg[7]); + if (axis == 'y') lo = yscale*force->numeric(FLERR,arg[7]); + if (axis == 'z') lo = zscale*force->numeric(FLERR,arg[7]); } if (strcmp(arg[8],"INF") == 0 || strcmp(arg[7],"EDGE") == 0) { @@ -97,9 +98,9 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : else hi = domain->boxhi_bound[2]; } } else { - if (axis == 'x') hi = xscale*atof(arg[8]); - if (axis == 'y') hi = yscale*atof(arg[8]); - if (axis == 'z') hi = zscale*atof(arg[8]); + if (axis == 'x') hi = xscale*force->numeric(FLERR,arg[8]); + if (axis == 'y') hi = yscale*force->numeric(FLERR,arg[8]); + if (axis == 'z') hi = zscale*force->numeric(FLERR,arg[8]); } // error check diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index b806ea07ea..de8baa2617 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -20,6 +20,7 @@ #include "input.h" #include "variable.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -38,14 +39,14 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : axis = arg[2][0]; if (axis == 'x') { - c1 = yscale*atof(arg[3]); - c2 = zscale*atof(arg[4]); + c1 = yscale*force->numeric(FLERR,arg[3]); + c2 = zscale*force->numeric(FLERR,arg[4]); } else if (axis == 'y') { - c1 = xscale*atof(arg[3]); - c2 = zscale*atof(arg[4]); + c1 = xscale*force->numeric(FLERR,arg[3]); + c2 = zscale*force->numeric(FLERR,arg[4]); } else if (axis == 'z') { - c1 = xscale*atof(arg[3]); - c2 = yscale*atof(arg[4]); + c1 = xscale*force->numeric(FLERR,arg[3]); + c2 = yscale*force->numeric(FLERR,arg[4]); } rstr = NULL; @@ -59,7 +60,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : variable_check(); shape_update(); } else { - radius = atof(arg[5]); + radius = force->numeric(FLERR,arg[5]); if (axis == 'x') radius *= xscale; else radius *= xscale; rstyle = CONSTANT; @@ -84,9 +85,9 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : else lo = domain->boxlo_bound[2]; } } else { - if (axis == 'x') lo = xscale*atof(arg[6]); - if (axis == 'y') lo = yscale*atof(arg[6]); - if (axis == 'z') lo = zscale*atof(arg[6]); + if (axis == 'x') lo = xscale*force->numeric(FLERR,arg[6]); + if (axis == 'y') lo = yscale*force->numeric(FLERR,arg[6]); + if (axis == 'z') lo = zscale*force->numeric(FLERR,arg[6]); } if (strcmp(arg[7],"INF") == 0 || strcmp(arg[6],"EDGE") == 0) { @@ -108,9 +109,9 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : else hi = domain->boxhi_bound[2]; } } else { - if (axis == 'x') hi = xscale*atof(arg[7]); - if (axis == 'y') hi = yscale*atof(arg[7]); - if (axis == 'z') hi = zscale*atof(arg[7]); + if (axis == 'x') hi = xscale*force->numeric(FLERR,arg[7]); + if (axis == 'y') hi = yscale*force->numeric(FLERR,arg[7]); + if (axis == 'z') hi = zscale*force->numeric(FLERR,arg[7]); } // error check diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index bae73952d3..1da6d63be7 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -16,6 +16,7 @@ #include "region_intersect.h" #include "domain.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -25,7 +26,7 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) { if (narg < 5) error->all(FLERR,"Illegal region command"); - int n = atoi(arg[2]); + int n = force->inumeric(FLERR,arg[2]); if (n < 2) error->all(FLERR,"Illegal region command"); options(narg-(n+3),&arg[n+3]); diff --git a/src/region_plane.cpp b/src/region_plane.cpp index 4c588423fc..9a0d47c1fe 100644 --- a/src/region_plane.cpp +++ b/src/region_plane.cpp @@ -16,6 +16,7 @@ #include "string.h" #include "region_plane.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -26,12 +27,12 @@ RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : { options(narg-8,&arg[8]); - xp = xscale*atof(arg[2]); - yp = yscale*atof(arg[3]); - zp = zscale*atof(arg[4]); - normal[0] = xscale*atof(arg[5]); - normal[1] = yscale*atof(arg[6]); - normal[2] = zscale*atof(arg[7]); + xp = xscale*force->numeric(FLERR,arg[2]); + yp = yscale*force->numeric(FLERR,arg[3]); + zp = zscale*force->numeric(FLERR,arg[4]); + normal[0] = xscale*force->numeric(FLERR,arg[5]); + normal[1] = yscale*force->numeric(FLERR,arg[6]); + normal[2] = zscale*force->numeric(FLERR,arg[7]); // enforce unit normal diff --git a/src/region_prism.cpp b/src/region_prism.cpp index 041865c632..01e6f60c8a 100644 --- a/src/region_prism.cpp +++ b/src/region_prism.cpp @@ -38,46 +38,46 @@ RegPrism::RegPrism(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[2],"INF") == 0) xlo = -BIG; else xlo = domain->boxlo[0]; - } else xlo = xscale*atof(arg[2]); + } else xlo = xscale*force->numeric(FLERR,arg[2]); if (strcmp(arg[3],"INF") == 0 || strcmp(arg[3],"EDGE") == 0) { if (domain->box_exist == 0) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[3],"INF") == 0) xhi = BIG; else xhi = domain->boxhi[0]; - } else xhi = xscale*atof(arg[3]); + } else xhi = xscale*force->numeric(FLERR,arg[3]); if (strcmp(arg[4],"INF") == 0 || strcmp(arg[4],"EDGE") == 0) { if (domain->box_exist == 0) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[4],"INF") == 0) ylo = -BIG; else ylo = domain->boxlo[1]; - } else ylo = yscale*atof(arg[4]); + } else ylo = yscale*force->numeric(FLERR,arg[4]); if (strcmp(arg[5],"INF") == 0 || strcmp(arg[5],"EDGE") == 0) { if (domain->box_exist == 0) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[5],"INF") == 0) yhi = BIG; else yhi = domain->boxhi[1]; - } else yhi = yscale*atof(arg[5]); + } else yhi = yscale*force->numeric(FLERR,arg[5]); if (strcmp(arg[6],"INF") == 0 || strcmp(arg[6],"EDGE") == 0) { if (domain->box_exist == 0) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[6],"INF") == 0) zlo = -BIG; else zlo = domain->boxlo[2]; - } else zlo = zscale*atof(arg[6]); + } else zlo = zscale*force->numeric(FLERR,arg[6]); if (strcmp(arg[7],"INF") == 0 || strcmp(arg[7],"EDGE") == 0) { if (domain->box_exist == 0) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[7],"INF") == 0) zhi = BIG; else zhi = domain->boxhi[2]; - } else zhi = zscale*atof(arg[7]); + } else zhi = zscale*force->numeric(FLERR,arg[7]); - xy = xscale*atof(arg[8]); - xz = xscale*atof(arg[9]); - yz = yscale*atof(arg[10]); + xy = xscale*force->numeric(FLERR,arg[8]); + xz = xscale*force->numeric(FLERR,arg[9]); + yz = yscale*force->numeric(FLERR,arg[10]); // error check // prism cannot be 0 thickness in any dim, else inverse blows up diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp index 28436cc171..709080866d 100644 --- a/src/region_sphere.cpp +++ b/src/region_sphere.cpp @@ -19,6 +19,7 @@ #include "input.h" #include "variable.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -31,9 +32,9 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) : { options(narg-6,&arg[6]); - xc = xscale*atof(arg[2]); - yc = yscale*atof(arg[3]); - zc = zscale*atof(arg[4]); + xc = xscale*force->numeric(FLERR,arg[2]); + yc = yscale*force->numeric(FLERR,arg[3]); + zc = zscale*force->numeric(FLERR,arg[4]); rstr = NULL; if (strstr(arg[5],"v_") == arg[5]) { @@ -46,7 +47,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) : variable_check(); shape_update(); } else { - radius = xscale*atof(arg[5]); + radius = xscale*force->numeric(FLERR,arg[5]); rstyle = CONSTANT; } diff --git a/src/region_union.cpp b/src/region_union.cpp index 3741e8fdd1..e9fc4ef680 100644 --- a/src/region_union.cpp +++ b/src/region_union.cpp @@ -16,6 +16,7 @@ #include "region_union.h" #include "domain.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -26,7 +27,7 @@ using namespace LAMMPS_NS; RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) { if (narg < 5) error->all(FLERR,"Illegal region command"); - int n = atoi(arg[2]); + int n = force->inumeric(FLERR,arg[2]); if (n < 2) error->all(FLERR,"Illegal region command"); options(narg-(n+3),&arg[n+3]); diff --git a/src/replicate.cpp b/src/replicate.cpp index ba5f390211..c56af6a693 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -50,9 +50,9 @@ void Replicate::command(int narg, char **arg) // nrep = total # of replications - int nx = atoi(arg[0]); - int ny = atoi(arg[1]); - int nz = atoi(arg[2]); + int nx = force->inumeric(FLERR,arg[0]); + int ny = force->inumeric(FLERR,arg[1]); + int nz = force->inumeric(FLERR,arg[2]); int nrep = nx*ny*nz; // error and warning checks diff --git a/src/rerun.cpp b/src/rerun.cpp index 7405baa435..6e2c6262e8 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -24,6 +24,7 @@ #include "finish.h" #include "timer.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -80,12 +81,12 @@ void Rerun::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"every") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command"); - nevery = atoi(arg[iarg+1]); + nevery = force->inumeric(FLERR,arg[iarg+1]); if (nevery < 0) error->all(FLERR,"Illegal rerun command"); iarg += 2; } else if (strcmp(arg[iarg],"skip") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command"); - nskip = atoi(arg[iarg+1]); + nskip = force->inumeric(FLERR,arg[iarg+1]); if (nskip <= 0) error->all(FLERR,"Illegal rerun command"); iarg += 2; } else if (strcmp(arg[iarg],"start") == 0) { diff --git a/src/respa.cpp b/src/respa.cpp index 8e9288e35e..a0053750c1 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -46,13 +46,13 @@ Respa::Respa(LAMMPS *lmp, int narg, char **arg) : Integrate(lmp, narg, arg) { if (narg < 1) error->all(FLERR,"Illegal run_style respa command"); - nlevels = atoi(arg[0]); + nlevels = force->inumeric(FLERR,arg[0]); if (nlevels < 1) error->all(FLERR,"Respa levels must be >= 1"); if (narg < nlevels) error->all(FLERR,"Illegal run_style respa command"); loop = new int[nlevels]; for (int iarg = 1; iarg < nlevels; iarg++) { - loop[iarg-1] = atoi(arg[iarg]); + loop[iarg-1] = force->inumeric(FLERR,arg[iarg]); if (loop[iarg-1] <= 0) error->all(FLERR,"Illegal run_style respa command"); } loop[nlevels-1] = 1; @@ -68,43 +68,43 @@ Respa::Respa(LAMMPS *lmp, int narg, char **arg) : Integrate(lmp, narg, arg) while (iarg < narg) { if (strcmp(arg[iarg],"bond") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_bond = atoi(arg[iarg+1]) - 1; + level_bond = force->inumeric(FLERR,arg[iarg+1]) - 1; iarg += 2; } else if (strcmp(arg[iarg],"angle") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_angle = atoi(arg[iarg+1]) - 1; + level_angle = force->inumeric(FLERR,arg[iarg+1]) - 1; iarg += 2; } else if (strcmp(arg[iarg],"dihedral") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_dihedral = atoi(arg[iarg+1]) - 1; + level_dihedral = force->inumeric(FLERR,arg[iarg+1]) - 1; iarg += 2; } else if (strcmp(arg[iarg],"improper") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_improper = atoi(arg[iarg+1]) - 1; + level_improper = force->inumeric(FLERR,arg[iarg+1]) - 1; iarg += 2; } else if (strcmp(arg[iarg],"pair") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_pair = atoi(arg[iarg+1]) - 1; + level_pair = force->inumeric(FLERR,arg[iarg+1]) - 1; iarg += 2; } else if (strcmp(arg[iarg],"inner") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_inner = atoi(arg[iarg+1]) - 1; - cutoff[0] = atof(arg[iarg+2]); - cutoff[1] = atof(arg[iarg+3]); + level_inner = force->inumeric(FLERR,arg[iarg+1]) - 1; + cutoff[0] = force->numeric(FLERR,arg[iarg+2]); + cutoff[1] = force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"middle") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_middle = atoi(arg[iarg+1]) - 1; - cutoff[2] = atof(arg[iarg+2]); - cutoff[3] = atof(arg[iarg+3]); + level_middle = force->inumeric(FLERR,arg[iarg+1]) - 1; + cutoff[2] = force->numeric(FLERR,arg[iarg+2]); + cutoff[3] = force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"outer") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_outer = atoi(arg[iarg+1]) - 1; + level_outer = force->inumeric(FLERR,arg[iarg+1]) - 1; iarg += 2; } else if (strcmp(arg[iarg],"kspace") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_kspace = atoi(arg[iarg+1]) - 1; + level_kspace = force->inumeric(FLERR,arg[iarg+1]) - 1; iarg += 2; } else error->all(FLERR,"Illegal run_style respa command"); } diff --git a/src/run.cpp b/src/run.cpp index b963eb607d..b02865d6c1 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -23,6 +23,7 @@ #include "input.h" #include "timer.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; @@ -90,7 +91,7 @@ void Run::command(int narg, char **arg) } else if (strcmp(arg[iarg],"every") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal run command"); - nevery = atoi(arg[iarg+1]); + nevery = force->inumeric(FLERR,arg[iarg+1]); if (nevery <= 0) error->all(FLERR,"Illegal run command"); first = iarg+2; last = narg-1; diff --git a/src/set.cpp b/src/set.cpp index d7d6c69d88..7a7e7f7464 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -82,16 +82,16 @@ void Set::command(int narg, char **arg) if (strcmp(arg[iarg],"type") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = atoi(arg[iarg+1]); + ivalue = force->inumeric(FLERR,arg[iarg+1]); if (ivalue <= 0 || ivalue > atom->ntypes) error->all(FLERR,"Invalid value in set command"); set(TYPE); iarg += 2; } else if (strcmp(arg[iarg],"type/fraction") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); - newtype = atoi(arg[iarg+1]); - fraction = atof(arg[iarg+2]); - ivalue = atoi(arg[iarg+3]); + newtype = force->inumeric(FLERR,arg[iarg+1]); + fraction = force->numeric(FLERR,arg[iarg+2]); + ivalue = force->inumeric(FLERR,arg[iarg+3]); if (newtype <= 0 || newtype > atom->ntypes) error->all(FLERR,"Invalid value in set command"); if (fraction < 0.0 || fraction > 1.0) @@ -102,36 +102,36 @@ void Set::command(int narg, char **arg) iarg += 4; } else if (strcmp(arg[iarg],"mol") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = atoi(arg[iarg+1]); + ivalue = force->inumeric(FLERR,arg[iarg+1]); if (!atom->molecule_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(MOLECULE); iarg += 2; } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); set(X); iarg += 2; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); set(Y); iarg += 2; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); set(Z); iarg += 2; } else if (strcmp(arg[iarg],"charge") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->q_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(CHARGE); iarg += 2; } else if (strcmp(arg[iarg],"mass") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->rmass_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (dvalue <= 0.0) error->all(FLERR,"Invalid mass in set command"); @@ -139,9 +139,9 @@ void Set::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"shape") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); - xvalue = atof(arg[iarg+1]); - yvalue = atof(arg[iarg+2]); - zvalue = atof(arg[iarg+3]); + xvalue = force->numeric(FLERR,arg[iarg+1]); + yvalue = force->numeric(FLERR,arg[iarg+2]); + zvalue = force->numeric(FLERR,arg[iarg+3]); if (!atom->ellipsoid_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (xvalue < 0.0 || yvalue < 0.0 || zvalue < 0.0) @@ -154,7 +154,7 @@ void Set::command(int narg, char **arg) iarg += 4; } else if (strcmp(arg[iarg],"length") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->line_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (dvalue < 0.0) error->all(FLERR,"Invalid length in set command"); @@ -162,7 +162,7 @@ void Set::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"tri") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->tri_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (dvalue < 0.0) error->all(FLERR,"Invalid length in set command"); @@ -170,17 +170,17 @@ void Set::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"dipole") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); - xvalue = atof(arg[iarg+1]); - yvalue = atof(arg[iarg+2]); - zvalue = atof(arg[iarg+3]); + xvalue = force->numeric(FLERR,arg[iarg+1]); + yvalue = force->numeric(FLERR,arg[iarg+2]); + zvalue = force->numeric(FLERR,arg[iarg+3]); if (!atom->mu_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(DIPOLE); iarg += 4; } else if (strcmp(arg[iarg],"dipole/random") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal set command"); - ivalue = atoi(arg[iarg+1]); - dvalue = atof(arg[iarg+2]); + ivalue = force->inumeric(FLERR,arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+2]); if (!atom->mu_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0) @@ -191,17 +191,17 @@ void Set::command(int narg, char **arg) iarg += 3; } else if (strcmp(arg[iarg],"quat") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal set command"); - xvalue = atof(arg[iarg+1]); - yvalue = atof(arg[iarg+2]); - zvalue = atof(arg[iarg+3]); - wvalue = atof(arg[iarg+4]); + xvalue = force->numeric(FLERR,arg[iarg+1]); + yvalue = force->numeric(FLERR,arg[iarg+2]); + zvalue = force->numeric(FLERR,arg[iarg+3]); + wvalue = force->numeric(FLERR,arg[iarg+4]); if (!atom->ellipsoid_flag && !atom->tri_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(QUAT); iarg += 5; } else if (strcmp(arg[iarg],"quat/random") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = atoi(arg[iarg+1]); + ivalue = force->inumeric(FLERR,arg[iarg+1]); if (!atom->ellipsoid_flag && !atom->tri_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0) @@ -210,7 +210,7 @@ void Set::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"theta") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); dvalue *= MY_PI/180.0; if (!atom->line_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); @@ -218,16 +218,16 @@ void Set::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"angmom") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); - xvalue = atof(arg[iarg+1]); - yvalue = atof(arg[iarg+2]); - zvalue = atof(arg[iarg+3]); + xvalue = force->numeric(FLERR,arg[iarg+1]); + yvalue = force->numeric(FLERR,arg[iarg+2]); + zvalue = force->numeric(FLERR,arg[iarg+3]); if (!atom->ellipsoid_flag && !atom->tri_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(ANGMOM); iarg += 4; } else if (strcmp(arg[iarg],"diameter") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->radius_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (dvalue < 0.0) error->all(FLERR,"Invalid diameter in set command"); @@ -235,14 +235,14 @@ void Set::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"density") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->rmass_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(DENSITY); iarg += 2; } else if (strcmp(arg[iarg],"volume") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->vfrac_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(VOLUME); @@ -252,15 +252,15 @@ void Set::command(int narg, char **arg) ximageflag = yimageflag = zimageflag = 0; if (strcmp(arg[iarg+1],"NULL") != 0) { ximageflag = 1; - ximage = atoi(arg[iarg+1]); + ximage = force->inumeric(FLERR,arg[iarg+1]); } if (strcmp(arg[iarg+2],"NULL") != 0) { yimageflag = 1; - yimage = atoi(arg[iarg+2]); + yimage = force->inumeric(FLERR,arg[iarg+2]); } if (strcmp(arg[iarg+3],"NULL") != 0) { zimageflag = 1; - zimage = atoi(arg[iarg+3]); + zimage = force->inumeric(FLERR,arg[iarg+3]); } if (ximageflag && ximage && !domain->xperiodic) error->all(FLERR, @@ -275,7 +275,7 @@ void Set::command(int narg, char **arg) iarg += 4; } else if (strcmp(arg[iarg],"bond") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = atoi(arg[iarg+1]); + ivalue = force->inumeric(FLERR,arg[iarg+1]); if (atom->avec->bonds_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->nbondtypes) @@ -284,7 +284,7 @@ void Set::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"angle") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = atoi(arg[iarg+1]); + ivalue = force->inumeric(FLERR,arg[iarg+1]); if (atom->avec->angles_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->nangletypes) @@ -293,7 +293,7 @@ void Set::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"dihedral") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = atoi(arg[iarg+1]); + ivalue = force->inumeric(FLERR,arg[iarg+1]); if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->ndihedraltypes) @@ -302,7 +302,7 @@ void Set::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"improper") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = atoi(arg[iarg+1]); + ivalue = force->inumeric(FLERR,arg[iarg+1]); if (atom->avec->impropers_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->nimpropertypes) @@ -311,21 +311,21 @@ void Set::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"meso_e") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->e_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(MESO_E); iarg += 2; } else if (strcmp(arg[iarg],"meso_cv") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->cv_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(MESO_CV); iarg += 2; } else if (strcmp(arg[iarg],"meso_rho") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - dvalue = atof(arg[iarg+1]); + dvalue = force->numeric(FLERR,arg[iarg+1]); if (!atom->rho_flag) error->all(FLERR,"Cannot set meso_rho for this atom style"); set(MESO_RHO); diff --git a/src/thermo.cpp b/src/thermo.cpp index 85cb7f0689..ff30ca644b 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -537,7 +537,7 @@ void Thermo::modify_params(int narg, char **arg) format_float_user = new char[n]; strcpy(format_float_user,arg[iarg+2]); } else { - int i = atoi(arg[iarg+1]) - 1; + int i = force->inumeric(FLERR,arg[iarg+1]) - 1; if (i < 0 || i >= nfield_initial) error->all(FLERR,"Illegal thermo_modify command"); if (format_user[i]) delete [] format_user[i]; diff --git a/src/universe.cpp b/src/universe.cpp index 77a00d99fc..2b36bd856a 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -18,6 +18,7 @@ #include "universe.h" #include "version.h" #include "error.h" +#include "force.h" #include "memory.h" using namespace LAMMPS_NS; @@ -77,7 +78,7 @@ void Universe::reorder(char *style, char *arg) if (uworld != uorig) MPI_Comm_free(&uworld); if (strcmp(style,"nth") == 0) { - int n = atoi(arg); + int n = force->inumeric(FLERR,arg); if (n <= 0) error->universe_all(FLERR,"Invalid -reorder N value"); if (nprocs % n) diff --git a/src/variable.cpp b/src/variable.cpp index 4e09fd1f36..3c7e335acb 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -33,6 +33,7 @@ #include "atom_masks.h" #include "memory.h" #include "error.h" +#include "force.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -166,7 +167,7 @@ void Variable::set(int narg, char **arg) int nfirst,nlast; if (narg == 3 || (narg == 4 && strcmp(arg[3],"pad") == 0)) { nfirst = 1; - nlast = atoi(arg[2]); + nlast = force->inumeric(FLERR,arg[2]); if (nlast <= 0) error->all(FLERR,"Illegal variable command"); if (narg == 4 && strcmp(arg[3],"pad") == 0) { char digits[12]; @@ -174,8 +175,8 @@ void Variable::set(int narg, char **arg) pad[nvar] = strlen(digits); } else pad[nvar] = 0; } else if (narg == 4 || (narg == 5 && strcmp(arg[4],"pad") == 0)) { - nfirst = atoi(arg[2]); - nlast = atoi(arg[3]); + nfirst = force->inumeric(FLERR,arg[2]); + nlast = force->inumeric(FLERR,arg[3]); if (nfirst > nlast || nlast < 0) error->all(FLERR,"Illegal variable command"); if (narg == 5 && strcmp(arg[4],"pad") == 0) { @@ -229,7 +230,7 @@ void Variable::set(int narg, char **arg) if (find(arg[0]) >= 0) return; if (nvar == maxvar) grow(); style[nvar] = ULOOP; - num[nvar] = atoi(arg[2]); + num[nvar] = force->inumeric(FLERR,arg[2]); data[nvar] = new char*[1]; data[nvar][0] = NULL; if (narg == 4) { diff --git a/src/velocity.cpp b/src/velocity.cpp index b0c203b25d..a5c6a8673e 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -100,8 +100,8 @@ void Velocity::command(int narg, char **arg) // create() invoked differently, so can be called externally if (style == CREATE) { - double t_desired = atof(arg[2]); - int seed = atoi(arg[3]); + double t_desired = force->numeric(FLERR,arg[2]); + int seed = force->inumeric(FLERR,arg[3]); create(t_desired,seed); } else if (style == SET) set(narg-2,&arg[2]); @@ -357,21 +357,21 @@ void Velocity::set(int narg, char **arg) xstr = new char[n]; strcpy(xstr,&arg[0][2]); } else if (strcmp(arg[0],"NULL") == 0) xstyle = NONE; - else vx = atof(arg[0]); + else vx = force->numeric(FLERR,arg[0]); if (strstr(arg[1],"v_") == arg[1]) { int n = strlen(&arg[1][2]) + 1; ystr = new char[n]; strcpy(ystr,&arg[1][2]); } else if (strcmp(arg[1],"NULL") == 0) ystyle = NONE; - else vy = atof(arg[1]); + else vy = force->numeric(FLERR,arg[1]); if (strstr(arg[2],"v_") == arg[2]) { int n = strlen(&arg[2][2]) + 1; zstr = new char[n]; strcpy(zstr,&arg[2][2]); } else if (strcmp(arg[2],"NULL") == 0) zstyle = NONE; - else vz = atof(arg[2]); + else vz = force->numeric(FLERR,arg[2]); // set and apply scale factors @@ -505,7 +505,7 @@ void Velocity::set(int narg, char **arg) void Velocity::scale(int narg, char **arg) { - double t_desired = atof(arg[0]); + double t_desired = force->numeric(FLERR,arg[0]); // if temperature = NULL, create a new ComputeTemp with the velocity group @@ -566,14 +566,14 @@ void Velocity::ramp(int narg, char **arg) double v_lo,v_hi; if (v_dim == 0) { - v_lo = xscale*atof(arg[1]); - v_hi = xscale*atof(arg[2]); + v_lo = xscale*force->numeric(FLERR,arg[1]); + v_hi = xscale*force->numeric(FLERR,arg[2]); } else if (v_dim == 1) { - v_lo = yscale*atof(arg[1]); - v_hi = yscale*atof(arg[2]); + v_lo = yscale*force->numeric(FLERR,arg[1]); + v_hi = yscale*force->numeric(FLERR,arg[2]); } else if (v_dim == 2) { - v_lo = zscale*atof(arg[1]); - v_hi = zscale*atof(arg[2]); + v_lo = zscale*force->numeric(FLERR,arg[1]); + v_hi = zscale*force->numeric(FLERR,arg[2]); } int coord_dim; @@ -584,14 +584,14 @@ void Velocity::ramp(int narg, char **arg) double coord_lo,coord_hi; if (coord_dim == 0) { - coord_lo = xscale*atof(arg[4]); - coord_hi = xscale*atof(arg[5]); + coord_lo = xscale*force->numeric(FLERR,arg[4]); + coord_hi = xscale*force->numeric(FLERR,arg[5]); } else if (coord_dim == 1) { - coord_lo = yscale*atof(arg[4]); - coord_hi = yscale*atof(arg[5]); + coord_lo = yscale*force->numeric(FLERR,arg[4]); + coord_hi = yscale*force->numeric(FLERR,arg[5]); } else if (coord_dim == 2) { - coord_lo = zscale*atof(arg[4]); - coord_hi = zscale*atof(arg[5]); + coord_lo = zscale*force->numeric(FLERR,arg[4]); + coord_hi = zscale*force->numeric(FLERR,arg[5]); } // vramp = ramped velocity component for v_dim