some applications of the new function
This commit is contained in:
@ -1217,27 +1217,19 @@ int ReadDump::fields_and_keywords(int narg, char **arg)
|
|||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"box") == 0) {
|
} else if (strcmp(arg[iarg],"box") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
||||||
if (strcmp(arg[iarg+1],"yes") == 0) boxflag = 1;
|
boxflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"no") == 0) boxflag = 0;
|
|
||||||
else error->all(FLERR,"Illegal read_dump command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"replace") == 0) {
|
} else if (strcmp(arg[iarg],"replace") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
||||||
if (strcmp(arg[iarg+1],"yes") == 0) replaceflag = 1;
|
replaceflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"no") == 0) replaceflag = 0;
|
|
||||||
else error->all(FLERR,"Illegal read_dump command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"purge") == 0) {
|
} else if (strcmp(arg[iarg],"purge") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
||||||
if (strcmp(arg[iarg+1],"yes") == 0) purgeflag = 1;
|
purgeflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"no") == 0) purgeflag = 0;
|
|
||||||
else error->all(FLERR,"Illegal read_dump command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"trim") == 0) {
|
} else if (strcmp(arg[iarg],"trim") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
||||||
if (strcmp(arg[iarg+1],"yes") == 0) trimflag = 1;
|
trimflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"no") == 0) trimflag = 0;
|
|
||||||
else error->all(FLERR,"Illegal read_dump command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"add") == 0) {
|
} else if (strcmp(arg[iarg],"add") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
||||||
@ -1257,15 +1249,11 @@ int ReadDump::fields_and_keywords(int narg, char **arg)
|
|||||||
iarg += 3;
|
iarg += 3;
|
||||||
} else if (strcmp(arg[iarg],"scaled") == 0) {
|
} else if (strcmp(arg[iarg],"scaled") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
||||||
if (strcmp(arg[iarg+1],"yes") == 0) scaleflag = 1;
|
scaleflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"no") == 0) scaleflag = 0;
|
|
||||||
else error->all(FLERR,"Illegal read_dump command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"wrapped") == 0) {
|
} else if (strcmp(arg[iarg],"wrapped") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
||||||
if (strcmp(arg[iarg+1],"yes") == 0) wrapflag = 1;
|
wrapflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"no") == 0) wrapflag = 0;
|
|
||||||
else error->all(FLERR,"Illegal read_dump command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"format") == 0) {
|
} else if (strcmp(arg[iarg],"format") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command");
|
||||||
|
|||||||
@ -106,11 +106,7 @@ void Rerun::command(int narg, char **arg)
|
|||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"post") == 0) {
|
} else if (strcmp(arg[iarg],"post") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command");
|
||||||
if (strcmp(arg[iarg+1],"yes") == 0) {
|
postflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
postflag = 1;
|
|
||||||
} else if (strcmp(arg[iarg+1],"no") == 0) {
|
|
||||||
postflag = 0;
|
|
||||||
} else error->all(FLERR,"Illegal rerun command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"dump") == 0) {
|
} else if (strcmp(arg[iarg],"dump") == 0) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -69,9 +69,7 @@ void ResetIDs::command(int narg, char **arg)
|
|||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg],"sort") == 0) {
|
if (strcmp(arg[iarg],"sort") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal reset_atom_ids command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal reset_atom_ids command");
|
||||||
if (strcmp(arg[iarg+1],"yes") == 0) sortflag = 1;
|
sortflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"no") == 0) sortflag = 0;
|
|
||||||
else error->all(FLERR,"Illegal reset_atom_ids command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else error->all(FLERR,"Illegal reset_atom_ids command");
|
} else error->all(FLERR,"Illegal reset_atom_ids command");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,15 +77,11 @@ void ResetMolIDs::command(int narg, char **arg)
|
|||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg],"compress") == 0) {
|
if (strcmp(arg[iarg],"compress") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal reset_mol_ids command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal reset_mol_ids command");
|
||||||
if (strcmp(arg[iarg+1],"yes") == 0) compressflag = 1;
|
compressflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"no") == 0) compressflag = 0;
|
|
||||||
else error->all(FLERR,"Illegal reset_mol_ids command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"single") == 0) {
|
} else if (strcmp(arg[iarg],"single") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal reset_mol_ids command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal reset_mol_ids command");
|
||||||
if (strcmp(arg[iarg+1],"yes") == 0) singleflag = 1;
|
singleflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"no") == 0) singleflag = 0;
|
|
||||||
else error->all(FLERR,"Illegal reset_mol_ids command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"offset") == 0) {
|
} else if (strcmp(arg[iarg],"offset") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal reset_mol_ids command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal reset_mol_ids command");
|
||||||
|
|||||||
@ -77,15 +77,11 @@ void Run::command(int narg, char **arg)
|
|||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"pre") == 0) {
|
} else if (strcmp(arg[iarg],"pre") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal run command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal run command");
|
||||||
if (strcmp(arg[iarg+1],"no") == 0) preflag = 0;
|
preflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"yes") == 0) preflag = 1;
|
|
||||||
else error->all(FLERR,"Illegal run command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"post") == 0) {
|
} else if (strcmp(arg[iarg],"post") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal run command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal run command");
|
||||||
if (strcmp(arg[iarg+1],"no") == 0) postflag = 0;
|
postflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"yes") == 0) postflag = 1;
|
|
||||||
else error->all(FLERR,"Illegal run command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
|
||||||
// all remaining args are commands
|
// all remaining args are commands
|
||||||
|
|||||||
@ -556,16 +556,12 @@ void Thermo::modify_params(int narg, char **arg)
|
|||||||
} else if (strcmp(arg[iarg],"norm") == 0) {
|
} else if (strcmp(arg[iarg],"norm") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal thermo_modify command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal thermo_modify command");
|
||||||
normuserflag = 1;
|
normuserflag = 1;
|
||||||
if (strcmp(arg[iarg+1],"no") == 0) normuser = 0;
|
normuser = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"yes") == 0) normuser = 1;
|
|
||||||
else error->all(FLERR,"Illegal thermo_modify command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg],"flush") == 0) {
|
} else if (strcmp(arg[iarg],"flush") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal thermo_modify command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal thermo_modify command");
|
||||||
if (strcmp(arg[iarg+1],"no") == 0) flushflag = 0;
|
flushflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"yes") == 0) flushflag = 1;
|
|
||||||
else error->all(FLERR,"Illegal thermo_modify command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg],"line") == 0) {
|
} else if (strcmp(arg[iarg],"line") == 0) {
|
||||||
|
|||||||
@ -36,6 +36,7 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
enum{CREATE,SET,SCALE,RAMP,ZERO};
|
enum{CREATE,SET,SCALE,RAMP,ZERO};
|
||||||
enum{ALL,LOCAL,GEOM};
|
enum{ALL,LOCAL,GEOM};
|
||||||
|
enum{UNIFORM,GAUSSIAN};
|
||||||
enum{NONE,CONSTANT,EQUAL,ATOM};
|
enum{NONE,CONSTANT,EQUAL,ATOM};
|
||||||
|
|
||||||
#define WARMUP 100
|
#define WARMUP 100
|
||||||
@ -84,7 +85,7 @@ void Velocity::command(int narg, char **arg)
|
|||||||
// set defaults
|
// set defaults
|
||||||
|
|
||||||
temperature = nullptr;
|
temperature = nullptr;
|
||||||
dist_flag = 0;
|
dist_flag = UNIFORM;
|
||||||
sum_flag = 0;
|
sum_flag = 0;
|
||||||
momentum_flag = 1;
|
momentum_flag = 1;
|
||||||
rotation_flag = 0;
|
rotation_flag = 0;
|
||||||
@ -149,11 +150,12 @@ void Velocity::init_external(const char *extgroup)
|
|||||||
groupbit = group->bitmask[igroup];
|
groupbit = group->bitmask[igroup];
|
||||||
|
|
||||||
temperature = nullptr;
|
temperature = nullptr;
|
||||||
dist_flag = 0;
|
dist_flag = UNIFORM;
|
||||||
sum_flag = 0;
|
sum_flag = 0;
|
||||||
momentum_flag = 1;
|
momentum_flag = 1;
|
||||||
rotation_flag = 0;
|
rotation_flag = 0;
|
||||||
loop_flag = ALL;
|
loop_flag = ALL;
|
||||||
|
rfix = -1;
|
||||||
scale_flag = 1;
|
scale_flag = 1;
|
||||||
bias_flag = 0;
|
bias_flag = 0;
|
||||||
}
|
}
|
||||||
@ -275,11 +277,11 @@ void Velocity::create(double t_desired, int seed)
|
|||||||
int natoms = static_cast<int> (atom->natoms);
|
int natoms = static_cast<int> (atom->natoms);
|
||||||
|
|
||||||
for (i = 1; i <= natoms; i++) {
|
for (i = 1; i <= natoms; i++) {
|
||||||
if (dist_flag == 0) {
|
if (dist_flag == UNIFORM) {
|
||||||
vx = random->uniform() - 0.5;
|
vx = random->uniform() - 0.5;
|
||||||
vy = random->uniform() - 0.5;
|
vy = random->uniform() - 0.5;
|
||||||
vz = random->uniform() - 0.5;
|
vz = random->uniform() - 0.5;
|
||||||
} else {
|
} else { // GAUSSIAN
|
||||||
vx = random->gaussian();
|
vx = random->gaussian();
|
||||||
vy = random->gaussian();
|
vy = random->gaussian();
|
||||||
vz = random->gaussian();
|
vz = random->gaussian();
|
||||||
@ -310,11 +312,11 @@ void Velocity::create(double t_desired, int seed)
|
|||||||
|
|
||||||
for (i = 0; i < nlocal; i++) {
|
for (i = 0; i < nlocal; i++) {
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
if (dist_flag == 0) {
|
if (dist_flag == UNIFORM) {
|
||||||
vx = random->uniform() - 0.5;
|
vx = random->uniform() - 0.5;
|
||||||
vy = random->uniform() - 0.5;
|
vy = random->uniform() - 0.5;
|
||||||
vz = random->uniform() - 0.5;
|
vz = random->uniform() - 0.5;
|
||||||
} else {
|
} else { // GAUSSIAN
|
||||||
vx = random->gaussian();
|
vx = random->gaussian();
|
||||||
vy = random->gaussian();
|
vy = random->gaussian();
|
||||||
vz = random->gaussian();
|
vz = random->gaussian();
|
||||||
@ -335,11 +337,11 @@ void Velocity::create(double t_desired, int seed)
|
|||||||
for (i = 0; i < nlocal; i++) {
|
for (i = 0; i < nlocal; i++) {
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
random->reset(seed,x[i]);
|
random->reset(seed,x[i]);
|
||||||
if (dist_flag == 0) {
|
if (dist_flag == UNIFORM) {
|
||||||
vx = random->uniform() - 0.5;
|
vx = random->uniform() - 0.5;
|
||||||
vy = random->uniform() - 0.5;
|
vy = random->uniform() - 0.5;
|
||||||
vz = random->uniform() - 0.5;
|
vz = random->uniform() - 0.5;
|
||||||
} else {
|
} else { // GAUSSIAN
|
||||||
vx = random->gaussian();
|
vx = random->gaussian();
|
||||||
vy = random->gaussian();
|
vy = random->gaussian();
|
||||||
vz = random->gaussian();
|
vz = random->gaussian();
|
||||||
@ -824,27 +826,21 @@ void Velocity::options(int narg, char **arg)
|
|||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg],"dist") == 0) {
|
if (strcmp(arg[iarg],"dist") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
||||||
if (strcmp(arg[iarg+1],"uniform") == 0) dist_flag = 0;
|
if (strcmp(arg[iarg+1],"uniform") == 0) dist_flag = UNIFORM;
|
||||||
else if (strcmp(arg[iarg+1],"gaussian") == 0) dist_flag = 1;
|
else if (strcmp(arg[iarg+1],"gaussian") == 0) dist_flag = GAUSSIAN;
|
||||||
else error->all(FLERR,"Illegal velocity command");
|
else error->all(FLERR,"Illegal velocity command");
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"sum") == 0) {
|
} else if (strcmp(arg[iarg],"sum") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
||||||
if (strcmp(arg[iarg+1],"no") == 0) sum_flag = 0;
|
sum_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"yes") == 0) sum_flag = 1;
|
|
||||||
else error->all(FLERR,"Illegal velocity command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"mom") == 0) {
|
} else if (strcmp(arg[iarg],"mom") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
||||||
if (strcmp(arg[iarg+1],"no") == 0) momentum_flag = 0;
|
momentum_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"yes") == 0) momentum_flag = 1;
|
|
||||||
else error->all(FLERR,"Illegal velocity command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"rot") == 0) {
|
} else if (strcmp(arg[iarg],"rot") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
||||||
if (strcmp(arg[iarg+1],"no") == 0) rotation_flag = 0;
|
rotation_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"yes") == 0) rotation_flag = 1;
|
|
||||||
else error->all(FLERR,"Illegal velocity command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"temp") == 0) {
|
} else if (strcmp(arg[iarg],"temp") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
||||||
@ -856,9 +852,7 @@ void Velocity::options(int narg, char **arg)
|
|||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"bias") == 0) {
|
} else if (strcmp(arg[iarg],"bias") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
||||||
if (strcmp(arg[iarg+1],"no") == 0) bias_flag = 0;
|
bias_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||||
else if (strcmp(arg[iarg+1],"yes") == 0) bias_flag = 1;
|
|
||||||
else error->all(FLERR,"Illegal velocity command");
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"loop") == 0) {
|
} else if (strcmp(arg[iarg],"loop") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal velocity command");
|
||||||
|
|||||||
Reference in New Issue
Block a user