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
It might not be the exact answer to your question; however, as someone who reads this forum regularly, I have some suggestions for you to get your answer more efficiently. Please ask your questions following this logic:
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

1 Like

thanks for reply
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 reply as soon as possible
thanks in advance

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.
please help me.

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.

thanks for reply
can i solve this with the variable command using loops in lammps?

If you want just a moving average, like having 100 values and you want to save for time 20 the average of 10 to 20, for time 21, the average from 11 to 21 and so on up to saving the average from 90 to 100 in the last step, than simply follow the documentation for ave/time fix. It is well documented.

If you are not sure how it works, try to do a calculation of 20 steps and change Nevery, Nrepeat and Nfreq, and try to replicate the results using excell or similar. After some tests, you may get familiar with the fix. Of course you may save the non averaged values separately to check it out.

1 Like

No.

1 Like