Hello LAMMPS users,
I am using the LAMMPS version 23Jun2022.
I have the following line in my code where I am computing a property/atom using the following command:
compute creg selreg property/atom id x y z
Then I assign a computed array value to an atom-style variable:
variable X_atom atom “c_creg[2]”
I want to add this atom-style variable value to a number and assign the sum to a new variable. I essentially want to perform the addition of ‘X_atom’ and ‘x_add’ (which is a number). I tried assigning the sum to an equal-style, an atom-style and a vector-style variable, and every time, I got the following error ‘Substitution for illegal variable (whatever variable I was assigning the sum to)’. Can someone guide me as to how I can assign the variables in order to perform the addition of a computed array value and a number, and then assign it to another variable? I intend to use this sum in a ‘create_atoms’ command.
Regards,
Rajesh