While using xtb-python together with PySCF, I noticed a strange behaviour. Different energies would be obtained whether I got the coordinates from the PySCF Mole object or read them myself from an xyz file. I think the problem here is that PySCF uses F contiguous arrays, while xtb-python expects C contiguous. The problem is fixed by changing the order with np.ascontiguousarray. I guess that ideally this check + conversion should be done on the xib-python side.
mol = gto.Mole(verbose=0, basis="def2svp").fromfile("xtbopt.xyz", format="xyz")
elements = mol.atom_charges()
coordinates = mol.atom_coords()
coordinates.flags
C_CONTIGUOUS : False
F_CONTIGUOUS : True
OWNDATA : True
WRITEABLE : True
ALIGNED : True
WRITEBACKIFCOPY : False
UPDATEIFCOPY : False
calc_r = Calculator(get_method("GFNFF"), elements, coordinates)
results = calc_r.singlepoint()
results.get_energy()
coordinates = np.ascontiguousarray(mol.atom_coords())
coordinates.flags
C_CONTIGUOUS : True
F_CONTIGUOUS : False
OWNDATA : True
WRITEABLE : True
ALIGNED : True
WRITEBACKIFCOPY : False
UPDATEIFCOPY : False
calc_r = Calculator(get_method("GFNFF"), elements, coordinates)
results = calc_r.singlepoint()
results.get_energy()
xtbopt.xyz.zip
While using xtb-python together with PySCF, I noticed a strange behaviour. Different energies would be obtained whether I got the coordinates from the PySCF Mole object or read them myself from an xyz file. I think the problem here is that PySCF uses F contiguous arrays, while xtb-python expects C contiguous. The problem is fixed by changing the order with
np.ascontiguousarray. I guess that ideally this check + conversion should be done on the xib-python side.xtbopt.xyz.zip