forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9524 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
be4a5a8e54
commit
f24bd36fe5
|
@ -84,8 +84,7 @@ void PairBrownianPoly::compute(int eflag, int vflag)
|
|||
double xl[3],a_sq,a_sh,a_pu,Fbmag;
|
||||
double p1[3],p2[3],p3[3];
|
||||
|
||||
|
||||
// This section of code adjusts R0/RT0/RS0 if necessary due to changes
|
||||
// this section of code adjusts R0/RT0/RS0 if necessary due to changes
|
||||
// in the volume fraction as a result of fix deform or moving walls
|
||||
|
||||
double dims[3], wallcoord;
|
||||
|
|
|
@ -65,8 +65,6 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
|
|||
{
|
||||
int i,ibody;
|
||||
|
||||
scalar_flag = 1;
|
||||
extscalar = 0;
|
||||
time_integrate = 1;
|
||||
rigid_flag = 1;
|
||||
virial_flag = 1;
|
||||
|
|
|
@ -383,7 +383,8 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag)
|
|||
// else $x becomes x followed by NULL
|
||||
// beyond = points to text following variable
|
||||
|
||||
int n;
|
||||
int i,n,paren_count;
|
||||
char immediate[256];
|
||||
char *var,*value,*beyond;
|
||||
char quote = '\0';
|
||||
char *ptr = str;
|
||||
|
@ -394,23 +395,56 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag)
|
|||
char *ptr2 = str2;
|
||||
|
||||
while (*ptr) {
|
||||
// expand variable and append to str2
|
||||
// variable substitution
|
||||
|
||||
if (*ptr == '$' && !quote) {
|
||||
|
||||
// value = ptr to expanded variable
|
||||
// variable name between curly braces, e.g. ${a}
|
||||
|
||||
if (*(ptr+1) == '{') {
|
||||
var = ptr+2;
|
||||
int i = 0;
|
||||
i = 0;
|
||||
|
||||
while (var[i] != '\0' && var[i] != '}') i++;
|
||||
|
||||
if (var[i] == '\0') error->one(FLERR,"Invalid variable name");
|
||||
var[i] = '\0';
|
||||
beyond = ptr + strlen(var) + 3;
|
||||
value = variable->retrieve(var);
|
||||
|
||||
// immediate variable between parenthesis, e.g. $(1/2)
|
||||
|
||||
} else if (*(ptr+1) == '(') {
|
||||
var = ptr+2;
|
||||
paren_count = 0;
|
||||
i = 0;
|
||||
|
||||
while (var[i] != '\0' && !(var[i] == ')' && paren_count == 0)) {
|
||||
switch (var[i]) {
|
||||
case '(': paren_count++; break;
|
||||
case ')': paren_count--; break;
|
||||
default: ;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if (var[i] == '\0') error->one(FLERR,"Invalid immediate variable");
|
||||
var[i] = '\0';
|
||||
beyond = ptr + strlen(var) + 3;
|
||||
sprintf(immediate,"%.20g",variable->compute_equal(var));
|
||||
value = immediate;
|
||||
|
||||
// single character variable name, e.g. $a
|
||||
|
||||
} else {
|
||||
var = ptr;
|
||||
var[0] = var[1];
|
||||
var[1] = '\0';
|
||||
beyond = ptr + 2;
|
||||
value = variable->retrieve(var);
|
||||
}
|
||||
value = variable->retrieve(var);
|
||||
|
||||
if (value == NULL) error->one(FLERR,"Substitution for illegal variable");
|
||||
|
||||
// check if storage in str2 needs to be expanded
|
||||
|
@ -428,8 +462,10 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag)
|
|||
if (echo_screen && screen) fprintf(screen,"%s%s\n",str2,beyond);
|
||||
if (echo_log && logfile) fprintf(logfile,"%s%s\n",str2,beyond);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (*ptr == quote) quote = '\0';
|
||||
else if (*ptr == '"' || *ptr == '\'') quote = *ptr;
|
||||
|
||||
|
|
|
@ -526,6 +526,16 @@ double Variable::compute_equal(int ivar)
|
|||
return value;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return result of immediate equal-style variable evaluation
|
||||
called from Input::substitute()
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double Variable::compute_equal(char *str)
|
||||
{
|
||||
return evaluate(str,NULL);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
compute result of atom-style variable evaluation
|
||||
only computed for atoms in igroup, else result is 0.0
|
||||
|
|
|
@ -31,6 +31,7 @@ class Variable : protected Pointers {
|
|||
int atomstyle(int);
|
||||
char *retrieve(char *);
|
||||
double compute_equal(int);
|
||||
double compute_equal(char *);
|
||||
void compute_atom(int, int, double *, int, int);
|
||||
int int_between_brackets(char *&);
|
||||
double evaluate_boolean(char *);
|
||||
|
|
Loading…
Reference in New Issue