# Chemistry - Conversion of Hessian from internal coordinates to cartesian coordinates

## Solution 1:

BAGEL (http://nubakery.org/ and https://github.com/nubakery/bagel) has CASPT2 analytical gradients and can run frequency computations.

It's currently being prepared for 1.0 release, so it might still have bugs. On the other hand, it is freely available under the GPL.

As for converting the Hessian, it might be useful to look at the INTDER program, which is (among others?) part of the PSI3 suite of programs available here: https://sourceforge.net/projects/psicode/files/psi/3.4.0/psi-3.4.0.tar.gz/download - PSI3 is under the GPL as well.

The manual page for INTDER is here: https://manned.org/intder and it says:

"Force field transformations between Cartesian and general internal coordinate spaces up to fourth order, including nonstationary reference structures. Both forward and reverse transformations are possible; hence, by using intermediate Cartesian coordinates, force fields can be transferred among different representations in the internal space."

Whether or not it will be easy to coerce the MOLCAS Hessian into a format INTDER likes and then transform it as you want I cannot say as I don't have any direct experience with INTDER - it is typically run as a step in a chain of commands automatically generated by the PSI3 driver routines.

## Solution 2:

In the Geometric ^{[1]} package, there is code to convert an internal coordinate Hessian into Cartesian coordinates

```
def calcHessCart(self, xyz, gradq, hessq):
"""
Compute the Cartesian Hessian given internal coordinate gradient and Hessian.
Returns the answer in a.u.
"""
Bmat = self.wilsonB(xyz)
Hx = np.einsum('ai,ab,bj->ij', Bmat, hessq, Bmat, optimize=True)
Hx += np.einsum('ji,j->i', Bmat, gradq, optimize=True)
return Hx
```

The code is also reproduced in my repository^{[2]} but I've never attempted to use it

**References:**

- https://raw.githubusercontent.com/leeping/geomeTRIC/master/geometric/internal.py
- https://github.com/ZimmermanGroup/pyGSM/tree/master/pygsm/coordinate_systems