From fcd0b9f78f61d0c4d6cfd012e6fe4d4270b87b4a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 29 Aug 2020 18:23:03 -0400 Subject: [PATCH] move Force::bounds() and Force::boundsbig() to utils. --- src/ASPHERE/pair_gayberne.cpp | 4 +- src/ASPHERE/pair_line_lj.cpp | 5 +- src/ASPHERE/pair_resquared.cpp | 4 +- src/ASPHERE/pair_tri_lj.cpp | 5 +- src/BODY/pair_body_nparticle.cpp | 5 +- src/BODY/pair_body_rounded_polygon.cpp | 5 +- src/BODY/pair_body_rounded_polyhedron.cpp | 5 +- src/CLASS2/angle_class2.cpp | 2 +- src/CLASS2/bond_class2.cpp | 2 +- src/CLASS2/dihedral_class2.cpp | 2 +- src/CLASS2/improper_class2.cpp | 2 +- src/CLASS2/pair_lj_class2.cpp | 4 +- src/CLASS2/pair_lj_class2_coul_cut.cpp | 4 +- src/CLASS2/pair_lj_class2_coul_long.cpp | 4 +- src/COLLOID/pair_brownian.cpp | 4 +- src/COLLOID/pair_colloid.cpp | 4 +- src/COLLOID/pair_lubricate.cpp | 4 +- src/COLLOID/pair_lubricateU.cpp | 4 +- src/DIPOLE/pair_lj_cut_dipole_cut.cpp | 4 +- src/DIPOLE/pair_lj_cut_dipole_long.cpp | 4 +- src/DIPOLE/pair_lj_long_dipole_long.cpp | 4 +- src/GRANULAR/pair_gran_hooke_history.cpp | 4 +- src/GRANULAR/pair_granular.cpp | 4 +- src/KIM/pair_kim.cpp | 4 +- src/KOKKOS/pair_hybrid_overlay_kokkos.cpp | 5 +- src/KOKKOS/pair_table_rx_kokkos.cpp | 4 +- src/KSPACE/pair_born_coul_long.cpp | 4 +- src/KSPACE/pair_buck_coul_long.cpp | 4 +- src/KSPACE/pair_buck_long_coul_long.cpp | 4 +- src/KSPACE/pair_coul_long.cpp | 4 +- src/KSPACE/pair_lj_charmm_coul_long.cpp | 4 +- src/KSPACE/pair_lj_charmmfsw_coul_long.cpp | 4 +- src/KSPACE/pair_lj_cut_coul_long.cpp | 4 +- src/KSPACE/pair_lj_long_coul_long.cpp | 4 +- src/MANYBODY/pair_atm.cpp | 6 +- src/MANYBODY/pair_eam.cpp | 4 +- src/MC/pair_dsmc.cpp | 4 +- src/MISC/compute_ti.cpp | 3 +- src/MISC/pair_nm_cut.cpp | 4 +- src/MISC/pair_nm_cut_coul_cut.cpp | 4 +- src/MISC/pair_nm_cut_coul_long.cpp | 4 +- src/MOLECULE/angle_charmm.cpp | 2 +- src/MOLECULE/angle_cosine.cpp | 2 +- src/MOLECULE/angle_cosine_periodic.cpp | 2 +- src/MOLECULE/angle_cosine_squared.cpp | 2 +- src/MOLECULE/angle_harmonic.cpp | 2 +- src/MOLECULE/angle_table.cpp | 2 +- src/MOLECULE/bond_fene.cpp | 2 +- src/MOLECULE/bond_fene_expand.cpp | 2 +- src/MOLECULE/bond_gromos.cpp | 2 +- src/MOLECULE/bond_harmonic.cpp | 2 +- src/MOLECULE/bond_morse.cpp | 2 +- src/MOLECULE/bond_nonlinear.cpp | 2 +- src/MOLECULE/bond_quartic.cpp | 2 +- src/MOLECULE/bond_table.cpp | 2 +- src/MOLECULE/dihedral_charmm.cpp | 2 +- src/MOLECULE/dihedral_charmmfsw.cpp | 2 +- src/MOLECULE/dihedral_harmonic.cpp | 2 +- src/MOLECULE/dihedral_helix.cpp | 2 +- src/MOLECULE/dihedral_multi_harmonic.cpp | 2 +- src/MOLECULE/dihedral_opls.cpp | 2 +- src/MOLECULE/improper_cvff.cpp | 2 +- src/MOLECULE/improper_harmonic.cpp | 2 +- src/MOLECULE/improper_umbrella.cpp | 2 +- src/MOLECULE/pair_hbond_dreiding_lj.cpp | 7 +- src/MOLECULE/pair_hbond_dreiding_morse.cpp | 7 +- src/MOLECULE/pair_lj_charmm_coul_charmm.cpp | 4 +- .../pair_lj_charmmfsw_coul_charmmfsh.cpp | 4 +- src/MOLECULE/pair_lj_cut_tip4p_cut.cpp | 4 +- src/MOLECULE/pair_tip4p_cut.cpp | 4 +- src/PERI/pair_peri_eps.cpp | 4 +- src/PERI/pair_peri_lps.cpp | 4 +- src/PERI/pair_peri_pmb.cpp | 4 +- src/PERI/pair_peri_ves.cpp | 4 +- src/QEQ/fix_qeq.cpp | 2 +- src/RIGID/fix_rigid.cpp | 4 +- src/SPIN/pair_spin_dipole_cut.cpp | 4 +- src/SPIN/pair_spin_dipole_long.cpp | 4 +- src/SPIN/pair_spin_dmi.cpp | 4 +- src/SPIN/pair_spin_exchange.cpp | 4 +- src/SPIN/pair_spin_magelec.cpp | 4 +- src/SPIN/pair_spin_neel.cpp | 4 +- src/USER-AWPMD/pair_awpmd_cut.cpp | 4 +- src/USER-CGDNA/bond_oxdna_fene.cpp | 2 +- src/USER-CGDNA/pair_oxdna2_coaxstk.cpp | 4 +- src/USER-CGDNA/pair_oxdna2_dh.cpp | 4 +- src/USER-CGDNA/pair_oxdna_coaxstk.cpp | 4 +- src/USER-CGDNA/pair_oxdna_excv.cpp | 4 +- src/USER-CGDNA/pair_oxdna_hbond.cpp | 4 +- src/USER-CGDNA/pair_oxdna_stk.cpp | 4 +- src/USER-CGDNA/pair_oxdna_xstk.cpp | 4 +- src/USER-CGDNA/pair_oxrna2_stk.cpp | 4 +- src/USER-CGDNA/pair_oxrna2_xstk.cpp | 4 +- src/USER-CGSDK/angle_sdk.cpp | 2 +- src/USER-CGSDK/pair_lj_sdk.cpp | 4 +- src/USER-CGSDK/pair_lj_sdk_coul_long.cpp | 4 +- src/USER-DPD/pair_dpd_fdt.cpp | 4 +- src/USER-DPD/pair_dpd_fdt_energy.cpp | 4 +- src/USER-DPD/pair_exp6_rx.cpp | 4 +- src/USER-DPD/pair_multi_lucy.cpp | 4 +- src/USER-DPD/pair_multi_lucy_rx.cpp | 4 +- src/USER-DPD/pair_table_rx.cpp | 4 +- src/USER-DRUDE/pair_lj_cut_thole_long.cpp | 4 +- src/USER-DRUDE/pair_thole.cpp | 4 +- src/USER-EFF/pair_eff_cut.cpp | 4 +- src/USER-FEP/compute_fep.cpp | 13 +- src/USER-FEP/fix_adapt_fep.cpp | 13 +- src/USER-FEP/pair_coul_cut_soft.cpp | 4 +- src/USER-FEP/pair_coul_long_soft.cpp | 4 +- .../pair_lj_charmm_coul_long_soft.cpp | 4 +- src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp | 4 +- .../pair_lj_class2_coul_long_soft.cpp | 4 +- src/USER-FEP/pair_lj_class2_soft.cpp | 4 +- src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp | 4 +- src/USER-FEP/pair_lj_cut_coul_long_soft.cpp | 4 +- src/USER-FEP/pair_lj_cut_soft.cpp | 4 +- src/USER-FEP/pair_morse_soft.cpp | 4 +- src/USER-LB/fix_lb_rigid_pc_sphere.cpp | 5 +- src/USER-MESODPD/pair_edpd.cpp | 4 +- src/USER-MESODPD/pair_mdpd.cpp | 4 +- src/USER-MESODPD/pair_mdpd_rhosum.cpp | 5 +- src/USER-MESODPD/pair_tdpd.cpp | 4 +- src/USER-MESONT/pair_mesont_tpm.cpp | 4 +- src/USER-MISC/angle_cosine_shift.cpp | 2 +- src/USER-MISC/angle_cosine_shift_exp.cpp | 2 +- src/USER-MISC/angle_dipole.cpp | 2 +- src/USER-MISC/angle_fourier.cpp | 2 +- src/USER-MISC/angle_fourier_simple.cpp | 2 +- src/USER-MISC/angle_quartic.cpp | 2 +- src/USER-MISC/bond_harmonic_shift.cpp | 2 +- src/USER-MISC/bond_harmonic_shift_cut.cpp | 2 +- src/USER-MISC/bond_special.cpp | 3 +- src/USER-MISC/dihedral_cosine_shift_exp.cpp | 2 +- src/USER-MISC/dihedral_fourier.cpp | 2 +- src/USER-MISC/dihedral_nharmonic.cpp | 2 +- src/USER-MISC/dihedral_quadratic.cpp | 2 +- src/USER-MISC/dihedral_spherical.cpp | 2 +- src/USER-MISC/dihedral_table.cpp | 2 +- src/USER-MISC/dihedral_table_cut.cpp | 2 +- src/USER-MISC/improper_cossq.cpp | 2 +- src/USER-MISC/improper_distance.cpp | 2 +- src/USER-MISC/improper_fourier.cpp | 2 +- src/USER-MISC/improper_ring.cpp | 2 +- src/USER-MISC/pair_buck_mdf.cpp | 4 +- src/USER-MISC/pair_cosine_squared.cpp | 4 +- src/USER-MISC/pair_coul_diel.cpp | 4 +- src/USER-MISC/pair_coul_shield.cpp | 4 +- src/USER-MISC/pair_coul_slater_long.cpp | 5 +- src/USER-MISC/pair_gauss_cut.cpp | 4 +- src/USER-MISC/pair_kolmogorov_crespi_z.cpp | 4 +- src/USER-MISC/pair_lebedeva_z.cpp | 4 +- src/USER-MISC/pair_lennard_mdf.cpp | 4 +- src/USER-MISC/pair_list.cpp | 5 +- src/USER-MISC/pair_lj_expand_coul_long.cpp | 4 +- src/USER-MISC/pair_lj_mdf.cpp | 4 +- src/USER-MISC/pair_lj_sf_dipole_sf.cpp | 4 +- src/USER-MISC/pair_momb.cpp | 4 +- src/USER-MISC/pair_morse_smooth_linear.cpp | 4 +- src/USER-MISC/pair_srp.cpp | 4 +- src/USER-MOFFF/angle_class2_p6.cpp | 2 +- src/USER-MOFFF/angle_cosine_buck6d.cpp | 2 +- .../improper_inversion_harmonic.cpp | 2 +- src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp | 4 +- .../pair_buck6d_coul_gauss_long.cpp | 4 +- .../pair_sdpd_taitwater_isothermal.cpp | 5 +- src/USER-SMD/pair_smd_hertz.cpp | 5 +- .../pair_smd_triangulated_surface.cpp | 5 +- src/USER-SPH/pair_sph_heatconduction.cpp | 5 +- src/USER-SPH/pair_sph_idealgas.cpp | 5 +- src/USER-SPH/pair_sph_lj.cpp | 5 +- src/USER-SPH/pair_sph_rhosum.cpp | 5 +- src/USER-SPH/pair_sph_taitwater.cpp | 5 +- src/USER-SPH/pair_sph_taitwater_morris.cpp | 5 +- src/USER-YAFF/angle_cross.cpp | 2 +- src/USER-YAFF/angle_mm3.cpp | 2 +- src/USER-YAFF/bond_mm3.cpp | 2 +- src/USER-YAFF/improper_distharm.cpp | 2 +- src/USER-YAFF/improper_sqdistharm.cpp | 2 +- .../pair_lj_switch3_coulgauss_long.cpp | 4 +- .../pair_mm3_switch3_coulgauss_long.cpp | 4 +- src/angle_hybrid.cpp | 2 +- src/angle_zero.cpp | 2 +- src/bond_hybrid.cpp | 2 +- src/bond_zero.cpp | 2 +- src/comm.cpp | 2 +- src/compute_adf.cpp | 7 +- src/compute_coord_atom.cpp | 2 +- src/compute_rdf.cpp | 5 +- src/delete_bonds.cpp | 4 +- src/dihedral_hybrid.cpp | 2 +- src/dihedral_zero.cpp | 3 +- src/dump_image.cpp | 9 +- src/fix_adapt.cpp | 12 +- src/force.cpp | 68 ------ src/force.h | 2 - src/improper_hybrid.cpp | 2 +- src/improper_zero.cpp | 3 +- src/pair_beck.cpp | 4 +- src/pair_born.cpp | 4 +- src/pair_born_coul_dsf.cpp | 4 +- src/pair_born_coul_wolf.cpp | 4 +- src/pair_buck.cpp | 4 +- src/pair_buck_coul_cut.cpp | 4 +- src/pair_coul_cut.cpp | 4 +- src/pair_coul_dsf.cpp | 4 +- src/pair_coul_wolf.cpp | 4 +- src/pair_dpd.cpp | 4 +- src/pair_dpd_tstat.cpp | 4 +- src/pair_gauss.cpp | 4 +- src/pair_hybrid.cpp | 4 +- src/pair_hybrid_overlay.cpp | 5 +- src/pair_lj96_cut.cpp | 4 +- src/pair_lj_cubic.cpp | 4 +- src/pair_lj_cut.cpp | 4 +- src/pair_lj_cut_coul_cut.cpp | 4 +- src/pair_lj_cut_coul_dsf.cpp | 4 +- src/pair_lj_cut_coul_wolf.cpp | 4 +- src/pair_lj_expand.cpp | 4 +- src/pair_lj_gromacs.cpp | 4 +- src/pair_lj_gromacs_coul_gromacs.cpp | 4 +- src/pair_lj_smooth.cpp | 4 +- src/pair_lj_smooth_linear.cpp | 4 +- src/pair_mie_cut.cpp | 4 +- src/pair_morse.cpp | 4 +- src/pair_soft.cpp | 4 +- src/pair_table.cpp | 4 +- src/pair_ufm.cpp | 4 +- src/pair_yukawa.cpp | 4 +- src/pair_zbl.cpp | 4 +- src/pair_zero.cpp | 4 +- src/set.cpp | 6 +- src/utils.cpp | 214 ++++++++++++++++++ src/utils.h | 118 ++++++++-- 233 files changed, 751 insertions(+), 498 deletions(-) diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index 51896aab85..1c63ddbb5d 100644 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -294,8 +294,8 @@ void PairGayBerne::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/ASPHERE/pair_line_lj.cpp b/src/ASPHERE/pair_line_lj.cpp index fdeb09aac4..48b35e4cd1 100644 --- a/src/ASPHERE/pair_line_lj.cpp +++ b/src/ASPHERE/pair_line_lj.cpp @@ -20,6 +20,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -367,8 +368,8 @@ void PairLineLJ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double size_itype = force->numeric(FLERR,arg[2]); double size_jtype = force->numeric(FLERR,arg[3]); diff --git a/src/ASPHERE/pair_resquared.cpp b/src/ASPHERE/pair_resquared.cpp index dd4b11935e..4e653e4838 100644 --- a/src/ASPHERE/pair_resquared.cpp +++ b/src/ASPHERE/pair_resquared.cpp @@ -266,8 +266,8 @@ void PairRESquared::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/ASPHERE/pair_tri_lj.cpp b/src/ASPHERE/pair_tri_lj.cpp index 0984b0a30c..d71cc0b7a9 100644 --- a/src/ASPHERE/pair_tri_lj.cpp +++ b/src/ASPHERE/pair_tri_lj.cpp @@ -21,6 +21,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -438,8 +439,8 @@ void PairTriLJ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/BODY/pair_body_nparticle.cpp b/src/BODY/pair_body_nparticle.cpp index bd7aba5455..f2b1fa77f9 100644 --- a/src/BODY/pair_body_nparticle.cpp +++ b/src/BODY/pair_body_nparticle.cpp @@ -23,6 +23,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -385,8 +386,8 @@ void PairBodyNparticle::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index 22a6d82b44..7e213eba1c 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -34,6 +34,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -385,8 +386,8 @@ void PairBodyRoundedPolygon::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double k_n_one = force->numeric(FLERR,arg[2]); double k_na_one = force->numeric(FLERR,arg[3]); diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index ff7e7fc25e..d3e92ab2f6 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -37,6 +37,7 @@ #include "error.h" #include "math_extra.h" #include "math_const.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -363,8 +364,8 @@ void PairBodyRoundedPolyhedron::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double k_n_one = force->numeric(FLERR,arg[2]); double k_na_one = force->numeric(FLERR,arg[3]); diff --git a/src/CLASS2/angle_class2.cpp b/src/CLASS2/angle_class2.cpp index fe567ead34..79d71b2ee4 100644 --- a/src/CLASS2/angle_class2.cpp +++ b/src/CLASS2/angle_class2.cpp @@ -273,7 +273,7 @@ void AngleClass2::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); int count = 0; diff --git a/src/CLASS2/bond_class2.cpp b/src/CLASS2/bond_class2.cpp index 7feec1a4b3..d6b802a11a 100644 --- a/src/CLASS2/bond_class2.cpp +++ b/src/CLASS2/bond_class2.cpp @@ -134,7 +134,7 @@ void BondClass2::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double r0_one = force->numeric(FLERR,arg[1]); double k2_one = force->numeric(FLERR,arg[2]); diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index 73b6a420e8..e08661a480 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -639,7 +639,7 @@ void DihedralClass2::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); int count = 0; diff --git a/src/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index 2d5918fdef..d150a5b7b4 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -523,7 +523,7 @@ void ImproperClass2::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); int count = 0; diff --git a/src/CLASS2/pair_lj_class2.cpp b/src/CLASS2/pair_lj_class2.cpp index 47b3185bbf..bdd922bce6 100644 --- a/src/CLASS2/pair_lj_class2.cpp +++ b/src/CLASS2/pair_lj_class2.cpp @@ -457,8 +457,8 @@ void PairLJClass2::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/CLASS2/pair_lj_class2_coul_cut.cpp b/src/CLASS2/pair_lj_class2_coul_cut.cpp index 3635c21c8c..da5732c9bd 100644 --- a/src/CLASS2/pair_lj_class2_coul_cut.cpp +++ b/src/CLASS2/pair_lj_class2_coul_cut.cpp @@ -223,8 +223,8 @@ void PairLJClass2CoulCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 0bb802579c..c8487e8c1d 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -633,8 +633,8 @@ void PairLJClass2CoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/COLLOID/pair_brownian.cpp b/src/COLLOID/pair_brownian.cpp index d73789d890..46ec5c9d2f 100644 --- a/src/COLLOID/pair_brownian.cpp +++ b/src/COLLOID/pair_brownian.cpp @@ -419,8 +419,8 @@ void PairBrownian::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_inner_one = cut_inner_global; double cut_one = cut_global; diff --git a/src/COLLOID/pair_colloid.cpp b/src/COLLOID/pair_colloid.cpp index d1c6e4594f..e97684dcd1 100644 --- a/src/COLLOID/pair_colloid.cpp +++ b/src/COLLOID/pair_colloid.cpp @@ -269,8 +269,8 @@ void PairColloid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a12_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/COLLOID/pair_lubricate.cpp b/src/COLLOID/pair_lubricate.cpp index a72eaef679..59b3fd2909 100644 --- a/src/COLLOID/pair_lubricate.cpp +++ b/src/COLLOID/pair_lubricate.cpp @@ -501,8 +501,8 @@ void PairLubricate::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_inner_one = cut_inner_global; double cut_one = cut_global; diff --git a/src/COLLOID/pair_lubricateU.cpp b/src/COLLOID/pair_lubricateU.cpp index b0e21256ac..0a003cd0ab 100644 --- a/src/COLLOID/pair_lubricateU.cpp +++ b/src/COLLOID/pair_lubricateU.cpp @@ -1734,8 +1734,8 @@ void PairLubricateU::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_inner_one = cut_inner_global; double cut_one = cut_global; diff --git a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp index 9f9e897357..bd68a9445a 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp @@ -326,8 +326,8 @@ void PairLJCutDipoleCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/DIPOLE/pair_lj_cut_dipole_long.cpp b/src/DIPOLE/pair_lj_cut_dipole_long.cpp index 7fc03005b5..5d78d9bfd3 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_long.cpp @@ -373,8 +373,8 @@ void PairLJCutDipoleLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/DIPOLE/pair_lj_long_dipole_long.cpp b/src/DIPOLE/pair_lj_long_dipole_long.cpp index 7dc596eccb..27af0b7ff4 100644 --- a/src/DIPOLE/pair_lj_long_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_long_dipole_long.cpp @@ -191,8 +191,8 @@ void PairLJLongDipoleLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index af46d813ca..04f1cb0a95 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -385,8 +385,8 @@ void PairGranHookeHistory::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 8bf2d1bf17..b677c7711d 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -784,8 +784,8 @@ void PairGranular::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); //Defaults normal_model_one = tangential_model_one = -1; diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 7d2333aab1..69586b55d6 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -343,8 +343,8 @@ void PairKIM::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom species to KIM elements // lmps_map_species_to_unique[i] = diff --git a/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp b/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp index 0cebd79c88..a051b7bf4d 100644 --- a/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp +++ b/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp @@ -17,6 +17,7 @@ #include "atom.h" #include "force.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -34,8 +35,8 @@ void PairHybridOverlayKokkos::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // 3rd arg = pair sub-style name // 4th arg = pair sub-style index if name used multiple times diff --git a/src/KOKKOS/pair_table_rx_kokkos.cpp b/src/KOKKOS/pair_table_rx_kokkos.cpp index 3dc325371b..28b3a0d12d 100644 --- a/src/KOKKOS/pair_table_rx_kokkos.cpp +++ b/src/KOKKOS/pair_table_rx_kokkos.cpp @@ -1025,8 +1025,8 @@ void PairTableRXKokkos::coeff(int narg, char **arg) if (!rx_flag) error->all(FLERR,"PairTableRX requires a fix rx command."); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int me; MPI_Comm_rank(world,&me); diff --git a/src/KSPACE/pair_born_coul_long.cpp b/src/KSPACE/pair_born_coul_long.cpp index b4d050412a..3c1391ed94 100644 --- a/src/KSPACE/pair_born_coul_long.cpp +++ b/src/KSPACE/pair_born_coul_long.cpp @@ -264,8 +264,8 @@ void PairBornCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a_one = force->numeric(FLERR,arg[2]); double rho_one = force->numeric(FLERR,arg[3]); diff --git a/src/KSPACE/pair_buck_coul_long.cpp b/src/KSPACE/pair_buck_coul_long.cpp index a63047ea9f..92086812a0 100644 --- a/src/KSPACE/pair_buck_coul_long.cpp +++ b/src/KSPACE/pair_buck_coul_long.cpp @@ -265,8 +265,8 @@ void PairBuckCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a_one = force->numeric(FLERR,arg[2]); double rho_one = force->numeric(FLERR,arg[3]); diff --git a/src/KSPACE/pair_buck_long_coul_long.cpp b/src/KSPACE/pair_buck_long_coul_long.cpp index 7408ac12b9..dc4704569e 100644 --- a/src/KSPACE/pair_buck_long_coul_long.cpp +++ b/src/KSPACE/pair_buck_long_coul_long.cpp @@ -200,8 +200,8 @@ void PairBuckLongCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,*(arg++),atom->ntypes,ilo,ihi); - force->bounds(FLERR,*(arg++),atom->ntypes,jlo,jhi); + utils::bounds(FLERR,*(arg++),1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,*(arg++),1,atom->ntypes,jlo,jhi,error); double buck_a_one = force->numeric(FLERR,*(arg++)); double buck_rho_one = force->numeric(FLERR,*(arg++)); diff --git a/src/KSPACE/pair_coul_long.cpp b/src/KSPACE/pair_coul_long.cpp index 9a9f2f3783..2cee7a7994 100644 --- a/src/KSPACE/pair_coul_long.cpp +++ b/src/KSPACE/pair_coul_long.cpp @@ -212,8 +212,8 @@ void PairCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/KSPACE/pair_lj_charmm_coul_long.cpp b/src/KSPACE/pair_lj_charmm_coul_long.cpp index 9ea6739c8e..4178660fff 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_long.cpp @@ -647,8 +647,8 @@ void PairLJCharmmCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp index 36d8126eec..b1b86c7a4e 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp @@ -698,8 +698,8 @@ void PairLJCharmmfswCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/KSPACE/pair_lj_cut_coul_long.cpp b/src/KSPACE/pair_lj_cut_coul_long.cpp index 578e5be30c..b998c9b8ef 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long.cpp @@ -619,8 +619,8 @@ void PairLJCutCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index 8ece088bd3..e226cc9912 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -198,8 +198,8 @@ void PairLJLongCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/MANYBODY/pair_atm.cpp b/src/MANYBODY/pair_atm.cpp index e943b6bfdd..e10ebffb4f 100644 --- a/src/MANYBODY/pair_atm.cpp +++ b/src/MANYBODY/pair_atm.cpp @@ -224,9 +224,9 @@ void PairATM::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi,klo,khi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); - force->bounds(FLERR,arg[2],atom->ntypes,klo,khi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + utils::bounds(FLERR,arg[2],1,atom->ntypes,klo,khi,error); double nu_one = force->numeric(FLERR,arg[3]); diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index da2385237b..159ba55a29 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -378,8 +378,8 @@ void PairEAM::coeff(int narg, char **arg) // parse pair of atom types int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read funcfl file if hasn't already been read // store filename in Funcfl data struct diff --git a/src/MC/pair_dsmc.cpp b/src/MC/pair_dsmc.cpp index ed03ca6ffc..e6d2f4fe89 100644 --- a/src/MC/pair_dsmc.cpp +++ b/src/MC/pair_dsmc.cpp @@ -245,8 +245,8 @@ void PairDSMC::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double sigma_one = force->numeric(FLERR,arg[2]); diff --git a/src/MISC/compute_ti.cpp b/src/MISC/compute_ti.cpp index 06188de238..286770017c 100644 --- a/src/MISC/compute_ti.cpp +++ b/src/MISC/compute_ti.cpp @@ -27,6 +27,7 @@ #include "input.h" #include "variable.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -79,7 +80,7 @@ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) : int n = strlen(arg[iarg]) + 1; pstyle[nterms] = new char[n]; strcpy(pstyle[nterms],arg[iarg]); - force->bounds(FLERR,arg[iarg+1],atom->ntypes,ilo[nterms],ihi[nterms]); + utils::bounds(FLERR,arg[iarg+1],1,atom->ntypes,ilo[nterms],ihi[nterms],error); iarg += 1; if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) { diff --git a/src/MISC/pair_nm_cut.cpp b/src/MISC/pair_nm_cut.cpp index 07731fe93b..9cf6700656 100644 --- a/src/MISC/pair_nm_cut.cpp +++ b/src/MISC/pair_nm_cut.cpp @@ -202,8 +202,8 @@ void PairNMCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double e0_one = force->numeric(FLERR,arg[2]); double r0_one = force->numeric(FLERR,arg[3]); diff --git a/src/MISC/pair_nm_cut_coul_cut.cpp b/src/MISC/pair_nm_cut_coul_cut.cpp index 270f4080ee..39efd4a2d1 100644 --- a/src/MISC/pair_nm_cut_coul_cut.cpp +++ b/src/MISC/pair_nm_cut_coul_cut.cpp @@ -231,8 +231,8 @@ void PairNMCutCoulCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double e0_one = force->numeric(FLERR,arg[2]); double r0_one = force->numeric(FLERR,arg[3]); diff --git a/src/MISC/pair_nm_cut_coul_long.cpp b/src/MISC/pair_nm_cut_coul_long.cpp index b63ede2b63..073cf59128 100644 --- a/src/MISC/pair_nm_cut_coul_long.cpp +++ b/src/MISC/pair_nm_cut_coul_long.cpp @@ -267,8 +267,8 @@ void PairNMCutCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double e0_one = force->numeric(FLERR,arg[2]); double r0_one = force->numeric(FLERR,arg[3]); diff --git a/src/MOLECULE/angle_charmm.cpp b/src/MOLECULE/angle_charmm.cpp index 161ad90ea3..ec46958c94 100644 --- a/src/MOLECULE/angle_charmm.cpp +++ b/src/MOLECULE/angle_charmm.cpp @@ -196,7 +196,7 @@ void AngleCharmm::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double theta0_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/angle_cosine.cpp b/src/MOLECULE/angle_cosine.cpp index 59593d2448..81d94c680e 100644 --- a/src/MOLECULE/angle_cosine.cpp +++ b/src/MOLECULE/angle_cosine.cpp @@ -156,7 +156,7 @@ void AngleCosine::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); diff --git a/src/MOLECULE/angle_cosine_periodic.cpp b/src/MOLECULE/angle_cosine_periodic.cpp index b305ece7dd..c771eb8e4b 100644 --- a/src/MOLECULE/angle_cosine_periodic.cpp +++ b/src/MOLECULE/angle_cosine_periodic.cpp @@ -201,7 +201,7 @@ void AngleCosinePeriodic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double c_one = force->numeric(FLERR,arg[1]); int b_one = force->inumeric(FLERR,arg[2]); diff --git a/src/MOLECULE/angle_cosine_squared.cpp b/src/MOLECULE/angle_cosine_squared.cpp index 9056600c3f..4dc96a538b 100644 --- a/src/MOLECULE/angle_cosine_squared.cpp +++ b/src/MOLECULE/angle_cosine_squared.cpp @@ -172,7 +172,7 @@ void AngleCosineSquared::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double theta0_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/angle_harmonic.cpp b/src/MOLECULE/angle_harmonic.cpp index baeb9a8ed8..c7b917b4d3 100644 --- a/src/MOLECULE/angle_harmonic.cpp +++ b/src/MOLECULE/angle_harmonic.cpp @@ -172,7 +172,7 @@ void AngleHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double theta0_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index 4890a11975..ed150da094 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -218,7 +218,7 @@ void AngleTable::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); int me; MPI_Comm_rank(world,&me); diff --git a/src/MOLECULE/bond_fene.cpp b/src/MOLECULE/bond_fene.cpp index 357c37b7a2..f853d038e4 100644 --- a/src/MOLECULE/bond_fene.cpp +++ b/src/MOLECULE/bond_fene.cpp @@ -152,7 +152,7 @@ void BondFENE::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double r0_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/bond_fene_expand.cpp b/src/MOLECULE/bond_fene_expand.cpp index 9cdc2639a5..d283a3553e 100644 --- a/src/MOLECULE/bond_fene_expand.cpp +++ b/src/MOLECULE/bond_fene_expand.cpp @@ -159,7 +159,7 @@ void BondFENEExpand::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double r0_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/bond_gromos.cpp b/src/MOLECULE/bond_gromos.cpp index 27447d7298..dc8236221f 100644 --- a/src/MOLECULE/bond_gromos.cpp +++ b/src/MOLECULE/bond_gromos.cpp @@ -123,7 +123,7 @@ void BondGromos::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double r0_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/bond_harmonic.cpp b/src/MOLECULE/bond_harmonic.cpp index 5ea60cda46..b637b41eb4 100644 --- a/src/MOLECULE/bond_harmonic.cpp +++ b/src/MOLECULE/bond_harmonic.cpp @@ -124,7 +124,7 @@ void BondHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double r0_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/bond_morse.cpp b/src/MOLECULE/bond_morse.cpp index c644d2be1c..e369099370 100644 --- a/src/MOLECULE/bond_morse.cpp +++ b/src/MOLECULE/bond_morse.cpp @@ -126,7 +126,7 @@ void BondMorse::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double d0_one = force->numeric(FLERR,arg[1]); double alpha_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/bond_nonlinear.cpp b/src/MOLECULE/bond_nonlinear.cpp index 1451fa29c2..a111f9dcea 100644 --- a/src/MOLECULE/bond_nonlinear.cpp +++ b/src/MOLECULE/bond_nonlinear.cpp @@ -123,7 +123,7 @@ void BondNonlinear::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double epsilon_one = force->numeric(FLERR,arg[1]); double r0_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/bond_quartic.cpp b/src/MOLECULE/bond_quartic.cpp index 813e322473..94b9ff70e5 100644 --- a/src/MOLECULE/bond_quartic.cpp +++ b/src/MOLECULE/bond_quartic.cpp @@ -201,7 +201,7 @@ void BondQuartic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double b1_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/bond_table.cpp b/src/MOLECULE/bond_table.cpp index 3a1529a155..20d83ddd3b 100644 --- a/src/MOLECULE/bond_table.cpp +++ b/src/MOLECULE/bond_table.cpp @@ -170,7 +170,7 @@ void BondTable::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); int me; MPI_Comm_rank(world,&me); diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index 0163772123..f30ad6cf34 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -330,7 +330,7 @@ void DihedralCharmm::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); // require integer values of shift for backwards compatibility // arbitrary phase angle shift could be allowed, but would break diff --git a/src/MOLECULE/dihedral_charmmfsw.cpp b/src/MOLECULE/dihedral_charmmfsw.cpp index 39b7e92bd2..13b2b0c205 100644 --- a/src/MOLECULE/dihedral_charmmfsw.cpp +++ b/src/MOLECULE/dihedral_charmmfsw.cpp @@ -348,7 +348,7 @@ void DihedralCharmmfsw::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); // require integer values of shift for backwards compatibility // arbitrary phase angle shift could be allowed, but would break diff --git a/src/MOLECULE/dihedral_harmonic.cpp b/src/MOLECULE/dihedral_harmonic.cpp index 48adf07903..cdf580e4e4 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -274,7 +274,7 @@ void DihedralHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); int sign_one = force->inumeric(FLERR,arg[2]); diff --git a/src/MOLECULE/dihedral_helix.cpp b/src/MOLECULE/dihedral_helix.cpp index 26461883c6..bc723bc3b2 100644 --- a/src/MOLECULE/dihedral_helix.cpp +++ b/src/MOLECULE/dihedral_helix.cpp @@ -285,7 +285,7 @@ void DihedralHelix::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); double aphi_one = force->numeric(FLERR,arg[1]); double bphi_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/dihedral_multi_harmonic.cpp b/src/MOLECULE/dihedral_multi_harmonic.cpp index b5db685247..143222de5e 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -275,7 +275,7 @@ void DihedralMultiHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); double a1_one = force->numeric(FLERR,arg[1]); double a2_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index 5dd268b39f..cbdad9228f 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -288,7 +288,7 @@ void DihedralOPLS::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); double k1_one = force->numeric(FLERR,arg[1]); double k2_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/improper_cvff.cpp b/src/MOLECULE/improper_cvff.cpp index 0ffb3f3c31..75f97907ef 100644 --- a/src/MOLECULE/improper_cvff.cpp +++ b/src/MOLECULE/improper_cvff.cpp @@ -296,7 +296,7 @@ void ImproperCvff::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); int sign_one = force->inumeric(FLERR,arg[2]); diff --git a/src/MOLECULE/improper_harmonic.cpp b/src/MOLECULE/improper_harmonic.cpp index e90bc04c90..2742bfe91a 100644 --- a/src/MOLECULE/improper_harmonic.cpp +++ b/src/MOLECULE/improper_harmonic.cpp @@ -238,7 +238,7 @@ void ImproperHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double chi_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 5259b6baf4..2ca37d208d 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -276,7 +276,7 @@ void ImproperUmbrella::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double w_one = force->numeric(FLERR,arg[2]); diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.cpp b/src/MOLECULE/pair_hbond_dreiding_lj.cpp index 647060eab7..ca2c91c1a2 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_lj.cpp @@ -30,6 +30,7 @@ #include "math_special.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -317,9 +318,9 @@ void PairHbondDreidingLJ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi,klo,khi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); - force->bounds(FLERR,arg[2],atom->ntypes,klo,khi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + utils::bounds(FLERR,arg[2],1,atom->ntypes,klo,khi,error); int donor_flag; if (strcmp(arg[3],"i") == 0) donor_flag = 0; diff --git a/src/MOLECULE/pair_hbond_dreiding_morse.cpp b/src/MOLECULE/pair_hbond_dreiding_morse.cpp index 44eefc07fd..6d2406de54 100644 --- a/src/MOLECULE/pair_hbond_dreiding_morse.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_morse.cpp @@ -30,6 +30,7 @@ #include "math_special.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -241,9 +242,9 @@ void PairHbondDreidingMorse::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi,klo,khi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); - force->bounds(FLERR,arg[2],atom->ntypes,klo,khi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + utils::bounds(FLERR,arg[2],1,atom->ntypes,klo,khi,error); int donor_flag; if (strcmp(arg[3],"i") == 0) donor_flag = 0; diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp index 0712f6be73..e0d6f6b5d6 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp @@ -246,8 +246,8 @@ void PairLJCharmmCoulCharmm::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp index 026b96c00c..6710be9549 100644 --- a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp +++ b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp @@ -270,8 +270,8 @@ void PairLJCharmmfswCoulCharmmfsh::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp index 673fb83066..6d1626606f 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp @@ -457,8 +457,8 @@ void PairLJCutTIP4PCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/MOLECULE/pair_tip4p_cut.cpp b/src/MOLECULE/pair_tip4p_cut.cpp index 334dbf89c8..889565e5ea 100644 --- a/src/MOLECULE/pair_tip4p_cut.cpp +++ b/src/MOLECULE/pair_tip4p_cut.cpp @@ -395,8 +395,8 @@ void PairTIP4PCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/PERI/pair_peri_eps.cpp b/src/PERI/pair_peri_eps.cpp index cae33fe580..c415b5b20f 100644 --- a/src/PERI/pair_peri_eps.cpp +++ b/src/PERI/pair_peri_eps.cpp @@ -450,8 +450,8 @@ void PairPeriEPS::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double bulkmodulus_one = force->numeric(FLERR,arg[2]); double shearmodulus_one = force->numeric(FLERR,arg[3]); diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index 65c6c30e19..bdea3bb719 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -378,8 +378,8 @@ void PairPeriLPS::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double bulkmodulus_one = force->numeric(FLERR,arg[2]); double shearmodulus_one = force->numeric(FLERR,arg[3]); diff --git a/src/PERI/pair_peri_pmb.cpp b/src/PERI/pair_peri_pmb.cpp index 7c900b5c4e..9969a287eb 100644 --- a/src/PERI/pair_peri_pmb.cpp +++ b/src/PERI/pair_peri_pmb.cpp @@ -311,8 +311,8 @@ void PairPeriPMB::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double kspring_one = force->numeric(FLERR,arg[2]); double cut_one = force->numeric(FLERR,arg[3]); diff --git a/src/PERI/pair_peri_ves.cpp b/src/PERI/pair_peri_ves.cpp index ed9babf5ed..3d5ab00ef5 100644 --- a/src/PERI/pair_peri_ves.cpp +++ b/src/PERI/pair_peri_ves.cpp @@ -426,8 +426,8 @@ void PairPeriVES::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double bulkmodulus_one = force->numeric(FLERR,arg[2]); double shearmodulus_one = force->numeric(FLERR,arg[3]); diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 63fa3caefe..d5a19f82fe 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -753,7 +753,7 @@ void FixQEq::read_file(char *file) n < 6; words[++n] = strtok(NULL," \t\n\r\f")); - force->bounds(FLERR,words[0],ntypes,nlo,nhi); + utils::bounds(FLERR,words[0],1,ntypes,nlo,nhi,error); for (n=nlo; n <=nhi; ++n) { chi[n] = force->numeric(FLERR,words[1]); eta[n] = force->numeric(FLERR,words[2]); diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index 0d15f22090..6f73d98f5d 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -340,7 +340,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (iarg+5 > narg) error->all(FLERR,"Illegal fix rigid command"); int mlo,mhi; - force->bounds(FLERR,arg[iarg+1],nbody,mlo,mhi); + utils::bounds(FLERR,arg[iarg+1],1,nbody,mlo,mhi,error); double xflag,yflag,zflag; if (strcmp(arg[iarg+2],"off") == 0) xflag = 0.0; @@ -371,7 +371,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (iarg+5 > narg) error->all(FLERR,"Illegal fix rigid command"); int mlo,mhi; - force->bounds(FLERR,arg[iarg+1],nbody,mlo,mhi); + utils::bounds(FLERR,arg[iarg+1],1,nbody,mlo,mhi,error); double xflag,yflag,zflag; if (strcmp(arg[iarg+2],"off") == 0) xflag = 0.0; diff --git a/src/SPIN/pair_spin_dipole_cut.cpp b/src/SPIN/pair_spin_dipole_cut.cpp index cdae3c0bab..49e82a9d68 100644 --- a/src/SPIN/pair_spin_dipole_cut.cpp +++ b/src/SPIN/pair_spin_dipole_cut.cpp @@ -105,8 +105,8 @@ void PairSpinDipoleCut::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double spin_long_cut_one = force->numeric(FLERR,arg[2]); diff --git a/src/SPIN/pair_spin_dipole_long.cpp b/src/SPIN/pair_spin_dipole_long.cpp index aeb916cfae..bb27d8cadf 100644 --- a/src/SPIN/pair_spin_dipole_long.cpp +++ b/src/SPIN/pair_spin_dipole_long.cpp @@ -109,8 +109,8 @@ void PairSpinDipoleLong::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double spin_long_cut_one = force->numeric(FLERR,arg[2]); diff --git a/src/SPIN/pair_spin_dmi.cpp b/src/SPIN/pair_spin_dmi.cpp index c6b0564463..a5452ed739 100644 --- a/src/SPIN/pair_spin_dmi.cpp +++ b/src/SPIN/pair_spin_dmi.cpp @@ -98,8 +98,8 @@ void PairSpinDmi::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); const double rij = force->numeric(FLERR,arg[3]); const double dm = (force->numeric(FLERR,arg[4])); diff --git a/src/SPIN/pair_spin_exchange.cpp b/src/SPIN/pair_spin_exchange.cpp index 5c5d5cb1a4..30c6383bc6 100644 --- a/src/SPIN/pair_spin_exchange.cpp +++ b/src/SPIN/pair_spin_exchange.cpp @@ -92,8 +92,8 @@ void PairSpinExchange::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // get exchange arguments from input command diff --git a/src/SPIN/pair_spin_magelec.cpp b/src/SPIN/pair_spin_magelec.cpp index 741305fbf4..9e1de9b1e7 100644 --- a/src/SPIN/pair_spin_magelec.cpp +++ b/src/SPIN/pair_spin_magelec.cpp @@ -95,8 +95,8 @@ void PairSpinMagelec::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); const double rij = force->numeric(FLERR,arg[3]); const double magelec = (force->numeric(FLERR,arg[4])); diff --git a/src/SPIN/pair_spin_neel.cpp b/src/SPIN/pair_spin_neel.cpp index 4fd8ecc215..5aef34ad9d 100644 --- a/src/SPIN/pair_spin_neel.cpp +++ b/src/SPIN/pair_spin_neel.cpp @@ -99,8 +99,8 @@ void PairSpinNeel::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); const double rij = force->numeric(FLERR,arg[3]); const double k1 = force->numeric(FLERR,arg[4]); diff --git a/src/USER-AWPMD/pair_awpmd_cut.cpp b/src/USER-AWPMD/pair_awpmd_cut.cpp index e382a1cb9c..dc823661d8 100644 --- a/src/USER-AWPMD/pair_awpmd_cut.cpp +++ b/src/USER-AWPMD/pair_awpmd_cut.cpp @@ -484,8 +484,8 @@ void PairAWPMDCut::coeff(int narg, char **arg) } int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_one = cut_global; if (narg == 3) cut_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-CGDNA/bond_oxdna_fene.cpp b/src/USER-CGDNA/bond_oxdna_fene.cpp index b2737fc4cd..afe73c397a 100644 --- a/src/USER-CGDNA/bond_oxdna_fene.cpp +++ b/src/USER-CGDNA/bond_oxdna_fene.cpp @@ -302,7 +302,7 @@ void BondOxdnaFene::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double Delta_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp index 51ff26cc6e..be6287934f 100644 --- a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp @@ -555,8 +555,8 @@ void PairOxdna2Coaxstk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // cross-stacking interaction count = 0; diff --git a/src/USER-CGDNA/pair_oxdna2_dh.cpp b/src/USER-CGDNA/pair_oxdna2_dh.cpp index e698d8d906..8cbe607197 100644 --- a/src/USER-CGDNA/pair_oxdna2_dh.cpp +++ b/src/USER-CGDNA/pair_oxdna2_dh.cpp @@ -277,8 +277,8 @@ void PairOxdna2Dh::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); count = 0; diff --git a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp index 750c6c022d..b54798e1da 100644 --- a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp @@ -685,8 +685,8 @@ void PairOxdnaCoaxstk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // cross-stacking interaction count = 0; diff --git a/src/USER-CGDNA/pair_oxdna_excv.cpp b/src/USER-CGDNA/pair_oxdna_excv.cpp index e8e2fad020..c45dfdc036 100644 --- a/src/USER-CGDNA/pair_oxdna_excv.cpp +++ b/src/USER-CGDNA/pair_oxdna_excv.cpp @@ -455,8 +455,8 @@ void PairOxdnaExcv::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); count = 0; diff --git a/src/USER-CGDNA/pair_oxdna_hbond.cpp b/src/USER-CGDNA/pair_oxdna_hbond.cpp index 26042339ea..f94be44e28 100644 --- a/src/USER-CGDNA/pair_oxdna_hbond.cpp +++ b/src/USER-CGDNA/pair_oxdna_hbond.cpp @@ -634,8 +634,8 @@ void PairOxdnaHbond::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi,imod4,jmod4; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // h-bonding interaction count = 0; diff --git a/src/USER-CGDNA/pair_oxdna_stk.cpp b/src/USER-CGDNA/pair_oxdna_stk.cpp index 4d1c4a7101..2c01e253e8 100644 --- a/src/USER-CGDNA/pair_oxdna_stk.cpp +++ b/src/USER-CGDNA/pair_oxdna_stk.cpp @@ -779,8 +779,8 @@ void PairOxdnaStk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi,imod4,jmod4; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // stacking interaction count = 0; diff --git a/src/USER-CGDNA/pair_oxdna_xstk.cpp b/src/USER-CGDNA/pair_oxdna_xstk.cpp index a1fc86bd4d..b1eaccdca2 100644 --- a/src/USER-CGDNA/pair_oxdna_xstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_xstk.cpp @@ -630,8 +630,8 @@ void PairOxdnaXstk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // cross-stacking interaction count = 0; diff --git a/src/USER-CGDNA/pair_oxrna2_stk.cpp b/src/USER-CGDNA/pair_oxrna2_stk.cpp index de2cd63799..64dacd6c91 100644 --- a/src/USER-CGDNA/pair_oxrna2_stk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_stk.cpp @@ -863,8 +863,8 @@ void PairOxrna2Stk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // stacking interaction count = 0; diff --git a/src/USER-CGDNA/pair_oxrna2_xstk.cpp b/src/USER-CGDNA/pair_oxrna2_xstk.cpp index 73a73c1ea0..39a155c942 100644 --- a/src/USER-CGDNA/pair_oxrna2_xstk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_xstk.cpp @@ -580,8 +580,8 @@ void PairOxrna2Xstk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // cross-stacking interaction count = 0; diff --git a/src/USER-CGSDK/angle_sdk.cpp b/src/USER-CGSDK/angle_sdk.cpp index 11b3a8308c..077a4a2eee 100644 --- a/src/USER-CGSDK/angle_sdk.cpp +++ b/src/USER-CGSDK/angle_sdk.cpp @@ -241,7 +241,7 @@ void AngleSDK::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double theta0_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-CGSDK/pair_lj_sdk.cpp b/src/USER-CGSDK/pair_lj_sdk.cpp index 3e4f8deee8..7afa53be2e 100644 --- a/src/USER-CGSDK/pair_lj_sdk.cpp +++ b/src/USER-CGSDK/pair_lj_sdk.cpp @@ -256,8 +256,8 @@ void PairLJSDK::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int lj_type_one = find_lj_type(arg[2],lj_type_list); if (lj_type_one == LJ_NOT_SET) diff --git a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp index 7e5852f367..db2dabacaa 100644 --- a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp +++ b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp @@ -318,8 +318,8 @@ void PairLJSDKCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int lj_type_one = find_lj_type(arg[2],lj_type_list); if (lj_type_one == LJ_NOT_SET) diff --git a/src/USER-DPD/pair_dpd_fdt.cpp b/src/USER-DPD/pair_dpd_fdt.cpp index 14bbe0b784..c6e7a78157 100644 --- a/src/USER-DPD/pair_dpd_fdt.cpp +++ b/src/USER-DPD/pair_dpd_fdt.cpp @@ -279,8 +279,8 @@ void PairDPDfdt::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a0_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-DPD/pair_dpd_fdt_energy.cpp b/src/USER-DPD/pair_dpd_fdt_energy.cpp index 455af2f481..cbebb1dc3a 100644 --- a/src/USER-DPD/pair_dpd_fdt_energy.cpp +++ b/src/USER-DPD/pair_dpd_fdt_energy.cpp @@ -367,8 +367,8 @@ void PairDPDfdtEnergy::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a0_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-DPD/pair_exp6_rx.cpp b/src/USER-DPD/pair_exp6_rx.cpp index 4ac491afb1..3e27dafe98 100644 --- a/src/USER-DPD/pair_exp6_rx.cpp +++ b/src/USER-DPD/pair_exp6_rx.cpp @@ -589,8 +589,8 @@ void PairExp6rx::coeff(int narg, char **arg) int ilo,ihi,jlo,jhi; int n; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); nspecies = atom->nspecies_dpd; if(nspecies==0) error->all(FLERR,"There are no rx species specified."); diff --git a/src/USER-DPD/pair_multi_lucy.cpp b/src/USER-DPD/pair_multi_lucy.cpp index 1cbb29a93c..143f393492 100644 --- a/src/USER-DPD/pair_multi_lucy.cpp +++ b/src/USER-DPD/pair_multi_lucy.cpp @@ -269,8 +269,8 @@ void PairMultiLucy::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int me; MPI_Comm_rank(world,&me); diff --git a/src/USER-DPD/pair_multi_lucy_rx.cpp b/src/USER-DPD/pair_multi_lucy_rx.cpp index 79df11a038..c8e733904c 100644 --- a/src/USER-DPD/pair_multi_lucy_rx.cpp +++ b/src/USER-DPD/pair_multi_lucy_rx.cpp @@ -374,8 +374,8 @@ void PairMultiLucyRX::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int me; MPI_Comm_rank(world,&me); diff --git a/src/USER-DPD/pair_table_rx.cpp b/src/USER-DPD/pair_table_rx.cpp index cf64c17c5e..10790960bd 100644 --- a/src/USER-DPD/pair_table_rx.cpp +++ b/src/USER-DPD/pair_table_rx.cpp @@ -308,8 +308,8 @@ void PairTableRX::coeff(int narg, char **arg) if (!rx_flag) error->all(FLERR,"Pair style table/rx requires a fix rx command."); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int me; MPI_Comm_rank(world,&me); diff --git a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp index fa4f761663..76980bf105 100644 --- a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp +++ b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp @@ -320,8 +320,8 @@ void PairLJCutTholeLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-DRUDE/pair_thole.cpp b/src/USER-DRUDE/pair_thole.cpp index 4dd6cb12c0..df5fd1d92d 100644 --- a/src/USER-DRUDE/pair_thole.cpp +++ b/src/USER-DRUDE/pair_thole.cpp @@ -219,8 +219,8 @@ void PairThole::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double polar_one = force->numeric(FLERR,arg[2]); double thole_one = thole_global; diff --git a/src/USER-EFF/pair_eff_cut.cpp b/src/USER-EFF/pair_eff_cut.cpp index f9333f4bec..a2346f0167 100644 --- a/src/USER-EFF/pair_eff_cut.cpp +++ b/src/USER-EFF/pair_eff_cut.cpp @@ -903,8 +903,8 @@ void PairEffCut::coeff(int narg, char **arg) if ((strcmp(arg[0],"*") == 0) || (strcmp(arg[1],"*") == 0)) { int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_one = cut_global; if (narg == 3) cut_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-FEP/compute_fep.cpp b/src/USER-FEP/compute_fep.cpp index 1853828db3..664750c7a7 100644 --- a/src/USER-FEP/compute_fep.cpp +++ b/src/USER-FEP/compute_fep.cpp @@ -34,6 +34,7 @@ #include "timer.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -94,10 +95,10 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) : n = strlen(arg[iarg+2]) + 1; perturb[npert].pparam = new char[n]; strcpy(perturb[npert].pparam,arg[iarg+2]); - force->bounds(FLERR,arg[iarg+3],atom->ntypes, - perturb[npert].ilo,perturb[npert].ihi); - force->bounds(FLERR,arg[iarg+4],atom->ntypes, - perturb[npert].jlo,perturb[npert].jhi); + utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes, + perturb[npert].ilo,perturb[npert].ihi,error); + utils::bounds(FLERR,arg[iarg+4],1,atom->ntypes, + perturb[npert].jlo,perturb[npert].jhi,error); if (strstr(arg[iarg+5],"v_") == arg[iarg+5]) { n = strlen(&arg[iarg+5][2]) + 1; perturb[npert].var = new char[n]; @@ -111,8 +112,8 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) : perturb[npert].aparam = CHARGE; chgflag = 1; } else error->all(FLERR,"Illegal atom argument in compute fep"); - force->bounds(FLERR,arg[iarg+2],atom->ntypes, - perturb[npert].ilo,perturb[npert].ihi); + utils::bounds(FLERR,arg[iarg+2],1,atom->ntypes, + perturb[npert].ilo,perturb[npert].ihi,error); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; perturb[npert].var = new char[n]; diff --git a/src/USER-FEP/fix_adapt_fep.cpp b/src/USER-FEP/fix_adapt_fep.cpp index 46cf32cf0b..5d5f510547 100644 --- a/src/USER-FEP/fix_adapt_fep.cpp +++ b/src/USER-FEP/fix_adapt_fep.cpp @@ -32,6 +32,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -93,10 +94,10 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : n = strlen(arg[iarg+2]) + 1; adapt[nadapt].pparam = new char[n]; strcpy(adapt[nadapt].pparam,arg[iarg+2]); - force->bounds(FLERR,arg[iarg+3],atom->ntypes, - adapt[nadapt].ilo,adapt[nadapt].ihi); - force->bounds(FLERR,arg[iarg+4],atom->ntypes, - adapt[nadapt].jlo,adapt[nadapt].jhi); + utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes, + adapt[nadapt].ilo,adapt[nadapt].ihi,error); + utils::bounds(FLERR,arg[iarg+4],1,atom->ntypes, + adapt[nadapt].jlo,adapt[nadapt].jhi,error); if (strstr(arg[iarg+5],"v_") == arg[iarg+5]) { n = strlen(&arg[iarg+5][2]) + 1; adapt[nadapt].var = new char[n]; @@ -124,8 +125,8 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : adapt[nadapt].aparam = CHARGE; chgflag = 1; } else error->all(FLERR,"Illegal fix adapt/fep command"); - force->bounds(FLERR,arg[iarg+2],atom->ntypes, - adapt[nadapt].ilo,adapt[nadapt].ihi); + utils::bounds(FLERR,arg[iarg+2],1,atom->ntypes, + adapt[nadapt].ilo,adapt[nadapt].ihi,error); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; adapt[nadapt].var = new char[n]; diff --git a/src/USER-FEP/pair_coul_cut_soft.cpp b/src/USER-FEP/pair_coul_cut_soft.cpp index eb872ab8b9..be771dc0de 100644 --- a/src/USER-FEP/pair_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_coul_cut_soft.cpp @@ -185,8 +185,8 @@ void PairCoulCutSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double lambda_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-FEP/pair_coul_long_soft.cpp b/src/USER-FEP/pair_coul_long_soft.cpp index a631dca1b7..a0273f9650 100644 --- a/src/USER-FEP/pair_coul_long_soft.cpp +++ b/src/USER-FEP/pair_coul_long_soft.cpp @@ -203,8 +203,8 @@ void PairCoulLongSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double lambda_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp index 81c1599508..eb9cedaa7b 100644 --- a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp @@ -648,8 +648,8 @@ void PairLJCharmmCoulLongSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp index 255bdf6a07..1c898033c5 100644 --- a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp @@ -229,8 +229,8 @@ void PairLJClass2CoulCutSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp index dda10ed9e0..33b1b46c2c 100644 --- a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp @@ -242,8 +242,8 @@ void PairLJClass2CoulLongSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-FEP/pair_lj_class2_soft.cpp b/src/USER-FEP/pair_lj_class2_soft.cpp index 957fc0f8ab..aa6d08afe1 100644 --- a/src/USER-FEP/pair_lj_class2_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_soft.cpp @@ -194,8 +194,8 @@ void PairLJClass2Soft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp index 3f85a2c8aa..7f62467f94 100644 --- a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp @@ -230,8 +230,8 @@ void PairLJCutCoulCutSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp index c22b2ca673..c813c23bc2 100644 --- a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp @@ -595,8 +595,8 @@ void PairLJCutCoulLongSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-FEP/pair_lj_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_soft.cpp index 92abdf540a..09ebd375a5 100644 --- a/src/USER-FEP/pair_lj_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_soft.cpp @@ -476,8 +476,8 @@ void PairLJCutSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-FEP/pair_morse_soft.cpp b/src/USER-FEP/pair_morse_soft.cpp index c727ea0c2a..b1f514711f 100644 --- a/src/USER-FEP/pair_morse_soft.cpp +++ b/src/USER-FEP/pair_morse_soft.cpp @@ -177,8 +177,8 @@ void PairMorseSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double d0_one = force->numeric(FLERR,arg[2]); double alpha_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp index af1b01043d..9cc03591fa 100644 --- a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp +++ b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp @@ -31,6 +31,7 @@ #include "memory.h" #include "error.h" #include "fix_lb_fluid.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -233,7 +234,7 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : if (iarg+5 > narg) error->all(FLERR,"Illegal fix lb/rigid/pc/sphere command"); int mlo,mhi; - force->bounds(FLERR,arg[iarg+1],nbody,mlo,mhi); + utils::bounds(FLERR,arg[iarg+1],1,nbody,mlo,mhi,error); double xflag,yflag,zflag; if (strcmp(arg[iarg+2],"off") == 0) xflag = 0.0; @@ -260,7 +261,7 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : if (iarg+5 > narg) error->all(FLERR,"Illegal fix lb/rigid/pc/sphere command"); int mlo,mhi; - force->bounds(FLERR,arg[iarg+1],nbody,mlo,mhi); + utils::bounds(FLERR,arg[iarg+1],1,nbody,mlo,mhi,error); double xflag,yflag,zflag; if (strcmp(arg[iarg+2],"off") == 0) xflag = 0.0; diff --git a/src/USER-MESODPD/pair_edpd.cpp b/src/USER-MESODPD/pair_edpd.cpp index c32477513d..b4264985e4 100644 --- a/src/USER-MESODPD/pair_edpd.cpp +++ b/src/USER-MESODPD/pair_edpd.cpp @@ -306,8 +306,8 @@ void PairEDPD::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a0_one = force->numeric(FLERR,arg[2]); double gamma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MESODPD/pair_mdpd.cpp b/src/USER-MESODPD/pair_mdpd.cpp index 7f98e6da79..f46f88861b 100644 --- a/src/USER-MESODPD/pair_mdpd.cpp +++ b/src/USER-MESODPD/pair_mdpd.cpp @@ -245,8 +245,8 @@ void PairMDPD::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double A_one = force->numeric(FLERR,arg[2]); double B_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MESODPD/pair_mdpd_rhosum.cpp b/src/USER-MESODPD/pair_mdpd_rhosum.cpp index 05cb123f61..6f60234af3 100644 --- a/src/USER-MESODPD/pair_mdpd_rhosum.cpp +++ b/src/USER-MESODPD/pair_mdpd_rhosum.cpp @@ -29,6 +29,7 @@ #include "memory.h" #include "error.h" #include "neighbor.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -196,8 +197,8 @@ void PairMDPDRhoSum::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); double cut_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MESODPD/pair_tdpd.cpp b/src/USER-MESODPD/pair_tdpd.cpp index f5350de53d..0da187fd7b 100644 --- a/src/USER-MESODPD/pair_tdpd.cpp +++ b/src/USER-MESODPD/pair_tdpd.cpp @@ -269,8 +269,8 @@ void PairTDPD::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a0_one = force->numeric(FLERR,arg[2]); double gamma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MESONT/pair_mesont_tpm.cpp b/src/USER-MESONT/pair_mesont_tpm.cpp index d46fcad813..1f91b0e823 100644 --- a/src/USER-MESONT/pair_mesont_tpm.cpp +++ b/src/USER-MESONT/pair_mesont_tpm.cpp @@ -639,8 +639,8 @@ void PairMESONTTPM::coeff(int narg, char **arg){ if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_one = cut_global; if (narg == 3) cut_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/angle_cosine_shift.cpp b/src/USER-MISC/angle_cosine_shift.cpp index 59f7555709..f2a3ddc54b 100644 --- a/src/USER-MISC/angle_cosine_shift.cpp +++ b/src/USER-MISC/angle_cosine_shift.cpp @@ -175,7 +175,7 @@ void AngleCosineShift::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double umin = force->numeric(FLERR,arg[1]); double theta0 = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/angle_cosine_shift_exp.cpp b/src/USER-MISC/angle_cosine_shift_exp.cpp index ef5a2824b9..ec1a02bf30 100644 --- a/src/USER-MISC/angle_cosine_shift_exp.cpp +++ b/src/USER-MISC/angle_cosine_shift_exp.cpp @@ -203,7 +203,7 @@ void AngleCosineShiftExp::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double umin_ = force->numeric(FLERR,arg[1]); double theta0_ = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/angle_dipole.cpp b/src/USER-MISC/angle_dipole.cpp index e2fd7e618f..1f959192a5 100644 --- a/src/USER-MISC/angle_dipole.cpp +++ b/src/USER-MISC/angle_dipole.cpp @@ -160,7 +160,7 @@ void AngleDipole::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double gamma0_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/angle_fourier.cpp b/src/USER-MISC/angle_fourier.cpp index f83c9c4f88..c1ddc0d640 100644 --- a/src/USER-MISC/angle_fourier.cpp +++ b/src/USER-MISC/angle_fourier.cpp @@ -179,7 +179,7 @@ void AngleFourier::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double C0_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/angle_fourier_simple.cpp b/src/USER-MISC/angle_fourier_simple.cpp index baf4953760..640922ceba 100644 --- a/src/USER-MISC/angle_fourier_simple.cpp +++ b/src/USER-MISC/angle_fourier_simple.cpp @@ -193,7 +193,7 @@ void AngleFourierSimple::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double C_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/angle_quartic.cpp b/src/USER-MISC/angle_quartic.cpp index 097e774f17..7ad97cebd4 100644 --- a/src/USER-MISC/angle_quartic.cpp +++ b/src/USER-MISC/angle_quartic.cpp @@ -183,7 +183,7 @@ void AngleQuartic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double theta0_one = force->numeric(FLERR,arg[1]); double k2_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/bond_harmonic_shift.cpp b/src/USER-MISC/bond_harmonic_shift.cpp index cbcc33a824..87e40ecc86 100644 --- a/src/USER-MISC/bond_harmonic_shift.cpp +++ b/src/USER-MISC/bond_harmonic_shift.cpp @@ -128,7 +128,7 @@ void BondHarmonicShift::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double Umin = force->numeric(FLERR,arg[1]); // energy at minimum double r0_one = force->numeric(FLERR,arg[2]); // position of minimum diff --git a/src/USER-MISC/bond_harmonic_shift_cut.cpp b/src/USER-MISC/bond_harmonic_shift_cut.cpp index aa051f4bec..abf01d9739 100644 --- a/src/USER-MISC/bond_harmonic_shift_cut.cpp +++ b/src/USER-MISC/bond_harmonic_shift_cut.cpp @@ -130,7 +130,7 @@ void BondHarmonicShiftCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double Umin = force->numeric(FLERR,arg[1]); // energy at minimum double r0_one = force->numeric(FLERR,arg[2]); // position of minimum diff --git a/src/USER-MISC/bond_special.cpp b/src/USER-MISC/bond_special.cpp index 31ebbaa406..87b3db95e8 100644 --- a/src/USER-MISC/bond_special.cpp +++ b/src/USER-MISC/bond_special.cpp @@ -25,6 +25,7 @@ #include "pair.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -143,7 +144,7 @@ void BondSpecial::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double factor_lj_one = force->numeric(FLERR,arg[1]); double factor_coul_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/dihedral_cosine_shift_exp.cpp b/src/USER-MISC/dihedral_cosine_shift_exp.cpp index 0537e555a2..2098e713cc 100644 --- a/src/USER-MISC/dihedral_cosine_shift_exp.cpp +++ b/src/USER-MISC/dihedral_cosine_shift_exp.cpp @@ -276,7 +276,7 @@ void DihedralCosineShiftExp::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); double umin_ = force->numeric(FLERR,arg[1]); double theta0_ = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/dihedral_fourier.cpp b/src/USER-MISC/dihedral_fourier.cpp index f30a5e1eab..aafef7d7d5 100644 --- a/src/USER-MISC/dihedral_fourier.cpp +++ b/src/USER-MISC/dihedral_fourier.cpp @@ -297,7 +297,7 @@ void DihedralFourier::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); // require integer values of shift for backwards compatibility // arbitrary phase angle shift could be allowed, but would break diff --git a/src/USER-MISC/dihedral_nharmonic.cpp b/src/USER-MISC/dihedral_nharmonic.cpp index 81010a040e..15ffb6914d 100644 --- a/src/USER-MISC/dihedral_nharmonic.cpp +++ b/src/USER-MISC/dihedral_nharmonic.cpp @@ -284,7 +284,7 @@ void DihedralNHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/dihedral_quadratic.cpp b/src/USER-MISC/dihedral_quadratic.cpp index 28efad65b7..30aeb34c0d 100644 --- a/src/USER-MISC/dihedral_quadratic.cpp +++ b/src/USER-MISC/dihedral_quadratic.cpp @@ -287,7 +287,7 @@ void DihedralQuadratic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double phi0_one= force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/dihedral_spherical.cpp b/src/USER-MISC/dihedral_spherical.cpp index c72570c494..6a10b19523 100644 --- a/src/USER-MISC/dihedral_spherical.cpp +++ b/src/USER-MISC/dihedral_spherical.cpp @@ -681,7 +681,7 @@ void DihedralSpherical::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); int nterms_one = force->inumeric(FLERR,arg[1]); diff --git a/src/USER-MISC/dihedral_table.cpp b/src/USER-MISC/dihedral_table.cpp index 9fd3679106..eb09472a39 100644 --- a/src/USER-MISC/dihedral_table.cpp +++ b/src/USER-MISC/dihedral_table.cpp @@ -813,7 +813,7 @@ void DihedralTable::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); int me; MPI_Comm_rank(world,&me); diff --git a/src/USER-MISC/dihedral_table_cut.cpp b/src/USER-MISC/dihedral_table_cut.cpp index e2283633bc..239ae9a0a0 100644 --- a/src/USER-MISC/dihedral_table_cut.cpp +++ b/src/USER-MISC/dihedral_table_cut.cpp @@ -794,7 +794,7 @@ void DihedralTableCut::coeff(int narg, char **arg) if (narg != 7) error->all(FLERR,"Incorrect args for dihedral coefficients"); if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[2]); double theta0_1_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MISC/improper_cossq.cpp b/src/USER-MISC/improper_cossq.cpp index c5556b746d..babd63fb70 100644 --- a/src/USER-MISC/improper_cossq.cpp +++ b/src/USER-MISC/improper_cossq.cpp @@ -269,7 +269,7 @@ void ImproperCossq::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double chi_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/improper_distance.cpp b/src/USER-MISC/improper_distance.cpp index 146bd344f1..640e175ea7 100644 --- a/src/USER-MISC/improper_distance.cpp +++ b/src/USER-MISC/improper_distance.cpp @@ -211,7 +211,7 @@ void ImproperDistance::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double chi_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/improper_fourier.cpp b/src/USER-MISC/improper_fourier.cpp index beb473d78c..63f4104053 100644 --- a/src/USER-MISC/improper_fourier.cpp +++ b/src/USER-MISC/improper_fourier.cpp @@ -279,7 +279,7 @@ void ImproperFourier::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double C0_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/improper_ring.cpp b/src/USER-MISC/improper_ring.cpp index 7f818595a2..9c94a4d719 100644 --- a/src/USER-MISC/improper_ring.cpp +++ b/src/USER-MISC/improper_ring.cpp @@ -288,7 +288,7 @@ void ImproperRing ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double chi_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/pair_buck_mdf.cpp b/src/USER-MISC/pair_buck_mdf.cpp index 1937aeedf7..51d2f671b5 100644 --- a/src/USER-MISC/pair_buck_mdf.cpp +++ b/src/USER-MISC/pair_buck_mdf.cpp @@ -208,8 +208,8 @@ void PairBuckMDF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a_one = force->numeric(FLERR,arg[2]); double rho_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MISC/pair_cosine_squared.cpp b/src/USER-MISC/pair_cosine_squared.cpp index ff0d763b2d..becba54b2e 100644 --- a/src/USER-MISC/pair_cosine_squared.cpp +++ b/src/USER-MISC/pair_cosine_squared.cpp @@ -130,8 +130,8 @@ void PairCosineSquared::coeff(int narg, char **arg) allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR, arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR, arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); double epsilon_one = force->numeric(FLERR, arg[2]); double sigma_one = force->numeric(FLERR, arg[3]); diff --git a/src/USER-MISC/pair_coul_diel.cpp b/src/USER-MISC/pair_coul_diel.cpp index e0c675086f..f5a94bd0e1 100644 --- a/src/USER-MISC/pair_coul_diel.cpp +++ b/src/USER-MISC/pair_coul_diel.cpp @@ -181,8 +181,8 @@ void PairCoulDiel::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); eps_s = force->numeric(FLERR,arg[2]); double rme_one =force->numeric(FLERR,arg[3]); diff --git a/src/USER-MISC/pair_coul_shield.cpp b/src/USER-MISC/pair_coul_shield.cpp index 7ff479b2f7..3dad7a1a1f 100644 --- a/src/USER-MISC/pair_coul_shield.cpp +++ b/src/USER-MISC/pair_coul_shield.cpp @@ -198,8 +198,8 @@ void PairCoulShield::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double sigmae_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MISC/pair_coul_slater_long.cpp b/src/USER-MISC/pair_coul_slater_long.cpp index f5b7461db7..28be30c340 100644 --- a/src/USER-MISC/pair_coul_slater_long.cpp +++ b/src/USER-MISC/pair_coul_slater_long.cpp @@ -31,6 +31,7 @@ #include "respa.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -223,8 +224,8 @@ void PairCoulSlaterLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/pair_gauss_cut.cpp b/src/USER-MISC/pair_gauss_cut.cpp index 2a4f61cce3..ed34f91b8b 100644 --- a/src/USER-MISC/pair_gauss_cut.cpp +++ b/src/USER-MISC/pair_gauss_cut.cpp @@ -185,8 +185,8 @@ void PairGaussCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double hgauss_one = force->numeric(FLERR,arg[2]); double rmh_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp index 4315439624..2a932b840f 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp @@ -228,8 +228,8 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file // map[i] = which element the Ith atom type is, -1 if NULL diff --git a/src/USER-MISC/pair_lebedeva_z.cpp b/src/USER-MISC/pair_lebedeva_z.cpp index 53ee82274e..82dc265ef9 100644 --- a/src/USER-MISC/pair_lebedeva_z.cpp +++ b/src/USER-MISC/pair_lebedeva_z.cpp @@ -224,8 +224,8 @@ void PairLebedevaZ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file // map[i] = which element the Ith atom type is, -1 if NULL diff --git a/src/USER-MISC/pair_lennard_mdf.cpp b/src/USER-MISC/pair_lennard_mdf.cpp index 4728527a30..e1647f5220 100644 --- a/src/USER-MISC/pair_lennard_mdf.cpp +++ b/src/USER-MISC/pair_lennard_mdf.cpp @@ -214,8 +214,8 @@ void PairLennardMDF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double aparm_one = force->numeric(FLERR,arg[2]); double bparm_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MISC/pair_list.cpp b/src/USER-MISC/pair_list.cpp index 2f4e886a61..fe21dd6560 100644 --- a/src/USER-MISC/pair_list.cpp +++ b/src/USER-MISC/pair_list.cpp @@ -24,6 +24,7 @@ #include "force.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -344,8 +345,8 @@ void PairList::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/pair_lj_expand_coul_long.cpp b/src/USER-MISC/pair_lj_expand_coul_long.cpp index 3d96a3343c..033d1c3ccd 100644 --- a/src/USER-MISC/pair_lj_expand_coul_long.cpp +++ b/src/USER-MISC/pair_lj_expand_coul_long.cpp @@ -651,8 +651,8 @@ void PairLJExpandCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MISC/pair_lj_mdf.cpp b/src/USER-MISC/pair_lj_mdf.cpp index 51e24639b9..d1d8221bcc 100644 --- a/src/USER-MISC/pair_lj_mdf.cpp +++ b/src/USER-MISC/pair_lj_mdf.cpp @@ -216,8 +216,8 @@ void PairLJMDF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp index 19bc66bdcb..570c8f4eab 100644 --- a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp +++ b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp @@ -361,8 +361,8 @@ void PairLJSFDipoleSF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MISC/pair_momb.cpp b/src/USER-MISC/pair_momb.cpp index 010aa1e5fd..e98832c6d7 100644 --- a/src/USER-MISC/pair_momb.cpp +++ b/src/USER-MISC/pair_momb.cpp @@ -215,8 +215,8 @@ void PairMomb::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double d0_one = force->numeric(FLERR,arg[2]); double alpha_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MISC/pair_morse_smooth_linear.cpp b/src/USER-MISC/pair_morse_smooth_linear.cpp index 7513eebd98..64549114a9 100644 --- a/src/USER-MISC/pair_morse_smooth_linear.cpp +++ b/src/USER-MISC/pair_morse_smooth_linear.cpp @@ -184,8 +184,8 @@ void PairMorseSmoothLinear::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double d0_one = force->numeric(FLERR,arg[2]); double alpha_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MISC/pair_srp.cpp b/src/USER-MISC/pair_srp.cpp index d0e73b265d..3a53334b31 100644 --- a/src/USER-MISC/pair_srp.cpp +++ b/src/USER-MISC/pair_srp.cpp @@ -429,8 +429,8 @@ void PairSRP::coeff(int narg, char **arg) // set ij bond-bond cutoffs int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], bptype, ilo, ihi); - force->bounds(FLERR,arg[1], bptype, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, bptype, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, bptype, jlo, jhi, error); double a0_one = force->numeric(FLERR,arg[2]); double cut_one = cut_global; diff --git a/src/USER-MOFFF/angle_class2_p6.cpp b/src/USER-MOFFF/angle_class2_p6.cpp index 839148bc13..5a913af379 100644 --- a/src/USER-MOFFF/angle_class2_p6.cpp +++ b/src/USER-MOFFF/angle_class2_p6.cpp @@ -280,7 +280,7 @@ void AngleClass2P6::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); int count = 0; diff --git a/src/USER-MOFFF/angle_cosine_buck6d.cpp b/src/USER-MOFFF/angle_cosine_buck6d.cpp index a6643601c1..838aa1ad70 100644 --- a/src/USER-MOFFF/angle_cosine_buck6d.cpp +++ b/src/USER-MOFFF/angle_cosine_buck6d.cpp @@ -251,7 +251,7 @@ void AngleCosineBuck6d::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double c_one = force->numeric(FLERR,arg[1]); int n_one = force->inumeric(FLERR,arg[2]); diff --git a/src/USER-MOFFF/improper_inversion_harmonic.cpp b/src/USER-MOFFF/improper_inversion_harmonic.cpp index e38b82067d..ac2e06d364 100644 --- a/src/USER-MOFFF/improper_inversion_harmonic.cpp +++ b/src/USER-MOFFF/improper_inversion_harmonic.cpp @@ -276,7 +276,7 @@ void ImproperInversionHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double w_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp index 57a935a0b3..8ad6b55598 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp @@ -275,8 +275,8 @@ void PairBuck6dCoulGaussDSF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double buck6d1_one = force->numeric(FLERR,arg[2]); double buck6d2_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp index d3ccec3a55..848cafd882 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp @@ -291,8 +291,8 @@ void PairBuck6dCoulGaussLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double buck6d1_one = force->numeric(FLERR,arg[2]); double buck6d2_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp index b6f0c63546..befcdb8d34 100644 --- a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp +++ b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp @@ -30,6 +30,7 @@ #include "error.h" #include "domain.h" #include "update.h" +#include "utils.h" #ifndef USE_ZEST #include "random_mars.h" #endif @@ -270,8 +271,8 @@ void PairSDPDTaitwaterIsothermal::coeff (int narg, char **arg) { if (!allocated) allocate(); int ilo, ihi, jlo, jhi; - force->bounds (FLERR, arg[0], atom->ntypes, ilo, ihi); - force->bounds (FLERR, arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); double rho0_one = force->numeric (FLERR,arg[2]); double soundspeed_one = force->numeric (FLERR,arg[3]); diff --git a/src/USER-SMD/pair_smd_hertz.cpp b/src/USER-SMD/pair_smd_hertz.cpp index 97be94d833..b4af7ca955 100644 --- a/src/USER-SMD/pair_smd_hertz.cpp +++ b/src/USER-SMD/pair_smd_hertz.cpp @@ -40,6 +40,7 @@ #include "neigh_request.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -260,8 +261,8 @@ void PairHertz::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); double bulkmodulus_one = atof(arg[2]); diff --git a/src/USER-SMD/pair_smd_triangulated_surface.cpp b/src/USER-SMD/pair_smd_triangulated_surface.cpp index 53a93df7f7..b09fd38d09 100644 --- a/src/USER-SMD/pair_smd_triangulated_surface.cpp +++ b/src/USER-SMD/pair_smd_triangulated_surface.cpp @@ -41,6 +41,7 @@ #include "neigh_request.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace std; using namespace LAMMPS_NS; @@ -342,8 +343,8 @@ void PairTriSurf::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1,atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1,atom->ntypes, jlo, jhi, error); double bulkmodulus_one = atof(arg[2]); diff --git a/src/USER-SPH/pair_sph_heatconduction.cpp b/src/USER-SPH/pair_sph_heatconduction.cpp index ebd2cef684..2305bcf240 100644 --- a/src/USER-SPH/pair_sph_heatconduction.cpp +++ b/src/USER-SPH/pair_sph_heatconduction.cpp @@ -19,6 +19,7 @@ #include "error.h" #include "neigh_list.h" #include "domain.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -167,8 +168,8 @@ void PairSPHHeatConduction::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); double alpha_one = force->numeric(FLERR,arg[2]); double cut_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-SPH/pair_sph_idealgas.cpp b/src/USER-SPH/pair_sph_idealgas.cpp index 1f6b63e199..16d5f173ca 100644 --- a/src/USER-SPH/pair_sph_idealgas.cpp +++ b/src/USER-SPH/pair_sph_idealgas.cpp @@ -19,6 +19,7 @@ #include "memory.h" #include "error.h" #include "domain.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -209,8 +210,8 @@ void PairSPHIdealGas::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); double viscosity_one = force->numeric(FLERR,arg[2]); double cut_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-SPH/pair_sph_lj.cpp b/src/USER-SPH/pair_sph_lj.cpp index ae42c413e7..c4d62bff38 100644 --- a/src/USER-SPH/pair_sph_lj.cpp +++ b/src/USER-SPH/pair_sph_lj.cpp @@ -19,6 +19,7 @@ #include "memory.h" #include "error.h" #include "domain.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -217,8 +218,8 @@ void PairSPHLJ::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); double viscosity_one = force->numeric(FLERR,arg[2]); double cut_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-SPH/pair_sph_rhosum.cpp b/src/USER-SPH/pair_sph_rhosum.cpp index fa51dc3781..5b68e157fd 100644 --- a/src/USER-SPH/pair_sph_rhosum.cpp +++ b/src/USER-SPH/pair_sph_rhosum.cpp @@ -22,6 +22,7 @@ #include "neighbor.h" #include "update.h" #include "domain.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -238,8 +239,8 @@ void PairSPHRhoSum::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); double cut_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-SPH/pair_sph_taitwater.cpp b/src/USER-SPH/pair_sph_taitwater.cpp index 79d9ac7742..d49840ed5b 100644 --- a/src/USER-SPH/pair_sph_taitwater.cpp +++ b/src/USER-SPH/pair_sph_taitwater.cpp @@ -20,6 +20,7 @@ #include "memory.h" #include "error.h" #include "domain.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -239,8 +240,8 @@ void PairSPHTaitwater::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); double rho0_one = force->numeric(FLERR,arg[2]); double soundspeed_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-SPH/pair_sph_taitwater_morris.cpp b/src/USER-SPH/pair_sph_taitwater_morris.cpp index 862d2a8053..f513cb36a2 100644 --- a/src/USER-SPH/pair_sph_taitwater_morris.cpp +++ b/src/USER-SPH/pair_sph_taitwater_morris.cpp @@ -20,6 +20,7 @@ #include "memory.h" #include "error.h" #include "domain.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -240,8 +241,8 @@ void PairSPHTaitwaterMorris::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); double rho0_one = force->numeric(FLERR,arg[2]); double soundspeed_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-YAFF/angle_cross.cpp b/src/USER-YAFF/angle_cross.cpp index 3d5715c23e..e60563401a 100644 --- a/src/USER-YAFF/angle_cross.cpp +++ b/src/USER-YAFF/angle_cross.cpp @@ -223,7 +223,7 @@ void AngleCross::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); int count = 0; diff --git a/src/USER-YAFF/angle_mm3.cpp b/src/USER-YAFF/angle_mm3.cpp index cb3010e97c..0ebb92d933 100644 --- a/src/USER-YAFF/angle_mm3.cpp +++ b/src/USER-YAFF/angle_mm3.cpp @@ -180,7 +180,7 @@ void AngleMM3::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); int count = 0; diff --git a/src/USER-YAFF/bond_mm3.cpp b/src/USER-YAFF/bond_mm3.cpp index 8001e35d74..4009f64448 100644 --- a/src/USER-YAFF/bond_mm3.cpp +++ b/src/USER-YAFF/bond_mm3.cpp @@ -135,7 +135,7 @@ void BondMM3::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double k2_one = force->numeric(FLERR,arg[1]); double r0_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-YAFF/improper_distharm.cpp b/src/USER-YAFF/improper_distharm.cpp index 751e6e19c2..8486809813 100644 --- a/src/USER-YAFF/improper_distharm.cpp +++ b/src/USER-YAFF/improper_distharm.cpp @@ -219,7 +219,7 @@ void ImproperDistHarm::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double chi_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-YAFF/improper_sqdistharm.cpp b/src/USER-YAFF/improper_sqdistharm.cpp index 82bf4a1755..9bd07e51e0 100644 --- a/src/USER-YAFF/improper_sqdistharm.cpp +++ b/src/USER-YAFF/improper_sqdistharm.cpp @@ -219,7 +219,7 @@ void ImproperSQDistHarm::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); double k_one = force->numeric(FLERR,arg[1]); double chi_one = force->numeric(FLERR,arg[2]); diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index 37fc143e8b..fa0f3f4b05 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -299,8 +299,8 @@ void PairLJSwitch3CoulGaussLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index 6b0466cd6d..7b31aca039 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -301,8 +301,8 @@ void PairMM3Switch3CoulGaussLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index 882749b6b2..d0a1d29e65 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -267,7 +267,7 @@ void AngleHybrid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); // 2nd arg = angle sub-style name // allow for "none" or "skip" as valid sub-style name diff --git a/src/angle_zero.cpp b/src/angle_zero.cpp index 5da8e9d5bc..90359fbb53 100644 --- a/src/angle_zero.cpp +++ b/src/angle_zero.cpp @@ -87,7 +87,7 @@ void AngleZero::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double theta0_one = 0.0; if (coeffflag && (narg == 2)) diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index aadc25987a..2fe9f7d388 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -268,7 +268,7 @@ void BondHybrid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); // 2nd arg = bond sub-style name // allow for "none" as valid sub-style name diff --git a/src/bond_zero.cpp b/src/bond_zero.cpp index cb336ddd67..abc497d5d5 100644 --- a/src/bond_zero.cpp +++ b/src/bond_zero.cpp @@ -85,7 +85,7 @@ void BondZero::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double r0_one = 0.0; if (coeffflag && (narg == 2)) diff --git a/src/comm.cpp b/src/comm.cpp index 7902545330..c9a517340c 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -320,7 +320,7 @@ void Comm::modify_params(int narg, char **arg) for (i=0; i < ntypes+1; ++i) cutusermulti[i] = -1.0; } - force->bounds(FLERR,arg[iarg+1],ntypes,nlo,nhi,1); + utils::bounds(FLERR,arg[iarg+1],1,ntypes,nlo,nhi,error); cut = force->numeric(FLERR,arg[iarg+2]); cutghostuser = MAX(cutghostuser,cut); if (cut < 0.0) diff --git a/src/compute_adf.cpp b/src/compute_adf.cpp index dee5fb214f..e525d0250b 100644 --- a/src/compute_adf.cpp +++ b/src/compute_adf.cpp @@ -30,6 +30,7 @@ #include "memory.h" #include "error.h" #include "comm.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -134,9 +135,9 @@ ComputeADF::ComputeADF(LAMMPS *lmp, int narg, char **arg) : cutflag = 1; iarg = 4; for (int m = 0; m < ntriples; m++) { - force->bounds(FLERR,arg[iarg],atom->ntypes,ilo[m],ihi[m]); - force->bounds(FLERR,arg[iarg+1],atom->ntypes,jlo[m],jhi[m]); - force->bounds(FLERR,arg[iarg+2],atom->ntypes,klo[m],khi[m]); + utils::bounds(FLERR,arg[iarg],1,atom->ntypes,ilo[m],ihi[m],error); + utils::bounds(FLERR,arg[iarg+1],1,atom->ntypes,jlo[m],jhi[m],error); + utils::bounds(FLERR,arg[iarg+2],1,atom->ntypes,klo[m],khi[m],error); if (ilo[m] > ihi[m] || jlo[m] > jhi[m] || klo[m] > khi[m]) diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index 4a96c29a24..7bf3d017a9 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -75,7 +75,7 @@ ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) : } else { ncol = 0; while (iarg < narg) { - force->bounds(FLERR,arg[iarg],ntypes,typelo[ncol],typehi[ncol]); + utils::bounds(FLERR,arg[iarg],1,ntypes,typelo[ncol],typehi[ncol],error); if (typelo[ncol] > typehi[ncol]) error->all(FLERR,"Illegal compute coord/atom command"); ncol++; diff --git a/src/compute_rdf.cpp b/src/compute_rdf.cpp index 501a506c98..5ceddd4578 100644 --- a/src/compute_rdf.cpp +++ b/src/compute_rdf.cpp @@ -32,6 +32,7 @@ #include "memory.h" #include "error.h" #include "comm.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -98,8 +99,8 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) : } else { iarg = 4; for (int ipair = 0; ipair < npairs; ipair++) { - force->bounds(FLERR,arg[iarg],atom->ntypes,ilo[ipair],ihi[ipair]); - force->bounds(FLERR,arg[iarg+1],atom->ntypes,jlo[ipair],jhi[ipair]); + utils::bounds(FLERR,arg[iarg],1,atom->ntypes,ilo[ipair],ihi[ipair],error); + utils::bounds(FLERR,arg[iarg+1],1,atom->ntypes,jlo[ipair],jhi[ipair],error); if (ilo[ipair] > ihi[ipair] || jlo[ipair] > jhi[ipair]) error->all(FLERR,"Illegal compute rdf command"); iarg += 2; diff --git a/src/delete_bonds.cpp b/src/delete_bonds.cpp index 7b9260bc52..f08c94a273 100644 --- a/src/delete_bonds.cpp +++ b/src/delete_bonds.cpp @@ -75,7 +75,7 @@ void DeleteBonds::command(int narg, char **arg) else error->all(FLERR,"Illegal delete_bonds command"); // setup list of types (atom,bond,etc) to consider - // use force->bounds(FLERR,) to allow setting of range of types + // use utils::bounds(FLERR,) to allow setting of range of types // range can be 0 to ntypes inclusive int *tlist = NULL; @@ -94,7 +94,7 @@ void DeleteBonds::command(int narg, char **arg) tlist = new int[n+1]; for (int i = 0; i <= n; i++) tlist[i] = 0; int nlo,nhi; - force->bounds(FLERR,arg[2],n,nlo,nhi,0); + utils::bounds(FLERR,arg[2],0,n,nlo,nhi,error); for (int i = nlo; i <= nhi; i++) tlist[i] = 1; iarg++; diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index ca5c90093c..8f41b30d56 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -255,7 +255,7 @@ void DihedralHybrid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); // 2nd arg = dihedral sub-style name // allow for "none" or "skip" as valid sub-style name diff --git a/src/dihedral_zero.cpp b/src/dihedral_zero.cpp index daf46fe79a..59167ca30e 100644 --- a/src/dihedral_zero.cpp +++ b/src/dihedral_zero.cpp @@ -21,6 +21,7 @@ #include "force.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -80,7 +81,7 @@ void DihedralZero::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/dump_image.cpp b/src/dump_image.cpp index a78c214e08..73252e94f2 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -35,6 +35,7 @@ #include "math_extra.h" #include "error.h" #include "memory.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -1246,7 +1247,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"acolor") == 0) { if (narg < 3) error->all(FLERR,"Illegal dump_modify command"); int nlo,nhi; - force->bounds(FLERR,arg[1],atom->ntypes,nlo,nhi); + utils::bounds(FLERR,arg[1],1,atom->ntypes,nlo,nhi,error); // ptrs = list of ncount colornames separated by '/' @@ -1280,7 +1281,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"adiam") == 0) { if (narg < 3) error->all(FLERR,"Illegal dump_modify command"); int nlo,nhi; - force->bounds(FLERR,arg[1],atom->ntypes,nlo,nhi); + utils::bounds(FLERR,arg[1],1,atom->ntypes,nlo,nhi,error); 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; @@ -1309,7 +1310,7 @@ int DumpImage::modify_param(int narg, char **arg) if (atom->nbondtypes == 0) error->all(FLERR,"Dump modify bcolor not allowed with no bond types"); int nlo,nhi; - force->bounds(FLERR,arg[1],atom->nbondtypes,nlo,nhi); + utils::bounds(FLERR,arg[1],1,atom->nbondtypes,nlo,nhi,error); // ptrs = list of ncount colornames separated by '/' @@ -1345,7 +1346,7 @@ int DumpImage::modify_param(int narg, char **arg) if (atom->nbondtypes == 0) error->all(FLERR,"Dump modify bdiam not allowed with no bond types"); int nlo,nhi; - force->bounds(FLERR,arg[1],atom->nbondtypes,nlo,nhi); + utils::bounds(FLERR,arg[1],1,atom->nbondtypes,nlo,nhi,error); 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; diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index c502dc6595..f8b8092c0d 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -98,10 +98,10 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) adapt[nadapt].pparam = new char[n]; adapt[nadapt].pair = NULL; strcpy(adapt[nadapt].pparam,arg[iarg+2]); - force->bounds(FLERR,arg[iarg+3],atom->ntypes, - adapt[nadapt].ilo,adapt[nadapt].ihi); - force->bounds(FLERR,arg[iarg+4],atom->ntypes, - adapt[nadapt].jlo,adapt[nadapt].jhi); + utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes, + adapt[nadapt].ilo,adapt[nadapt].ihi,error); + utils::bounds(FLERR,arg[iarg+4],1,atom->ntypes, + adapt[nadapt].jlo,adapt[nadapt].jhi,error); if (strstr(arg[iarg+5],"v_") == arg[iarg+5]) { n = strlen(&arg[iarg+5][2]) + 1; adapt[nadapt].var = new char[n]; @@ -120,8 +120,8 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) adapt[nadapt].bparam = new char[n]; adapt[nadapt].bond = NULL; strcpy(adapt[nadapt].bparam,arg[iarg+2]); - force->bounds(FLERR,arg[iarg+3],atom->nbondtypes, - adapt[nadapt].ilo,adapt[nadapt].ihi); + utils::bounds(FLERR,arg[iarg+3],1,atom->nbondtypes, + adapt[nadapt].ilo,adapt[nadapt].ihi,error); if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) { n = strlen(&arg[iarg+4][2]) + 1; adapt[nadapt].var = new char[n]; diff --git a/src/force.cpp b/src/force.cpp index babb052e84..13b1971545 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -836,74 +836,6 @@ void Force::set_special(int narg, char **arg) error->all(FLERR,"Illegal special_bonds command"); } -/* ---------------------------------------------------------------------- - compute bounds implied by numeric str with a possible wildcard asterik - 1 = lower bound, nmax = upper bound - 5 possibilities: - (1) i = i to i, (2) * = nmin to nmax, - (3) i* = i to nmax, (4) *j = nmin to j, (5) i*j = i to j - return nlo,nhi -------------------------------------------------------------------------- */ - -void Force::bounds(const char *file, int line, char *str, - int nmax, int &nlo, int &nhi, int nmin) -{ - char *ptr = strchr(str,'*'); - - if (ptr == NULL) { - nlo = nhi = atoi(str); - } else if (strlen(str) == 1) { - nlo = nmin; - nhi = nmax; - } else if (ptr == str) { - nlo = nmin; - nhi = atoi(ptr+1); - } else if (strlen(ptr+1) == 0) { - nlo = atoi(str); - nhi = nmax; - } else { - nlo = atoi(str); - nhi = atoi(ptr+1); - } - - if (nlo < nmin || nhi > nmax || nlo > nhi) - error->all(file,line,"Numeric index is out of bounds"); -} - -/* ---------------------------------------------------------------------- - compute bounds implied by numeric str with a possible wildcard asterik - 1 = lower bound, nmax = upper bound - 5 possibilities: - (1) i = i to i, (2) * = nmin to nmax, - (3) i* = i to nmax, (4) *j = nmin to j, (5) i*j = i to j - return nlo,nhi -------------------------------------------------------------------------- */ - -void Force::boundsbig(const char *file, int line, char *str, - bigint nmax, bigint &nlo, bigint &nhi, bigint nmin) -{ - char *ptr = strchr(str,'*'); - - if (ptr == NULL) { - nlo = nhi = ATOBIGINT(str); - } else if (strlen(str) == 1) { - nlo = nmin; - nhi = nmax; - } else if (ptr == str) { - nlo = nmin; - nhi = ATOBIGINT(ptr+1); - } else if (strlen(ptr+1) == 0) { - nlo = ATOBIGINT(str); - nhi = nmax; - } else { - nlo = ATOBIGINT(str); - nhi = ATOBIGINT(ptr+1); - } - - if (nlo < nmin || nhi > nmax || nlo > nhi) - error->all(file,line,"Numeric index is out of bounds"); -} - /* ---------------------------------------------------------------------- read a floating point value from a string generate an error if not a legitimate floating point value diff --git a/src/force.h b/src/force.h index b566f02fb7..929d29d8e5 100644 --- a/src/force.h +++ b/src/force.h @@ -128,8 +128,6 @@ class Force : protected Pointers { void store_style(char *&, const std::string &, int); void set_special(int, char **); - void bounds(const char *, int, char *, int, int &, int &, int nmin=1); - void boundsbig(const char *, int, char *, bigint, bigint &, bigint &, bigint nmin=1); double numeric(const char *, int, char *); int inumeric(const char *, int, char *); bigint bnumeric(const char *, int, char *); diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index 69dfc2d9cd..ce0f36539f 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -263,7 +263,7 @@ void ImproperHybrid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); // 2nd arg = improper sub-style name // allow for "none" as valid sub-style name diff --git a/src/improper_zero.cpp b/src/improper_zero.cpp index efa70c8ff5..f269f8bf03 100644 --- a/src/improper_zero.cpp +++ b/src/improper_zero.cpp @@ -21,6 +21,7 @@ #include "force.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -80,7 +81,7 @@ void ImproperZero::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_beck.cpp b/src/pair_beck.cpp index 6085398d4c..0b300bc7f5 100644 --- a/src/pair_beck.cpp +++ b/src/pair_beck.cpp @@ -199,8 +199,8 @@ void PairBeck::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double AA_one = force->numeric(FLERR,arg[2]); double BB_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_born.cpp b/src/pair_born.cpp index b0aba57df5..b2a5ee2f7b 100644 --- a/src/pair_born.cpp +++ b/src/pair_born.cpp @@ -199,8 +199,8 @@ void PairBorn::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a_one = force->numeric(FLERR,arg[2]); double rho_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_born_coul_dsf.cpp b/src/pair_born_coul_dsf.cpp index 3e8c76696b..ced2c3ccf3 100644 --- a/src/pair_born_coul_dsf.cpp +++ b/src/pair_born_coul_dsf.cpp @@ -240,8 +240,8 @@ void PairBornCoulDSF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a_one = force->numeric(FLERR,arg[2]); double rho_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_born_coul_wolf.cpp b/src/pair_born_coul_wolf.cpp index dc4e4b8e3f..30275a05b1 100644 --- a/src/pair_born_coul_wolf.cpp +++ b/src/pair_born_coul_wolf.cpp @@ -243,8 +243,8 @@ void PairBornCoulWolf::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a_one = force->numeric(FLERR,arg[2]); double rho_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_buck.cpp b/src/pair_buck.cpp index 6fc1c782e0..982c400135 100644 --- a/src/pair_buck.cpp +++ b/src/pair_buck.cpp @@ -192,8 +192,8 @@ void PairBuck::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a_one = force->numeric(FLERR,arg[2]); double rho_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_buck_coul_cut.cpp b/src/pair_buck_coul_cut.cpp index de36b58df2..76ff05729e 100644 --- a/src/pair_buck_coul_cut.cpp +++ b/src/pair_buck_coul_cut.cpp @@ -225,8 +225,8 @@ void PairBuckCoulCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a_one = force->numeric(FLERR,arg[2]); double rho_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_coul_cut.cpp b/src/pair_coul_cut.cpp index a197955085..2abc65f322 100644 --- a/src/pair_coul_cut.cpp +++ b/src/pair_coul_cut.cpp @@ -172,8 +172,8 @@ void PairCoulCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_one = cut_global; if (narg == 3) cut_one = force->numeric(FLERR,arg[2]); diff --git a/src/pair_coul_dsf.cpp b/src/pair_coul_dsf.cpp index 992ee33ecb..b1bea9edbb 100644 --- a/src/pair_coul_dsf.cpp +++ b/src/pair_coul_dsf.cpp @@ -185,8 +185,8 @@ void PairCoulDSF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_coul_wolf.cpp b/src/pair_coul_wolf.cpp index b34877f508..38220386c0 100644 --- a/src/pair_coul_wolf.cpp +++ b/src/pair_coul_wolf.cpp @@ -186,8 +186,8 @@ void PairCoulWolf::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_dpd.cpp b/src/pair_dpd.cpp index ef0b7dd21d..d38e1f0655 100644 --- a/src/pair_dpd.cpp +++ b/src/pair_dpd.cpp @@ -221,8 +221,8 @@ void PairDPD::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a0_one = force->numeric(FLERR,arg[2]); double gamma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_dpd_tstat.cpp b/src/pair_dpd_tstat.cpp index 8366ff459f..fde8e2e2c3 100644 --- a/src/pair_dpd_tstat.cpp +++ b/src/pair_dpd_tstat.cpp @@ -176,8 +176,8 @@ void PairDPDTstat::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a0_one = 0.0; double gamma_one = force->numeric(FLERR,arg[2]); diff --git a/src/pair_gauss.cpp b/src/pair_gauss.cpp index dcc3ac5f51..fbf55b397a 100644 --- a/src/pair_gauss.cpp +++ b/src/pair_gauss.cpp @@ -187,8 +187,8 @@ void PairGauss::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a_one = force->numeric(FLERR,arg[2]); double b_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 646ddefc3e..baf3fd550f 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -438,8 +438,8 @@ void PairHybrid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // 3rd arg = pair sub-style name // 4th arg = pair sub-style index if name used multiple times diff --git a/src/pair_hybrid_overlay.cpp b/src/pair_hybrid_overlay.cpp index 4c2acfe8ba..a0b233d5bc 100644 --- a/src/pair_hybrid_overlay.cpp +++ b/src/pair_hybrid_overlay.cpp @@ -17,6 +17,7 @@ #include "atom.h" #include "force.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -34,8 +35,8 @@ void PairHybridOverlay::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // 3rd arg = pair sub-style name // 4th arg = pair sub-style index if name used multiple times diff --git a/src/pair_lj96_cut.cpp b/src/pair_lj96_cut.cpp index 8be6fefa44..de9ffcf486 100644 --- a/src/pair_lj96_cut.cpp +++ b/src/pair_lj96_cut.cpp @@ -456,8 +456,8 @@ void PairLJ96Cut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_lj_cubic.cpp b/src/pair_lj_cubic.cpp index 366554178f..2a2bd77599 100644 --- a/src/pair_lj_cubic.cpp +++ b/src/pair_lj_cubic.cpp @@ -192,8 +192,8 @@ void PairLJCubic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_lj_cut.cpp b/src/pair_lj_cut.cpp index 60bb7bceee..e9f6bce50b 100644 --- a/src/pair_lj_cut.cpp +++ b/src/pair_lj_cut.cpp @@ -450,8 +450,8 @@ void PairLJCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_lj_cut_coul_cut.cpp b/src/pair_lj_cut_coul_cut.cpp index 7f0f89a5bf..8c1a52fa6c 100644 --- a/src/pair_lj_cut_coul_cut.cpp +++ b/src/pair_lj_cut_coul_cut.cpp @@ -217,8 +217,8 @@ void PairLJCutCoulCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_lj_cut_coul_dsf.cpp b/src/pair_lj_cut_coul_dsf.cpp index 9dc6c001f4..cb2a4079c1 100644 --- a/src/pair_lj_cut_coul_dsf.cpp +++ b/src/pair_lj_cut_coul_dsf.cpp @@ -241,8 +241,8 @@ void PairLJCutCoulDSF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_lj_cut_coul_wolf.cpp b/src/pair_lj_cut_coul_wolf.cpp index 303d9a88bb..40bdfc5ce4 100644 --- a/src/pair_lj_cut_coul_wolf.cpp +++ b/src/pair_lj_cut_coul_wolf.cpp @@ -236,8 +236,8 @@ void PairLJCutCoulWolf::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_lj_expand.cpp b/src/pair_lj_expand.cpp index 98c8a808e2..a0728319c8 100644 --- a/src/pair_lj_expand.cpp +++ b/src/pair_lj_expand.cpp @@ -194,8 +194,8 @@ void PairLJExpand::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_lj_gromacs.cpp b/src/pair_lj_gromacs.cpp index 73f4307d62..d7cb640f30 100644 --- a/src/pair_lj_gromacs.cpp +++ b/src/pair_lj_gromacs.cpp @@ -220,8 +220,8 @@ void PairLJGromacs::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_lj_gromacs_coul_gromacs.cpp b/src/pair_lj_gromacs_coul_gromacs.cpp index a5663ecfd8..ab0e42e483 100644 --- a/src/pair_lj_gromacs_coul_gromacs.cpp +++ b/src/pair_lj_gromacs_coul_gromacs.cpp @@ -246,8 +246,8 @@ void PairLJGromacsCoulGromacs::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_lj_smooth.cpp b/src/pair_lj_smooth.cpp index bf97a44732..182738f547 100644 --- a/src/pair_lj_smooth.cpp +++ b/src/pair_lj_smooth.cpp @@ -225,8 +225,8 @@ void PairLJSmooth::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_lj_smooth_linear.cpp b/src/pair_lj_smooth_linear.cpp index 19e84f971d..e69fdc162b 100644 --- a/src/pair_lj_smooth_linear.cpp +++ b/src/pair_lj_smooth_linear.cpp @@ -194,8 +194,8 @@ void PairLJSmoothLinear::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_mie_cut.cpp b/src/pair_mie_cut.cpp index f031401a00..01f4ae98a4 100644 --- a/src/pair_mie_cut.cpp +++ b/src/pair_mie_cut.cpp @@ -461,8 +461,8 @@ void PairMIECut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_morse.cpp b/src/pair_morse.cpp index b883036c18..52237555a0 100644 --- a/src/pair_morse.cpp +++ b/src/pair_morse.cpp @@ -181,8 +181,8 @@ void PairMorse::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double d0_one = force->numeric(FLERR,arg[2]); double alpha_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_soft.cpp b/src/pair_soft.cpp index ddfc4476dc..dee10052f9 100644 --- a/src/pair_soft.cpp +++ b/src/pair_soft.cpp @@ -172,8 +172,8 @@ void PairSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double prefactor_one = force->numeric(FLERR,arg[2]); diff --git a/src/pair_table.cpp b/src/pair_table.cpp index bd2a6be654..0d9769cab8 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -259,8 +259,8 @@ void PairTable::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int me; MPI_Comm_rank(world,&me); diff --git a/src/pair_ufm.cpp b/src/pair_ufm.cpp index 3b94902af7..9f9f18dced 100644 --- a/src/pair_ufm.cpp +++ b/src/pair_ufm.cpp @@ -187,8 +187,8 @@ void PairUFM::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); diff --git a/src/pair_yukawa.cpp b/src/pair_yukawa.cpp index d1e06fdb84..5a3a589702 100644 --- a/src/pair_yukawa.cpp +++ b/src/pair_yukawa.cpp @@ -177,8 +177,8 @@ void PairYukawa::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a_one = force->numeric(FLERR,arg[2]); diff --git a/src/pair_zbl.cpp b/src/pair_zbl.cpp index 2ba499a911..5655570351 100644 --- a/src/pair_zbl.cpp +++ b/src/pair_zbl.cpp @@ -206,10 +206,10 @@ void PairZBL::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); int jlo,jhi; - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); z_one = force->numeric(FLERR,arg[2]); z_two = force->numeric(FLERR,arg[3]); diff --git a/src/pair_zero.cpp b/src/pair_zero.cpp index 6ab108ff4f..be09647365 100644 --- a/src/pair_zero.cpp +++ b/src/pair_zero.cpp @@ -117,8 +117,8 @@ void PairZero::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_one = cut_global; if (coeffflag && (narg == 3)) cut_one = force->numeric(FLERR,arg[2]); diff --git a/src/set.cpp b/src/set.cpp index 01176f68c0..22121c0b72 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -633,7 +633,7 @@ void Set::selection(int n) if (atom->tag_enable == 0) error->all(FLERR,"Cannot use set atom with no atom IDs defined"); bigint nlobig,nhibig; - force->boundsbig(FLERR,id,MAXTAGINT,nlobig,nhibig); + utils::boundsbig(FLERR,id,1,MAXTAGINT,nlobig,nhibig,error); tagint *tag = atom->tag; for (int i = 0; i < n; i++) @@ -644,7 +644,7 @@ void Set::selection(int n) if (atom->molecule_flag == 0) error->all(FLERR,"Cannot use set mol with no molecule IDs defined"); bigint nlobig,nhibig; - force->boundsbig(FLERR,id,MAXTAGINT,nlobig,nhibig); + utils::boundsbig(FLERR,id,1,MAXTAGINT,nlobig,nhibig,error); tagint *molecule = atom->molecule; for (int i = 0; i < n; i++) @@ -652,7 +652,7 @@ void Set::selection(int n) else select[i] = 0; } else if (style == TYPE_SELECT) { - force->bounds(FLERR,id,atom->ntypes,nlo,nhi); + utils::bounds(FLERR,id,1,atom->ntypes,nlo,nhi,error); int *type = atom->type; for (int i = 0; i < n; i++) diff --git a/src/utils.cpp b/src/utils.cpp index e9058d4c2d..46a369c02d 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -16,7 +16,11 @@ #include #include #include "lammps.h" +#include "compute.h" #include "error.h" +#include "fix.h" +#include "memory.h" +#include "modify.h" #include "tokenizer.h" #include "text_file_reader.h" #include "fmt/format.h" @@ -350,6 +354,216 @@ tagint utils::tnumeric(const char *file, int line, const char *str, return ATOTAGINT(str); } +/* ---------------------------------------------------------------------- + compute bounds implied by numeric str with a possible wildcard asterisk +------------------------------------------------------------------------- */ +void utils::bounds(const char *file, int line, char *str, + int nmin, int nmax, int &nlo, int &nhi, Error *error) +{ + char *ptr = strchr(str,'*'); + + nlo = nhi = -1; + if (ptr == NULL) { + nlo = nhi = atoi(str); + } else if (strlen(str) == 1) { + nlo = nmin; + nhi = nmax; + } else if (ptr == str) { + nlo = nmin; + nhi = atoi(ptr+1); + } else if (strlen(ptr+1) == 0) { + nlo = atoi(str); + nhi = nmax; + } else { + nlo = atoi(str); + nhi = atoi(ptr+1); + } + + if (error) { + if (nlo < nmin) + error->all(file,line,fmt::format("Numeric index {} is out of bounds" + "({}-{})",nlo,nmin,nmax)); + else if (nhi > nmax) + error->all(file,line,fmt::format("Numeric index {} is out of bounds" + "({}-{})",nhi,nmin,nmax)); + else if (nlo > nhi) + error->all(file,line,fmt::format("Numeric index {} is out of bounds" + "({}-{})",nlo,nmin,nhi)); + } +} + + +/* ---------------------------------------------------------------------- + compute bounds implied by numeric str with a possible wildcard asterisk +------------------------------------------------------------------------- */ +void utils::boundsbig(const char *file, int line, char *str, + bigint nmin, bigint nmax, bigint &nlo, bigint &nhi, + Error *error) +{ + char *ptr = strchr(str,'*'); + + nlo = nhi = -1; + if (ptr == NULL) { + nlo = nhi = ATOBIGINT(str); + } else if (strlen(str) == 1) { + nlo = nmin; + nhi = nmax; + } else if (ptr == str) { + nlo = nmin; + nhi = ATOBIGINT(ptr+1); + } else if (strlen(ptr+1) == 0) { + nlo = ATOBIGINT(str); + nhi = nmax; + } else { + nlo = ATOBIGINT(str); + nhi = ATOBIGINT(ptr+1); + } + + if (error) { + if (nlo < nmin) + error->all(file,line,fmt::format("Numeric index {} is out of bounds" + "({}-{})",nlo,nmin,nmax)); + else if (nhi > nmax) + error->all(file,line,fmt::format("Numeric index {} is out of bounds" + "({}-{})",nhi,nmin,nmax)); + else if (nlo > nhi) + error->all(file,line,fmt::format("Numeric index {} is out of bounds" + "({}-{})",nlo,nmin,nhi)); + } +} + +/* ------------------------------------------------------------------------- + Expand list of arguments in arg to earg if arg contains wildcards +------------------------------------------------------------------------- */ + +int utils::expand_args(const char *file, int line, int narg, char **arg, + int mode, char **&earg, LAMMPS *lmp) +{ + int n,iarg,index,nlo,nhi,nmax,expandflag,icompute,ifix; + char *ptr1,*ptr2,*str; + + ptr1 = NULL; + for (iarg = 0; iarg < narg; iarg++) { + ptr1 = strchr(arg[iarg],'*'); + if (ptr1) break; + } + + if (!ptr1) { + earg = arg; + return narg; + } + + // maxarg should always end up equal to newarg, so caller can free earg + + int maxarg = narg-iarg; + earg = (char **) lmp->memory->smalloc(maxarg*sizeof(char *),"input:earg"); + + int newarg = 0; + for (iarg = 0; iarg < narg; iarg++) { + expandflag = 0; + + if (strncmp(arg[iarg],"c_",2) == 0 || + strncmp(arg[iarg],"f_",2) == 0) { + + ptr1 = strchr(&arg[iarg][2],'['); + if (ptr1) { + ptr2 = strchr(ptr1,']'); + if (ptr2) { + *ptr2 = '\0'; + if (strchr(ptr1,'*')) { + if (arg[iarg][0] == 'c') { + *ptr1 = '\0'; + icompute = lmp->modify->find_compute(&arg[iarg][2]); + *ptr1 = '['; + + // check for global vector/array, peratom array, local array + + if (icompute >= 0) { + if (mode == 0 && lmp->modify->compute[icompute]->vector_flag) { + nmax = lmp->modify->compute[icompute]->size_vector; + expandflag = 1; + } else if (mode == 1 && lmp->modify->compute[icompute]->array_flag) { + nmax = lmp->modify->compute[icompute]->size_array_cols; + expandflag = 1; + } else if (lmp->modify->compute[icompute]->peratom_flag && + lmp->modify->compute[icompute]->size_peratom_cols) { + nmax = lmp->modify->compute[icompute]->size_peratom_cols; + expandflag = 1; + } else if (lmp->modify->compute[icompute]->local_flag && + lmp->modify->compute[icompute]->size_local_cols) { + nmax = lmp->modify->compute[icompute]->size_local_cols; + expandflag = 1; + } + } + } else if (arg[iarg][0] == 'f') { + *ptr1 = '\0'; + ifix = lmp->modify->find_fix(&arg[iarg][2]); + *ptr1 = '['; + + // check for global vector/array, peratom array, local array + + if (ifix >= 0) { + if (mode == 0 && lmp->modify->fix[ifix]->vector_flag) { + nmax = lmp->modify->fix[ifix]->size_vector; + expandflag = 1; + } else if (mode == 1 && lmp->modify->fix[ifix]->array_flag) { + nmax = lmp->modify->fix[ifix]->size_array_cols; + expandflag = 1; + } else if (lmp->modify->fix[ifix]->peratom_flag && + lmp->modify->fix[ifix]->size_peratom_cols) { + nmax = lmp->modify->fix[ifix]->size_peratom_cols; + expandflag = 1; + } else if (lmp->modify->fix[ifix]->local_flag && + lmp->modify->fix[ifix]->size_local_cols) { + nmax = lmp->modify->fix[ifix]->size_local_cols; + expandflag = 1; + } + } + } + } + *ptr2 = ']'; + } + } + } + + if (expandflag) { + *ptr2 = '\0'; + bounds(file,line,ptr1+1,1,nmax,nlo,nhi,lmp->error); + *ptr2 = ']'; + if (newarg+nhi-nlo+1 > maxarg) { + maxarg += nhi-nlo+1; + earg = (char **) + lmp->memory->srealloc(earg,maxarg*sizeof(char *),"input:earg"); + } + for (index = nlo; index <= nhi; index++) { + n = strlen(arg[iarg]) + 16; // 16 = space for large inserted integer + str = earg[newarg] = new char[n]; + strncpy(str,arg[iarg],ptr1+1-arg[iarg]); + sprintf(&str[ptr1+1-arg[iarg]],"%d",index); + strcat(str,ptr2); + newarg++; + } + + } else { + if (newarg == maxarg) { + maxarg++; + earg = (char **) + lmp->memory->srealloc(earg,maxarg*sizeof(char *),"input:earg"); + } + n = strlen(arg[iarg]) + 1; + earg[newarg] = new char[n]; + strcpy(earg[newarg],arg[iarg]); + newarg++; + } + } + + //printf("NEWARG %d\n",newarg); + //for (int i = 0; i < newarg; i++) + // printf(" arg %d: %s\n",i,earg[i]); + + return newarg; +} + /* ---------------------------------------------------------------------- Return string without leading or trailing whitespace ------------------------------------------------------------------------- */ diff --git a/src/utils.h b/src/utils.h index 4b1c68fb8e..2fb3c839a5 100644 --- a/src/utils.h +++ b/src/utils.h @@ -94,12 +94,12 @@ namespace LAMMPS_NS { /** Convert a string to a floating point number while checking * if it is a valid floating point or integer number * - * \param file name of source file for error message - * \param line in source file for error message - * \param str string to be converted to number + * \param file name of source file for error message + * \param line line number in source file for error message + * \param str string to be converted to number * \param do_abort determines whether to call Error::one() or Error::all() - * \param lmp pointer to top-level LAMMPS class instance - * \return double precision floating point number + * \param lmp pointer to top-level LAMMPS class instance + * \return double precision floating point number */ double numeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); @@ -107,12 +107,12 @@ namespace LAMMPS_NS { /** Convert a string to an integer number while checking * if it is a valid integer number (regular int) * - * \param file name of source file for error message - * \param line in source file for error message - * \param str string to be converted to number + * \param file name of source file for error message + * \param line line number in source file for error message + * \param str string to be converted to number * \param do_abort determines whether to call Error::one() or Error::all() - * \param lmp pointer to top-level LAMMPS class instance - * \return integer number (regular int) + * \param lmp pointer to top-level LAMMPS class instance + * \return integer number (regular int) */ int inumeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); @@ -120,12 +120,12 @@ namespace LAMMPS_NS { /** Convert a string to an integer number while checking * if it is a valid integer number (bigint) * - * \param file name of source file for error message - * \param line in source file for error message - * \param str string to be converted to number + * \param file name of source file for error message + * \param line line number in source file for error message + * \param str string to be converted to number * \param do_abort determines whether to call Error::one() or Error::all() - * \param lmp pointer to top-level LAMMPS class instance - * \return integer number (bigint) + * \param lmp pointer to top-level LAMMPS class instance + * \return integer number (bigint) */ bigint bnumeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); @@ -133,16 +133,94 @@ namespace LAMMPS_NS { /** Convert a string to an integer number while checking * if it is a valid integer number (tagint) * - * \param file name of source file for error message - * \param line in source file for error message - * \param str string to be converted to number + * \param file name of source file for error message + * \param line line number in source file for error message + * \param str string to be converted to number * \param do_abort determines whether to call Error::one() or Error::all() - * \param lmp pointer to top-level LAMMPS class instance - * \return integer number (tagint) + * \param lmp pointer to top-level LAMMPS class instance + * \return integer number (tagint) */ tagint tnumeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); + /** Compute index bounds derived from a string with a possible wildcard + * +\verbatim embed:rst + +This functions processes the string in *str* and set the values of *nlo* +and *nhi* according to the following five cases: +#. a single number *i*: nlo = i; nhi = i; +#. a single asterix *\*\ *: nlo = nmin; nhi = nmax; +#. a single number followed by an asterix *i\*\ *: nlo = i; nhi = nmax; +#. a single asterix followed by a number *\*\ i*: nlo = nmin; nhi = i; +#. two numbers with an asterix in between *i\*\ j*: nlo = i; nhi = j; +\endverbatim + + * \param file name of source file for error message + * \param line line number in source file for error message + * \param str string to be processed + * \param nmin smallest possible lower bound + * \param nmax largest allowed upper bound + * \param nlo lower bound + * \param nhi upper bound + * \param error pointer to Error class for out-of-bounds error message + */ + void bounds(const char *file, int line, char *str, + int nmin, int nmax, int &nlo, int &nhi, Error *error); + + /** Compute index bounds derived from a string with a possible wildcard + * +\verbatim embed:rst +This functions processes the string in *str* and set the values of *nlo* +and *nhi* according to the following five cases: +#. a single number *i*: nlo = i; nhi = i; +#. a single asterix *\*\ *: nlo = nmin; nhi = nmax; +#. a single number followed by an asterix *i\*\ *: nlo = i; nhi = nmax; +#. a single asterix followed by a number *\*\ i*: nlo = nmin; nhi = i; +#. two numbers with an asterix in between *i\*\ j*: nlo = i; nhi = j; +\endverbatim + + * \param file name of source file for error message + * \param line line number in source file for error message + * \param str string to be processed + * \param nmin smallest possible lower bound + * \param nmax largest allowed upper bound + * \param nlo lower bound + * \param nhi upper bound + * \param error pointer to Error class for out-of-bounds error message + */ + void boundsbig(const char *file, int line, char *str, + bigint nmin, bigint nmax, bigint &nlo, bigint &nhi, + Error *error); + + /** Expand list of arguments when containing fix/compute wildcards + * + * This function searches the list of arguments in *arg* for strings + * of the kind c_ID[*] or f_ID[*] referring to computes or fixes. + * Any such strings are replaced by one or more strings with the + * '*' character replaced by the corresponding possible numbers as + * determined from the fix or compute instance. Other strings are + * just copied. If the *mode* parameter is set to 0, expand global + * vectors, but not global arrays; if it is set to 1, expand global + * arrays (by column) but not global vectors. + * + * If any expansion happens, the earg list and all its + * strings are new allocations and must be freed explicitly by the + * caller. Otherwise arg and earg will point to the same address + * and no explicit deallocation is needed by the caller. + * + * \param file name of source file for error message + * \param line line number in source file for error message + * \param narg number of arguments in current list + * \param arg argument list, possibly containing wildcards + * \param mode select between global vectors(=0) and arrays (=1) + * \param earg new argument list with wildcards expanded + * \param lmp pointer to top-level LAMMPS class instance + * \return number of arguments in expanded list + */ + int expand_args(const char *file, int line, int narg, char **arg, + int mode, char **&earg, LAMMPS *lmp); + /** Trim leading and trailing whitespace. Like TRIM() in Fortran. * * \param line string that should be trimmed