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

Could improve diagnostic error messages to fix user/database errors #2030

Closed
rwest opened this issue Oct 14, 2020 · 7 comments
Closed

Could improve diagnostic error messages to fix user/database errors #2030

rwest opened this issue Oct 14, 2020 · 7 comments
Labels
abandoned abandoned issue/PR as determined by actions bot stale stale issue/PR as determined by actions bot

Comments

@rwest
Copy link
Member

rwest commented Oct 14, 2020

Motivation or Problem

Error messages like this one
image
are not very helpful to fix the problem(s) in the database or input file (or RMG, if indeed that was the cause).

Desired Solution

Error handling in various strategic places could, when handling an exception and about to crash, report things like

  1. full adjacency list of the molecule
  2. where it came from (if it was a library, for example)
  3. which reaction created it (if it was made by a reaction)
  4. where that reaction came from
@rwest
Copy link
Member Author

rwest commented Oct 14, 2020

Also error messages like "Reaction ___ in kinetics library ___ was not balanced!" could be much worse (yay!), but could be even better, eg. could state what the imbalance is, and/or print the adjacency lists.

@Tingchenlee
Copy link
Contributor

There are also different molecules errors:

1. If the reactant contained H2O:
For reaction generation 1 process is used.
Generating thermo for new species...
Traceback (most recent call last):
File "/Users/lee.ting/Code/RMG-Py/rmg.py", line 118, in
main()
File "/Users/lee.ting/Code/RMG-Py/rmg.py", line 112, in main
rmg.execute(*kwargs)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/main.py", line 922, in execute
trimolecular_react=self.trimolecular_react)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/model.py", line 610, in enlarge
self.apply_thermo_to_species(procnum)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/model.py", line 820, in apply_thermo_to_species
self.generate_thermo(spc, rename=True)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/model.py", line 827, in generate_thermo
submit(spc, self.solvent_name)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/thermo/thermoengine.py", line 175, in submit
spc.thermo = evaluator(spc, solvent_name=solvent_name)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/thermo/thermoengine.py", line 160, in evaluator
thermo = generate_thermo_data(spc, solvent_name=solvent_name)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/thermo/thermoengine.py", line 125, in generate_thermo_data
thermo0 = thermodb.get_thermo_data(spc)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/thermo.py", line 1222, in get_thermo_data
thermo0 = self.get_thermo_data_for_surface_species(species)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/thermo.py", line 1556, in get_thermo_data_for_surface_species
self._add_group_thermo_data(adsorption_thermo, self.groups['adsorptionPt111'], molecule, {})
File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/thermo.py", line 2402, in _add_group_thermo_data
'any of its ancestors.'.format(molecule, node0))
rmgpy.exceptions.DatabaseError: Unable to determine thermo parameters for <Molecule "[N-]=[N+]=N[Pt]">: no data for node R
or any of its ancestors.

2. If the reactant contained O2:
For reaction generation 1 process is used.
Generating thermo for new species...
Traceback (most recent call last):
File "/Users/lee.ting/Code/RMG-Py/rmg.py", line 118, in
main()
File "/Users/lee.ting/Code/RMG-Py/rmg.py", line 112, in main
rmg.execute(*kwargs)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/main.py", line 922, in execute
trimolecular_react=self.trimolecular_react)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/model.py", line 610, in enlarge
self.apply_thermo_to_species(procnum)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/model.py", line 820, in apply_thermo_to_species
self.generate_thermo(spc, rename=True)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/model.py", line 827, in generate_thermo
submit(spc, self.solvent_name)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/thermo/thermoengine.py", line 175, in submit
spc.thermo = evaluator(spc, solvent_name=solvent_name)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/thermo/thermoengine.py", line 160, in evaluator
thermo = generate_thermo_data(spc, solvent_name=solvent_name)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/thermo/thermoengine.py", line 125, in generate_thermo_data
thermo0 = thermodb.get_thermo_data(spc)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/thermo.py", line 1222, in get_thermo_data
thermo0 = self.get_thermo_data_for_surface_species(species)
File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/thermo.py", line 1556, in get_thermo_data_for_surface_species
self._add_group_thermo_data(adsorption_thermo, self.groups['adsorptionPt111'], molecule, {})
File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/thermo.py", line 2402, in _add_group_thermo_data
'any of its ancestors.'.format(molecule, node0))
rmgpy.exceptions.DatabaseError: Unable to determine thermo parameters for <Molecule "[Pt]N=O">: no data for node R
or any of its ancestors.

@Tingchenlee
Copy link
Contributor

Tingchenlee commented Oct 21, 2020

Motivation or Problem

Error messages like this one
image
are not very helpful to fix the problem(s) in the database or input file (or RMG, if indeed that was the cause).

Desired Solution

Error handling in various strategic places could, when handling an exception and about to crash, report things like

  1. full adjacency list of the molecule
  2. where it came from (if it was a library, for example)
  3. which reaction created it (if it was made by a reaction)
  4. where that reaction came from

Found this error message was due to the vanishing of "Surface/CPOX_Pt/Deutschmann2006" in the reactionLibraries.
After adding the Deutschmann2006 library, the model generation completed!

rwest added a commit that referenced this issue Oct 22, 2020
Helps address #2030 which shows that sometimes you hit a DatabaseError bug
and don't know where it came from.
rwest added a commit that referenced this issue Oct 22, 2020
If there's a problem making a species or estimating its thermochemistry
it can be helpful to know where the species came from to help debugging.
This will report the reaction that was being processed when the species was made
and where it came from, e.g. the kinetics library, seed mechanism, or reaction family.
Then it will raise the original error as if nothing happened.
Helps address #2030.
rwest added a commit that referenced this issue Oct 23, 2020
Helps address #2030 which shows that sometimes you hit a DatabaseError bug
and don't know where it came from.
rwest added a commit that referenced this issue Oct 23, 2020
If there's a problem making a species or estimating its thermochemistry
it can be helpful to know where the species came from to help debugging.
This will report the reaction that was being processed when the species was made
and where it came from, e.g. the kinetics library, seed mechanism, or reaction family.
Then it will raise the original error as if nothing happened.
Helps address #2030.
@Tingchenlee
Copy link
Contributor

Tingchenlee commented Oct 28, 2020

Thanks! I really appreciate it!
After trying this branch, I got some new messages like this:

Error: Could not update atomtypes for this molecule:
multiplicity -187
1 *4 N u0 p1 c+1 {2,D}
2 *6 X u0 p0 c0 {1,D}

Error: Problem family: Surface_Adsorption_Abstraction_vdW
Error: Problem reactants: (Molecule(smiles="N#N.[Pt]"), Molecule(smiles="[Pt]N=N"))
Traceback (most recent call last):
  File "/Users/lee.ting/Code/RMG-Py/rmg.py", line 118, in <module>
    main()
  File "/Users/lee.ting/Code/RMG-Py/rmg.py", line 112, in main
    rmg.execute(**kwargs)
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/main.py", line 922, in execute
    trimolecular_react=self.trimolecular_react)
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/model.py", line 595, in enlarge
    procnum=procnum)
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/react.py", line 172, in react_all
    return react(spc_fam_tuples, procnum), [fam_tuple[0] for fam_tuple in spc_fam_tuples]
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/react.py", line 66, in react
    reactions = list(map(_react_species_star, spc_fam_tuples))
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/react.py", line 79, in _react_species_star
    return react_species(*args)
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/rmg/react.py", line 94, in react_species
    reactions = get_db('kinetics').generate_reactions_from_families(species_tuple, only_families=only_families)
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/kinetics/database.py", line 534, in generate_reactions_from_families
    prod_resonance=resonance))
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/kinetics/database.py", line 561, in react_molecules
    prod_resonance=prod_resonance))
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/kinetics/family.py", line 1710, in generate_reactions
    self._generate_reactions(reactants, products=products, forward=True, prod_resonance=prod_resonance))
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/kinetics/family.py", line 1993, in _generate_reactions
    [map_b, map_a], forward)
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/kinetics/family.py", line 1588, in _generate_product_structures
    product_structures = self.apply_recipe(reactant_structures, forward=forward)
  File "/Users/lee.ting/Code/RMG-Py/rmgpy/data/kinetics/family.py", line 1517, in apply_recipe
    struct.update(sort_atoms=not self.save_order)
  File "rmgpy/molecule/molecule.py", line 1130, in rmgpy.molecule.molecule.Molecule.update
  File "rmgpy/molecule/molecule.py", line 1355, in rmgpy.molecule.molecule.Molecule.update_atomtypes
  File "rmgpy/molecule/molecule.py", line 1350, in rmgpy.molecule.molecule.Molecule.update_atomtypes
  File "rmgpy/molecule/atomtype.py", line 729, in rmgpy.molecule.atomtype.get_atomtype
  File "rmgpy/molecule/atomtype.py", line 757, in rmgpy.molecule.atomtype.get_atomtype
rmgpy.exceptions.AtomTypeError: Unable to determine atom type for atom N+, which has 0 single bonds, 1 double bonds (0 to O, 0 to S, 1 others), 0 triple bonds, 0 quadruple bonds, 0 benzene bonds, 1 lone pairs, and +1 charge.

Is it similar to issues#213? (But the Nitrogen version)
ReactionMechanismGenerator/RMG-database#213

@rwest
Copy link
Member Author

rwest commented Oct 28, 2020

Could you include some earlier lines from the log, leading up to that message?

The problem is in Surface_Adsorption_Abstraction_vdW so maybe @mazeau could look? Might need a c0 specifying somewhere.

@Tingchenlee
Copy link
Contributor

Tingchenlee commented Oct 28, 2020

Sure! Some earlier lines...

Making seed mechanism...
Conducting simulation of reaction system 1...
 DASPK--  AT T (=R1) AND STEPSIZE H (=R2) THE                                    
      In above,  R1 =  0.9460187878302D-28   R2 =  0.1702833818094D-27
 DASPK--  ERROR TEST FAILED REPEATEDLY OR WITH ABS(H)=HMIN                       
Error: Trying to step from time 0.0 to 1e-12 resulted in a solver (DASPK) error: DASPK returned with an IDID = -6, Repeated error test failures occurred on the last attempted step in DDASPK.  A singularity in the solution may be present.  If you are absolutely certain you want to continue, you should restart the integration.  (Provide initial values of Y and YPRIME which are consistent.)
Resurrecting Model...
At time 9.4602e-29 s, species [Pt]N=N(29) at rate ratio 5.652820754032678e-20 was added to model core in model resurrection process


Adding species [Pt]N=N(29) to model core

Summary of Model Enlargement
---------------------------------
Added 1 new core species
    [Pt]N=N(29)
Created 0 new edge species
Moved 5 reactions from edge to core
    N2_X(18) + [H][H].[Pt](27) <=> H_X(19) + [Pt]N=N(29)
    N2(4) + H_X(19) <=> [Pt]N=N(29)
    N2_X(18) + H_X(19) <=> X(5) + [Pt]N=N(29)
    N2_X(18) + C.[Pt](26) <=> [Pt]N=N(29) + C[Pt](25)
    N2_X(18) + C[Pt](25) <=> [Pt]N=N(29) + C=[Pt](31)
Added 0 new core reactions
Created 0 new edge reactions

After model enlargement:
    The model core has 18 species and 22 reactions
    The model edge has 22 species and 45 reactions


For reaction generation 1 process is used.
Error: Could not update atomtypes for this molecule:
multiplicity -187
1 *4 N u0 p1 c+1 {2,D}
2 *6 X u0 p0 c0 {1,D}

rwest added a commit that referenced this issue Oct 29, 2020
If there's a problem making a species or estimating its thermochemistry
it can be helpful to know where the species came from to help debugging.
This will report the reaction that was being processed when the species was made
and where it came from, e.g. the kinetics library, seed mechanism, or reaction family.
Then it will raise the original error as if nothing happened.
Helps address #2030.
mjohnson541 pushed a commit that referenced this issue Apr 26, 2021
Helps address #2030 which shows that sometimes you hit a DatabaseError bug
and don't know where it came from.
mjohnson541 pushed a commit that referenced this issue Apr 26, 2021
If there's a problem making a species or estimating its thermochemistry
it can be helpful to know where the species came from to help debugging.
This will report the reaction that was being processed when the species was made
and where it came from, e.g. the kinetics library, seed mechanism, or reaction family.
Then it will raise the original error as if nothing happened.
Helps address #2030.
@github-actions
Copy link

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.

@github-actions github-actions bot added the stale stale issue/PR as determined by actions bot label Jun 21, 2023
@github-actions github-actions bot added the abandoned abandoned issue/PR as determined by actions bot label Jul 23, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abandoned abandoned issue/PR as determined by actions bot stale stale issue/PR as determined by actions bot
Projects
None yet
Development

No branches or pull requests

2 participants