Running Psi4 (as a shared library) using (only) valid python

Could you not be calling update_geometry() enough? Any time you want the Molecule to reinterpret itself, you’ve got to call that function. I’m not sure of exactly your problem, but here’s an example of changing geometries between psi4.Matrix and python array classes where the Molecule is behaving fairly sanely.


molecule form {
C  0.0 0.0 0.0
O  0.0 1.2 0.0
H -0.8 -0.3 0.0
H  0.8 -0.3 0.0
}

form.update_geometry()
form.print_out()
pre = form.geometry()

pre.print_out()

pygeom = [[ 0.0,  0.0, 0.0],
          [ 0.0,  1.5, 0.0],
          [-0.8, -0.3, 0.0],
          [ 0.8, -0.3, 0.0]]
pygeom = pygeom
psimat = psi4.Matrix(4, 3)
psimat.set(pygeom)
psimat.scale(1.0/0.529)

psimat.print_out()

form.set_geometry(psimat)
form.print_out()
form.update_geometry()
form.print_out()

Thanks for the suggestions. I am now creating matrix objects from lists as you did and things are working okay during initial testing. Any thoughts on how to cleanly exit from Psi4 when using the shared library?

-David

Just raise a python exception:

raise Exception("Killing Psi4")