fix ave/chunk, temp/profile and temp/chunk

Hi-
I have been having several issues with fix ave/chunk, temp/profile and temp/chunk:

  1. When I use ‘fix ave/chunk’ to print the spatial temperature profile, I would expect that the spatial average over the bins would give the same result as the instantaneous temperature printed in the thermo file. This is not the case. The attached input script, in.test, illustrates this. I realize that I would need to normalize by the bin population in the spatial average to get the exact instantaneous temperature, but this is not the issue, because the test script runs for 0 steps, so all the bins are still equally populated.

  2. When I use both temp/profile and ‘temp/chunk com yes’ to compute the temperature in a simulation, I would expect the result to be the same, if the binning is the same. This does not seem to be the case. The attached input script demonstrates this. See the thermo output, which gives the two temperatures. This is a simulation with no flow, but I would expect the two commands to give identical output regardless of what is going on. Also, you can check that the binning is the same in the files tempMapNoBias and tempMapNoBiasChunk.

  3. Similarly, when I use ‘fix ave/chunk’ to output the spatial temperature profile. The relevant files that are output are: tempMap, which contains the temperature profile with no bias removed, tempMapNoBias, which contains the temperature profile with the bias from temp/profile removed, and tempMapNoBiasChunk, which contains the temperature profile with the bias from ‘temp/chunk com yes’ removed. It seems that ‘temp/chunk com yes’ is not compatible with the feature to remove a bias in ‘fix ave/chunk temp’, as the output in tempMap is identical with that in tempMapNoBiasChunk. This is fine. The issue is that the spatial average of the temperature in tempMapNoBias over all the bins is not the same as the instantaneous value of c_myTp, as I would expect it to be. Instead, the spatial average of tempMapNoBias is the same as the instantaneous value of ‘temp/compute com yes’

I’ve attached the input files, as well as some of the output files I mentioned above. Below are some of the averages I talk about (in LJ units):
instantaneous data (from thermo file):

Step Temp myTp(profile) myTc(chunk)
0 2 2.0284802 1.8700052

spatial average of temp/profile: 1.87 (from file tempMapNoBias)
spatial average of raw temperature: 1.97 (from file tempMap)

If anyone has some ideas about what’s going on, I would be grateful. Let me know if any of the above is not clear.
Thanks, Steven

in.test (895 Bytes)

tempMap (210 Bytes)

tempMapNoBias (211 Bytes)

tempMapNoBiasChunk (211 Bytes)

I’ll take a look - probably next week.

Steve

Thanks!

ok - I finally looked at these examples. I think this all has to do with how

the degrees of freedom are counted for normalizing the kinetic energy to

convert it to temperature. And its exacerbated by the fact you are testing

a tiny system - 64 atoms in 4 bins, ~16 atoms/bin.

If you do this:
compute myTp all temp/profile 1 1 1 xy 2 2 out bin
compute chunkComp all chunk/atom bin/2d x lower 2.0 y lower 2.0
compute myTc all temp/chunk chunkComp temp com yes
thermo_style custom step temp c_myTp c_myTc

you get this output (as you said):
0 2 2.0284802 1.8700052

So the 3 temps are “different”. However if you read the doc pages about

how the DOFs are computed, they are all slightly different. In the limit

of large numbers of atoms and small numbers of bins, the differences

would vanish.

Compute temp is (by default) subtracting 3 DOF for the entire system.

Compute temp/profile is subtracting 3 DOF per bin (you were the one

who suggested that is correct re: the Evans paper, right?).

Compute temp/chunk knows nothing about bins/etc and you control

the DOF formula explicitly with the adof and cdof settings.

So if you do this:

compute myTp all temp/profile 1 1 1 xy 2 2 out bin
compute_modify myTp extra 0
compute chunkComp all chunk/atom bin/2d x lower 2.0 y lower 2.0
compute myTc all temp/chunk chunkComp temp com yes cdof -3
thermo_style custom step temp c_myTp c_myTc

you get this output:
0 2 1.9946722 1.9946722

Now the 3 temps are nearly identical. The difference

is only 1 part in 3*64 or 1 DOF for the entire system.

Not sure why, but I don’t think it matters. I assume it

comes from the extra operation the 2 computes are doing

to zero the center of mass velocity per bin before computing KE.

So I don’t think anything is wrong with the code. I guess we

could make extra=0 the default for compute temp/profile. And

cdof = -dim the default for compute temp/chunk. However the

latter is not clear to me if it is correct only for bin chunks or for any

kind of chunking, and if it is only correct if “com yes” is enabled.

If you use compute temp/profile and temp/chunk to output per-bin

temperatures, then all these Qs remain, but in a different form.

What is the correct DOF for a single bin or chunk. They again

do it slightly differently, but its documented on the doc pages.

Steve

Ah, I see, thanks.