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

This commit is contained in:
sjplimp 2007-04-30 23:35:33 +00:00
parent e66c29fc66
commit 604c8b30d6
2 changed files with 49 additions and 0 deletions

View File

@ -391,6 +391,7 @@ int Input::execute_command()
if (!strcmp(command,"clear")) clear();
else if (!strcmp(command,"echo")) echo();
else if (!strcmp(command,"if")) ifthenelse();
else if (!strcmp(command,"include")) include();
else if (!strcmp(command,"jump")) jump();
else if (!strcmp(command,"label")) label();
@ -416,6 +417,7 @@ int Input::execute_command()
else if (!strcmp(command,"dipole")) dipole();
else if (!strcmp(command,"dump")) dump();
else if (!strcmp(command,"dump_modify")) dump_modify();
// else if (!strcmp(command,"ellipsoid")) ellipsoid();
else if (!strcmp(command,"fix")) fix();
else if (!strcmp(command,"fix_modify")) fix_modify();
else if (!strcmp(command,"group")) group_command();
@ -503,6 +505,39 @@ void Input::echo()
/* ---------------------------------------------------------------------- */
void Input::ifthenelse()
{
if (narg != 5 && narg != 7) error->all("Illegal if command");
int flag = 0;
if (strcmp(arg[1],"==") == 0) {
if (atof(arg[0]) == atof(arg[2])) flag = 1;
} else if (strcmp(arg[1],"!=") == 0) {
if (atof(arg[0]) != atof(arg[2])) flag = 1;
} else if (strcmp(arg[1],"<") == 0) {
if (atof(arg[0]) < atof(arg[2])) flag = 1;
} else if (strcmp(arg[1],"<=") == 0) {
if (atof(arg[0]) <= atof(arg[2])) flag = 1;
} else if (strcmp(arg[1],">") == 0) {
if (atof(arg[0]) > atof(arg[2])) flag = 1;
} else if (strcmp(arg[1],">=") == 0) {
if (atof(arg[0]) >= atof(arg[2])) flag = 1;
} else error->all("Illegal if command");
if (strcmp(arg[3],"then") != 0) error->all("Illegal if command");
if (narg == 7 && strcmp(arg[5],"else") != 0)
error->all("Illegal if command");
char str[128] = "\0";
if (flag) strcpy(str,arg[4]);
else if (narg == 7) strcpy(str,arg[6]);
strcat(str,"\n");
if (strlen(str) > 1) char *tmp = one(str);
}
/* ---------------------------------------------------------------------- */
void Input::include()
{
if (narg != 1) error->all("Illegal include command");
@ -789,6 +824,18 @@ void Input::dump_modify()
/* ---------------------------------------------------------------------- */
/*
void Input::ellipsoid()
{
if (narg != 4) error->all("Illegal ellipsoid command");
if (domain->box_exist == 0)
error->all("Ellipsoid command before simulation box is defined");
atom->set_radii3(narg,arg);
}
*/
/* ---------------------------------------------------------------------- */
void Input::fix()
{
modify->add_fix(narg,arg);

View File

@ -52,6 +52,7 @@ class Input : protected Pointers {
void clear(); // input script commands
void echo();
void ifthenelse();
void include();
void jump();
void label();
@ -77,6 +78,7 @@ class Input : protected Pointers {
void dipole();
void dump();
void dump_modify();
// void ellipsoid();
void fix();
void fix_modify();
void group_command();