use std::stoX() functions
This commit is contained in:
@ -13,21 +13,23 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "compute_bond_local.h"
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "update.h"
|
||||
#include "domain.h"
|
||||
#include "force.h"
|
||||
#include "bond.h"
|
||||
#include "comm.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "input.h"
|
||||
#include "variable.h"
|
||||
#include "math_extra.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "update.h"
|
||||
#include "variable.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -81,7 +83,7 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) :
|
||||
vstr[nvar] = utils::strdup(&arg[iarg][2]);
|
||||
nvar++;
|
||||
} else if (arg[iarg][0] == 'b') {
|
||||
int n = atoi(&arg[iarg][1]);
|
||||
int n = std::stoi(&arg[iarg][1]);
|
||||
if (n <= 0) error->all(FLERR, "Invalid keyword {} in compute bond/local command", arg[iarg]);
|
||||
bstyle[nvalues] = BN;
|
||||
bindex[nvalues++] = n - 1;
|
||||
|
||||
@ -67,7 +67,7 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) :
|
||||
else if (strcmp(arg[iarg], "dz") == 0)
|
||||
pstyle[nvalues++] = DZ;
|
||||
else if (arg[iarg][0] == 'p') {
|
||||
int n = atoi(&arg[iarg][1]);
|
||||
int n = std::stoi(&arg[iarg][1]);
|
||||
if (n <= 0) error->all(FLERR, "Invalid keyword {} in compute pair/local command", arg[iarg]);
|
||||
pstyle[nvalues] = PN;
|
||||
pindex[nvalues++] = n - 1;
|
||||
|
||||
@ -191,7 +191,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
||||
int me,nprocs;
|
||||
MPI_Comm_rank(communicator,&me);
|
||||
MPI_Comm_size(communicator,&nprocs);
|
||||
int color = atoi(arg[iarg+1]);
|
||||
int color = std::stoi(arg[iarg+1]);
|
||||
MPI_Comm subcomm;
|
||||
MPI_Comm_split(communicator,color,me,&subcomm);
|
||||
external_comm = communicator;
|
||||
|
||||
@ -484,7 +484,7 @@ void ReaderNative::read_atoms(int n, int nfield, double **fields)
|
||||
// convert selected fields to floats
|
||||
|
||||
for (int m = 0; m < nfield; m++)
|
||||
fields[i][m] = atof(words[fieldindex[m]].c_str());
|
||||
fields[i][m] = std::stod(words[fieldindex[m]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,10 +181,10 @@ void Universe::add_world(char *str)
|
||||
if ((found == 0) || (found == (part.size() - 1))) {
|
||||
valid = false;
|
||||
} else if (found == std::string::npos) {
|
||||
nper = atoi(part.c_str());
|
||||
nper = std::stoi(part);
|
||||
} else {
|
||||
n = atoi(part.substr(0,found).c_str());
|
||||
nper = atoi(part.substr(found+1).c_str());
|
||||
n = std::stoi(part.substr(0,found));
|
||||
nper = std::stoi(part.substr(found+1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,8 +193,7 @@ void Universe::add_world(char *str)
|
||||
if (n < 1 || nper < 1) valid = false;
|
||||
|
||||
if (!valid)
|
||||
error->universe_all(FLERR,fmt::format("Invalid partition string '{}'",
|
||||
str));
|
||||
error->universe_all(FLERR, fmt::format("Invalid partition string '{}'", str));
|
||||
} else nper = nprocs;
|
||||
|
||||
memory->grow(procs_per_world,nworlds+n,"universe:procs_per_world");
|
||||
|
||||
@ -152,7 +152,7 @@ void WriteCoeff::command(int narg, char **arg)
|
||||
}
|
||||
|
||||
// parse type number and skip over it
|
||||
int type = atoi(str);
|
||||
int type = std::stoi(str);
|
||||
char *p = str;
|
||||
while ((*p != '\0') && (*p == ' ')) ++p;
|
||||
while ((*p != '\0') && isdigit(*p)) ++p;
|
||||
|
||||
Reference in New Issue
Block a user