Calculation of density/mass in a region as a function of time

Hi everyone,

I want to calculate the density/mass in a region as a function of time, I used the adjacent commands and I get an error for the fix ave/time even though I wrote as in the documentation.

compute 1 CH chunk/atom bin/3d x 0 80.36 y 0 80.36 z 14.35 25 units reduced
fix 1 CH ave/chunk 1 1000 1000 1 density/mass ave running file densities.txt
fix 5 CH ave/time 1 1000 1000 f_1 den.txt

Could you please help me?


This line is correctly throwing an error since fix 1, i.e. fix ave/chunk does not compute a global scalar.
It is not at all clear to which part of the documentation you are referring.

Thanks Axel, I’m referring to this documentation where I used the syntax for my line and it also mentions that the values listed by the fix ave/time may be the result of a fix.

I didn’t know there was an exception for the global scalar value, so how do I get my density/mass vs. time?

Best regards

The logic for fix ave/time is different from what you describe it. It very well can process global scalar, but the fix or compute has to provide them and it has to be set to the correct mode. The limitation is an fix ave/chunk, anyway.

On top of that, you are already requesting time averaging from fix ave/chunk. How much more averaging do you need?

Thank so much Axe,

In fact, I just want to have the time average of the density/mass in a single file, that is, a file containing only the time and the density/mass.

best regards

You can easily get that by post-processing the file you get from fix ave/chunk.

Thank you, Axel,

but I do not understand why the number of my molecule group is not updated in the range I defined for calculating the density,

In fact, I make a deposit on a substrate containing atoms that I put in the same group as the one I deposit to calculate the evolution of my density, in the region considered

My initial atoms on the substrate are 975 and I know that injected atoms are added in this region during the simulation, but I do not understand why they are not taken into account in the calculation of my density.

Could you please help me?
densities.txt (62.3 KB) (4.8 KB)

This input deck if far too complex and convoluted to follow and debug. Also, it is missing the data file.
I am not your adviser and I don’t have the time to figure out all the details and so on.

So either you create an extremely minimal example input that is easy to read and debug and demonstrates the problem you have, but also explaining in detail which property you are specifically after and why you are using the approach you are using. Then I may be able to look at that and figure out an issue or suggest an alternative. Everything else is the job of your adviser/tutor/supervisor and I don’t have the time (and neither am I getting paid) to that person’s work.

Or simpler put:
If there is a problem where LAMMPS doesn’t do what the documentation says it does, or does something that the documentation doesn’t say it does, then this is something that I need to look into.
Or when it crashes where it should not etc.
But for that you first have to provide sufficient evidence to prove your point, and usually that means a small, simple test input that just does one thing: demonstrate the inconsistency or trigger the crash.