duartegroup / autodE

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

Constraints are ignored by xTB for Molecule().optimise() #245

Closed shoubhikraj closed 1 year ago

shoubhikraj commented 1 year ago
>>> import autode as ade
>>> mol = ade.Molecule(smiles='CCCO')
>>> mol.coordinates
Coordinates([[-1.306  -0.4675  0.2225]
 [-0.1404 -0.1831 -0.6519]
 [ 0.8531  0.7802 -0.0408]
 [ 1.3596  0.2682  1.1512]
 [-1.3114 -1.555   0.5116]
 [-1.3189  0.1064  1.1666]
 [-2.2933 -0.2964 -0.2571]
 [-0.486   0.1993 -1.6328]
 [ 0.4404 -1.1305 -0.8473]
 [ 1.7187  0.9044 -0.7223]
 [ 0.4255  1.7678  0.1718]
 [ 2.0586 -0.3937  0.9285]] Å)
>>> mol.constraints.cartesain = [0,1]
>>> mol.optimise(method=ade.methods.XTB())
>>> mol.coordinates
Coordinates([[-1.27720409 -0.52228338  0.25626575]
 [-0.05931335 -0.31812982 -0.63671753]
 [ 0.82733842  0.82100849 -0.12973593]
 [ 1.36479762  0.57179659  1.14757381]
 [-1.84804755 -1.39098091 -0.06346189]
 [-0.96362728 -0.66905583  1.28723299]
 [-1.92374216  0.35140304  0.21850671]
 [-0.37494956 -0.08805323 -1.65564772]
 [ 0.53117733 -1.23878808 -0.66867035]
 [ 1.63575406  1.00972798 -0.85285968]
 [ 0.24001634  1.73564627 -0.02231566]
 [ 1.84770022 -0.26219111  1.1198295 ]] Å)

All atoms are optimised by xTB, despite constraints. (Is this something that would be best to use autode.opt.optimisers?) However, when optimised with ORCA, the constraints are present in the optimisation, as the coordinates of those atoms do not move.

t-young31 commented 1 year ago

Thanks for finding this @shoubhikraj – looks like at some point the format of the cartesian constraints has changed in XTB, and so they're just ignored in the input file 😞

Happy to have a go fixing this