Inquiry on LAMMPS fix_deform and variable formula"

Dear Dr. Axel Kohlmeyer,

Hello Dr. Kohlmeyer. Thank you for your e-mail.

I was curious if I could ask a question on an error that I obtained when I ran my LAMMPS simulation.

I used a “fix deform” command to change my simulation box such that the length of the box follows a triangular sinusoidal path using the following “variable” command. (L0 is the initial box length. Tp is the time period.)

- variable displace equal "v_L0 + (0.5*v_L0)*(1 + (2/PI)*asin(sin((2*PI*(1/v_Tp)*step*dt) - (PI/2))))" - variable rate equal "(2*v_L0*(1/v_Tp))*(-1)^floor(2*(1/v_Tp)*step*dt)"
  • fix 4 all deform 1 x variable v_displace v_rate remap v

However, I obtained an error statement: ERROR: Power by 0 in variable formula (…/variable.cpp:1718)

Even when I looked at the LAMMPS error manual, I am not understanding this error since my variable formula does not have a zero powered to a number. I would greatly appreciate if you could inform me a clue in resolving this error. Thank you.

Sincerely,

Masato Koizumi

Dear Dr. Axel Kohlmeyer,

Hello Dr. Kohlmeyer. Thank you for your e-mail.

I was curious if I could ask a question on an error that I obtained when I
ran my LAMMPS simulation.

I used a "fix deform" command to change my simulation box such that the
length of the box follows a triangular sinusoidal path using the following
"variable" command. (L0 is the initial box length. Tp is the time period.)

variable displace equal "v_L0 + (0.5*v_L0)*(1 +
(2/PI)*asin(sin((2*PI*(1/v_Tp)*step*dt) - (PI/2))))"
variable rate equal "(2*v_L0*(1/v_Tp))*(-1)^floor(2*(1/v_Tp)*step*dt)"
fix 4 all deform 1 x variable v_displace v_rate remap v

However, I obtained an error statement: ERROR: Power by 0 in variable
formula (../variable.cpp:1718)

Even when I looked at the LAMMPS error manual, I am not understanding this
error since my variable formula does not have a zero powered to a number. I

that is not what the error message says. it says that you have a
number raised to the power of 0.

axel.

variable displace equal "v_L0 + (0.5*v_L0)*(1 +
(2/PI)*asin(sin((2*PI*(1/v_Tp)*step*dt) - (PI/2))))"
variable rate equal "(2*v_L0*(1/v_Tp))*(-1)^floor(2*(1/v_Tp)*step*dt)"
fix 4 all deform 1 x variable v_displace v_rate remap v

However, I obtained an error statement: ERROR: Power by 0 in variable
formula (../variable.cpp:1718)

Even when I looked at the LAMMPS error manual, I am not understanding this
error since my variable formula does not have a zero powered to a number. I

that is not what the error message says. it says that you have a
number raised to the power of 0.

that said, LAMMPS should not stop with an error here.

x^0 should always result in 1.0 for any value of x, even for x == NaN.
instead 0^y with y < 0.0 should be disallowed, as this is equivalent
to 1.0/0^-y and thus would cause a division by zero.
so the current behavior of LAMMPS is actually a bug.

axel

Dear Dr. Axel Kohlmeyer,

Hello Dr. Kohlmeyer. Thank you for your e-mail. I was curious if this bug is intrinsic to LAMMPS or I was curious if there is a way in solving this problem since I have (-1) raised to a power of a number. Thank you.

Sincerely,

Masato Koizumi