Skip to content
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

Using CHARMM36 leads to ValueError: Found multiple NonbondedForce tags with different 1-4 scales #209

Closed
ljmartin opened this issue Jul 11, 2022 · 2 comments
Labels

Comments

@ljmartin
Copy link

Hi all,
Generating a System object works fine using amber forcefields, but not with charmm - it raises ValueError: Found multiple NonbondedForce tags with different 1-4 scales. Is this the correct way to create systems for use with CHARMM36?

Using OpenFF version 0.10.1, and openmmforcefields version "0+untagged.14.g7942a11.dirty" (?)
Thank you!

A small example:

from rdkit import Chem
from rdkit.Chem import AllChem
from openmmforcefields.generators import SMIRNOFFTemplateGenerator
from openff.toolkit.topology import Molecule
from openmm.app import ForceField
from openmm import app

#ATP:
molOrig = Chem.MolFromSmiles('C1=NC(=C2C(=N1)N(C=N2)[C@H]3[C@@H]([C@@H]([C@H](O3)COP(=O)(O)OP(=O)(O)OP(=O)(O)O)O)O)N')

molOrig = Chem.AddHs(molOrig)
AllChem.EmbedMolecule(molOrig)
Chem.rdmolops.AssignAtomChiralTagsFromStructure(molOrig)
ofmol = Molecule.from_rdkit(molOrig)
ofmol.assign_partial_charges('gasteiger')
gen = SMIRNOFFTemplateGenerator(molecules=ofmol)

##works:
#forcefield = ForceField('amber/protein.ff14SB.xml')

##does not work:
forcefield = ForceField('charmm36.xml')

forcefield.registerTemplateGenerator(gen.generator)

positions = ofmol.conformers[0]
topology = ofmol.to_topology()
modeller = app.Modeller(topology.to_openmm(), positions)
system = forcefield.createSystem(modeller.topology, nonbondedMethod=app.NoCutoff)
@jchodera
Copy link
Member

The OpenFF small molecule force fields are not compatible with CHARMM---they are only intended to be used with the AMBER family of biomolecular force fields.

Since the residue template generator is only supposed to parameterize separate molecules, it is in principle possible to assign parameters with separate 1-4 scaling factors, but it would have to be through a completely separate mechanism than the OpenMM ForceField route, since it uses a single 14 scaling to generate 1-4 exceptions.

If you need to do this (recognizing that it certainly isn't recommended!), your best bet is to parameterize the components of your systems separately and then try to combine them with parmed.

@ljmartin
Copy link
Author

makes sense, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants