Skip to content

How to handle constraints in a self-consistent way with SMIRNOFFTemplateGenerator? #428

@epretti

Description

@epretti

I'm still trying to work on #423. Though it wasn't the original focus of that PR, testing virtual site handling with the SMIRNOFF ports of various water models has turned up some unpleasant edge cases involving constraints. Specifically, I've found broken behavior where waters end up with neither rigid constraints nor harmonic bond/angle terms.

I'm opening this issue primarily as a request for comments to establish what the behavior should be, and the implementation details can follow after. I think there's a mismatch between how OpenMM and OpenFF treat constraints. OpenMM treats them entirely at system creation time, controlled by the constraints, rigidWater, and flexibleConstraints options. What this means is that constraints aren't part of an OpenMM XML (atom typed) force field.1 Instead, the lengths and angles of bond/angle terms in the force field are used to add constraints that the user requests. SMIRNOFF force fields, on the other hand, contain <Constraints> tags to explicitly specify constraints, and there is no equivalent to the constraints and rigidWater options if you are creating an OpenMM System using the OpenFF Toolkit or Interchange (@j-wags @mattwthompson please correct me if that's wrong). Furthermore, for the SMIRNOFF water force fields with constraints, there aren't any harmonic bond/angle terms present.

What should the behavior be if a user's constraint options to ForceField.createSystem() request that certain bonds or angles be flexible, but there are only rigid constraint parameters in the SMIRNOFF force field for them?

  • Set some default force constants for the bonds and angles2 silently
  • Set some default force constants, and warn about it
  • Add the rigid constraints anyway, silently
  • Add the rigid constraints anyway, and warn about it
  • Stop and raise an error

Since OpenMM treats water as a special case for constraints, we'd need to detect that a user is trying to use SMIRNOFF water (which is relatively easy). Will water be the only case for SMIRNOFF constraints, or do/will other OpenFF force fields use them too?

Footnotes

  1. There is one place where XML force fields have information related to constraints: if a residue template for water (which must be named HOH) has a rigidWater attribute with a value other than true, and the rigidWater user option is not specified, this instructs OpenMM to make flexible water molecules.

  2. The XML force fields distributed with OpenMM for rigid water models do this in some sense; many contain bond and angle force constants equal to 1106 kcal/mol/Å^2 and 200 kcal/mol/rad^2. Where did these numbers come from?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions