# Running Time averaging calculation in Lammps

Need help in finding running time averaging calculation
Can you help me?

Without any context, no. You need to give as many details as possible, please read the guideline of the forum.

Simon

1 Like

Are you asking about calculating time average in lammps? You can look into commands like fix ave/time. Or are asking about running averages (moving averages) along time?

1 Like

Hey Vishal
1- Explain what you are doing and what is your final goal. For example, I want to calculate X using the running time averaging.
2- Explain what is keeping you from doing what you want. For example, I am using â€śthisâ€ť function, but it gives me â€śthatâ€ť error.
3- If you think your questionâ€™s answer is longer than two to three sentences, always try to include your input file. It would save a lot of time from whoever is answering you.
4- Always check and read the docs and commands on what you want to do in detail. If you donâ€™t know what you want, no one can help you.
For your case, check here: fix ave/time command â€” LAMMPS documentation
Good luck

2 Likes

I am stuck with the running time average (moving time average ) .
I have got the fluctuating curve of kinetic energy with time step of aluminum material and i need to find the running average with time step say 100 . I have ran it for 10000 steps . At every step i need to find the moving average when i go with the fix/time command i am getting error it is not giving averaging at every time step there is a command in script where i have to fill the at what frequency i have to find but it not taking 1 as frequency as i need the averaging at every step.
here i am attaching the input script

please look at the fix 3 command
there i am getting error

yes moving average at every step of strip of 100 and i am running it for 10000 steps.

thanks for response .

If you want ave/time to print every timestep, you should use 1 1 1 for Nevery, Nrepeat and Nfreq,
and not 1 10 1 which is not allowed.

Simon

If we use 1 1 1 then there would not be averaging. I had tried it earlier.it will produce same data as itâ€™s taking only one value at 1 frequency.
I want it like i have to find the running average at all points of say time strip of 50 when i am running it by 10000 steps.
If we are at the Kth point and earlier to kth we have to take a strip value say 50 of which we have to do average . Then again for K+1 th it will take earlier 50 data and the average of this will be the value of running average at k+1th point.

Please read the documentation of fix ave/time again. The sliding window averaging that you want is enabled by a different keyword. The 1 1 1 choice is required to fulfill the documented requirements of of the command. As a computer program, LAMMPS requires precise input and you cannot reason with it the way you just did. What is documented as a requirement is not negotiable.

Dear Vishal
I am not sure if I understood your question correctly. But my guess is that you want to use the â€śaveâ€ť keyword followed by â€śrunningâ€ť argument. As mentioned in the LAMMPS docs (the same link that I posted before), it will â€śoutput cumulative average of all previous Nfreq stepsâ€ť. You can play with those keywords and args to get what you want. However, as Dr. Kohlmeyer said, always read the documents in detail and make sure you know what you put inside LAMMPS, otherwise, you will get the wrong results.

how it will be running average if we use 1 1 1 as let at 100th step it will take only one step (N_repeat), of the same gap 1( N_every) at each point (N frequency is 1 also) .
and why i am getting error when Nrepeat more than N frequency?

i am giving you example please give the solution of it ,
let i am at 100th step in the output input curve and i need to find the running average and i had define the strip M=50
so i need the averaging of 50 step values before 100 and the same for 101th and the same way for others.
how to solve this problem?

As stated previously by Axel, what you want is a sliding window averaging:

It wont run any average indeed, but it works. Using 1 1 1 was a suggestion to your first very unclear request.

If you want to find out exactly how, you must read the source code.

Because that is a documented requirement for the fix.

As mentioned now multiple times, you have to study the documentation more carefully. All the answers you are looking for are there. For example, it is explained that there are two types of averaging that fix ave/time will do: 1. for each individual computation every â€śNfreqâ€ť step which is controlled by â€śNrepeatâ€ť, and 2. how those results are accumulated which is controlled by the â€śaveâ€ť keyword. If you want a sliding window averaging, this is not controlled by the â€śNrepeatâ€ť value, but the â€śaveâ€ť keyword. It is all explained at great length in the documentation. You are wasting your (and our) time by not following it properly.