openforcefield / openff-toolkit

The Open Forcefield Toolkit provides implementations of the SMIRNOFF format, parameterization engine, and other tools. Documentation available at http://open-forcefield-toolkit.readthedocs.io
http://openforcefield.org
MIT License
305 stars 90 forks source link

ValueError: Found multiple NonbondedForce tags with different 1-4 scales #1717

Closed Dan-Burns closed 10 months ago

Dan-Burns commented 10 months ago

Hello,

I need some help with parameterizing a molecule. Unless I'm mistaken (most) NTPs aren't present in standard forcefields.

I've attached a zip with a notebook and input files.

I have a protein system that needs cytidine triphosphate ('CTD') present.

I loaded a .mol file of CTD into a Molecule object as input for SMIRNOFFTemplateGenerator and tried to solvate. This gave me ValueError: Found multiple NonbondedForce tags with different 1-4 scales

My script is as follows:


from openmm.app import *
from openmm import *
from openff.toolkit.topology import *
from openmm.unit import *
from openmm.app import ForceField

# parameterize ligand
molecule = Molecule()
ligand_molecule = molecule.from_file(f'{ligand.upper()}.mol')
ligand_molecule.name = 'CTP'
ligand_molecule.assign_partial_charges('am1bcc')
from openmmforcefields.generators import SMIRNOFFTemplateGenerator
smir = SMIRNOFFTemplateGenerator(molecules=ligand_molecule)
forcefield = ForceField('charmm36.xml','charmm/waters_ions_tip3p_pme_b.xml')
forcefield.registerTemplateGenerator(smir.generator)

modeller.addSolvent(forcefield, model='tip3p', padding=1*nanometer, 
                    ionicStrength=0.1*molar, boxShape='dodecahedron' )

Last part of output:


File /opt/anaconda3/envs/omm8/lib/python3.11/site-packages/openmm/app/forcefield.py:2457, in NonbondedGenerator.parseElement(element, ff)
   2453 generator = existing[0]
   2454 if (abs(generator.coulomb14scale - float(element.attrib['coulomb14scale'])) > NonbondedGenerator.SCALETOL
   2455     or abs(generator.lj14scale - float(element.attrib['lj14scale'])) > NonbondedGenerator.SCALETOL
   2456 ):
-> 2457     raise ValueError('Found multiple NonbondedForce tags with different 1-4 scales')
   2458 if (
   2459         generator.useDispersionCorrection is not None
   2460         and useDispersionCorrection is not None
   2461         and generator.useDispersionCorrection != useDispersionCorrection
   2462 ):
   2463     raise ValueError('Found multiple NonbondedForce tags with different useDispersionCorrection settings.')

ValueError: Found multiple NonbondedForce tags with different 1-4 scales

I had to hand edit the last lines of the mol file to specify charges on atoms that I didn't want protonated.

Thank you for any guidance.

Dan 1rab_test.zip

Dan-Burns commented 10 months ago

I tend to discover things shortly after I post - regardless of how much time I spent trying to work things out independently before I make the post...

The error is because I'm using the Charmm forcefield. Using Amber fixes it.

This was covered in an openmmforcefields issue here .

j-wags commented 10 months ago

Good catch! For future questions about SMIRNOFFTemplateGenerator, the OpenMMForceFields repo is the right place to ask. OpenFF and OpenMM only differ by two letters but we're actually two different groups of developers :-)