duartegroup / autodE

automated reaction profile generation
https://duartegroup.github.io/autodE/
MIT License
165 stars 51 forks source link

autode.exceptions.NoConformers(xtb and orca) #268

Closed KS-spec closed 1 year ago

KS-spec commented 1 year ago

Describe the bug Failed to produce conformers with this error message : "autode.exceptions.NoConformers"

To Reproduce

-input-

import autode as ade
ade.Config.n_cores = 48
rxn = ade.Reaction('C[Sn](C)(OC1C(C)(C)C(O)C1(C)C)OC(C2=CC=C(C(O)=O)C=C2)=O>>CC1(C)C(OC(C2=CC=C(C(O)=O)C=C2)=O)C(C)(C)C1O.O=[Sn](C)C', name='pol_3')
rxn.calculate_reaction_profile()

-output-

Traceback (most recent call last):
  File "poly.py", line 8, in <module>
    rxn.calculate_reaction_profile()
  File "/home/---/miniforge3/envs/catalyst/lib/python3.8/site-packages/autode/utils.py", line 345, in wrapped_function
    return func(*args, **kwargs)
  File "/home/---/miniforge3/envs/catalyst/lib/python3.8/site-packages/autode/reactions/reaction.py", line 139, in calculate_reaction_profile
    calculate(self)
  File "/home/---/miniforge3/envs/catalyst/lib/python3.8/site-packages/autode/utils.py", line 163, in wrapped_function
    result = func(*args, **kwargs)
  File "/home/---/miniforge3/envs/catalyst/lib/python3.8/site-packages/autode/reactions/reaction.py", line 127, in calculate
    reaction.find_lowest_energy_conformers()
  File "/home/---/miniforge3/envs/catalyst/lib/python3.8/site-packages/autode/reactions/reaction.py", line 533, in find_lowest_energy_conformers
    mol.find_lowest_energy_conformer(hmethod=h_method)
  File "/home/---/miniforge3/envs/catalyst/lib/python3.8/site-packages/autode/utils.py", line 163, in wrapped_function
    result = func(*args, **kwargs)
  File "/home/---/miniforge3/envs/catalyst/lib/python3.8/site-packages/autode/species/species.py", line 1244, in find_lowest_energy_conformer
    self._set_lowest_energy_conformer()
  File "/home/---/miniforge3/envs/catalyst/lib/python3.8/site-packages/autode/utils.py", line 317, in wrapped_function
    raise NoConformers
autode.exceptions.NoConformers

Expected behavior

Successful calculation

Environment

Additional context

There are some files In the "3-pos/conformers/".

t-young31 commented 1 year ago

Hi @KS-spec – no conformers usually means either energies for all the conformers have failed to be calculated or that the optimised geometry no longer generates a molecular graph that matches the input. In this case I think it could be either or! Were there any errors in the output (other than the exception)? And what do the ORCA output files in 3-pos/conformers/ look like?

KS-spec commented 1 year ago

Thank you for your reply. Previously, when I did the calculation, I was running the .py as a batch job and only that error was outputted. When I tried running it in a notebook, as you pointed out, an error related to the molecular graph occurred.


File ~/miniforge3/envs/catalyst/lib/python3.8/site-packages/autode/mol_graphs.py:105, in make_graph(species, rel_tolerance, bond_list, allow_invalid_valancies) 71 """ 72 Make the molecular graph from the 'bonds' determined on a distance criteria 73 or a SMILES parser object. All attributes default to false:: (...) 101 NoAtomsInMolecule: 102 """ 104 if species.n_atoms == 0: --> 105 raise ex.NoAtomsInMolecule('Could not build a molecular graph with no ' 106 'atoms') 108 logger.info('Generating molecular graph with NetworkX') 110 graph = MolecularGraph()

NoAtomsInMolecule: Could not build a molecular graph with no atoms

Additionally, the out file of the previous calculation using orca indicated that it did not converge.

                              WARNING !!!
   The optimization did not converge but reached the maximum number of
   optimization cycles.
   Please check your results very carefully.
----------------------------------------------------------------------------
KS-spec commented 1 year ago

May I ask if it is possible to proceed with the calculation by providing an xyz file or something similar if the conformer search fails? Also, is it possible to change the convergence conditions for structure optimization in a similar way to changing the conditions for SCF calculation, which was mentioned in a previous question? Thank you.

t-young31 commented 1 year ago

sorry for the slow response @KS-spec – you definitely should be able to provide xyz files, but also then might need to call something other than .calculate_reaction_profile if you want to avoid the conformer search. Something like

import autode as ade
# assuming the charge=0 and spin multiplicity = 1
r = ade.Reactant("reactant.xyz")
p = ade.Product("product.xyz")

rxn = ade.Reaction(r, p)
rxn.optimise_reacs_prods()
rxn.locate_transition_state()
rxn.calculate_single_points()
rxn.print_output()

As for changing convergence conditions: definitely, should be much the same as in https://github.com/duartegroup/autodE/issues/269, or max the number of optimisation cycles changed with e.g. ade.Config.ORCA.keywords.opt.max_opt_cycles = 100

KS-spec commented 1 year ago

Thank you very much for your kind reply. I will try it.

Best,