Hi!
I'm sligtly confused as to when one may use internal variables, as opposed to
equal style ones, and what the difference is between them.
What I understand of them, is that internals are for numerical values, and
equals are for formulae that require evaluation (which of-course includes
numerical values).
The following quotaitions are from the 'variable' page of the documentation:
Variables of style internal can be used in place of an equal-style variable,
except by commands that set the value stored by the internal-style variable.
I don't quite comprehend what the above line means.
For the internal style a numeric value is provided. This value will be
assigned to the variable until a LAMMPS command sets it to a new value.
Does this mean that internals are mutable, while equals are constants?
Thanks!
Vishnu
Hi!
I’m sligtly confused as to when one may use internal variables, as opposed to
equal style ones, and what the difference is between them.
What I understand of them, is that internals are for numerical values, and
equals are for formulae that require evaluation (which of-course includes
numerical values).
The following quotaitions are from the ‘variable’ page of the documentation:
Variables of style internal can be used in place of an equal-style variable,
except by commands that set the value stored by the internal-style variable.
I don’t quite comprehend what the above line means.
the explanation for it is in the next sentence: Thus any command that states it can use an equal-style variable as an argument, can also use an internal-style variable.
it means, that if a LAMMPS command accepts an equal-style variable, it will also accept an internal style variable. it doesn’t say anything about how those are defined.
For the internal style a numeric value is provided. This value will be
assigned to the variable until a LAMMPS command sets it to a new value.
Does this mean that internals are mutable, while equals are constants?
no. it means, that the definition of equal style variables can only be changed by the user through the variable command. the value of an equal style variable is whatever the given expression evaluates to at the moment it is requested. if the expression is a constant, that it will be constant, otherwise not. however, internal style variables can only represent a specific numerical value, which may be changed (internally!) by commands that accept (only) an internal variable as argument.
axel.
> > For the internal style a numeric value is provided. This value will be
> > assigned to the variable until a LAMMPS command sets it to a new value.
>
> Does this mean that internals are mutable, while equals are constants?
>
>
no. it means, that the *definition* of equal style variables can only be
changed by the user through the variable command. the *value* of an equal
style variable is whatever the given expression evaluates to _at the moment
it is requested_. if the expression is a constant, that it will be
constant, otherwise not. however, internal style variables can *only*
represent a specific numerical value, which may be changed (internally!) by
commands that accept (only) an internal variable as argument.
Okay, so that means, if I want to define constants, I should use equal-style
variables rather than internal ones.
Or Index style.
Yes, that seems more appropriate, because it is then as though there is a
default value set in-script, which can be overriden via -var inputs. This is
oft useful when you need to programatically vary parameters. You then don't
have to alter the file.
Thanks a lot!