[lammps-users] Help with fix ave/time to a variable

Hi all,

I am trying to calculate a variable based on a fix ave/time variable, but I fail to do so. This is for sure because I cannot understand the fix ave/time command well, but after a few weeks of trying several things, I decided to email you for help.

A simplified version of my code is as follows.

variable nGas equal count(vgas,RBox)


fix Qiso all ave/time 1 100 100 v_time v_nGas start 0 file Qisofile.txt


variable A equal “f_Qiso[2]”

Run 1000

I know that my problem is that I am calling the variable f_Qiso[2] at the wrong time. The manual indicates that “Note that some fixes only generate quantities on certain timesteps. If a variable attempts to access the fix on non−allowed timesteps, an error is generated. For example, the fix ave/time command may only generate averaged quantities every 100 steps. See the doc pages for individual fix commands for details.”

Could you please let me know how to be sure that I call the f_Qiso[2] at the right time?

Thanks a lot for your help


With this fix ave/time command, a result you can access is only on steps that are multiples of 100.
The last of the 3 numerics values in the command.

You don’t show how you are triggering the variable A to be calculated.
That has to be done only on a step that is a multiple of 100, else you will get an error.

E.g. you could print it with thermo output every 100 or 1000 steps. But if your
thermo output is every 50 steps, you will get an error.


Dear Steve,

Many thanks for your explanation. It is in tune on what I understand. If you do not mind, I will let you know if I could fix my problem.

Kins regards,