# pressure of the system

Dear Lammps Community,

during NVT, NPT, and NVE MD simulation.
I am still confuse about how to get the pressure value for the system.

1. How can I got the pressure of the system?
I calculated it by averaging the Pressure for each time step after the
Energy or Volume converged, is this a correct method ?

2. What is the best practice of avoiding pressure fluctuation ?
What I usually do is
1. 1st minimize the system using cg or sd minimization.
2. raise up the system with NVT to the target temperature with about
10K/ps Tincreament
3. equilibrate the system with NVT until the Temperature and Total
Energy is stable,
4. equilibrate the system with NPT to target pressure until the
TotEnergy is stable.
During NPT, the volume will change, so I also make sure that the
5. equilibrate the system with to see if the Temperature and Pressure
fluctuate a lot or not with constant TotEnergy.

Thanks,
Erik

Dear Lammps Community,

during NVT, NPT, and NVE MD simulation.
I am still confuse about how to get the pressure value for the system.

1. How can I got the pressure of the system?
I calculated it by averaging the Pressure for each time step after the
Energy or Volume converged, is this a correct method ?

there is no point in averaging over *all* steps.
those data is strongly correlated and thus its
statistical weight is very little. probably taking
every 10 or less steps should suffice.

2. What is the best practice of avoiding pressure fluctuation ?

use a larger system!

What I usually do is
1. 1st minimize the system using cg or sd minimization.
2. raise up the system with NVT to the target temperature with about
10K/ps Tincreament
3. equilibrate the system with NVT until the Temperature and Total
Energy is stable,
4. equilibrate the system with NPT to target pressure until the
TotEnergy is stable.
During NPT, the volume will change, so I also make sure that the
5. equilibrate the system with to see if the Temperature and Pressure
fluctuate a lot or not with constant TotEnergy.

those fluctuations are usually system size dependent.

however, you may also run into having feedback with
certain choices of time constant and having rather
incompressible systems. the protocol you describe
is rather careful. for uncritical systems, you can
combine steps 1 and 2 with using fix nve/limit and
fix langevin with a shorter time constant before switching
to NVT.

axel.

Dear Dr. Kohlmeyer and lammps community,

during NVT, NPT, and NVE MD simulation.
I am still confuse about how to get the pressure value for the system.

1. How can I got the pressure of the system?
I calculated it by averaging the Pressure for each time step after the
Energy or Volume converged, is this a correct method ?

there is no point in averaging over *all* steps.
those data is strongly correlated and thus its
statistical weight is very little. probably taking
every 10 or less steps should suffice.

Yes, I mean averaging the pressure for some period of time steps,
usually I output thermo data every 500 steps so I use those values to
calculate the average Pressure. However, sometimes I still get
negative pressure average even when the TotE and Volume already
stable.

2. What is the best practice of avoiding pressure fluctuation ?

use a larger system!

How can I define a large system ? is it has to be more than 1000 or 5000 atoms ?

What I usually do is
1. 1st minimize the system using cg or sd minimization.
2. raise up the system with NVT to the target temperature with about
10K/ps Tincreament
3. equilibrate the system with NVT until the Temperature and Total
Energy is stable,
4. equilibrate the system with NPT to target pressure until the
TotEnergy is stable.
During NPT, the volume will change, so I also make sure that the
5. equilibrate the system with to see if the Temperature and Pressure
fluctuate a lot or not with constant TotEnergy.

those fluctuations are usually system size dependent.

however, you may also run into having feedback with
certain choices of time constant and having rather
incompressible systems.

Sometimes, I dont know that is the correct density for the system,
thats why I need to run compressible system.
But, even using those steps, I still sometimes couldn't get the correct density.

the protocol you describe is rather careful. for uncritical systems, you can
combine steps 1 and 2 with using fix nve/limit and
fix langevin with a shorter time constant before switching
to NVT.

I will try the new method as your suggestion.

axel.

Thanks Dr. Kohlmeyer !

Regards,
Erik

Dear Dr. Kohlmeyer and lammps community,

during NVT, NPT, and NVE MD simulation.
I am still confuse about how to get the pressure value for the system.

1. How can I got the pressure of the system?
I calculated it by averaging the Pressure for each time step after the
Energy or Volume converged, is this a correct method ?

there is no point in averaging over *all* steps.
those data is strongly correlated and thus its
statistical weight is very little. probably taking
every 10 or less steps should suffice.

Yes, I mean averaging the pressure for some period of time steps,
usually I output thermo data every 500 steps so I use those values to
calculate the average Pressure. However, sometimes I still get
negative pressure average even when the TotE and Volume already
stable.

you must not only look at the average,
but also at the error bar. if you try to
reach ambient pressure (i.e. next to nothing),
then you need a lot of data to get a small
enough error bar. having a slightly negative
pressure, may still be a reasonable
approximation for 1 atm.

2. What is the best practice of avoiding pressure fluctuation ?

use a larger system!

How can I define a large system ? is it has to be more than 1000 or 5000 atoms ?

yes. 5000 is still tiny.

of course, you can also run a very long trajectory.
you also have to be careful about finite size effects.

What I usually do is
1. 1st minimize the system using cg or sd minimization.
2. raise up the system with NVT to the target temperature with about
10K/ps Tincreament
3. equilibrate the system with NVT until the Temperature and Total
Energy is stable,
4. equilibrate the system with NPT to target pressure until the
TotEnergy is stable.
During NPT, the volume will change, so I also make sure that the
5. equilibrate the system with to see if the Temperature and Pressure
fluctuate a lot or not with constant TotEnergy.

those fluctuations are usually system size dependent.

however, you may also run into having feedback with
certain choices of time constant and having rather
incompressible systems.

Sometimes, I dont know that is the correct density for the system,
thats why I need to run compressible system.
But, even using those steps, I still sometimes couldn't get the correct density.

how do you know that it is incorrect, if you don't know
what is correct? also, what is correct in this context at all?
there are no absolute truths in simulations. truth is a study
object for philosophy classes. when using models and
simulations, one always has to consider all the
approximations and their associated systematical and
statistical errors.

axel.

Dear Dr. Kohlmeyer

I suppose not to say it correct density.
But I tried to compared the density from the NIST data at that
Temperature and pressure.

My problem is how can I make sure that my system is running at certain
temperature and pressure ?
For example :if I want to run CO2 + H2O at 385K and 300 atm.

I couldnt get the Paverage to be 300 when using npt.

Thanks,
Erik