Skip to content

Some orders of imported component combination fail #1422

@j-wags

Description

@j-wags

Reproduction
With input files from openforcefield/anything-goes#28

from openff.toolkit import Molecule, ForceField
from openff.interchange import Interchange
import openmm.app
import openmm
import openmm.unit 

inpcrd1 = openmm.app.AmberInpcrdFile('monomer.inpcrd')
prmtop1 = openmm.app.AmberPrmtopFile('monomer.prmtop', 
                                     periodicBoxVectors=inpcrd1.boxVectors)
system1 = prmtop1.createSystem(nonbondedMethod=openmm.app.PME, 
                               nonbondedCutoff=9 * openmm.unit.angstrom, 
                               switchDistance=8 * openmm.unit.angstrom,
                               constraints=openmm.app.HBonds)
i1 = Interchange.from_openmm(system1, 
                             prmtop1.topology, 
                             positions=inpcrd1.positions, 
                             box_vectors=inpcrd1.boxVectors)

inpcrd2 = openmm.app.AmberInpcrdFile('ALA_ALA.inpcrd')
prmtop2 = openmm.app.AmberPrmtopFile('ALA_ALA.prmtop', 
                                     periodicBoxVectors=inpcrd2.boxVectors)
system2 = prmtop2.createSystem(nonbondedMethod=openmm.app.PME, 
                               nonbondedCutoff=9 * openmm.unit.angstrom, 
                               switchDistance=8 * openmm.unit.angstrom,
                               constraints=openmm.app.HBonds)
i2 = Interchange.from_openmm(system2, 
                             prmtop2.topology, 
                             positions=inpcrd2.positions, 
                             box_vectors=inpcrd2.boxVectors)


offmol = Molecule.from_smiles("CCO")
offmol.generate_conformers()
ff = ForceField('openff-2.3.0-rc2.offxml')
i3 = ff.create_interchange(offmol.to_topology())

With this setup, the following orders of combinations have the following outcomes:

# Permutations of all three
#comb_interchange = i1.combine(i2.combine(i3)) # works
#comb_interchange = i1.combine(i3.combine(i2)) # works
#comb_interchange = i2.combine(i1.combine(i3)) # works
#comb_interchange = i2.combine(i3.combine(i1)) # works
#comb_interchange = i3.combine(i2.combine(i1)) # UnsupportedCombinationError
#comb_interchange = i3.combine(i1.combine(i2)) # UnsupportedCombinationError

# Three of the same
#comb_interchange = i1.combine(i1.combine(i1)) # UnsupportedCombinationError
#comb_interchange = i2.combine(i2.combine(i2)) # UnsupportedCombinationError
#comb_interchange = i3.combine(i3.combine(i3)) # UnsupportedCombinationError

Software versions

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