Logic of calculation of strain

Dear LAMMPS users,

I am calculating the strain value during compression of a single crystal. I have come across the following code:

compute 1 all stress/atom NULL
compute 2 all reduce sum c_1[1] c_1[2] c_1[3]
variable stress equal ((c_2[2])/(3*vol))
variable tmp equal ly
variable lo equal ${tmp}
variable strain equal (ly-v_lo)/v_lo

.
.
.
.
fix 5 all deform 1 y erate -0.001 units box

In this, “ly” is assigned to “tmp” --> then “tmp” is printed and assigned to “lo”.
With this, engineering strain is calculated in y-axis as erate is applied in y-axis.

I want to know when “ly” is changed after some timesteps, will “lo” changes…???

I want to know the logic behind the calculation of strain.

Dear LAMMPS users,

I am calculating the strain value during compression of a single crystal. I
have come across the following code:

compute 1 all stress/atom NULL
compute 2 all reduce sum c_1[1] c_1[2] c_1[3]
variable stress equal ((c_2[2])/(3*vol))
variable tmp equal ly
variable lo equal ${tmp}
variable strain equal (ly-v_lo)/v_lo
.
.
.
.
fix 5 all deform 1 y erate -0.001 units box

In this, "ly" is assigned to "tmp" --> then "tmp" is printed and assigned to
"lo".
With this, engineering strain is calculated in y-axis as erate is applied in
y-axis.

I want to know when "ly" is changed after some timesteps, will "lo"
changes..???

no. it cannot change because you are using an _immediate_ expansion of
the variable tmp via ${} this is done while reading the input.
if you want "lo" to change, you have to use a _reference_ to a
variable in the expression, i.e. v_tmp.

you can see it for yourself when running with -echo screen. lines with
immediate variable expansion will be printed repeatedly, once after
each individual expansion.

axel.