Pressure Can't Be Negative

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Ali Eltareb
Posts: 39
Joined: Tue Jul 30, 2019 10:46 am

Pressure Can't Be Negative

Post by Ali Eltareb » Tue Oct 11, 2022 11:43 am

Hi Peter,

I installed the newer version of OpenMM and I got a weird error. The MC barostat now gives an error if you try to set the pressure to be negative. With the older OpenMM version (7.4.0) there was no issue with setting the pressure to be negative.

I do want to add that I have run simulations setting the pressure to be negative and I've never run into anything unphysical/strange with the simulations. I'm curious, is there a particular reason for adding this exception?

Thanks,
Ali

User avatar
Peter Eastman
Posts: 2553
Joined: Thu Aug 09, 2007 1:25 pm

Re: Pressure Can't Be Negative

Post by Peter Eastman » Tue Oct 11, 2022 12:04 pm

It didn't check for the incorrect parameter value before, but that doesn't mean it worked correctly! What are you trying to simulate that involves negative pressure? Except for unusual systems (ones whose potential energies go to infinity as the box size grows), all simulations with negative pressure are unstable.

User avatar
Ali Eltareb
Posts: 39
Joined: Tue Jul 30, 2019 10:46 am

Re: Pressure Can't Be Negative

Post by Ali Eltareb » Tue Oct 11, 2022 12:31 pm

There were a couple of things that I have simulated with negative pressure. One I was looking at the behaviour of liquid water at negative pressures to see at which temperatures it would begin to cavitate.

Another is related to the compression and subsequent decompression of solids and glasses. In this case I was looking at the transformations the solid/glass will have during the compression and decompression cycle.
It didn't check for the incorrect parameter value before, but that doesn't mean it worked correctly!
What do you mean by this? Is there something in particular in the MC algorithm that doesn't allow for negative values?

Side remark: I'm pretty sure that Gromacs also (I have to check lammps) allows you to specify a negative pressure.

Ali

User avatar
Peter Eastman
Posts: 2553
Joined: Thu Aug 09, 2007 1:25 pm

Re: Pressure Can't Be Negative

Post by Peter Eastman » Tue Oct 18, 2022 1:32 pm

I'm really not sure what would happen. Pressure control is implemented through Monte Carlo moves. With negative pressure, moves that make the box larger will usually be accepted no matter how large it gets, so I would expect the box to quickly grow without limit. Is there something in your system to prevent that from happening?

The check was added to catch user errors. If a pressure is negative, it's usually because someone made a mistake. I don't think it occurred to anyone that someone might really want to simulate negative pressure.

User avatar
Peter Eastman
Posts: 2553
Joined: Thu Aug 09, 2007 1:25 pm

Re: Pressure Can't Be Negative

Post by Peter Eastman » Mon Oct 31, 2022 9:27 am

One other note on this. The check for negative pressure is only done in setDefaultPressure(), which sets the default pressure for newly created Contexts. Once you create your Context, it won't prevent you from setting the pressure to a negative value with

Code: Select all

context.setParameter(barostat.Pressure(), pressure)
No promises about what the effect on your system will be! But you can try it out and see.

POST REPLY