duartegroup / autodE

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

Hessian had no negative eigenvalues: DA check #195

Closed eneas77 closed 1 year ago

eneas77 commented 1 year ago

Describe the bug Hi,

I´ve recently installed latest version. When trying to running the simple DA example, following issue appears:

>>> import autode as ade
>>> ade.Config.n_cores = 2
>>> ade.Config.lcode = 'XTB'
>>> ade.Config.hcode = 'NWChem'
>>> rxn = ade.Reaction('C=CC=C.C=C>>C1=CCCCC1', name='DA')
>>> rxn.calculate_reaction_profile()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/utils.py", line 350, in wrapped_function
    return func(*args, **kwargs)
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/reactions/reaction.py", line 146, in calculate_reaction_profile
    calculate(self)
  File "/home/conda/envs/autode/lib/python3.10/site-packages/autode/utils.py", line 154, in wrapped_function
    result = func(*args, **kwargs)
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/reactions/reaction.py", line 136, in calculate
    reaction.locate_transition_state()
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/utils.py", line 350, in wrapped_function
    return func(*args, **kwargs)
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/utils.py", line 154, in wrapped_function
    result = func(*args, **kwargs)
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/reactions/reaction.py", line 631, in locate_transition_state
    self.tss = find_tss(self)
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/transition_states/locate_tss.py", line 61, in find_tss
    ts = get_ts(str(reaction), reactant, product, bond_rearrangement)
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/transition_states/locate_tss.py", line 316, in get_ts
    ts.optimise()
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/utils.py", line 288, in wrapped_function
    return func(*args, **kwargs)
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/transition_states/transition_state.py", line 209, in optimise
    self._run_opt_ts_calc(method=get_hmethod(), name_ext=name_ext)
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/transition_states/transition_state.py", line 88, in _run_opt_ts_calc
    optts_calc.run()
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/calculations/calculation.py", line 116, in run
    self._executor.run()
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/calculations/executors.py", line 371, in run
    self.optimiser.run(
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/opt/optimisers/base.py", line 132, in run
    self._step()  # Update self._coords
  File "/home/.conda/envs/autode/lib/python3.10/site-packages/autode/opt/optimisers/prfo.py", line 46, in _step
    raise RuntimeError(
RuntimeError: Hessian had no negative eigenvalues, cannot follow to a TS

To Reproduce Any idea of what is going on? XTB/NWChem are out of conda env. Thank you kindly

Expected behavior Previous version worked fine

Environment Ubuntu 21.04 LTS

Additional context

t-young31 commented 1 year ago

Hi @eneas77 – thanks a lot for reporting this! in hindsight I should have tried out the quickstart reaction when in v1.3.0 the NWChem wrapper switched from using NWChem to autodE optimisation algorithms..

I've reproduced this and it looks like the XTB path generates a TS guess with an eigenmode that the new optimiser can't follow, which then raises an exception which isn't handled (this should definitely be caught and the next TS find method called if so). Will hopefully get around to having a more in-depth look this weekend but for the time being it may be worth using v1.2 if you're using NWChem, until v1.3.3 is released with hopefully a fix for this!


Aside: hope you don't mind but I edited your comment to add syntax highlighting – slightly easier to parse that way!

t-young31 commented 1 year ago

199 which is included in v1.3.3 I hope fixes this by allowing calculation exceptions to be thrown in low-level TS finding, and using some more sensible defaults

t-young31 commented 1 year ago

(feel free to reopen this if this isn't the case!)