First, as a correction, the "2" in f_2[11][3]
stands for the name of the fix, which is called "2" in the definition
fix 2 all ave/chunk [...]
Second, you are referring to the KAPPA example in the LAMMPS examples folder, which can be found here. It is useful to point out that in this example, a box is separated into 20 "chunks" in the Z-direction, the middle of which (chunk 11) is "cold" (heat is removed using fix heat
) and the lowest one (chunk 1) is "hot" (heat is added). After some time equilibrating the temperature gradient, heat transfer is computed.
Now, let's break down the key commands:
compute ke all ke/atom
variable temp atom c_ke/1.5
Here, per-atom kinetic energies are calculated, and converted into "temperature" using , I assume, $E = \frac{3}{2} kT$ (we're in a Lennard-Jones system, so $k = 1$). Note that for every atom, we obtain a vector of length 3, with the three components of the kinetic energy.
compute layers all chunk/atom bin/1d z lower 0.05 units reduced
Here, the box is "chopped up" into 20 chunks along Z (each 0.05 box thick)
fix 2 all ave/chunk 10 100 1000 layers v_temp file profile.heat
Now, we average the values of v_temp
for the atoms within each chunk, so we get average temperature per chunk. However, v_temp
is a vector of length 3, so we actually get a temperature vector for every chunk.
Finally, we access the per-chunk averages. Normally, we access the property of chunk n
through f_2[n]
. So to subtract a value between chunk 1 and 11, we'd have f_2[11]-f_2[1]
. However, we're still dealing with temperature vectors (for every component) and need to specify one index to get a scalar. Given that heat flux in the Z-direction is computed, we take the third component.
So we have:
- All values for all chunks:
f_2
- The averaged quantity for chunk 1:
f_2[1]
- If the quantity is a vector, one component:
f_2[1][3]