How to access xlo, xhi?

Dear LAMMPS users and developers,

I want to use xhi, xlo red from a data file.
The answer
https://matsci.org/t/lammps-users-using-xlo-and-xhi-as-variables/7819
suggest to use xlo and xhi directly since these a thermo keywords,
but an attempt to use '${xlo}' yields an error unless I make
variable xlo equal xlo.
Do I really need to make such self-assignment prior to using a variable, or am I misunderstanding something ?

You are confusing keywords that can be used in a variable expressions and the variable itself.

If you use ${temp} there must be a variable named temp.
Thus you can temporarily define an equal style variable, then output it, and then delete it.
There also is the $(2+2) syntax where you can compute and output an expression. This also works with Thermo keywords. Thus for what you want you could use $(xlo).

1 Like

Thanks, $(xlo) works just fine!