# Cacluating the pressure of water molecules inside a nanotube

Dear LAMMPS users,

I am trying to calculate the pressure of a sub-volume of water molecules inside a carbon nanotube (the water molecules are moving inside the nanotube). I am using compute stress/atom command; however, the problem is that this command gives the stress tensor for each atom inside the sub-volume while I am looking for the stress on each water molecule.

So my question is that how to calculate the pressure of water molecules inside a certain sub-volume? Is is correct to just sum the stress values for all Oxygen and Hydrogen atoms inside that volume? or in other words use this:

compute StressPerAtom water stress/atom NULL

compute P water reduce/region Region_of_Interest sum c_peratom[1] c_peratom[2] c_peratom[3]

variable TotalPressure equal -(c_P[1]+c_P2]+c_P[3])/(3*Volume_of_Region)

Any suggestions would be greatly appreciated.

Many thanks,
Hamed Farokhi

Dear LAMMPS users,

I am trying to calculate the pressure of a sub-volume of water molecules
inside a carbon nanotube (the water molecules are moving inside the
nanotube). I am using compute stress/atom command; however, the problem is
that this command gives the stress tensor for each atom inside the
sub-volume while I am looking for the stress on each water molecule.

So my question is that how to calculate the pressure of water molecules
inside a certain sub-volume? Is is correct to just sum the stress values for
all Oxygen and Hydrogen atoms inside that volume? or in other words use
this:

there is a fundamental conceptual issue here. there is no such thing
as a pressure per molecule. full stop. it has been explained on this
mailing list many times. pressure is essentially a macroscopic
property and as such the force per area generated by a macroscopic
system. now, there is a way to relate the pressure of a bulk(!) system
simulated under 3d periodic boundary conditions to the virial stress
(under these conditions the volume of the system is an input parameter
and thus easy to compute). people have now applied this derivation to
subvolumes and have come up with different ways to approximate the
volume and thus have an approximation of something resembling a "local
pressure". however, dividing this down to the case of a single
molecule is asking for too much. FWIW, the same is true for
temperature. even though it is quite easily possible to determine the
kinetic energy and the degrees of freedom of a single water molecule
and converting it the same way into an instantaneous temperature as
you would do with a larger system, its meaning as a "temperature" is
stretching what can can be understood as a temperature. temperature
and pressure are inherently macroscopic properties and defined over
macroscopic observations.

btw) the big question is now: what do you need this "impossible
pressure" property for?

axel.

Thanks for the explanation.

The thing is that I am NOT trying to obtain the pressure for a single molecule or per molecule. As you explained, I need to obtain the “local pressure”; in particular, I need to calculate local pressure for a sub-volume of water molecules at different positions in flow direction in order to calculate the Pressure Drop in water flow.

I have seen a couple of papers in the literature mentioning that they have done so (but not in LAMMPS, or at least they do not have mentioned it), such as:

Reassessing Fast Water Transport Through Carbon Nanotubes, John A. Thomas and Alan J. H. McGaughey. They predicted the pressure within different subvolumes of water molecules inside a nanotube using the virial expansion method.

So what I am trying to figure out is how to calculate the local pressure of subvolumes of water molecules in LAMMPS.

Many thanks,
Hamed

Thanks for the explanation.

The thing is that I am NOT trying to obtain the pressure for a single
molecule or per molecule. As you explained, I need to obtain the "local
pressure"; in particular, I need to calculate local pressure for a
sub-volume of water molecules at different positions in flow direction in
order to calculate the Pressure Drop in water flow.

I have seen a couple of papers in the literature mentioning that they have
done so (but not in LAMMPS, or at least they do not have mentioned it), such
as:

Reassessing Fast Water Transport Through Carbon Nanotubes, John A. Thomas
and Alan J. H. McGaughey. They predicted the pressure within different
subvolumes of water molecules inside a nanotube using the virial expansion
method.

like i already mentioned, yes, people have done these kinds of
calculations and you can at best call them approximations, since they
compute a property that is intrinsically not local in its
(macroscopic) definition and the necessary determination of a volume
can only be an approximation on the atomic scale.

So what I am trying to figure out is how to calculate the local pressure of
subvolumes of water molecules in LAMMPS.

there are endless discussions in the mailing list archives on this