I have modular input scripts where I have multiple “include” statements I can use to add different calculations (fix bond reactions, energies, stress, etc) to a LAMMPS script that update output commands by updating/appending string variables.
I’m experiencing a change in variable behavior after updating LAMMPS from a 2024 version of LAMMPS to the current version:
- LAMMPS (27 Jun 2024 - Development - patch_27Jun2024-956-g6e791034f9-modified)
- LAMMPS (4 Jul 2026 - Development - patch_4Jul2026-178-gc4fe7a5bcf)
In the previous version the commands below worked without error:
variable string_thermo string "temp press"
variable string_thermo string "${string_thermo} lx ly lz"
fix global all ave/time 1000 1 1000 ${string_thermo} file thermo.1.txt
While the current version produces the error:
ERROR on proc 0: Substitution for illegal variable string_thermo
For more information see
(src/input.cpp:675)
I can get around this by creating and deleting a temporary variable, which works but is a bit clunky.
variable string_thermo string "temp press"
variable string_thermo_temp string "${string_thermo}"
variable string_thermo delete
variable string_thermo string "${string_thermo_temp} lx ly lz"
variable string_thermo_temp delete
I’m wondering if anybody has any suggestions for a cleaner way to accomplish this?