Measure Enthalpy profile – how to add a per-atom compute like a vector

Dear all,

another quick question just popped up concerning the per-atom stress. As written in the documentation the stress is calculated in units of pressurevolume already, which is nice for me since I need for each bin the term pV to determine the enthalpy H = U + pV.

Now my question:
Would the sum -(c_peratomStress[1]+c_peratomStress[2]+c_peratomStress[3])/3 in each bin already be the term that I need? Or do I have to divide it by the simulation box volume and multiply it again by the volume of the small bin the get p*V of the bin?


Sven Auschra

We know from the documentation that the per-atom stress exactly sums to PV (I am deliberately ignoring sign changes and the averaging over axial components of stress). Similarly, you would like the enthalpy (extensive) of the bins to sum to the total enthalpy of the system (extensive). That is what you will get if you just sum the per-atom stress of atoms in each bin, never dividing by volume or number of atoms. However, there is an implicit assumption in this, that the volume/atom in each bin is roughly the same. If the bins are at very different densities, this is not a good assumption, and you will need to account for the density differences in some appropriate way, perhaps by scaling PV for each bin by (volume_bin/natoms_bin)/(volume/natoms).