Elapsed time with variable timestep (dt/reset)

Hello,

I have a technical question that I couldn’t find the answer to in the manual or mailing list archive.

In my simulation, I set a time-dependent electric field using fix efield.
I also use a variable timestep using fix dt/reset.
The exact command is:
fix dtfix all dt/reset 100 0.000477 0.001677 0.05 units box

Now, since I have a variable timestep, I use f_dtfix[1] as my elapsed time for my efield, but that vector is only updated every time the dt/reset is invoked (set to 100 timesteps in my example).
Of course, the easy solution is to update dt/reset at each time step, like:
fix dtfix all dt/reset 1 0.000477 0.001677 0.05 units box
But I’m worried that this would affect the efficiency of my simulation (I’m simulating a few hundred thousand atoms).

As for thermo_style commands like elaplong or tpcpu, I don’t think it they work with variable timesteps…

Does anybody know a way I could make this work?

Thank you

One possibility is to have fix dt/reset be made
smarter to make what you want to do easier.

E.g. the fix could define another method that is invoked
every timestep to just update the elapsed time.

Or its vector output could define an extra quantity
or 2, such as the last timestep that dt was updated.

In that case you might define a variable that was something
like

deltat = v_dtfix[1] + (current timestep - v_dtfix[2])*v_dtfix

Suggest something that would be easy/useful and
it will take just a couple minutes to implement.

Steve

Thank you Steve!

I was hoping that we wouldn’t have to change the code, but it looks like we’ll have to.
I think the 1st option (update elapsed time every timestep) would be simplest and probably easy to do. I can look into the code if you’d like to propose a way to do it.
My only concern is how it will work when the run is restarted, but that can always be set manually.

Would you like me to make the modifications in the fix_dt_reset files? I’m not very familiar with that piece of code, but I could figure out I guess. Or if you don’t mind making the modification, I would appreciate and it would probably be done better and faster :slight_smile:

Thanks again!

Christian

I'll take a look next week when I'm back
in the office ...

Steve

Ok, thanks!

I posted a 29Nov11 patch to the fix dt/reset command
that stores the elapsed simulation time every step now.
It's one of the vector output. See if this does what you want.

Steve