Skip to content

Psi4 fix

Ben Comer requested to merge benmcomer/ase:psi4_fix into master

psi4 will sometimes rotate molecules without informing the user, returning forces in the rotated frame. This merge is a one-line fix that prevents psi4 from rotating molecules. The code below demonstrates the error, this structure will only optimize if the no_reorient line is added.

import numpy as np

from ase.optimize import BFGSLineSearch
from ase.calculators.psi4 import Psi4
from ase import Atoms


atoms = Atoms(symbols='OH2',
              pbc=np.array([False, False, False]),
              cell=np.array([[15.,  0.,  0.],
                             [0., 15.1,  0.],
                             [0.,  0., 15.2]]),
              positions=np.array([[7.5, 7.81624166, 8.0409556],
                                  [7.5, 8.41255066, 7.2777166],
                                  [7.5, 6.68744934, 7.1590444]]))

calc = Psi4(atoms=atoms)
atoms.set_calculator(calc)
relax = BFGSLineSearch(atoms)
relax.run(0.05)

Merge request reports