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

Dear all,

I am currently trying to measure the enthalpy profile within a thin slap in a 3D simulation box, i.e., I split the box into 2D bins with the command

compute bins fluid chunk/atom bin/2d x lower 0.5 z lower 0.5 bound y -0.4 0.4

and then want to calculate the enthalpy via H = U + pV for each bin.

I first determine the per-atom stress (already measured in units of [p][V]) via

compute peratomStress all stress/atom NULL

In the next step, I first just looked at the output of the first three components of the stress tensor

fix stressComponentsSlap fluid ave/chunk 1 1 1 bins c_perAtomStress[1] c_perAtomStress[2] c_perAtomStress[2] file stressSlap.txt

Worked quite well.

Because the pressure*volume per bin would then bis simply given by the negative sum over the first three components of the perAtomStress vector divided by 3 , I would like to define a per-atom variable like

variable perAtomPressure equal -(c_peratomStress[1]+c_peratomStress[2]+c_peratomStress[3])/3

and output the binned data via

fix pVslap fluid ave/chunk 1 1 1 bins v_perAtomPressure file pVslap.txt

Now, we come to my problem:

I receive the error message: “Fix ave/chunk variable is not atom-style variable”

Apparently, I define the per-atom pressure variable in the wrong way. It is supposed to add the three components of the stress tensor for each atom, which it obviously does not.

From the variable command documentation, however, I cannot find how to do this properly. Is it possible to do something like this in LAMMPS?

Best,

Sven Auschra

Dear all,

I am currently trying to measure the enthalpy profile within a thin slap
in a 3D simulation box, i.e., I split the box into 2D bins with the command

compute bins fluid chunk/atom bin/2d x lower 0.5 z lower 0.5 bound
y -0.4 0.4

and then want to calculate the enthalpy via H = U + pV for each bin.

I first determine the per-atom stress (already measured in units of
[p][V]) via

compute peratomStress all stress/atom NULL

In the next step, I first just looked at the output of the first three
components of the stress tensor

fix stressComponentsSlap fluid ave/chunk 1 1 1 bins
c_perAtomStress[1] c_perAtomStress[2] c_perAtomStress[2] file stressSlap.txt

Worked quite well.

Because the pressure*volume per bin would then bis simply given by the
negative sum over the first three components of the perAtomStress vector
divided by 3 , I would like to define a per-atom variable like

variable perAtomPressure equal -(c_peratomStress[1]+c_peratomStress[2]+c_
peratomStress[3])/3

and output the binned data via

fix pVslap fluid ave/chunk 1 1 1 bins v_perAtomPressure file pVslap.txt

*Now, we come to my problem:*

I receive the error message: “Fix ave/chunk variable is not atom-style
variable”

Apparently, I define the per-atom pressure variable in the wrong way. It
is supposed to add the three components of the stress tensor for each atom,
which it obviously does not.

From the variable command documentation, however, I cannot find how to do
this properly. Is it possible to do something like this in LAMMPS?

​you define an equal style variable, however you should define the
computation as an atom style variable. equal style variables work on global
data, atom style variables on per-atom data. fix ave/chunk can only use the
latter.

axel.​