Miscalculation of pressure while using fix setforce

Dear Lammps expert,

Currently, I build MD simulations of hydrogen adsorption on CNT.

In the simulations, I use command:

fix 2 cnt setforce 0.0 0.0 0.0

This command is used in order to make the CNT stay rigid at its place, so that I can calculate amount of adsorbed hydrogen on the CNT surface.

Besides, I need to calculate the pressure of the system, so that I can plot its adsorption isotherm (amount of adsorbed hydrogen as function of system pressure).

But, unfortunately, time averaged value of pressure

(let me call it mean pressure) that is provided by thermo_style in LAMMPS give negative value, and I think it’s kinda nonsense.

In my opinion, the reason is the using of fix setforce command. This command means that the CNT is given by any “external forces” to neutralize resultant force caused by pair interactions. this “external forces” is the reason why the value of mean pressure is negative.

So, my questions are: is my analysis true? is the fix setforce command really the reason of pressure miscalculation?

1 Like

In my opinion, the reason is the using of fix setforce command. This command means that the CNT is given by any
“external forces” to neutralize resultant force caused by pair interactions. this “external forces” is the reason why
the value of mean pressure is negative.

No, I don’t think so. External forces do not contribute to the virial or the pressure. Also, LAMMPS computes
the virial based on the inter-particle pair-wise interactions. That happens before fix setforce even

operates and changes forces on some particles.

Conceptually there is nothing funny about a negative pressure. It simply means your

system is in a dilated state. I.e. the simulation box is bigger than it wants to be.

Steve

Dear Lammps expert,

Currently, I build MD simulations of hydrogen adsorption on CNT.

In the simulations, I use command:

fix 2 cnt setforce 0.0 0.0 0.0

This command is used in order to make the CNT stay rigid at its place, so
that I can calculate amount of adsorbed hydrogen on the CNT surface.

Besides, I need to calculate the pressure of the system, so that I can
plot its adsorption isotherm (amount of adsorbed hydrogen as function of
system pressure).

You are confusing one "pressure" to another. Adsorption isotherm is
plotted as a function of gas vapor pressure (which you can compute using
the ideal gas law by assuming that your H2 is ideal gas-like), not as a
function of the system pressure LAMMPS gives you.

But, unfortunately, time averaged value of pressure <p> (let me call it
mean pressure) that is provided by thermo_style in LAMMPS give negative
value, and I think it's kinda nonsense.

Negative system pressure makes just as much sense as a positive system
pressure.

In my opinion, the reason is the using of fix setforce command. This
command means that the CNT is given by any "external forces" to neutralize
resultant force caused by pair interactions. this "external forces" is the
reason why the value of mean pressure is negative.

Have you minimized the CNT by itself before the adsorption simulation?

Ray

You are confusing one “pressure” to another. Adsorption isotherm is plotted as a function of gas vapor pressure (which you can compute using the ideal gas law by assuming that your H2 is ideal gas-like), not as a function of the system pressure LAMMPS gives you.

Aha. That’s the answer that I’m looking for. Thanks, Ray. :slight_smile:

Zulkarnain