ReactionMechanismGenerator / RMG-Py

Python version of the amazing Reaction Mechanism Generator (RMG).
http://reactionmechanismgenerator.github.io/RMG-Py/
Other
397 stars 228 forks source link

Solute corrections create invalid molecules #1505

Closed cgrambow closed 1 year ago

cgrambow commented 6 years ago

Bug Description

transformLonePairs in solvation.py creates an invalid atom type for the HCOH species in the Klippenstein_Glarborg2016 library because it breaks up the lone pair on the carbon into two radical electrons. Traceback:

Error: Could not update atomtypes for this molecule:
multiplicity 1
1 O u0 p1 c+1 {2,D} {4,S}
2 C u2 p0 c-1 {1,D} {3,S}
3 H u0 p0 c0 {2,S}
4 H u0 p0 c0 {1,S}

Traceback (most recent call last):
  File "/home/cgrambow/Code/RMG-Py/rmg.py", line 173, in <module>
    main()
  File "/home/cgrambow/Code/RMG-Py/rmg.py", line 167, in main
    rmg.execute(**kwargs)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/rmg/main.py", line 603, in execute
    self.initialize(**kwargs)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/rmg/main.py", line 494, in initialize
    self.reactionModel.addReactionLibraryToEdge(library)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/rmg/model.py", line 1581, in addReactionLibraryToEdge
    r, isNew = self.makeNewReaction(rxn) # updates self.newSpeciesList and self.newReactionlist
  File "/home/cgrambow/Code/RMG-Py/rmgpy/rmg/model.py", line 503, in makeNewReaction
    products  = [self.makeNewSpecies(product)[0]  for product  in forward.products ]
  File "/home/cgrambow/Code/RMG-Py/rmgpy/rmg/model.py", line 371, in makeNewSpecies
    submit(spec,self.solventName)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/thermo/thermoengine.py", line 188, in submit
    spc.thermo = submit_(evaluator, spc, solventName= solventName)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/scoop_framework/util.py", line 171, in submit_
    return func(*args, **kwargs)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/thermo/thermoengine.py", line 174, in evaluator
    thermo = generateThermoData(spc,solventName=solventName)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/thermo/thermoengine.py", line 157, in generateThermoData
    return processThermoData(spc, thermo0, thermoClass, solventName)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/thermo/thermoengine.py", line 72, in processThermoData
    soluteData = solvationdatabase.getSoluteData(spc)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/data/solvation.py", line 625, in getSoluteData
    soluteData = self.getSoluteDataFromGroups(species)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/data/solvation.py", line 684, in getSoluteDataFromGroups
    sdata = self.estimateSoluteViaGroupAdditivity(molecule)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/data/solvation.py", line 809, in estimateSoluteViaGroupAdditivity
    saturatedStruct, addedToPairs = self.transformLonePairs(saturatedStruct)
  File "/home/cgrambow/Code/RMG-Py/rmgpy/data/solvation.py", line 745, in transformLonePairs
    saturatedStruct.update()
  File "rmgpy/molecule/molecule.py", line 898, in rmgpy.molecule.molecule.Molecule.update
  File "rmgpy/molecule/molecule.py", line 1112, in rmgpy.molecule.molecule.Molecule.updateAtomTypes
  File "rmgpy/molecule/molecule.py", line 1107, in rmgpy.molecule.molecule.Molecule.updateAtomTypes
  File "rmgpy/molecule/atomtype.py", line 665, in rmgpy.molecule.atomtype.getAtomType
  File "rmgpy/molecule/atomtype.py", line 700, in rmgpy.molecule.atomtype.getAtomType
rmgpy.exceptions.AtomTypeError: Unable to determine atom type for atom C..-, which has 1 single bonds, 0 double bonds to C, 1 double bonds to O, 0 double bonds to S, 0 triple bonds, 0 benzene bonds, 0 lone pairs, and -1 charge.

How To Reproduce

Run a liquid phase RMG job using Klippenstein_Glarborg2016 as a reaction library.

Additional Context

What is the reason for splitting up lone pairs in this way? We probably don't expect to encounter this very often, so how should we handle such errors?

github-actions[bot] commented 1 year ago

This issue is being automatically marked as stale because it has not received any interaction in the last 90 days. Please leave a comment if this is still a relevant issue, otherwise it will automatically be closed in 30 days.