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

Error exit upon failure to find atom type #589

Open
iGulitch opened this issue Oct 17, 2024 · 0 comments
Open

Error exit upon failure to find atom type #589

iGulitch opened this issue Oct 17, 2024 · 0 comments

Comments

@iGulitch
Copy link

Describe the behavior you would like added to Foyer

When Foyer can't find an atom type in *.xml file for an atom during the FF application to a molecule, it exits immediately with error message and big python error traceback :

>>> mol_ff = ff.apply(mol)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/foyer/foyer/forcefield.py", line 758, in apply
    typemap = self.run_atomtyping(
              ^^^^^^^^^^^^^^^^^^^^
  File "/foyer/foyer/forcefield.py", line 837, in run_atomtyping
    typemap = find_atomtypes(structure, forcefield=self)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/foyer/foyer/atomtyper.py", line 146, in find_atomtypes
    _resolve_atomtypes(topology_graph, typemap)
  File "/foyer/foyer/atomtyper.py", line 221, in _resolve_atomtypes
    raise FoyerError(
foyer.exceptions.FoyerError: Found no types for atom numbered 2 which is atomic number 6. Forcefield file is missing this atomtype, so try to add SMARTS definitions to account for this atom.

However, there might be other atoms, for which atom types info is missing, which the user won't know about until the current issue is fixed. That would be useful, if all such problems are collected and reported all at once, e.g. :

Found no types for atom numbered i1 which is atomic number n1.
Found no types for atom numbered i2 which is atomic number n2.
...
Found no types for atom numbered i3 which is atomic number n3.

Also, perhaps, suppressing the python output would also be nice?

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

1 participant