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 not determine representative localized structures #1598

Closed
2 of 6 tasks
AH9316 opened this issue May 10, 2019 · 11 comments
Closed
2 of 6 tasks

Could not determine representative localized structures #1598

AH9316 opened this issue May 10, 2019 · 11 comments

Comments

@AH9316
Copy link

AH9316 commented May 10, 2019

Topic

General area which your question is related to.

  • Installation of RMG
  • Running an RMG job
  • Using RMG API
  • Arkane (formerly CanTherm)
  • Dependencies
  • An error message

Context

With running one RMG simulation, I get an error:

Traceback (most recent call last):
  File "/opt/scientific/RMG-Py-stable/rmgpy/scoop_framework/util.py", line 112, in __call__
    return self.myfn(*args, **kwargs)
  File "/opt/scientific/RMG-Py-stable/rmgpy/rmg/react.py", line 75, in reactSpecies
    reactions = getDB('kinetics').generate_reactions_from_families(speciesTuple)
  File "/opt/scientific/RMG-Py-stable/rmgpy/data/kinetics/database.py", line 513, in generate_reactions_from_families
    reaction_list = find_degenerate_reactions(reaction_list, same_reactants, kinetics_database=self)
  File "/opt/scientific/RMG-Py-stable/rmgpy/data/kinetics/common.py", line 279, in find_degenerate_reactions
    rxn0.ensure_species()
  File "rmgpy/reaction.py", line 1108, in rmgpy.reaction.Reaction.ensure_species
    def ensure_species(self, reactant_resonance=False, product_resonance=True):
  File "rmgpy/reaction.py", line 1126, in rmgpy.reaction.Reaction.ensure_species
    ensure_species(self.products, resonance=product_resonance, keep_isomorphic=True)
  File "/opt/scientific/RMG-Py-stable/rmgpy/data/kinetics/common.py", line 171, in ensure_species
    new_item.generate_resonance_structures(keep_isomorphic=keep_isomorphic)
  File "rmgpy/species.py", line 168, in rmgpy.species.Species.generate_resonance_structures
    def generate_resonance_structures(self, keep_isomorphic=True, filter_structures=True):
  File "rmgpy/species.py", line 178, in rmgpy.species.Species.generate_resonance_structures
    self.molecule = self.molecule[0].generate_resonance_structures(keep_isomorphic=keep_isomorphic,
  File "rmgpy/molecule/molecule.py", line 1775, in rmgpy.molecule.molecule.Molecule.generate_resonance_structures
    def generate_resonance_structures(self, keep_isomorphic=False, filter_structures=True):
  File "rmgpy/molecule/molecule.py", line 1777, in rmgpy.molecule.molecule.Molecule.generate_resonance_structures
    return resonance.generate_resonance_structures(self, keep_isomorphic=keep_isomorphic,
  File "rmgpy/molecule/resonance.py", line 151, in rmgpy.molecule.resonance.generate_resonance_structures
    def generate_resonance_structures(mol, clar_structures=True, keep_isomorphic=False, filter_structures=True):
  File "rmgpy/molecule/resonance.py", line 240, in rmgpy.molecule.resonance.generate_resonance_structures
    return filtration.filter_structures(mol_list, features=features)
  File "/opt/scientific/RMG-Py-stable/rmgpy/molecule/filtration.py", line 76, in filter_structures
    mol_list[0].toSMILES()))
ResonanceError: Could not determine representative localized structures for species CCCCC(CO[N+]([C]1[CH][CH][CH][CH][CH]1)([O])[O-])CC

Traceback (most recent call last):
  File "./rmg.py", line 173, in <module>
    main()
  File "./rmg.py", line 167, in main
    rmg.execute(**kwargs)
  File "/opt/scientific/RMG-Py-stable/rmgpy/rmg/main.py", line 841, in execute
    trimolecularReact=self.trimolecularReact)
  File "/opt/scientific/RMG-Py-stable/rmgpy/rmg/model.py", line 679, in enlarge
    unimolecularReact, bimolecularReact, trimolecularReact=trimolecularReact)
  File "/opt/scientific/RMG-Py-stable/rmgpy/rmg/react.py", line 143, in reactAll
    rxns = list(react(*spcTuples))
  File "/opt/scientific/RMG-Py-stable/rmgpy/rmg/react.py", line 59, in react
    spcTuples)
  File "/opt/scientific/RMG-Py-stable/rmgpy/scoop_framework/util.py", line 154, in map_
    return map(WorkerWrapper(args[0]), *args[1:], **kwargs)
  File "build/bdist.linux-x86_64/egg/scoop/fallbacks.py", line 49, in wrapper
  File "/opt/scientific/RMG-Py-stable/rmgpy/scoop_framework/util.py", line 112, in __call__
    return self.myfn(*args, **kwargs)
  File "/opt/scientific/RMG-Py-stable/rmgpy/rmg/react.py", line 75, in reactSpecies
    reactions = getDB('kinetics').generate_reactions_from_families(speciesTuple)
  File "/opt/scientific/RMG-Py-stable/rmgpy/data/kinetics/database.py", line 513, in generate_reactions_from_families
    reaction_list = find_degenerate_reactions(reaction_list, same_reactants, kinetics_database=self)
  File "/opt/scientific/RMG-Py-stable/rmgpy/data/kinetics/common.py", line 279, in find_degenerate_reactions
    rxn0.ensure_species()
  File "rmgpy/reaction.py", line 1108, in rmgpy.reaction.Reaction.ensure_species
  File "rmgpy/reaction.py", line 1126, in rmgpy.reaction.Reaction.ensure_species
  File "/opt/scientific/RMG-Py-stable/rmgpy/data/kinetics/common.py", line 171, in ensure_species
    new_item.generate_resonance_structures(keep_isomorphic=keep_isomorphic)
  File "rmgpy/species.py", line 168, in rmgpy.species.Species.generate_resonance_structures
  File "rmgpy/species.py", line 178, in rmgpy.species.Species.generate_resonance_structures
  File "rmgpy/molecule/molecule.py", line 1775, in rmgpy.molecule.molecule.Molecule.generate_resonance_structures
  File "rmgpy/molecule/molecule.py", line 1777, in rmgpy.molecule.molecule.Molecule.generate_resonance_structures
  File "rmgpy/molecule/resonance.py", line 151, in rmgpy.molecule.resonance.generate_resonance_structures
  File "rmgpy/molecule/resonance.py", line 240, in rmgpy.molecule.resonance.generate_resonance_structures
  File "/opt/scientific/RMG-Py-stable/rmgpy/molecule/filtration.py", line 76, in filter_structures
    mol_list[0].toSMILES()))
rmgpy.exceptions.ResonanceError: Could not determine representative localized structures for species CCCCC(CO[N+]([C]1[CH][CH][CH][CH][CH]1)([O])[O-])CC

Question

What does this error mean? Does this mean RMG cannot generate the above species' structure? And how to fix this problem? I attach the input file below,

input_gasoline_C8H17NO3_baseline_T_0.01_C_0.95_725_.zip

@alongd
Copy link
Member

alongd commented May 11, 2019

The website does generate resonance structures for CCCCC(CO[N+](C1C=CC=CC=1)([O])[O-])CC:
image
I'll continue exploring

@AH9316
Copy link
Author

AH9316 commented May 11, 2019

So now, I am confused. Does it mean that with one SMILES, we can generate several different structures, and now the RMG cannot determine which one to use? Looking forward to the solution, it is very important for us to get a model with gasoline and 2-Ethylhexyl-nitrate blend.

@alongd
Copy link
Member

alongd commented May 11, 2019

Yes, SMILES represent localized structures, while many species have delocalization (resonance). In this case, the only difference is whether the benzene ring is represented with alternating S/D bonds or with aromatic bonds (with bond orders of 1.5).
No, RMG has no problem (generally speaking) of determining "which one to use".
We're looking into your original issue

@alongd
Copy link
Member

alongd commented May 11, 2019

@mliu49, it seems to me that in filtration.py, aromaticity_filtration returns an empty list in this case. Looks like we assume the aromatic structure exists in the molecule list (but it doesn't), and we remove the monocyclic Kekule structure. Could you take a look? We need to figure out why wasn't the aromatic structure generated (or stored). Perhaps we could also add a check at the end of aromaticity_filtration to verify it doesn't return an empty list?

@mliu49
Copy link
Contributor

mliu49 commented May 13, 2019

I've discovered that octet_filtration is removing the aromatic resonance structure for some reason. Interestingly, it seems to be dependent on atom order (most likely via Atom.sortingLabel). When I tried to add some debugging statements which would print the molecule SMILES, the error went away. I narrowed it down to the fact that Molecule.sortAtoms is called in the process of SMILES generation.

Unfortunately, I haven't been able to create an easily replicable test case. I can't seem to recreate the error by creating the molecule from scratch in an ipython notebook. Running the input file does generate the error consistently though, and sorting atoms for each molecule in mol_list is able to prevent the error. I don't feel comfortable implementing that as a fix until understanding exactly why though.

@AH9316
Copy link
Author

AH9316 commented May 13, 2019

As a general user is there any easy way to fix this problem since I have no idea how to actually sort atoms for each molecule in mol_list. Thanks!

@mliu49
Copy link
Contributor

mliu49 commented May 13, 2019

Sorry, that wasn't necessarily intended to be a user fix. If you really want and are comfortable with editing code, you can add the following lines here:

for mol in mol_list:
    mol.sortAtoms()

The purpose of my comment was primarily to help us debug this issue. Once we do find the root cause, we'll patch it and you can update your local version.

@alongd
Copy link
Member

alongd commented May 15, 2019

@AH9316, PR #1600 should address this issue. Try updating RMG and let us know whether this is resolved.

@AH9316
Copy link
Author

AH9316 commented May 16, 2019

@alongd I updated RMG with "conda update rmg rmgdatabase -c rmg" command, but I still get the same error. When I installed RMG, I followed "For Basic Users: Binary installation using Anaconda for Unix-Based Systems" guide. Should I install RMG again by following "For Developers: Installation by Source Using Anaconda Environment" guide so that this error will disappear?

@alongd
Copy link
Member

alongd commented May 16, 2019

Yes, the developer installation is able to be updated by the user (so it should solve your issue). The basic version is updated periodically, the next update should be son (end of May or early June). So go ahead and install the developer version.

@mliu49
Copy link
Contributor

mliu49 commented Jun 14, 2019

Fixed by #1600

@mliu49 mliu49 closed this as completed Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants