I never used this functionality, but from the Psi4 manual you should be able to do H2O = qcdb.Molecule.init_with_xyz('h2o.xyz')
and then perform your computation on the water molecule.
I do not think there is a way to export the MO energies to a separate file. You should probably write a script to do that, I would advise to look into Python, it’s pretty easy to learn and can do everything you need. There is a lot of tutorials and help available on the Internet for Python.
eigvecs is now a Psi4 Vector object which you can iterator over, print, and store using normal python techniques. You can also convert to a numpy array and save easily:
import numpy as np
np_eigvecs = np.array(eigvecs)
np.save('scf_eigenvalues.csv', np_eigvecs)
@jgonthier exactly this does NOT work for me. The problem is that H20 is not a molecule object (pointer if you print it), it is just a simple string with all the information
@dgasmith Thanks a lot, this works fine for me, exactly what I was looking for
Yeah, sorry, I should have noticed the above wouldn’t work. This is slightly more complicated than it ought to be b/c our internal C++ Molecule class doesn’t export its init_with_xyz to Python. But the below works and should orient you to what’s going on.
# read from XYZ file into a Molecule in the python qcdb.Molecule class
# note that though not properly in the XYZ file spec, can convey charge/multiplicity here
# contents of h3op.xyz:
# 4
# 1 1
# O 0.0 0.0 0.0
# H 1.0 0.0 0.0
# H 0.0 1.0 0.0
# H 0.0 0.0 1.0
qmol = qcdb.Molecule.init_with_xyz('h3op.xyz')
# create a Psi4 C++ class Molecule from that python Molecule
lmol = geometry(qmol.create_psi4_string_from_molecule())
# odd little line that does some initialization of the molecule
# * if you're doing the above, then setting some options and running energy(),
# then energy() will handle this step and you don't need this line and can
# comment it out
# * but if you want to probe the molecule a bit *before* running energy(),
# as we do in the next section by printing NRE, etc., then you *do* need
# this line, otherwise your molecule will look empty ("No atoms in this molecule.")
lmol.update_geometry()
# stuff you can do: print NRE to screen, print geometry to output file
print lmol.nuclear_repulsion_energy()
lmol.print_out()
# more interesting stuff you can do: run SCF
set basis cc-pvdz
energy('hf')
# just checking we get the same answers
compare_values(-76.28175456610472, get_variable('HF TOTAL ENERGY'), 5, 'HF E')