Dear all

I want to use and save a quantity (for example “potential energy”) in different time steps in order to do an operation:

for example I want to subtract the value of potential energy when timestep= 1000 from the value of potential energy when time-step = 5000. (ie P.E.@…3811…=5000 - P.E.@…3811…=1000).

i used if command and variable command and used multiple runs but i couldn’t get any success.for example I used:

run 1000

variable pe1 equal pe

run 5000

variable pe2 equal pe

variable deltaPe equal {pe2}-{pe1}

==========END of Input scrip=======

result was: deltaPe = 0

can any one guid me please?

regards

Dear all

I want to use and save a quantity (for example "potential energy") in

different time steps in order to do an operation:

for example I want to subtract the value of potential energy when timestep=

1000 from the value of potential energy when time-step = 5000. (ie

[email protected]...=5000 - [email protected]...=1000).

i used if command and variable command and used multiple runs but i couldn't

get any success.for example I used:

run 1000

variable pe1 equal pe

run 5000

variable pe2 equal pe

variable deltaPe equal \{pe2\}\-{pe1}

==========END of Input scrip=======

result was: deltaPe = 0

as it should be. both equal style variable

expressions are evaluated only when you

define the deltaPe variable.

you have to do such an immediate expansion

when you want to keep the result. an equal style

variable is more like a function than a variable.

try something list this instead:

# define equal style variable to get the current potential energy

variable getpe equal pe

run 1000

variable pe1 equal ${getpe}

run 5000

variable pe2 equal ${getpe}

# compute the difference between PE after 1000 and after 5000 steps

variable deltaPeTwoOne equal \{pe2\}\-{pe1}

# compute the difference between PE after 1000 steps and current step

variable deltaPe equal v_getpe-${pe1}

please read up on this in the documentation of the

variable command and you'll easily see how and

why this works the way it does.

axel.

Dear Axel

Thanks a lot , for your very nice and helpful answer.