Dumping Temperature of the whole system

I’m confused about temperature calculations. I tried to add the following to my lammps code:

compute myTemp all temp
# Give velocities to atoms with langevin and setup other stuff.
dump myTempDump all custom 80 sympathetic-cooling.temperatures.txt c_myTemp
run 10000

And I got the error:

ERROR: Dump custom compute myTemp does not compute per-atom info (src/dump_custom.cpp:1485)

Which makes sense, as explained in statistical thermodynamics courses: Temperature is a property of the whole system, and not of particular particles. This is also mentioned in the and in the following topics:

But what I want to see in my dump file, is a single temperature number (per 80 steps), inferred from the whole system. I also tried to replace c_myTemp with temperature, as documented here, and I got:

ERROR: Dumping an atom property that isn't allocated (src/dump_custom.cpp:1404)

I also don’t understand the logic behind the arguments the commands accept. What can I do for instance with c_myTemp? What can I do with dump ... temperature?

I am aware that I can dump the averaged velocities and perform the temperature calculations myself, but I’d be really satisfied if lammps could have done that for me.

Did you have a look at fix ave/time ?

1 Like

This looks interesting, but I’m not sure I know how to get this working, I tried to use:

compute myTemp all temp
# Give velocities to atoms with langevin and setup other stuff.
fix myTempFix all ave/time 1 80 80 c_myTemp
dump myTempDump all custom 80 sympathetic-cooling.temperatures.txt f_myTemp
run 10000

And again it failed with:

ERROR: Dump custom fix myTempFix does not compute per-atom info (src/dump_custom.cpp:1506)

See 8.3.1. Output from LAMMPS (thermo, dumps, computes, fixes, variables) — LAMMPS documentation

Oh wait, with the file keyword argument to fix ave/time this works! Thanks for the help @simongravelle . I’m still puzzled as for the temperatures argument to the dump command - what exactly is it’s purpose?

1 Like

Very simple. There is a per-atom temperature (and heat capacity) property when running with atom style edpd and pair style edpd which implements the mesoscale eDPD model, where each particle represents a bunch of atoms. The closest equivalent on when simulating point particles is the per-atom kinetic energy, which can be computed from the velocities with the compute ke/atom command — LAMMPS documentation. With the mesoscale model, the temperature property represents the “internal” kinetic energy which goes on top of the per-particle kinetic energy.

1 Like

OK so LAMMPS does (or at least can) calculate per-atom temperature, proportional to it’s kinetic energy - if I understand correctly. If it’s all considered well defined, what I don’t understand is why does dump with the temperature argument give the error I quoted earlier:

ERROR: Dumping an atom property that isn't allocated (src/dump_custom.cpp:1404)

2-3 lines of dump with temperature example would be greatly appreciated by noob LAMMPS developers!

You don’t.

Because that property is not present in your simulation. Are you running an eDPD model?

No, I’m using pair_style coul/cut.

Then the per-atom temperature property is not available. Computing a per-atom temperature doesn’t make sense for this kind of model anyway. But as I have already pointed out, computing the per-atom kinetic energy does make sense and is available as a compute and can be dumped in a custom style dump.

One important step that you urgently need to understand is the following: LAMMPS is not a human and doesn’t think or apply common sense. It will strictly follow the logic of what it is programmed to do, so you have to follow the “LAMMPS logic” of how things need to be done. Given LAMMPS’ complexity and flexibility, you have to keep in mind that a lot of functionality depends on context. If the settings are not suitable, then features are not available and thus cannot be used. Please also keep in mind that the documentation is no tutorial, but a reference. It will not spell everything out for you, specifically not details that depend on the context.

Or in short: if you cannot figure out how something is supposed to work from the documentation and the errors it causes, then you probably should not be using it (until you have figured it out).

1 Like

Cool, good to know. Thanks again!

So in general, what per-atom properties are available to which pair_style? Was there a way that I could have figured this out from the reference? Maybe the error message words atom property that isn't allocated could be improved to something like this:

ERROR: Dumping the per-atom property `temperature` is not possible when pair_style is coul/cut

It is not the pair style that matters for this, but the atom style. Certain pair style require certain per-atom properties to be present, as they are updated during the timestep and its data is used by the pair style. If you are using pair style coul/cut, you need to have per-atom charges on top of the defaults (positions, forces, velocities). Hence you must use atom style charge and all properties listed for atom style charge are available for output. Now you might think “hey, I can just use a different atom style and the per-atom ‘temperature’ property is available”. And indeed the property is, but it does not help since nothing sets or updates it in your simulation. And while the per-particle temperature is an integral part of the eDPD algorithm, it makes no sense at all for “real” atoms modeled as point particles with charge.