replace atoi() with suitable utility functions
This commit is contained in:
@ -120,8 +120,8 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// If ngpu is 0, autoset ngpu to the number of devices per node matching
|
||||
// best device
|
||||
int ngpu = atoi(arg[3]);
|
||||
if (ngpu < 0) error->all(FLERR,"Illegal package gpu command");
|
||||
int ngpu = utils::inumeric(FLERR, arg[3], false, lmp);
|
||||
if (ngpu < 0) error->all(FLERR,"Illegal number of GPUs ({}) in package gpu command", ngpu);
|
||||
|
||||
// Negative value indicate GPU package should find the best device ID
|
||||
int first_gpu_id = -1;
|
||||
|
||||
@ -98,9 +98,7 @@ ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) :
|
||||
descriptorflag = 1;
|
||||
} else if (strcmp(arg[iarg],"gradgradflag") == 0) {
|
||||
if (iarg+1 > narg) error->all(FLERR,"Illegal compute mliap command");
|
||||
gradgradflag = atoi(arg[iarg+1]);
|
||||
if (gradgradflag != 0 && gradgradflag != 1)
|
||||
error->all(FLERR,"Illegal compute mliap command");
|
||||
gradgradflag = utils::logical(FLERR, arg[iarg+1], false, lmp);
|
||||
iarg += 2;
|
||||
} else
|
||||
error->all(FLERR,"Illegal compute mliap command");
|
||||
|
||||
@ -4274,12 +4274,14 @@ void FixBondReact::readID(char *strarg, int iconstr, int myrxn, int i)
|
||||
if (isalpha(strarg[0])) {
|
||||
constraints[iconstr][myrxn].idtype[i] = FRAG; // fragment vs. atom ID flag
|
||||
int ifragment = onemol->findfragment(strarg);
|
||||
if (ifragment < 0) error->one(FLERR,"Fix bond/react: Molecule fragment does not exist");
|
||||
if (ifragment < 0)
|
||||
error->one(FLERR,"Fix bond/react: Molecule fragment {} does not exist", strarg);
|
||||
constraints[iconstr][myrxn].id[i] = ifragment;
|
||||
} else {
|
||||
constraints[iconstr][myrxn].idtype[i] = ATOM; // fragment vs. atom ID flag
|
||||
int iatom = atoi(strarg);
|
||||
if (iatom > onemol->natoms) error->one(FLERR,"Fix bond/react: Invalid template atom ID in map file");
|
||||
int iatom = utils::inumeric(FLERR, strarg, true, lmp);
|
||||
if (iatom > onemol->natoms)
|
||||
error->one(FLERR,"Fix bond/react: Invalid template atom ID {} in map file", strarg);
|
||||
constraints[iconstr][myrxn].id[i] = iatom;
|
||||
}
|
||||
}
|
||||
@ -4287,7 +4289,7 @@ void FixBondReact::readID(char *strarg, int iconstr, int myrxn, int i)
|
||||
void FixBondReact::open(char *file)
|
||||
{
|
||||
fp = fopen(file,"r");
|
||||
if (fp == nullptr) error->one(FLERR, "Fix bond/react: Cannot open map file {}",file);
|
||||
if (fp == nullptr) error->one(FLERR, "Fix bond/react: Cannot open map file {}", file);
|
||||
}
|
||||
|
||||
void FixBondReact::readline(char *line)
|
||||
|
||||
Reference in New Issue
Block a user