git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10161 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2013-06-28 19:06:37 +00:00
parent aa33af4032
commit f37ae6cb74
48 changed files with 283 additions and 312 deletions

View File

@ -17,6 +17,7 @@
#include "atom_vec_body.h" #include "atom_vec_body.h"
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
#include "force.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -29,8 +30,8 @@ BodyNparticle::BodyNparticle(LAMMPS *lmp, int narg, char **arg) :
{ {
if (narg != 3) error->all(FLERR,"Invalid body nparticle command"); if (narg != 3) error->all(FLERR,"Invalid body nparticle command");
int nmin = atoi(arg[1]); int nmin = force->inumeric(FLERR,arg[1]);
int nmax = atoi(arg[2]); int nmax = force->inumeric(FLERR,arg[2]);
if (nmin <= 0 || nmin > nmax) if (nmin <= 0 || nmin > nmax)
error->all(FLERR,"Invalid body nparticle command"); error->all(FLERR,"Invalid body nparticle command");

View File

@ -352,9 +352,9 @@ void PairLJCutDipoleLong::settings(int narg, char **arg)
if (narg < 1 || narg > 2) if (narg < 1 || narg > 2)
error->all(FLERR,"Incorrect args in pair_style command"); error->all(FLERR,"Incorrect args in pair_style command");
cut_lj_global = atof(arg[0]); cut_lj_global = force->numeric(FLERR,arg[0]);
if (narg == 1) cut_coul = cut_lj_global; if (narg == 1) cut_coul = cut_lj_global;
else cut_coul = atof(arg[1]); else cut_coul = force->numeric(FLERR,arg[1]);
// reset cutoffs that have been explicitly set // reset cutoffs that have been explicitly set
@ -380,11 +380,11 @@ void PairLJCutDipoleLong::coeff(int narg, char **arg)
force->bounds(arg[0],atom->ntypes,ilo,ihi); force->bounds(arg[0],atom->ntypes,ilo,ihi);
force->bounds(arg[1],atom->ntypes,jlo,jhi); force->bounds(arg[1],atom->ntypes,jlo,jhi);
double epsilon_one = atof(arg[2]); double epsilon_one = force->numeric(FLERR,arg[2]);
double sigma_one = atof(arg[3]); double sigma_one = force->numeric(FLERR,arg[3]);
double cut_lj_one = cut_lj_global; double cut_lj_one = cut_lj_global;
if (narg == 5) cut_lj_one = atof(arg[4]); if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]);
int count = 0; int count = 0;
for (int i = ilo; i <= ihi; i++) { for (int i = ilo; i <= ihi; i++) {

View File

@ -375,18 +375,18 @@ void PairBrownian::settings(int narg, char **arg)
{ {
if (narg != 7 && narg != 9) error->all(FLERR,"Illegal pair_style command"); if (narg != 7 && narg != 9) error->all(FLERR,"Illegal pair_style command");
mu = atof(arg[0]); mu = force->numeric(FLERR,arg[0]);
flaglog = atoi(arg[1]); flaglog = force->inumeric(FLERR,arg[1]);
flagfld = atoi(arg[2]); flagfld = force->inumeric(FLERR,arg[2]);
cut_inner_global = atof(arg[3]); cut_inner_global = force->numeric(FLERR,arg[3]);
cut_global = atof(arg[4]); cut_global = force->numeric(FLERR,arg[4]);
t_target = atof(arg[5]); t_target = force->numeric(FLERR,arg[5]);
seed = atoi(arg[6]); seed = force->inumeric(FLERR,arg[6]);
flagHI = flagVF = 1; flagHI = flagVF = 1;
if (narg == 9) { if (narg == 9) {
flagHI = atoi(arg[7]); flagHI = force->inumeric(FLERR,arg[7]);
flagVF = atoi(arg[8]); flagVF = force->inumeric(FLERR,arg[8]);
} }
if (flaglog == 1 && flagHI == 0) { if (flaglog == 1 && flagHI == 0) {
@ -431,8 +431,8 @@ void PairBrownian::coeff(int narg, char **arg)
double cut_one = cut_global; double cut_one = cut_global;
if (narg == 4) { if (narg == 4) {
cut_inner_one = atof(arg[2]); cut_inner_one = force->numeric(FLERR,arg[2]);
cut_one = atof(arg[3]); cut_one = force->numeric(FLERR,arg[3]);
} }
int count = 0; int count = 0;

View File

@ -486,16 +486,16 @@ void PairLubricate::settings(int narg, char **arg)
{ {
if (narg != 5 && narg != 7) error->all(FLERR,"Illegal pair_style command"); if (narg != 5 && narg != 7) error->all(FLERR,"Illegal pair_style command");
mu = atof(arg[0]); mu = force->numeric(FLERR,arg[0]);
flaglog = atoi(arg[1]); flaglog = force->inumeric(FLERR,arg[1]);
flagfld = atoi(arg[2]); flagfld = force->inumeric(FLERR,arg[2]);
cut_inner_global = atof(arg[3]); cut_inner_global = force->numeric(FLERR,arg[3]);
cut_global = atof(arg[4]); cut_global = force->numeric(FLERR,arg[4]);
flagHI = flagVF = 1; flagHI = flagVF = 1;
if (narg == 7) { if (narg == 7) {
flagHI = atoi(arg[5]); flagHI = force->inumeric(FLERR,arg[5]);
flagVF = atoi(arg[6]); flagVF = force->inumeric(FLERR,arg[6]);
} }
if (flaglog == 1 && flagHI == 0) { if (flaglog == 1 && flagHI == 0) {
@ -534,8 +534,8 @@ void PairLubricate::coeff(int narg, char **arg)
double cut_inner_one = cut_inner_global; double cut_inner_one = cut_inner_global;
double cut_one = cut_global; double cut_one = cut_global;
if (narg == 4) { if (narg == 4) {
cut_inner_one = atof(arg[2]); cut_inner_one = force->numeric(FLERR,arg[2]);
cut_one = atof(arg[3]); cut_one = force->numeric(FLERR,arg[3]);
} }
int count = 0; int count = 0;

View File

@ -1761,16 +1761,16 @@ void PairLubricateU::settings(int narg, char **arg)
{ {
if (narg != 5 && narg != 7) error->all(FLERR,"Illegal pair_style command"); if (narg != 5 && narg != 7) error->all(FLERR,"Illegal pair_style command");
mu = atof(arg[0]); mu = force->numeric(FLERR,arg[0]);
flaglog = atoi(arg[1]); flaglog = force->inumeric(FLERR,arg[1]);
cut_inner_global = atof(arg[2]); cut_inner_global = force->numeric(FLERR,arg[2]);
cut_global = atof(arg[3]); cut_global = force->numeric(FLERR,arg[3]);
gdot = atof(arg[4]); gdot = force->numeric(FLERR,arg[4]);
flagHI = flagVF = 1; flagHI = flagVF = 1;
if (narg == 7) { if (narg == 7) {
flagHI = atoi(arg[5]); flagHI = force->inumeric(FLERR,arg[5]);
flagVF = atoi(arg[6]); flagVF = force->inumeric(FLERR,arg[6]);
} }
if (flaglog == 1 && flagHI == 0) { if (flaglog == 1 && flagHI == 0) {
@ -1822,8 +1822,8 @@ void PairLubricateU::coeff(int narg, char **arg)
double cut_inner_one = cut_inner_global; double cut_inner_one = cut_inner_global;
double cut_one = cut_global; double cut_one = cut_global;
if (narg == 4) { if (narg == 4) {
cut_inner_one = atof(arg[2]); cut_inner_one = force->numeric(FLERR,arg[2]);
cut_one = atof(arg[3]); cut_one = force->numeric(FLERR,arg[3]);
} }
int count = 0; int count = 0;

View File

@ -53,9 +53,9 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) :
// required args // required args
ninsert = atoi(arg[3]); ninsert = force->inumeric(FLERR,arg[3]);
ntype = atoi(arg[4]); ntype = force->inumeric(FLERR,arg[4]);
seed = atoi(arg[5]); seed = force->inumeric(FLERR,arg[5]);
if (seed <= 0) error->all(FLERR,"Illegal fix pour command"); if (seed <= 0) error->all(FLERR,"Illegal fix pour command");
@ -86,20 +86,20 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(arg[iarg+1],"one") == 0) { if (strcmp(arg[iarg+1],"one") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command");
dstyle = ONE; dstyle = ONE;
radius_one = 0.5 * atof(arg[iarg+2]); radius_one = 0.5 * force->numeric(FLERR,arg[iarg+2]);
radius_max = radius_one; radius_max = radius_one;
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg+1],"range") == 0) { } else if (strcmp(arg[iarg+1],"range") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix pour command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix pour command");
dstyle = RANGE; dstyle = RANGE;
radius_lo = 0.5 * atof(arg[iarg+2]); radius_lo = 0.5 * force->numeric(FLERR,arg[iarg+2]);
radius_hi = 0.5 * atof(arg[iarg+3]); radius_hi = 0.5 * force->numeric(FLERR,arg[iarg+3]);
radius_max = radius_hi; radius_max = radius_hi;
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg+1],"poly") == 0) { } else if (strcmp(arg[iarg+1],"poly") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command");
dstyle = POLY; dstyle = POLY;
npoly = atoi(arg[iarg+2]); npoly = force->inumeric(FLERR,arg[iarg+2]);
if (npoly <= 0) error->all(FLERR,"Illegal fix pour command"); if (npoly <= 0) error->all(FLERR,"Illegal fix pour command");
if (iarg+3 + 2*npoly > narg) if (iarg+3 + 2*npoly > narg)
error->all(FLERR,"Illegal fix pour command"); error->all(FLERR,"Illegal fix pour command");
@ -108,8 +108,8 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) :
iarg += 3; iarg += 3;
radius_max = 0.0; radius_max = 0.0;
for (int i = 0; i < npoly; i++) { for (int i = 0; i < npoly; i++) {
radius_poly[i] = 0.5 * atof(arg[iarg++]); radius_poly[i] = 0.5 * force->numeric(FLERR,arg[iarg++]);
frac_poly[i] = atof(arg[iarg++]); frac_poly[i] = force->numeric(FLERR,arg[iarg++]);
if (radius_poly[i] <= 0.0 || frac_poly[i] < 0.0) if (radius_poly[i] <= 0.0 || frac_poly[i] < 0.0)
error->all(FLERR,"Illegal fix pour command"); error->all(FLERR,"Illegal fix pour command");
radius_max = MAX(radius_max,radius_poly[i]); radius_max = MAX(radius_max,radius_poly[i]);
@ -124,32 +124,32 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"dens") == 0) { } else if (strcmp(arg[iarg],"dens") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command");
density_lo = atof(arg[iarg+1]); density_lo = force->numeric(FLERR,arg[iarg+1]);
density_hi = atof(arg[iarg+2]); density_hi = force->numeric(FLERR,arg[iarg+2]);
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"vol") == 0) { } else if (strcmp(arg[iarg],"vol") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command");
volfrac = atof(arg[iarg+1]); volfrac = force->numeric(FLERR,arg[iarg+1]);
maxattempt = atoi(arg[iarg+2]); maxattempt = force->inumeric(FLERR,arg[iarg+2]);
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"rate") == 0) { } else if (strcmp(arg[iarg],"rate") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command");
rate = atof(arg[iarg+1]); rate = force->numeric(FLERR,arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"vel") == 0) { } else if (strcmp(arg[iarg],"vel") == 0) {
if (domain->dimension == 3) { if (domain->dimension == 3) {
if (iarg+6 > narg) error->all(FLERR,"Illegal fix pour command"); if (iarg+6 > narg) error->all(FLERR,"Illegal fix pour command");
vxlo = atof(arg[iarg+1]); vxlo = force->numeric(FLERR,arg[iarg+1]);
vxhi = atof(arg[iarg+2]); vxhi = force->numeric(FLERR,arg[iarg+2]);
vylo = atof(arg[iarg+3]); vylo = force->numeric(FLERR,arg[iarg+3]);
vyhi = atof(arg[iarg+4]); vyhi = force->numeric(FLERR,arg[iarg+4]);
vz = atof(arg[iarg+5]); vz = force->numeric(FLERR,arg[iarg+5]);
iarg += 6; iarg += 6;
} else { } else {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix pour command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix pour command");
vxlo = atof(arg[iarg+1]); vxlo = force->numeric(FLERR,arg[iarg+1]);
vxhi = atof(arg[iarg+2]); vxhi = force->numeric(FLERR,arg[iarg+2]);
vy = atof(arg[iarg+3]); vy = force->numeric(FLERR,arg[iarg+3]);
vz = 0.0; vz = 0.0;
iarg += 4; iarg += 4;
} }

View File

@ -34,7 +34,7 @@ using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
using namespace MathConst; using namespace MathConst;
enum{XPLANE,YPLANE,ZPLANE,ZCYLINDER}; // XYZ PLANE need to be 0,1,2 enum{XPLANE=0,YPLANE=1,ZPLANE=2,ZCYLINDER}; // XYZ PLANE need to be 0,1,2
enum{HOOKE,HOOKE_HISTORY,HERTZ_HISTORY}; enum{HOOKE,HOOKE_HISTORY,HERTZ_HISTORY};
#define BIG 1.0e20 #define BIG 1.0e20
@ -54,16 +54,16 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
// wall/particle coefficients // wall/particle coefficients
kn = atof(arg[3]); kn = force->numeric(FLERR,arg[3]);
if (strcmp(arg[4],"NULL") == 0) kt = kn * 2.0/7.0; if (strcmp(arg[4],"NULL") == 0) kt = kn * 2.0/7.0;
else kt = atof(arg[4]); else kt = force->numeric(FLERR,arg[4]);
gamman = atof(arg[5]); gamman = force->numeric(FLERR,arg[5]);
if (strcmp(arg[6],"NULL") == 0) gammat = 0.5 * gamman; if (strcmp(arg[6],"NULL") == 0) gammat = 0.5 * gamman;
else gammat = atof(arg[6]); else gammat = force->numeric(FLERR,arg[6]);
xmu = atof(arg[7]); xmu = force->numeric(FLERR,arg[7]);
int dampflag = atoi(arg[8]); int dampflag = force->inumeric(FLERR,arg[8]);
if (dampflag == 0) gammat = 0.0; if (dampflag == 0) gammat = 0.0;
if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 ||
@ -84,31 +84,31 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command");
wallstyle = XPLANE; wallstyle = XPLANE;
if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG;
else lo = atof(arg[iarg+1]); else lo = force->numeric(FLERR,arg[iarg+1]);
if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG;
else hi = atof(arg[iarg+2]); else hi = force->numeric(FLERR,arg[iarg+2]);
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"yplane") == 0) { } else if (strcmp(arg[iarg],"yplane") == 0) {
if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command");
wallstyle = YPLANE; wallstyle = YPLANE;
if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG;
else lo = atof(arg[iarg+1]); else lo = force->numeric(FLERR,arg[iarg+1]);
if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG;
else hi = atof(arg[iarg+2]); else hi = force->numeric(FLERR,arg[iarg+2]);
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"zplane") == 0) { } else if (strcmp(arg[iarg],"zplane") == 0) {
if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command");
wallstyle = ZPLANE; wallstyle = ZPLANE;
if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG;
else lo = atof(arg[iarg+1]); else lo = force->numeric(FLERR,arg[iarg+1]);
if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG;
else hi = atof(arg[iarg+2]); else hi = force->numeric(FLERR,arg[iarg+2]);
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"zcylinder") == 0) { } else if (strcmp(arg[iarg],"zcylinder") == 0) {
if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/gran command"); if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/gran command");
wallstyle = ZCYLINDER; wallstyle = ZCYLINDER;
lo = hi = 0.0; lo = hi = 0.0;
cylradius = atof(arg[iarg+1]); cylradius = force->numeric(FLERR,arg[iarg+1]);
iarg += 2; iarg += 2;
} }
@ -124,8 +124,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[iarg+1],"y") == 0) axis = 1; else if (strcmp(arg[iarg+1],"y") == 0) axis = 1;
else if (strcmp(arg[iarg+1],"z") == 0) axis = 2; else if (strcmp(arg[iarg+1],"z") == 0) axis = 2;
else error->all(FLERR,"Illegal fix wall/gran command"); else error->all(FLERR,"Illegal fix wall/gran command");
amplitude = atof(arg[iarg+2]); amplitude = force->numeric(FLERR,arg[iarg+2]);
period = atof(arg[iarg+3]); period = force->numeric(FLERR,arg[iarg+3]);
wiggle = 1; wiggle = 1;
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"shear") == 0) { } else if (strcmp(arg[iarg],"shear") == 0) {
@ -134,7 +134,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[iarg+1],"y") == 0) axis = 1; else if (strcmp(arg[iarg+1],"y") == 0) axis = 1;
else if (strcmp(arg[iarg+1],"z") == 0) axis = 2; else if (strcmp(arg[iarg+1],"z") == 0) axis = 2;
else error->all(FLERR,"Illegal fix wall/gran command"); else error->all(FLERR,"Illegal fix wall/gran command");
vshear = atof(arg[iarg+2]); vshear = force->numeric(FLERR,arg[iarg+2]);
wshear = 1; wshear = 1;
iarg += 3; iarg += 3;
} else error->all(FLERR,"Illegal fix wall/gran command"); } else error->all(FLERR,"Illegal fix wall/gran command");

View File

@ -48,7 +48,7 @@ Ewald::Ewald(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg)
group_group_enable = 1; group_group_enable = 1;
group_allocate_flag = 0; group_allocate_flag = 0;
accuracy_relative = atof(arg[0]); accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
kmax = 0; kmax = 0;
kxvecs = kyvecs = kzvecs = NULL; kxvecs = kyvecs = kzvecs = NULL;

View File

@ -50,7 +50,7 @@ EwaldDisp::EwaldDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg)
if (narg!=1) error->all(FLERR,"Illegal kspace_style ewald/n command"); if (narg!=1) error->all(FLERR,"Illegal kspace_style ewald/n command");
ewaldflag = dispersionflag = dipoleflag = 1; ewaldflag = dispersionflag = dipoleflag = 1;
accuracy_relative = fabs(atof(arg[0])); accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
memset(function, 0, EWALD_NORDER*sizeof(int)); memset(function, 0, EWALD_NORDER*sizeof(int));
kenergy = kvirial = NULL; kenergy = kvirial = NULL;

View File

@ -51,7 +51,7 @@ MSM::MSM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg)
msmflag = 1; msmflag = 1;
accuracy_relative = atof(arg[0]); accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
nfactors = 1; nfactors = 1;
factors = new int[nfactors]; factors = new int[nfactors];
@ -298,7 +298,7 @@ double MSM::estimate_cutoff(double h, double prd)
a = C_p*pow(h,(p-1))/accuracy; a = C_p*pow(h,(p-1))/accuracy;
// include dependency of error on other terms // include dependency of error on other terms
a *= q2/(prd*sqrt(atom->natoms)); a *= q2/(prd*sqrt(double(atom->natoms)));
a = pow(a,1.0/double(p)); a = pow(a,1.0/double(p));
@ -349,7 +349,7 @@ double MSM::estimate_1d_error(double h, double prd)
double error_1d = C_p*pow(h,(p-1))/pow(a,(p+1)); double error_1d = C_p*pow(h,(p-1))/pow(a,(p+1));
// include dependency of error on other terms // include dependency of error on other terms
error_1d *= q2*a/(prd*sqrt(atom->natoms)); error_1d *= q2*a/(prd*sqrt(double(atom->natoms)));
return error_1d; return error_1d;
} }

View File

@ -50,7 +50,7 @@ MSMCG::MSMCG(LAMMPS *lmp, int narg, char **arg) : MSM(lmp, narg, arg)
triclinic_support = 0; triclinic_support = 0;
if (narg == 2) smallq = atof(arg[1]); if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1]));
else smallq = SMALLQ; else smallq = SMALLQ;
num_charged = -1; num_charged = -1;

View File

@ -72,7 +72,7 @@ PPPM::PPPM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg)
pppmflag = 1; pppmflag = 1;
group_group_enable = 1; group_group_enable = 1;
accuracy_relative = atof(arg[0]); accuracy_relative = fabs(force->numeric(FLERR,arg[0]));
nfactors = 3; nfactors = 3;
factors = new int[nfactors]; factors = new int[nfactors];

View File

@ -55,7 +55,7 @@ PPPMCG::PPPMCG(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg)
triclinic_support = 0; triclinic_support = 0;
if (narg == 2) smallq = atof(arg[1]); if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1]));
else smallq = SMALLQ; else smallq = SMALLQ;
num_charged = -1; num_charged = -1;

View File

@ -39,7 +39,7 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) :
MPI_Comm_rank(world,&me); MPI_Comm_rank(world,&me);
nevery = atoi(arg[3]); nevery = force->inumeric(FLERR,arg[3]);
if (nevery <= 0) error->all(FLERR,"Illegal fix bond/break command"); if (nevery <= 0) error->all(FLERR,"Illegal fix bond/break command");
force_reneighbor = 1; force_reneighbor = 1;
@ -49,8 +49,8 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) :
global_freq = 1; global_freq = 1;
extvector = 0; extvector = 0;
btype = atoi(arg[4]); btype = force->inumeric(FLERR,arg[4]);
double cutoff = atof(arg[5]); double cutoff = force->numeric(FLERR,arg[5]);
if (btype < 1 || btype > atom->nbondtypes) if (btype < 1 || btype > atom->nbondtypes)
error->all(FLERR,"Invalid bond type in fix bond/break command"); error->all(FLERR,"Invalid bond type in fix bond/break command");
@ -67,8 +67,8 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"prob") == 0) { if (strcmp(arg[iarg],"prob") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/break command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/break command");
fraction = atof(arg[iarg+1]); fraction = force->numeric(FLERR,arg[iarg+1]);
seed = atoi(arg[iarg+2]); seed = force->inumeric(FLERR,arg[iarg+2]);
if (fraction < 0.0 || fraction > 1.0) if (fraction < 0.0 || fraction > 1.0)
error->all(FLERR,"Illegal fix bond/break command"); error->all(FLERR,"Illegal fix bond/break command");
if (seed <= 0) error->all(FLERR,"Illegal fix bond/break command"); if (seed <= 0) error->all(FLERR,"Illegal fix bond/break command");

View File

@ -43,7 +43,7 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) :
MPI_Comm_rank(world,&me); MPI_Comm_rank(world,&me);
nevery = atoi(arg[3]); nevery = force->inumeric(FLERR,arg[3]);
if (nevery <= 0) error->all(FLERR,"Illegal fix bond/create command"); if (nevery <= 0) error->all(FLERR,"Illegal fix bond/create command");
force_reneighbor = 1; force_reneighbor = 1;
@ -53,10 +53,10 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) :
global_freq = 1; global_freq = 1;
extvector = 0; extvector = 0;
iatomtype = atoi(arg[4]); iatomtype = force->inumeric(FLERR,arg[4]);
jatomtype = atoi(arg[5]); jatomtype = force->inumeric(FLERR,arg[5]);
double cutoff = atof(arg[6]); double cutoff = force->numeric(FLERR,arg[6]);
btype = atoi(arg[7]); btype = force->inumeric(FLERR,arg[7]);
if (iatomtype < 1 || iatomtype > atom->ntypes || if (iatomtype < 1 || iatomtype > atom->ntypes ||
jatomtype < 1 || jatomtype > atom->ntypes) jatomtype < 1 || jatomtype > atom->ntypes)
@ -80,24 +80,24 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"iparam") == 0) { if (strcmp(arg[iarg],"iparam") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command");
imaxbond = atoi(arg[iarg+1]); imaxbond = force->inumeric(FLERR,arg[iarg+1]);
inewtype = atoi(arg[iarg+2]); inewtype = force->inumeric(FLERR,arg[iarg+2]);
if (imaxbond < 0) error->all(FLERR,"Illegal fix bond/create command"); if (imaxbond < 0) error->all(FLERR,"Illegal fix bond/create command");
if (inewtype < 1 || inewtype > atom->ntypes) if (inewtype < 1 || inewtype > atom->ntypes)
error->all(FLERR,"Invalid atom type in fix bond/create command"); error->all(FLERR,"Invalid atom type in fix bond/create command");
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"jparam") == 0) { } else if (strcmp(arg[iarg],"jparam") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command");
jmaxbond = atoi(arg[iarg+1]); jmaxbond = force->inumeric(FLERR,arg[iarg+1]);
jnewtype = atoi(arg[iarg+2]); jnewtype = force->inumeric(FLERR,arg[iarg+2]);
if (jmaxbond < 0) error->all(FLERR,"Illegal fix bond/create command"); if (jmaxbond < 0) error->all(FLERR,"Illegal fix bond/create command");
if (jnewtype < 1 || jnewtype > atom->ntypes) if (jnewtype < 1 || jnewtype > atom->ntypes)
error->all(FLERR,"Invalid atom type in fix bond/create command"); error->all(FLERR,"Invalid atom type in fix bond/create command");
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"prob") == 0) { } else if (strcmp(arg[iarg],"prob") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command");
fraction = atof(arg[iarg+1]); fraction = force->numeric(FLERR,arg[iarg+1]);
seed = atoi(arg[iarg+2]); seed = force->inumeric(FLERR,arg[iarg+2]);
if (fraction < 0.0 || fraction > 1.0) if (fraction < 0.0 || fraction > 1.0)
error->all(FLERR,"Illegal fix bond/create command"); error->all(FLERR,"Illegal fix bond/create command");
if (seed <= 0) error->all(FLERR,"Illegal fix bond/create command"); if (seed <= 0) error->all(FLERR,"Illegal fix bond/create command");

View File

@ -49,13 +49,13 @@ FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) :
global_freq = 1; global_freq = 1;
extvector = 0; extvector = 0;
fraction = atof(arg[3]); fraction = force->numeric(FLERR,arg[3]);
double cutoff = atof(arg[4]); double cutoff = force->numeric(FLERR,arg[4]);
cutsq = cutoff*cutoff; cutsq = cutoff*cutoff;
// initialize Marsaglia RNG with processor-unique seed // initialize Marsaglia RNG with processor-unique seed
int seed = atoi(arg[5]); int seed = force->inumeric(FLERR,arg[5]);
random = new RanMars(lmp,seed + comm->me); random = new RanMars(lmp,seed + comm->me);
// create a new compute temp style // create a new compute temp style

View File

@ -58,14 +58,14 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) :
// required args // required args
nevery = atoi(arg[3]); nevery = force->inumeric(FLERR,arg[3]);
nexchanges = atoi(arg[4]); nexchanges = force->inumeric(FLERR,arg[4]);
nmcmoves = atoi(arg[5]); nmcmoves = force->inumeric(FLERR,arg[5]);
ngcmc_type = atoi(arg[6]); ngcmc_type = force->inumeric(FLERR,arg[6]);
seed = atoi(arg[7]); seed = force->inumeric(FLERR,arg[7]);
reservoir_temperature = atof(arg[8]); reservoir_temperature = force->numeric(FLERR,arg[8]);
chemical_potential = atof(arg[9]); chemical_potential = force->numeric(FLERR,arg[9]);
displace = atof(arg[10]); displace = force->numeric(FLERR,arg[10]);
if (nexchanges < 0) error->all(FLERR,"Illegal fix gcmc command"); if (nexchanges < 0) error->all(FLERR,"Illegal fix gcmc command");
if (nmcmoves < 0) error->all(FLERR,"Illegal fix gcmc command"); if (nmcmoves < 0) error->all(FLERR,"Illegal fix gcmc command");
@ -199,17 +199,17 @@ void FixGCMC::options(int narg, char **arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"maxangle") == 0) { } else if (strcmp(arg[iarg],"maxangle") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command");
max_rotation_angle = atof(arg[iarg+1]); max_rotation_angle = force->numeric(FLERR,arg[iarg+1]);
max_rotation_angle *= MY_PI/180; max_rotation_angle *= MY_PI/180;
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"pressure") == 0) { } else if (strcmp(arg[iarg],"pressure") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command");
pressure = atof(arg[iarg+1]); pressure = force->numeric(FLERR,arg[iarg+1]);
pressure_flag = true; pressure_flag = true;
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"fugacity_coeff") == 0) { } else if (strcmp(arg[iarg],"fugacity_coeff") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command");
fugacity_coeff = atof(arg[iarg+1]); fugacity_coeff = force->numeric(FLERR,arg[iarg+1]);
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix gcmc command"); } else error->all(FLERR,"Illegal fix gcmc command");
} }

View File

@ -207,9 +207,9 @@ void AngleCosinePeriodic::coeff(int narg, char **arg)
int ilo,ihi; int ilo,ihi;
force->bounds(arg[0],atom->nangletypes,ilo,ihi); force->bounds(arg[0],atom->nangletypes,ilo,ihi);
double c_one = atof(arg[1]); double c_one = force->numeric(FLERR,arg[1]);
int b_one = atoi(arg[2]); int b_one = force->inumeric(FLERR,arg[2]);
int n_one = atoi(arg[3]); int n_one = force->inumeric(FLERR,arg[3]);
if (n_one <= 0) error->all(FLERR,"Incorrect args for angle coefficients"); if (n_one <= 0) error->all(FLERR,"Incorrect args for angle coefficients");
int count = 0; int count = 0;

View File

@ -260,8 +260,8 @@ void ImproperUmbrella::coeff(int narg, char **arg)
int ilo,ihi; int ilo,ihi;
force->bounds(arg[0],atom->nimpropertypes,ilo,ihi); force->bounds(arg[0],atom->nimpropertypes,ilo,ihi);
double k_one = atof(arg[1]); double k_one = force->numeric(FLERR,arg[1]);
double w_one = atof(arg[2]); double w_one = force->numeric(FLERR,arg[2]);
// convert w0 from degrees to radians // convert w0 from degrees to radians

View File

@ -374,11 +374,11 @@ void PairPeriLPS::coeff(int narg, char **arg)
force->bounds(arg[0],atom->ntypes,ilo,ihi); force->bounds(arg[0],atom->ntypes,ilo,ihi);
force->bounds(arg[1],atom->ntypes,jlo,jhi); force->bounds(arg[1],atom->ntypes,jlo,jhi);
double bulkmodulus_one = atof(arg[2]); double bulkmodulus_one = force->numeric(FLERR,arg[2]);
double shearmodulus_one = atof(arg[3]); double shearmodulus_one = force->numeric(FLERR,arg[3]);
double cut_one = atof(arg[4]); double cut_one = force->numeric(FLERR,arg[4]);
double s00_one = atof(arg[5]); double s00_one = force->numeric(FLERR,arg[5]);
double alpha_one = atof(arg[6]); double alpha_one = force->numeric(FLERR,arg[6]);
int count = 0; int count = 0;
for (int i = ilo; i <= ihi; i++) { for (int i = ilo; i <= ihi; i++) {

View File

@ -41,7 +41,7 @@ FixReaxBonds::FixReaxBonds(LAMMPS *lmp, int narg, char **arg) :
MPI_Comm_rank(world,&me); MPI_Comm_rank(world,&me);
nevery = atoi(arg[3]); nevery = force->inumeric(FLERR,arg[3]);
if (nevery < 1) error->all(FLERR,"Illegal fix reax/bonds command"); if (nevery < 1) error->all(FLERR,"Illegal fix reax/bonds command");
if (me == 0) { if (me == 0) {

View File

@ -26,6 +26,7 @@
#include "fix_event.h" #include "fix_event.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "update.h" #include "update.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -42,7 +43,7 @@ ComputeEventDisplace::ComputeEventDisplace(LAMMPS *lmp, int narg, char **arg) :
scalar_flag = 1; scalar_flag = 1;
extscalar = 0; extscalar = 0;
double displace_dist = atof(arg[3]); double displace_dist = force->numeric(FLERR,arg[3]);
if (displace_dist <= 0.0) if (displace_dist <= 0.0)
error->all(FLERR,"Distance must be > 0 for compute event/displace"); error->all(FLERR,"Distance must be > 0 for compute event/displace");
displace_distsq = displace_dist * displace_dist; displace_distsq = displace_dist * displace_dist;

View File

@ -24,6 +24,7 @@
#include "atom.h" #include "atom.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "error.h"
#include "force.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -35,7 +36,7 @@ FixNEB::FixNEB(LAMMPS *lmp, int narg, char **arg) :
{ {
if (narg != 4) error->all(FLERR,"Illegal fix neb command"); if (narg != 4) error->all(FLERR,"Illegal fix neb command");
kspring = atof(arg[3]); kspring = force->numeric(FLERR,arg[3]);
if (kspring <= 0.0) error->all(FLERR,"Illegal fix neb command"); if (kspring <= 0.0) error->all(FLERR,"Illegal fix neb command");
// nreplica = number of partitions // nreplica = number of partitions

View File

@ -161,7 +161,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[3],"group") == 0) { } else if (strcmp(arg[3],"group") == 0) {
if (narg < 5) error->all(FLERR,"Illegal fix rigid command"); if (narg < 5) error->all(FLERR,"Illegal fix rigid command");
rstyle = GROUP; rstyle = GROUP;
nbody = atoi(arg[4]); nbody = force->inumeric(FLERR,arg[4]);
if (nbody <= 0) error->all(FLERR,"Illegal fix rigid command"); if (nbody <= 0) error->all(FLERR,"Illegal fix rigid command");
if (narg < 5+nbody) error->all(FLERR,"Illegal fix rigid command"); if (narg < 5+nbody) error->all(FLERR,"Illegal fix rigid command");
iarg = 5+nbody; iarg = 5+nbody;
@ -330,10 +330,10 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(style,"rigid") != 0 && strcmp(style,"rigid/nve") != 0) if (strcmp(style,"rigid") != 0 && strcmp(style,"rigid/nve") != 0)
error->all(FLERR,"Illegal fix rigid command"); error->all(FLERR,"Illegal fix rigid command");
langflag = 1; langflag = 1;
t_start = atof(arg[iarg+1]); t_start = force->numeric(FLERR,arg[iarg+1]);
t_stop = atof(arg[iarg+2]); t_stop = force->numeric(FLERR,arg[iarg+2]);
t_period = atof(arg[iarg+3]); t_period = force->numeric(FLERR,arg[iarg+3]);
seed = atoi(arg[iarg+4]); seed = force->inumeric(FLERR,arg[iarg+4]);
if (t_period <= 0.0) if (t_period <= 0.0)
error->all(FLERR,"Fix rigid langevin period must be > 0.0"); error->all(FLERR,"Fix rigid langevin period must be > 0.0");
if (seed <= 0) error->all(FLERR,"Illegal fix rigid command"); if (seed <= 0) error->all(FLERR,"Illegal fix rigid command");
@ -344,9 +344,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(style,"rigid/nvt") != 0 && strcmp(style,"rigid/npt") != 0) if (strcmp(style,"rigid/nvt") != 0 && strcmp(style,"rigid/npt") != 0)
error->all(FLERR,"Illegal fix rigid command"); error->all(FLERR,"Illegal fix rigid command");
tstat_flag = 1; tstat_flag = 1;
t_start = atof(arg[iarg+1]); t_start = force->numeric(FLERR,arg[iarg+1]);
t_stop = atof(arg[iarg+2]); t_stop = force->numeric(FLERR,arg[iarg+2]);
t_period = atof(arg[iarg+3]); t_period = force->numeric(FLERR,arg[iarg+3]);
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"iso") == 0) { } else if (strcmp(arg[iarg],"iso") == 0) {
@ -354,9 +354,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0) if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0)
error->all(FLERR,"Illegal fix rigid command"); error->all(FLERR,"Illegal fix rigid command");
pcouple = XYZ; pcouple = XYZ;
p_start[0] = p_start[1] = p_start[2] = atof(arg[iarg+1]); p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]);
p_stop[0] = p_stop[1] = p_stop[2] = atof(arg[iarg+2]); p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]);
p_period[0] = p_period[1] = p_period[2] = atof(arg[iarg+3]); p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]);
p_flag[0] = p_flag[1] = p_flag[2] = 1; p_flag[0] = p_flag[1] = p_flag[2] = 1;
if (dimension == 2) { if (dimension == 2) {
p_start[2] = p_stop[2] = p_period[2] = 0.0; p_start[2] = p_stop[2] = p_period[2] = 0.0;
@ -368,9 +368,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command");
if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0) if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0)
error->all(FLERR,"Illegal fix rigid command"); error->all(FLERR,"Illegal fix rigid command");
p_start[0] = p_start[1] = p_start[2] = atof(arg[iarg+1]); p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]);
p_stop[0] = p_stop[1] = p_stop[2] = atof(arg[iarg+2]); p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]);
p_period[0] = p_period[1] = p_period[2] = atof(arg[iarg+3]); p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]);
p_flag[0] = p_flag[1] = p_flag[2] = 1; p_flag[0] = p_flag[1] = p_flag[2] = 1;
if (dimension == 2) { if (dimension == 2) {
p_start[2] = p_stop[2] = p_period[2] = 0.0; p_start[2] = p_stop[2] = p_period[2] = 0.0;
@ -380,25 +380,25 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"x") == 0) { } else if (strcmp(arg[iarg],"x") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command");
p_start[0] = atof(arg[iarg+1]); p_start[0] = force->numeric(FLERR,arg[iarg+1]);
p_stop[0] = atof(arg[iarg+2]); p_stop[0] = force->numeric(FLERR,arg[iarg+2]);
p_period[0] = atof(arg[iarg+3]); p_period[0] = force->numeric(FLERR,arg[iarg+3]);
p_flag[0] = 1; p_flag[0] = 1;
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"y") == 0) { } else if (strcmp(arg[iarg],"y") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command");
p_start[1] = atof(arg[iarg+1]); p_start[1] = force->numeric(FLERR,arg[iarg+1]);
p_stop[1] = atof(arg[iarg+2]); p_stop[1] = force->numeric(FLERR,arg[iarg+2]);
p_period[1] = atof(arg[iarg+3]); p_period[1] = force->numeric(FLERR,arg[iarg+3]);
p_flag[1] = 1; p_flag[1] = 1;
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"z") == 0) { } else if (strcmp(arg[iarg],"z") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command");
p_start[2] = atof(arg[iarg+1]); p_start[2] = force->numeric(FLERR,arg[iarg+1]);
p_stop[2] = atof(arg[iarg+2]); p_stop[2] = force->numeric(FLERR,arg[iarg+2]);
p_period[2] = atof(arg[iarg+3]); p_period[2] = force->numeric(FLERR,arg[iarg+3]);
p_flag[2] = 1; p_flag[2] = 1;
iarg += 4; iarg += 4;
@ -433,16 +433,16 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command");
if (strcmp(style,"rigid/nvt") != 0 && strcmp(style,"rigid/npt") != 0) if (strcmp(style,"rigid/nvt") != 0 && strcmp(style,"rigid/npt") != 0)
error->all(FLERR,"Illegal fix rigid command"); error->all(FLERR,"Illegal fix rigid command");
t_chain = atoi(arg[iarg+1]); t_chain = force->inumeric(FLERR,arg[iarg+1]);
t_iter = atoi(arg[iarg+2]); t_iter = force->inumeric(FLERR,arg[iarg+2]);
t_order = atoi(arg[iarg+3]); t_order = force->inumeric(FLERR,arg[iarg+3]);
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"pchain") == 0) { } else if (strcmp(arg[iarg],"pchain") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid command");
if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0) if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0)
error->all(FLERR,"Illegal fix rigid command"); error->all(FLERR,"Illegal fix rigid command");
p_chain = atoi(arg[iarg+1]); p_chain = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"infile") == 0) { } else if (strcmp(arg[iarg],"infile") == 0) {
@ -901,7 +901,7 @@ void FixRigid::post_force(int vflag)
void FixRigid::final_integrate() void FixRigid::final_integrate()
{ {
int i,ibody; int i,ibody;
double dtfm,xy,xz,yz; double dtfm;
// sum over atoms to get force and torque on rigid body // sum over atoms to get force and torque on rigid body
@ -994,7 +994,7 @@ void FixRigid::final_integrate()
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void FixRigid::no_squish_rotate(int k, double *p, double *q, void FixRigid::no_squish_rotate(int k, double *p, double *q,
double *inertia, double dt) double *inertia, double dt) const
{ {
double phi,c_phi,s_phi,kp[4],kq[4]; double phi,c_phi,s_phi,kp[4],kq[4];
@ -1239,7 +1239,7 @@ void FixRigid::deform(int flag)
void FixRigid::set_xv() void FixRigid::set_xv()
{ {
int ibody,itype; int ibody;
int xbox,ybox,zbox; int xbox,ybox,zbox;
double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone; double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone;
double xy,xz,yz; double xy,xz,yz;
@ -1416,9 +1416,7 @@ void FixRigid::set_xv()
void FixRigid::set_v() void FixRigid::set_v()
{ {
int ibody,itype;
int xbox,ybox,zbox; int xbox,ybox,zbox;
double dx,dy,dz;
double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone; double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone;
double xy,xz,yz; double xy,xz,yz;
double ione[3],exone[3],eyone[3],ezone[3],delta[3],vr[6]; double ione[3],exone[3],eyone[3],ezone[3],delta[3],vr[6];
@ -1445,7 +1443,7 @@ void FixRigid::set_v()
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (body[i] < 0) continue; if (body[i] < 0) continue;
ibody = body[i]; const int ibody = body[i];
MathExtra::matvec(ex_space[ibody],ey_space[ibody], MathExtra::matvec(ex_space[ibody],ey_space[ibody],
ez_space[ibody],displace[i],delta); ez_space[ibody],displace[i],delta);
@ -1519,7 +1517,7 @@ void FixRigid::set_v()
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (body[i] < 0) continue; if (body[i] < 0) continue;
ibody = body[i]; const int ibody = body[i];
if (eflags[i] & SPHERE) { if (eflags[i] & SPHERE) {
omega_one[i][0] = omega[ibody][0]; omega_one[i][0] = omega[ibody][0];
@ -1558,7 +1556,7 @@ void FixRigid::set_v()
void FixRigid::setup_bodies() void FixRigid::setup_bodies()
{ {
int i,itype,ibody; int i,ibody;
// extended = 1 if any particle in a rigid body is finite size // extended = 1 if any particle in a rigid body is finite size
// or has a dipole moment // or has a dipole moment
@ -1721,7 +1719,7 @@ void FixRigid::setup_bodies()
// dx,dy,dz = coords relative to center-of-mass // dx,dy,dz = coords relative to center-of-mass
// symmetric 3x3 inertia tensor stored in Voigt notation as 6-vector // symmetric 3x3 inertia tensor stored in Voigt notation as 6-vector
double dx,dy,dz,rad; double dx,dy,dz;
for (ibody = 0; ibody < nbody; ibody++) for (ibody = 0; ibody < nbody; ibody++)
for (i = 0; i < 6; i++) sum[ibody][i] = 0.0; for (i = 0; i < 6; i++) sum[ibody][i] = 0.0;

View File

@ -127,7 +127,7 @@ class FixRigid : public Fix {
int POINT,SPHERE,ELLIPSOID,LINE,TRIANGLE,DIPOLE; // bitmasks for eflags int POINT,SPHERE,ELLIPSOID,LINE,TRIANGLE,DIPOLE; // bitmasks for eflags
int OMEGA,ANGMOM,TORQUE; int OMEGA,ANGMOM,TORQUE;
void no_squish_rotate(int, double *, double *, double *, double); void no_squish_rotate(int, double *, double *, double *, double) const;
void set_xv(); void set_xv();
void set_v(); void set_v();
void setup_bodies(); void setup_bodies();

View File

@ -108,10 +108,10 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(style,"rigid/small") != 0) if (strcmp(style,"rigid/small") != 0)
error->all(FLERR,"Illegal fix rigid/small command"); error->all(FLERR,"Illegal fix rigid/small command");
langflag = 1; langflag = 1;
t_start = atof(arg[iarg+1]); t_start = force->numeric(FLERR,arg[iarg+1]);
t_stop = atof(arg[iarg+2]); t_stop = force->numeric(FLERR,arg[iarg+2]);
t_period = atof(arg[iarg+3]); t_period = force->numeric(FLERR,arg[iarg+3]);
seed = atoi(arg[iarg+4]); seed = force->inumeric(FLERR,arg[iarg+4]);
if (t_period <= 0.0) if (t_period <= 0.0)
error->all(FLERR,"Fix rigid/small langevin period must be > 0.0"); error->all(FLERR,"Fix rigid/small langevin period must be > 0.0");
if (seed <= 0) error->all(FLERR,"Illegal fix rigid/small command"); if (seed <= 0) error->all(FLERR,"Illegal fix rigid/small command");
@ -151,7 +151,6 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
bodyown[i] = nlocal_body++; bodyown[i] = nlocal_body++;
} else bodyown[i] = -1; } else bodyown[i] = -1;
// bodysize = sizeof(Body) in doubles // bodysize = sizeof(Body) in doubles
bodysize = sizeof(Body)/sizeof(double); bodysize = sizeof(Body)/sizeof(double);
@ -218,11 +217,6 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
random = NULL; random = NULL;
if (langflag) random = new RanMars(lmp,seed + comm->me); if (langflag) random = new RanMars(lmp,seed + comm->me);
// mass vector for granular pair styles
mass_body = NULL;
nmax_mass = 0;
// firstflag = 1 triggers one-time initialization of rigid body attributes // firstflag = 1 triggers one-time initialization of rigid body attributes
firstflag = 1; firstflag = 1;
@ -250,7 +244,6 @@ FixRigidSmall::~FixRigidSmall()
delete random; delete random;
memory->destroy(langextra); memory->destroy(langextra);
memory->destroy(mass_body);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -1296,7 +1289,10 @@ void FixRigidSmall::create_bodies()
n = 0; n = 0;
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
if (!(mask[i] & groupbit)) continue; if (!(mask[i] & groupbit)) continue;
if (hash->find(molecule[i]) == hash->end()) (*hash)[molecule[i]] = n++; if (hash->find(molecule[i]) == hash->end()) {
hash->insert(std::pair<int,int> (molecule[i],n));
n++;
}
} }
// bbox = bounding box of each rigid body my atoms are part of // bbox = bounding box of each rigid body my atoms are part of
@ -1556,7 +1552,7 @@ void FixRigidSmall::setup_bodies()
atom->tri_flag || atom->mu_flag) { atom->tri_flag || atom->mu_flag) {
int flag = 0; int flag = 0;
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
if (bodytag[i] == 0) continue; if (atom2body[i] < 0) continue;
if (radius && radius[i] > 0.0) flag = 1; if (radius && radius[i] > 0.0) flag = 1;
if (ellipsoid && ellipsoid[i] >= 0) flag = 1; if (ellipsoid && ellipsoid[i] >= 0) flag = 1;
if (line && line[i] >= 0) flag = 1; if (line && line[i] >= 0) flag = 1;
@ -1581,7 +1577,7 @@ void FixRigidSmall::setup_bodies()
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
eflags[i] = 0; eflags[i] = 0;
if (bodytag[i] == 0) continue; if (atom2body[i] < 0) continue;
// set to POINT or SPHERE or ELLIPSOID or LINE // set to POINT or SPHERE or ELLIPSOID or LINE
@ -2522,37 +2518,6 @@ void FixRigidSmall::reset_dt()
dtq = 0.5 * update->dt; dtq = 0.5 * update->dt;
} }
/* ---------------------------------------------------------------------- */
void *FixRigidSmall::extract(const char *str, int &dim)
{
if (strcmp(str,"body") == 0) {
dim = 1;
return atom2body;
}
// return vector of rigid body masses, for owned+ghost bodies
// used by granular pair styles, indexed by atom2body
if (strcmp(str,"masstotal") == 0) {
dim = 1;
if (nmax_mass < nmax_body) {
memory->destroy(mass_body);
nmax_mass = nmax_body;
memory->create(mass_body,nmax_mass,"rigid:mass_body");
}
int n = nlocal_body + nghost_body;
for (int i = 0; i < n; i++)
mass_body[i] = body[i].mass;
return mass_body;
}
return NULL;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
return temperature of collection of rigid bodies return temperature of collection of rigid bodies
non-active DOF are removed by fflag/tflag and in tfactor non-active DOF are removed by fflag/tflag and in tfactor

View File

@ -107,7 +107,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Append boundary must be shrink/minimum"); error->all(FLERR,"Append boundary must be shrink/minimum");
} else if (strcmp(arg[iarg],"freq") == 0) { } else if (strcmp(arg[iarg],"freq") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command");
freq = atoi(arg[iarg+1]); freq = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"spatial") == 0) { } else if (strcmp(arg[iarg],"spatial") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix append/atoms command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix append/atoms command");
@ -116,7 +116,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) :
"Bad fix ID in fix append/atoms command"); "Bad fix ID in fix append/atoms command");
spatflag = 1; spatflag = 1;
int n = strlen(arg[iarg+1]); int n = strlen(arg[iarg+1]);
spatlead = atof(arg[iarg+2]); spatlead = force->numeric(FLERR,arg[iarg+2]);
char *suffix = new char[n]; char *suffix = new char[n];
strcpy(suffix,&arg[iarg+1][2]); strcpy(suffix,&arg[iarg+1][2]);
n = strlen(suffix) + 1; n = strlen(suffix) + 1;
@ -126,15 +126,15 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) :
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"basis") == 0) { } else if (strcmp(arg[iarg],"basis") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix append/atoms command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix append/atoms command");
int ibasis = atoi(arg[iarg+1]); int ibasis = force->inumeric(FLERR,arg[iarg+1]);
int itype = atoi(arg[iarg+2]); int itype = force->inumeric(FLERR,arg[iarg+2]);
if (ibasis <= 0 || ibasis > nbasis || itype <= 0 || itype > atom->ntypes) if (ibasis <= 0 || ibasis > nbasis || itype <= 0 || itype > atom->ntypes)
error->all(FLERR,"Invalid basis setting in fix append/atoms command"); error->all(FLERR,"Invalid basis setting in fix append/atoms command");
basistype[ibasis-1] = itype; basistype[ibasis-1] = itype;
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"size") == 0) { } else if (strcmp(arg[iarg],"size") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command");
size = atof(arg[iarg+1]); size = force->numeric(FLERR,arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"units") == 0) { } else if (strcmp(arg[iarg],"units") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command");
@ -145,20 +145,20 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"random") == 0) { } else if (strcmp(arg[iarg],"random") == 0) {
if (iarg+5 > narg) error->all(FLERR,"Illegal fix append/atoms command"); if (iarg+5 > narg) error->all(FLERR,"Illegal fix append/atoms command");
ranflag = 1; ranflag = 1;
ranx = atof(arg[iarg+1]); ranx = force->numeric(FLERR,arg[iarg+1]);
rany = atof(arg[iarg+2]); rany = force->numeric(FLERR,arg[iarg+2]);
ranz = atof(arg[iarg+3]); ranz = force->numeric(FLERR,arg[iarg+3]);
xseed = atoi(arg[iarg+4]); xseed = force->inumeric(FLERR,arg[iarg+4]);
if (xseed <= 0) error->all(FLERR,"Illegal fix append/atoms command"); if (xseed <= 0) error->all(FLERR,"Illegal fix append/atoms command");
randomx = new RanMars(lmp,xseed + comm->me); randomx = new RanMars(lmp,xseed + comm->me);
iarg += 5; iarg += 5;
} else if (strcmp(arg[iarg],"temp") == 0) { } else if (strcmp(arg[iarg],"temp") == 0) {
if (iarg+5 > narg) error->all(FLERR,"Illegal fix append/atoms command"); if (iarg+5 > narg) error->all(FLERR,"Illegal fix append/atoms command");
tempflag = 1; tempflag = 1;
t_target = atof(arg[iarg+1]); t_target = force->numeric(FLERR,arg[iarg+1]);
t_period = atof(arg[iarg+2]); t_period = force->numeric(FLERR,arg[iarg+2]);
tseed = atoi(arg[iarg+3]); tseed = force->inumeric(FLERR,arg[iarg+3]);
t_extent = atof(arg[iarg+4]); t_extent = force->numeric(FLERR,arg[iarg+4]);
if (t_target <= 0) error->all(FLERR,"Illegal fix append/atoms command"); if (t_target <= 0) error->all(FLERR,"Illegal fix append/atoms command");
if (t_period <= 0) error->all(FLERR,"Illegal fix append/atoms command"); if (t_period <= 0) error->all(FLERR,"Illegal fix append/atoms command");
if (t_extent <= 0) error->all(FLERR,"Illegal fix append/atoms command"); if (t_extent <= 0) error->all(FLERR,"Illegal fix append/atoms command");

View File

@ -80,31 +80,31 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Illegal fix msst command"); error->all(FLERR,"Illegal fix msst command");
} }
velocity = atof(arg[4]); velocity = force->numeric(FLERR,arg[4]);
if ( velocity < 0 ) if ( velocity < 0 )
error->all(FLERR,"Illegal fix msst command"); error->all(FLERR,"Illegal fix msst command");
for ( int iarg = 5; iarg < narg; iarg++ ) { for ( int iarg = 5; iarg < narg; iarg++ ) {
if ( strcmp(arg[iarg],"q") == 0 ) { if ( strcmp(arg[iarg],"q") == 0 ) {
qmass = atof(arg[iarg+1]); qmass = force->numeric(FLERR,arg[iarg+1]);
iarg++; iarg++;
} else if ( strcmp(arg[iarg],"mu") == 0 ) { } else if ( strcmp(arg[iarg],"mu") == 0 ) {
mu = atof(arg[iarg+1]); mu = force->numeric(FLERR,arg[iarg+1]);
iarg++; iarg++;
} else if ( strcmp(arg[iarg],"p0") == 0 ) { } else if ( strcmp(arg[iarg],"p0") == 0 ) {
p0 = atof(arg[iarg+1]); p0 = force->numeric(FLERR,arg[iarg+1]);
iarg++; iarg++;
p0_set = 1; p0_set = 1;
} else if ( strcmp(arg[iarg],"v0") == 0 ) { } else if ( strcmp(arg[iarg],"v0") == 0 ) {
v0 = atof(arg[iarg+1]); v0 = force->numeric(FLERR,arg[iarg+1]);
v0_set = 1; v0_set = 1;
iarg++; iarg++;
} else if ( strcmp(arg[iarg],"e0") == 0 ) { } else if ( strcmp(arg[iarg],"e0") == 0 ) {
e0 = atof(arg[iarg+1]); e0 = force->numeric(FLERR,arg[iarg+1]);
e0_set = 1; e0_set = 1;
iarg++; iarg++;
} else if ( strcmp(arg[iarg],"tscale") == 0 ) { } else if ( strcmp(arg[iarg],"tscale") == 0 ) {
tscale = atof(arg[iarg+1]); tscale = force->numeric(FLERR,arg[iarg+1]);
if (tscale < 0.0 || tscale > 1.0) if (tscale < 0.0 || tscale > 1.0)
error->all(FLERR,"Fix msst tscale must satisfy 0 <= tscale < 1"); error->all(FLERR,"Fix msst tscale must satisfy 0 <= tscale < 1");
iarg++; iarg++;

View File

@ -442,17 +442,17 @@ int FixNPHug::modify_param(int narg, char **arg)
{ {
if (strcmp(arg[0],"e0") == 0) { if (strcmp(arg[0],"e0") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix nphug command"); if (narg < 2) error->all(FLERR,"Illegal fix nphug command");
e0 = atof(arg[1]); e0 = force->numeric(FLERR,arg[1]);
e0_set = 1; e0_set = 1;
return 2; return 2;
} else if (strcmp(arg[0],"v0") == 0) { } else if (strcmp(arg[0],"v0") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix nphug command"); if (narg < 2) error->all(FLERR,"Illegal fix nphug command");
v0 = atof(arg[1]); v0 = force->numeric(FLERR,arg[1]);
v0_set = 1; v0_set = 1;
return 2; return 2;
} else if (strcmp(arg[0],"p0") == 0) { } else if (strcmp(arg[0],"p0") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix nphug command"); if (narg < 2) error->all(FLERR,"Illegal fix nphug command");
p0 = atof(arg[1]); p0 = force->numeric(FLERR,arg[1]);
p0_set = 1; p0_set = 1;
return 2; return 2;
} }

View File

@ -73,23 +73,23 @@ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Fix wall/piston command only available at zlo"); error->all(FLERR,"Fix wall/piston command only available at zlo");
else if (strcmp(arg[iarg],"vel") == 0) { else if (strcmp(arg[iarg],"vel") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix wall/piston command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix wall/piston command");
vx = atof(arg[iarg+1]); vx = force->numeric(FLERR,arg[iarg+1]);
vy = atof(arg[iarg+2]); vy = force->numeric(FLERR,arg[iarg+2]);
vz = atof(arg[iarg+3]); vz = force->numeric(FLERR,arg[iarg+3]);
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"pos") == 0) { } else if (strcmp(arg[iarg],"pos") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix wall/piston command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix wall/piston command");
x0 = atof(arg[iarg+1]); x0 = force->numeric(FLERR,arg[iarg+1]);
y0 = atof(arg[iarg+2]); y0 = force->numeric(FLERR,arg[iarg+2]);
z0 = atof(arg[iarg+3]); z0 = force->numeric(FLERR,arg[iarg+3]);
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"temp") == 0) { } else if (strcmp(arg[iarg],"temp") == 0) {
if (iarg+5 > narg) error->all(FLERR,"Illegal fix wall/piston command"); if (iarg+5 > narg) error->all(FLERR,"Illegal fix wall/piston command");
tempflag = 1; tempflag = 1;
t_target = atof(arg[iarg+1]); t_target = force->numeric(FLERR,arg[iarg+1]);
t_period = atof(arg[iarg+2]); t_period = force->numeric(FLERR,arg[iarg+2]);
tseed = atoi(arg[iarg+3]); tseed = force->inumeric(FLERR,arg[iarg+3]);
t_extent = atof(arg[iarg+4]); t_extent = force->numeric(FLERR,arg[iarg+4]);
if (t_target <= 0) error->all(FLERR,"Illegal fix wall/piston command"); if (t_target <= 0) error->all(FLERR,"Illegal fix wall/piston command");
if (t_period <= 0) error->all(FLERR,"Illegal fix wall/piston command"); if (t_period <= 0) error->all(FLERR,"Illegal fix wall/piston command");
if (t_extent <= 0) error->all(FLERR,"Illegal fix wall/piston command"); if (t_extent <= 0) error->all(FLERR,"Illegal fix wall/piston command");
@ -100,7 +100,7 @@ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) :
iarg += 5; iarg += 5;
} else if (strcmp(arg[iarg],"rough") == 0) { } else if (strcmp(arg[iarg],"rough") == 0) {
roughflag = 1; roughflag = 1;
roughdist = atof(arg[iarg+1]); roughdist = force->numeric(FLERR,arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"ramp") == 0) { } else if (strcmp(arg[iarg],"ramp") == 0) {
rampflag = 1; rampflag = 1;

View File

@ -77,15 +77,15 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
global_freq = 1; global_freq = 1;
extvector = 0; extvector = 0;
nevery = atoi(arg[3]); nevery = force->inumeric(FLERR,arg[3]);
bigexist = 1; bigexist = 1;
if (strcmp(arg[4],"NULL") == 0) bigexist = 0; if (strcmp(arg[4],"NULL") == 0) bigexist = 0;
else biggroup = group->find(arg[4]); else biggroup = group->find(arg[4]);
temperature_srd = atof(arg[5]); temperature_srd = force->numeric(FLERR,arg[5]);
gridsrd = atof(arg[6]); gridsrd = force->numeric(FLERR,arg[6]);
int seed = atoi(arg[7]); int seed = force->inumeric(FLERR,arg[7]);
// parse options // parse options
@ -108,7 +108,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"lamda") == 0) { if (strcmp(arg[iarg],"lamda") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command");
lamda = atof(arg[iarg+1]); lamda = force->numeric(FLERR,arg[iarg+1]);
lamdaflag = 1; lamdaflag = 1;
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"collision") == 0) { } else if (strcmp(arg[iarg],"collision") == 0) {
@ -138,22 +138,22 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"radius") == 0) { } else if (strcmp(arg[iarg],"radius") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command");
radfactor = atof(arg[iarg+1]); radfactor = force->numeric(FLERR,arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"bounce") == 0) { } else if (strcmp(arg[iarg],"bounce") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command");
maxbounceallow = atoi(arg[iarg+1]); maxbounceallow = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"search") == 0) { } else if (strcmp(arg[iarg],"search") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command");
gridsearch = atof(arg[iarg+1]); gridsearch = force->numeric(FLERR,arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"cubic") == 0) { } else if (strcmp(arg[iarg],"cubic") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix srd command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix srd command");
if (strcmp(arg[iarg+1],"error") == 0) cubicflag = CUBIC_ERROR; if (strcmp(arg[iarg+1],"error") == 0) cubicflag = CUBIC_ERROR;
else if (strcmp(arg[iarg+1],"warn") == 0) cubicflag = CUBIC_WARN; else if (strcmp(arg[iarg+1],"warn") == 0) cubicflag = CUBIC_WARN;
else error->all(FLERR,"Illegal fix srd command"); else error->all(FLERR,"Illegal fix srd command");
cubictol = atof(arg[iarg+2]); cubictol = force->numeric(FLERR,arg[iarg+2]);
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"shift") == 0) { } else if (strcmp(arg[iarg],"shift") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix srd command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix srd command");
@ -161,7 +161,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
else if (strcmp(arg[iarg+1],"yes") == 0) shiftuser = SHIFT_YES; else if (strcmp(arg[iarg+1],"yes") == 0) shiftuser = SHIFT_YES;
else if (strcmp(arg[iarg+1],"possible") == 0) shiftuser = SHIFT_POSSIBLE; else if (strcmp(arg[iarg+1],"possible") == 0) shiftuser = SHIFT_POSSIBLE;
else error->all(FLERR,"Illegal fix srd command"); else error->all(FLERR,"Illegal fix srd command");
shiftseed = atoi(arg[iarg+2]); shiftseed = force->inumeric(FLERR,arg[iarg+2]);
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"tstat") == 0) { } else if (strcmp(arg[iarg],"tstat") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command");

View File

@ -25,6 +25,7 @@
#include "variable.h" #include "variable.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "error.h"
#include "force.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -77,7 +78,7 @@ FixWallSRD::FixWallSRD(LAMMPS *lmp, int narg, char **arg) :
strcpy(varstr[nwall],&arg[iarg+1][2]); strcpy(varstr[nwall],&arg[iarg+1][2]);
} else { } else {
wallstyle[nwall] = CONSTANT; wallstyle[nwall] = CONSTANT;
coord0[nwall] = atof(arg[iarg+1]); coord0[nwall] = force->numeric(FLERR,arg[iarg+1]);
} }
nwall++; nwall++;

View File

@ -501,7 +501,7 @@ void PairAWPMDCut::coeff(int narg, char **arg)
force->bounds(arg[1],atom->ntypes,jlo,jhi); force->bounds(arg[1],atom->ntypes,jlo,jhi);
double cut_one = cut_global; double cut_one = cut_global;
if (narg == 3) cut_one = atof(arg[2]); if (narg == 3) cut_one = force->numeric(FLERR,arg[2]);
int count = 0; int count = 0;
for (int i = ilo; i <= ihi; i++) { for (int i = ilo; i <= ihi; i++) {

View File

@ -302,14 +302,14 @@ void AngleCGCMM::coeff(int narg, char **arg)
int ilo,ihi; int ilo,ihi;
force->bounds(arg[0],atom->nangletypes,ilo,ihi); force->bounds(arg[0],atom->nangletypes,ilo,ihi);
double k_one = atof(arg[1]); double k_one = force->numeric(FLERR,arg[1]);
double theta0_one = atof(arg[2]); double theta0_one = force->numeric(FLERR,arg[2]);
int cg_type_one=find_cg_type(arg[3]); int cg_type_one=find_cg_type(arg[3]);
if (cg_type_one == CG_NOT_SET) error->all(FLERR,"Error reading CG type flag."); if (cg_type_one == CG_NOT_SET) error->all(FLERR,"Error reading CG type flag.");
double epsilon_one = atof(arg[4]); double epsilon_one = force->numeric(FLERR,arg[4]);
double sigma_one = atof(arg[5]); double sigma_one = force->numeric(FLERR,arg[5]);
// find minimum of LJ potential. we only want to include // find minimum of LJ potential. we only want to include
// the repulsive part of the 1-3 LJ. // the repulsive part of the 1-3 LJ.

View File

@ -42,17 +42,17 @@ FixTempRescaleEff::FixTempRescaleEff(LAMMPS *lmp, int narg, char **arg) :
{ {
if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale/eff command"); if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale/eff command");
nevery = atoi(arg[3]); nevery = force->inumeric(FLERR,arg[3]);
if (nevery <= 0) error->all(FLERR,"Illegal fix temp/rescale/eff command"); if (nevery <= 0) error->all(FLERR,"Illegal fix temp/rescale/eff command");
scalar_flag = 1; scalar_flag = 1;
global_freq = nevery; global_freq = nevery;
extscalar = 1; extscalar = 1;
t_start = atof(arg[4]); t_start = force->numeric(FLERR,arg[4]);
t_stop = atof(arg[5]); t_stop = force->numeric(FLERR,arg[5]);
t_window = atof(arg[6]); t_window = force->numeric(FLERR,arg[6]);
fraction = atof(arg[7]); fraction = force->numeric(FLERR,arg[7]);
// create a new compute temp/eff // create a new compute temp/eff
// id = fix-ID + temp, compute group = fix group // id = fix-ID + temp, compute group = fix group

View File

@ -897,7 +897,7 @@ void PairEffCut::coeff(int narg, char **arg)
force->bounds(arg[1],atom->ntypes,jlo,jhi); force->bounds(arg[1],atom->ntypes,jlo,jhi);
double cut_one = cut_global; double cut_one = cut_global;
if (narg == 3) cut_one = atof(arg[2]); if (narg == 3) cut_one = force->numeric(FLERR,arg[2]);
int count = 0; int count = 0;
for (int i = ilo; i <= ihi; i++) { for (int i = ilo; i <= ihi; i++) {

View File

@ -56,7 +56,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) :
xstr = new char[n]; xstr = new char[n];
strcpy(xstr,&arg[3][2]); strcpy(xstr,&arg[3][2]);
} else { } else {
xvalue = atof(arg[3]); xvalue = force->numeric(FLERR,arg[3]);
xstyle = CONSTANT; xstyle = CONSTANT;
} }
if (strstr(arg[4],"v_") == arg[4]) { if (strstr(arg[4],"v_") == arg[4]) {
@ -64,7 +64,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) :
ystr = new char[n]; ystr = new char[n];
strcpy(ystr,&arg[4][2]); strcpy(ystr,&arg[4][2]);
} else { } else {
yvalue = atof(arg[4]); yvalue = force->numeric(FLERR,arg[4]);
ystyle = CONSTANT; ystyle = CONSTANT;
} }
if (strstr(arg[5],"v_") == arg[5]) { if (strstr(arg[5],"v_") == arg[5]) {
@ -72,7 +72,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) :
zstr = new char[n]; zstr = new char[n];
strcpy(zstr,&arg[5][2]); strcpy(zstr,&arg[5][2]);
} else { } else {
zvalue = atof(arg[5]); zvalue = force->numeric(FLERR,arg[5]);
zstyle = CONSTANT; zstyle = CONSTANT;
} }

View File

@ -53,6 +53,7 @@ negotiate an appropriate license for such distribution."
#include "update.h" #include "update.h"
#include "respa.h" #include "respa.h"
#include "domain.h" #include "domain.h"
#include "force.h"
#include "error.h" #include "error.h"
#include "group.h" #include "group.h"
#include "memory.h" #include "memory.h"
@ -62,7 +63,7 @@ negotiate an appropriate license for such distribution."
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if defined(_MSC_VER) || defined(__MINGW32_VERSION) #if defined(_MSC_VER) || defined(__MINGW32__)
#include <winsock2.h> #include <winsock2.h>
#else #else
#include <arpa/inet.h> #include <arpa/inet.h>
@ -447,7 +448,7 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) :
if (narg < 4) if (narg < 4)
error->all(FLERR,"Illegal fix imd command"); error->all(FLERR,"Illegal fix imd command");
imd_port = atoi(arg[3]); imd_port = force->inumeric(FLERR,arg[3]);
if (imd_port < 1024) if (imd_port < 1024)
error->all(FLERR,"Illegal fix imd parameter: port < 1024"); error->all(FLERR,"Illegal fix imd parameter: port < 1024");
@ -474,9 +475,9 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) :
nowait_flag = 0; nowait_flag = 0;
} }
} else if (0 == strcmp(arg[argsdone], "fscale")) { } else if (0 == strcmp(arg[argsdone], "fscale")) {
imd_fscale = atof(arg[argsdone+1]); imd_fscale = force->numeric(FLERR,arg[argsdone+1]);
} else if (0 == strcmp(arg[argsdone], "trate")) { } else if (0 == strcmp(arg[argsdone], "trate")) {
imd_trate = atoi(arg[argsdone+1]); imd_trate = force->inumeric(FLERR,arg[argsdone+1]);
} else { } else {
error->all(FLERR,"Unknown fix imd parameter"); error->all(FLERR,"Unknown fix imd parameter");
} }
@ -1179,7 +1180,7 @@ double FixIMD::memory_usage(void)
***************************************************************************/ ***************************************************************************/
int imdsock_init(void) { int imdsock_init(void) {
#if defined(_MSC_VER) || defined(__MINGW32_VERSION) #if defined(_MSC_VER) || defined(__MINGW32__)
int rc = 0; int rc = 0;
static int initialized=0; static int initialized=0;
@ -1258,7 +1259,7 @@ void *imdsock_accept(void * v) {
int imdsock_write(void * v, const void *buf, int len) { int imdsock_write(void * v, const void *buf, int len) {
imdsocket *s = (imdsocket *) v; imdsocket *s = (imdsocket *) v;
#if defined(_MSC_VER) || defined(__MINGW32_VERSION) #if defined(_MSC_VER) || defined(__MINGW32__)
return send(s->sd, (const char*) buf, len, 0); /* windows lacks the write() call */ return send(s->sd, (const char*) buf, len, 0); /* windows lacks the write() call */
#else #else
return write(s->sd, buf, len); return write(s->sd, buf, len);
@ -1267,7 +1268,7 @@ int imdsock_write(void * v, const void *buf, int len) {
int imdsock_read(void * v, void *buf, int len) { int imdsock_read(void * v, void *buf, int len) {
imdsocket *s = (imdsocket *) v; imdsocket *s = (imdsocket *) v;
#if defined(_MSC_VER) || defined(__MINGW32_VERSION) #if defined(_MSC_VER) || defined(__MINGW32__)
return recv(s->sd, (char*) buf, len, 0); /* windows lacks the read() call */ return recv(s->sd, (char*) buf, len, 0); /* windows lacks the read() call */
#else #else
return read(s->sd, buf, len); return read(s->sd, buf, len);
@ -1280,7 +1281,7 @@ void imdsock_shutdown(void *v) {
if (s == NULL) if (s == NULL)
return; return;
#if defined(_MSC_VER) || defined(__MINGW32_VERSION) #if defined(_MSC_VER) || defined(__MINGW32__)
shutdown(s->sd, SD_SEND); shutdown(s->sd, SD_SEND);
#else #else
shutdown(s->sd, 1); /* complete sends and send FIN */ shutdown(s->sd, 1); /* complete sends and send FIN */
@ -1292,7 +1293,7 @@ void imdsock_destroy(void * v) {
if (s == NULL) if (s == NULL)
return; return;
#if defined(_MSC_VER) || defined(__MINGW32_VERSION) #if defined(_MSC_VER) || defined(__MINGW32__)
closesocket(s->sd); closesocket(s->sd);
#else #else
close(s->sd); close(s->sd);

View File

@ -26,6 +26,7 @@
#include "respa.h" #include "respa.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "group.h" #include "group.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -60,13 +61,13 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(arg[argoffs],"cvel") == 0) { if (strcmp(arg[argoffs],"cvel") == 0) {
if (narg < argoffs+3) error->all(FLERR,"Illegal fix smd command"); if (narg < argoffs+3) error->all(FLERR,"Illegal fix smd command");
styleflag |= SMD_CVEL; styleflag |= SMD_CVEL;
k_smd = atof(arg[argoffs+1]); k_smd = force->numeric(FLERR,arg[argoffs+1]);
v_smd = atof(arg[argoffs+2]); // to be multiplied by update->dt when used. v_smd = force->numeric(FLERR,arg[argoffs+2]); // to be multiplied by update->dt when used.
argoffs += 3; argoffs += 3;
} else if (strcmp(arg[argoffs],"cfor") == 0) { } else if (strcmp(arg[argoffs],"cfor") == 0) {
if (narg < argoffs+2) error->all(FLERR,"Illegal fix smd command"); if (narg < argoffs+2) error->all(FLERR,"Illegal fix smd command");
styleflag |= SMD_CFOR; styleflag |= SMD_CFOR;
f_smd = atof(arg[argoffs+1]); f_smd = force->numeric(FLERR,arg[argoffs+1]);
argoffs += 2; argoffs += 2;
} else error->all(FLERR,"Illegal fix smd command"); } else error->all(FLERR,"Illegal fix smd command");
@ -74,12 +75,12 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) :
if (narg < argoffs+5) error->all(FLERR,"Illegal fix smd command"); if (narg < argoffs+5) error->all(FLERR,"Illegal fix smd command");
styleflag |= SMD_TETHER; styleflag |= SMD_TETHER;
if (strcmp(arg[argoffs+1],"NULL") == 0) xflag = 0; if (strcmp(arg[argoffs+1],"NULL") == 0) xflag = 0;
else xc = atof(arg[argoffs+1]); else xc = force->numeric(FLERR,arg[argoffs+1]);
if (strcmp(arg[argoffs+2],"NULL") == 0) yflag = 0; if (strcmp(arg[argoffs+2],"NULL") == 0) yflag = 0;
else yc = atof(arg[argoffs+2]); else yc = force->numeric(FLERR,arg[argoffs+2]);
if (strcmp(arg[argoffs+3],"NULL") == 0) zflag = 0; if (strcmp(arg[argoffs+3],"NULL") == 0) zflag = 0;
else zc = atof(arg[argoffs+3]); else zc = force->numeric(FLERR,arg[argoffs+3]);
r0 = atof(arg[argoffs+4]); r0 = force->numeric(FLERR,arg[argoffs+4]);
if (r0 < 0) error->all(FLERR,"R0 < 0 for fix smd command"); if (r0 < 0) error->all(FLERR,"R0 < 0 for fix smd command");
argoffs += 5; argoffs += 5;
} else if (strcmp(arg[argoffs],"couple") == 0) { } else if (strcmp(arg[argoffs],"couple") == 0) {
@ -94,15 +95,15 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(arg[argoffs+2],"NULL") == 0) xflag = 0; if (strcmp(arg[argoffs+2],"NULL") == 0) xflag = 0;
else if (strcmp(arg[argoffs+2],"auto") == 0) styleflag |= SMD_AUTOX; else if (strcmp(arg[argoffs+2],"auto") == 0) styleflag |= SMD_AUTOX;
else xc = atof(arg[argoffs+2]); else xc = force->numeric(FLERR,arg[argoffs+2]);
if (strcmp(arg[argoffs+3],"NULL") == 0) yflag = 0; if (strcmp(arg[argoffs+3],"NULL") == 0) yflag = 0;
else if (strcmp(arg[argoffs+3],"auto") == 0) styleflag |= SMD_AUTOY; else if (strcmp(arg[argoffs+3],"auto") == 0) styleflag |= SMD_AUTOY;
else yc = atof(arg[argoffs+3]); else yc = force->numeric(FLERR,arg[argoffs+3]);
if (strcmp(arg[argoffs+4],"NULL") == 0) zflag = 0; if (strcmp(arg[argoffs+4],"NULL") == 0) zflag = 0;
else if (strcmp(arg[argoffs+4],"auto") == 0) styleflag |= SMD_AUTOZ; else if (strcmp(arg[argoffs+4],"auto") == 0) styleflag |= SMD_AUTOZ;
else zc = atof(arg[argoffs+4]); else zc = force->numeric(FLERR,arg[argoffs+4]);
r0 = atof(arg[argoffs+5]); r0 = force->numeric(FLERR,arg[argoffs+5]);
if (r0 < 0) error->all(FLERR,"R0 < 0 for fix smd command"); if (r0 < 0) error->all(FLERR,"R0 < 0 for fix smd command");
argoffs +=6; argoffs +=6;
} else error->all(FLERR,"Illegal fix smd command"); } else error->all(FLERR,"Illegal fix smd command");

View File

@ -442,17 +442,17 @@ int FixNPHugOMP::modify_param(int narg, char **arg)
{ {
if (strcmp(arg[0],"e0") == 0) { if (strcmp(arg[0],"e0") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix nphug/omp command"); if (narg < 2) error->all(FLERR,"Illegal fix nphug/omp command");
e0 = atof(arg[1]); e0 = force->numeric(FLERR,arg[1]);
e0_set = 1; e0_set = 1;
return 2; return 2;
} else if (strcmp(arg[0],"v0") == 0) { } else if (strcmp(arg[0],"v0") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix nphug/omp command"); if (narg < 2) error->all(FLERR,"Illegal fix nphug/omp command");
v0 = atof(arg[1]); v0 = force->numeric(FLERR,arg[1]);
v0_set = 1; v0_set = 1;
return 2; return 2;
} else if (strcmp(arg[0],"p0") == 0) { } else if (strcmp(arg[0],"p0") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix nphug/omp command"); if (narg < 2) error->all(FLERR,"Illegal fix nphug/omp command");
p0 = atof(arg[1]); p0 = force->numeric(FLERR,arg[1]);
p0_set = 1; p0_set = 1;
return 2; return 2;
} }

View File

@ -80,7 +80,7 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg)
#pragma omp parallel default(none) shared(nthreads) #pragma omp parallel default(none) shared(nthreads)
nthreads = omp_get_num_threads(); nthreads = omp_get_num_threads();
else else
nthreads = atoi(arg[3]); nthreads = force->inumeric(FLERR,arg[3]);
#endif #endif
} }

View File

@ -51,7 +51,7 @@ MSMCGOMP::MSMCGOMP(LAMMPS *lmp, int narg, char **arg) : MSMOMP(lmp, narg, arg)
triclinic_support = 0; triclinic_support = 0;
if (narg == 2) smallq = atof(arg[1]); if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1]));
else smallq = SMALLQ; else smallq = SMALLQ;
num_charged = -1; num_charged = -1;

View File

@ -51,10 +51,10 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
if (narg < 8) error->all(FLERR,"Illegal fix phonon command: number of arguments < 8"); if (narg < 8) error->all(FLERR,"Illegal fix phonon command: number of arguments < 8");
nevery = atoi(arg[3]); // Calculate this fix every n steps! nevery = force->inumeric(FLERR,arg[3]); // Calculate this fix every n steps!
if (nevery < 1) error->all(FLERR,"Illegal fix phonon command"); if (nevery < 1) error->all(FLERR,"Illegal fix phonon command");
nfreq = atoi(arg[4]); // frequency to output result nfreq = force->inumeric(FLERR,arg[4]); // frequency to output result
if (nfreq < 1) error->all(FLERR,"Illegal fix phonon command"); if (nfreq < 1) error->all(FLERR,"Illegal fix phonon command");
waitsteps = ATOBIGINT(arg[5]); // Wait this many timesteps before actually measuring waitsteps = ATOBIGINT(arg[5]); // Wait this many timesteps before actually measuring
@ -78,11 +78,11 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
while (iarg < narg){ while (iarg < narg){
if (strcmp(arg[iarg],"sysdim") == 0){ if (strcmp(arg[iarg],"sysdim") == 0){
if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command line options."); if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command line options.");
sdim = atoi(arg[iarg]); sdim = force->inumeric(FLERR,arg[iarg]);
} else if (strcmp(arg[iarg],"nasr") == 0){ } else if (strcmp(arg[iarg],"nasr") == 0){
if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command line options."); if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command line options.");
nasr = atoi(arg[iarg]); nasr = force->inumeric(FLERR,arg[iarg]);
} else { } else {
error->all(FLERR,"Illegal fix phonon command: unknown option read!"); error->all(FLERR,"Illegal fix phonon command: unknown option read!");

View File

@ -58,10 +58,10 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) :
{ {
if (narg != 8) error->all(FLERR,"Illegal fix qeq/reax command"); if (narg != 8) error->all(FLERR,"Illegal fix qeq/reax command");
nevery = atoi(arg[3]); nevery = force->inumeric(FLERR,arg[3]);
swa = atof(arg[4]); swa = force->numeric(FLERR,arg[4]);
swb = atof(arg[5]); swb = force->numeric(FLERR,arg[5]);
tolerance = atof(arg[6]); tolerance = force->numeric(FLERR,arg[6]);
pertype_parameters(arg[7]); pertype_parameters(arg[7]);
shld = NULL; shld = NULL;

View File

@ -53,7 +53,7 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) :
ntypes = atom->ntypes; ntypes = atom->ntypes;
nmax = atom->nmax; nmax = atom->nmax;
nevery = atoi(arg[3]); nevery = force->inumeric(FLERR,arg[3]);
if (nevery <= 0 ) if (nevery <= 0 )
error->all(FLERR,"Illegal fix reax/c/bonds command"); error->all(FLERR,"Illegal fix reax/c/bonds command");
@ -158,6 +158,7 @@ void FixReaxCBonds::Output_ReaxC_Bonds(bigint ntimestep, FILE *fp)
// allocate a temporary buffer for the snapshot info // allocate a temporary buffer for the snapshot info
MPI_Allreduce(&numbonds,&numbonds_max,1,MPI_INT,MPI_MAX,world); MPI_Allreduce(&numbonds,&numbonds_max,1,MPI_INT,MPI_MAX,world);
MPI_Allreduce(&nlocal,&nlocal_max,1,MPI_INT,MPI_MAX,world); MPI_Allreduce(&nlocal,&nlocal_max,1,MPI_INT,MPI_MAX,world);
nbuf = 1+(numbonds_max*2+10)*nlocal_max; nbuf = 1+(numbonds_max*2+10)*nlocal_max;
memory->create(buf,nbuf,"reax/c/bonds:buf"); memory->create(buf,nbuf,"reax/c/bonds:buf");
for (i = 0; i < nbuf; i ++) buf[i] = 0.0; for (i = 0; i < nbuf; i ++) buf[i] = 0.0;

View File

@ -58,9 +58,9 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) :
MPI_Comm_size(world,&nprocs); MPI_Comm_size(world,&nprocs);
ntypes = atom->ntypes; ntypes = atom->ntypes;
nevery = atoi(arg[3]); nevery = force->inumeric(FLERR,arg[3]);
nrepeat = atoi(arg[4]); nrepeat = force->inumeric(FLERR,arg[4]);
global_freq = nfreq = atoi(arg[5]); global_freq = nfreq = force->inumeric(FLERR,arg[5]);
comm_forward = 1; comm_forward = 1;
@ -127,9 +127,9 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) :
// set BO cutoff // set BO cutoff
if (strcmp(arg[iarg],"cutoff") == 0) { if (strcmp(arg[iarg],"cutoff") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix reax/c/species command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix reax/c/species command");
itype = atoi(arg[iarg+1]); itype = force->inumeric(FLERR,arg[iarg+1]);
jtype = atoi(arg[iarg+2]); jtype = force->inumeric(FLERR,arg[iarg+2]);
bo_cut = atof(arg[iarg+3]); bo_cut = force->numeric(FLERR,arg[iarg+3]);
if (itype > ntypes || jtype > ntypes) if (itype > ntypes || jtype > ntypes)
error->all(FLERR,"Illegal fix reax/c/species command"); error->all(FLERR,"Illegal fix reax/c/species command");
if (itype <= 0 || jtype <= 0) if (itype <= 0 || jtype <= 0)
@ -154,7 +154,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"position") == 0) { } else if (strcmp(arg[iarg],"position") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix species command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix species command");
posflag = 1; posflag = 1;
posfreq = atoi(arg[iarg+1]); posfreq = force->inumeric(FLERR,arg[iarg+1]);
filepos = new char[n]; filepos = new char[n];
strcpy(filepos,arg[iarg+2]); strcpy(filepos,arg[iarg+2]);
if (strchr(filepos,'*')) { if (strchr(filepos,'*')) {

View File

@ -228,14 +228,14 @@ void PairReaxC::settings(int narg, char **arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"safezone") == 0) { } else if (strcmp(arg[iarg],"safezone") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command");
system->safezone = atof(arg[iarg+1]); system->safezone = force->numeric(FLERR,arg[iarg+1]);
if (system->safezone < 0.0) if (system->safezone < 0.0)
error->all(FLERR,"Illegal pair_style reax/c safezone command"); error->all(FLERR,"Illegal pair_style reax/c safezone command");
system->saferzone = system->safezone + 0.2; system->saferzone = system->safezone + 0.2;
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"mincap") == 0) { } else if (strcmp(arg[iarg],"mincap") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command");
system->mincap = atoi(arg[iarg+1]); system->mincap = force->inumeric(FLERR,arg[iarg+1]);
if (system->mincap < 0) if (system->mincap < 0)
error->all(FLERR,"Illegal pair_style reax/c mincap command"); error->all(FLERR,"Illegal pair_style reax/c mincap command");
iarg += 2; iarg += 2;

View File

@ -34,6 +34,7 @@
#include "group.h" #include "group.h"
#include "output.h" #include "output.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "memory.h" #include "memory.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -272,7 +273,7 @@ int DumpXTC::modify_param(int narg, char **arg)
return 2; return 2;
} else if (strcmp(arg[0],"precision") == 0) { } else if (strcmp(arg[0],"precision") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
precision = atof(arg[1]); precision = force->numeric(FLERR,arg[1]);
if ((fabs(precision-10.0) > EPS) && (fabs(precision-100.0) > EPS) && if ((fabs(precision-10.0) > EPS) && (fabs(precision-100.0) > EPS) &&
(fabs(precision-1000.0) > EPS) && (fabs(precision-10000.0) > EPS) && (fabs(precision-1000.0) > EPS) && (fabs(precision-10000.0) > EPS) &&
(fabs(precision-100000.0) > EPS) && (fabs(precision-100000.0) > EPS) &&