-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
constraint = allbonds Causes Crashes with OpenForceFields #47
Comments
I imagine the system is overconstrained when using from openmm import *
from openmm.app import *
from openmm.unit import *
# Load the topology and coordinate files.
prmtop = AmberPrmtopFile("somd.prm7")
inpcrd = AmberInpcrdFile("somd.rst7")
# Initialise the molecular system.
system = prmtop.createSystem(
nonbondedMethod=PME, nonbondedCutoff=1 * nanometer, constraints=AllBonds
)
# Define the integrator.
integrator = LangevinMiddleIntegrator(
300.0 * kelvin, 1.00000 / picosecond, 0.002 * picoseconds
)
# Set the simulation platform.
platform = Platform.getPlatformByName("CPU")
properties = {}
# Initialise and configure the simulation object.
simulation = Simulation(prmtop.topology, system, integrator, platform, properties)
simulation.context.setPositions(inpcrd.positions)
if inpcrd.boxVectors is not None:
simulation.context.setPeriodicBoxVectors(*inpcrd.boxVectors)
# Setting initial system velocities.
simulation.context.setVelocitiesToTemperature(300.0)
# Run the simulation.
simulation.step(1000) I get:
The CCMA constraint solver in OpenMM will blow up if the constraint matrix is singular, or if the constraint is ill defined, e.g. for planar molecules. I think you can get back information from the context as to which atoms are constrained. You can also remove constraints one-by-one to try to figure out which constraint(s) is/are causing the issue. (There's a good thread about constraint issues with OpenMM here.) Sire now has a direct to-OpenMM converter, so it might be worth trying this, although I'm not sure if it supports |
Your input also blows up during minimisation using |
Hi @fjclark - could you cross reference this issue on the openff-toolkit github issues tracker ? |
Actually, looking at the OpenFF code for |
I can simulate the ligand with no issue in sire with I do see an error when trying to run the entire system in water.
My conclusion is that you can't constrain all bonds for this system. It over-constrains things. I recommend only constraining bonds involving hydrogen. Strangely, we don't see this issue with the gas-phase ligand. That blows my idea of using short gas-phase simulations to test for over-constraining... |
The issue is using the constraint in the
It may be something weird in OpenMM not liking too many constraints with a Triclinic space? |
These two pages in the sire docs show how you can convert to/from openmm and run minimisation and dynamics simulations: https://sire.openbiosim.org/tutorial/part05/04_dynamics.html |
To add to the mystery I understand @fjclark can simulate with all bond constraints the exact same system if parameterised with GAFF2. |
I've just checked and get a NaN in a periodic box too
I think it is something about the use of Ewald? |
Nope - even see this with reaction field
|
I get this in a Cartesian space with a 7 A cutoff, but don't get a crash when I have no cutoff. It looks like it is related to the cutoff used, not the space. |
(the with no cutoff is a red herring as it doesn't crash in this case, but completely blows up without error...) |
Looking at a video of the trajectory, it is a very planar molecule that oscillates about the plane. I think it is best to not use
|
Thanks very much for the comments.
Thanks - I don't plan to run my current simulations with
Yes, I have run many simulations with the same molecule in the past, only parameterised with GAFF2. I have never observed instabilities related to the ligand in this case with I had forgotten that there was some discussion of this issue previously. The same issue affected a variety of systems supplied by Bayer (already parameterised) for ABFE benchmarking. Changing the constraint settings consistently caused/ prevented crashes. |
This issue is really helpful, particularly as it gives concrete examples that will let us test different schemes for detecting and correcting over-constrained systems. I am not sure that there is anything that we can do to fix this though for the current version of somd? I think it is sampling issue, whereby the OFF1 / OFF2 parameters are causing this quite planar molecule to undergo motions that cause instability in the constraint solver for As this isn't a "bug", would it be ok to close this issue? We will refer back to it when we start ramping up development of somd2, and developing algorithms for detecting and correcting simulations that are over-constrained. |
Yes, no problem. Thanks for looking into this. Just to point out that this doesn't seem to be specific to this system, as I've tried a few ligands with OFF1/2 and all seem to be affected by this issue (mentioned here). |
Hello,
I've been attempting to run ABFE calculations with OFF1 / OFF2. These run without crashing when
constraint = hbonds
but crash immediately after minimisation upon changing toconstraint = allbonds
(NaN or Inf has been generated along the simulation
). When using GAFF2, there are no issues withconstraint = allbonds
.Please see all input here. The system is a ligand in a box of water, and I've included the sdf file I used to parameterise the ligand with OFF2 (through BSS).
Thanks.
The text was updated successfully, but these errors were encountered: