LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
Re: [lammps-users] Inquiry on LAMMPS fix_deform and variable formula"

# Re: [lammps-users] Inquiry on LAMMPS fix_deform and variable formula"

 From: MASATO KOIZUMI Date: Thu, 27 Jul 2017 13:08:26 -0700

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

On Thu, Jul 27, 2017 at 12:51 PM, Axel Kohlmeyer wrote:
>> 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

>
> axel.
>

--
Dr. Axel Kohlmeyer  akohlmey@...43...4...  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.