volkamerlab/teachopencadd

dev branch: T019 fails locally

mbackenkoehler opened this issue · 5 comments

The cell

modeller = app.Modeller(complex_topology, complex_positions)
modeller.addSolvent(forcefield, padding=1.0 * unit.nanometers, ionicStrength=0.15 * unit.molar)

results in the following error.

Did not recognize residue 03P; did you forget to call .add_molecules() to add it?

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[18], line 2
      1 modeller = app.Modeller(complex_topology, complex_positions)
----> 2 modeller.addSolvent(forcefield, padding=1.0 * unit.nanometers, ionicStrength=0.15 * unit.molar)

File ~/.miniconda3/envs/teachopencadd/lib/python3.9/site-packages/openmm/app/modeller.py:514, in Modeller.addSolvent(self, forcefield, model, boxSize, boxVectors, padding, numAdded, boxShape, positiveIon, negativeIon, ionicStrength, neutralize)
    510         raise ValueError('Neither the box size, box vectors, nor padding was specified, and the Topology does not define unit cell dimensions')
    512 # Have the ForceField build a System for the solute from which we can determine van der Waals radii.
--> 514 system = forcefield.createSystem(self.topology)
    515 nonbonded = None
    516 for i in range(system.getNumForces()):

File ~/.miniconda3/envs/teachopencadd/lib/python3.9/site-packages/openmm/app/forcefield.py:1218, in ForceField.createSystem(self, topology, nonbondedMethod, nonbondedCutoff, constraints, rigidWater, removeCMMotion, hydrogenMass, residueTemplates, ignoreExternalBonds, switchDistance, flexibleConstraints, drudeMass, **args)
   1214 rigidResidue = [False]*topology.getNumResidues()
   1216 # Find the template matching each residue and assign atom types.
-> 1218 templateForResidue = self._matchAllResiduesToTemplates(data, topology, residueTemplates, ignoreExternalBonds)
   1219 for res in topology.residues():
   1220     if res.name == 'HOH':
   1221         # Determine whether this should be a rigid water.

File ~/.miniconda3/envs/teachopencadd/lib/python3.9/site-packages/openmm/app/forcefield.py:1433, in ForceField._matchAllResiduesToTemplates(self, data, topology, residueTemplates, ignoreExternalBonds, ignoreExtraParticles, recordParameters)
   1431                 break
   1432 if matches is None:
-> 1433     raise ValueError('No template found for residue %d (%s).  %s  For more information, see https://github.com/openmm/openmm/wiki/Frequently-Asked-Questions#template' % (res.index+1, res.name, _findMatchErrors(self, res)))
   1434 else:
   1435     if recordParameters:

ValueError: No template found for residue 444 (03P).  This might mean your input topology is missing some atoms or bonds, or possibly that you are using the wrong force field.  For more information, see https://github.com/openmm/openmm/wiki/Frequently-Asked-Questions#template

Interestingly, it does not fail in the CI; only locally.

@AndreaVolkamer Do you have immediate thoughts on this? Is the PDB invalid for some reason? Should I just try to circumvent the problem by using a different PDB? 😅

@mbackenkoehler there is also an open PR for this issue: #308

@schallerdavid or @Mika-Le any chance one of you could have a look at this?

also mentioned in this issue: #307

Closed as a duplicate.