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
Pressure Can't Be Negative
- Peter Eastman
- Posts: 2564
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Pressure Can't Be Negative
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.
- Ali Eltareb
- Posts: 39
- Joined: Tue Jul 30, 2019 10:46 am
Re: Pressure Can't Be Negative
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.
Side remark: I'm pretty sure that Gromacs also (I have to check lammps) allows you to specify a negative pressure.
Ali
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.
What do you mean by this? Is there something in particular in the MC algorithm that doesn't allow for negative values?It didn't check for the incorrect parameter value before, but that doesn't mean it worked correctly!
Side remark: I'm pretty sure that Gromacs also (I have to check lammps) allows you to specify a negative pressure.
Ali
- Peter Eastman
- Posts: 2564
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Pressure Can't Be Negative
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.
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.
- Peter Eastman
- Posts: 2564
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Pressure Can't Be Negative
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
No promises about what the effect on your system will be! But you can try it out and see.
Code: Select all
context.setParameter(barostat.Pressure(), pressure)