LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
Re: [lammps-users] fix halt with condition on derivative?

# Re: [lammps-users] fix halt with condition on derivative?

 From: Christophe Ortiz Date: Tue, 18 Jul 2017 14:10:14 +0000

El mar., 18 jul. 2017 a las 16:04, Steve Plimpton (<sjplimp@...24...>) escribió:
The variable doc page (at the bottom) explains how to store
the old value of one variable in another variable, e.g.

>If you want to store the initial volume of the system, you can do it this way:

```>variable v equal vol
>variable v0 equal \$v
```
If you put lines like that in a loop construct every 1000 steps,
then I think you could have two variables that have
values 1000 steps apart.  Your fix halt could compare the
2 values (every 1000 steps) and decide to exit if they
were sufficiently close to each other (time derivate nearly 0.0).

Yes, that could make it. Thanks for the advice.

Note that for numeric fluctuating values like volume (in a NPT
simulation), you would not get a derivative exactly zero.

Since it is difficult to get exactly 0 for any value due to flucturations, my idea for the fix halt would be something like:

fix halt deriv < eps
where eps would be a tolerance (1e-4 eg).

Christophe

Steve

On Tue, Jul 18, 2017 at 2:07 AM, Christophe Ortiz wrote:
Dear LAMMPS users,

I am trying to define a fix halt to stop a run when a certain condition is met. What would be useful is that the run stops when a variable (calculated with a compute eg) reaches a constant value (or derivative ~ 0).
I found in the manual that a time-averaged value can be calculated with fix ave/time but nothing about derivatives.
Is there a way to do that during a run? I did not find anything in the manual nor in the mailing list.

Many thanks in advance and best regards,
Christophe

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most