Thanks for all the advice. I currently manages to write the densities into a molden file using the following script:
ci_energy, ci_wfn = energy('FCI', return_wfn=True)
nmo=ci_wfn.nmo()
nso=ci_wfn.nso()
# Alpha Density
CA = ci_wfn.Ca()
DA = ci_wfn.Da()
NOSA = psi4.Matrix(nmo,nmo);
NOSOA = psi4.Matrix(nso,nmo);
NOOCA = psi4.Vector(nmo);
DA.diagonalize(NOSA,NOOCA,DiagonalizeOrder.Descending)
NOSOA.gemm(False, False, 1.0, CA, NOSA, 0.0)
# Beta Density
CB = ci_wfn.Cb()
DB = ci_wfn.Db()
NOSB = psi4.Matrix(nmo,nmo);
NOSOB = psi4.Matrix(nso,nmo);
NOOCB = psi4.Vector(nmo);
DB.diagonalize(NOSB,NOOCB,DiagonalizeOrder.Descending)
NOSOB.gemm(False, False, 1.0, CB, NOSB, 0.0)
# Total Density
D = psi4.Matrix(nmo,nmo);
D.zero()
D.add(DA)
D.add(DB)
NOS = psi4.Matrix(nmo,nmo);
NOSO = psi4.Matrix(nso,nmo);
NOOC = psi4.Vector(nmo);
D.diagonalize(NOS,NOOC,DiagonalizeOrder.Descending)
NOSO.gemm(False, False, 1.0, CA, NOS, 0.0)
# Molden File
mw = psi4.MoldenWriter(ci_wfn)
mw.write('AB.molden', NOSOA, NOSOB, NOOCA, NOOCB, NOOCA, NOOCB)
The molden write is a bit annoying in the sense that it orders the nos in an ascending manner. Nevertheless, it works. There is a writeNO function for MoldenWrite but this is not enabled for the python interface. This might be a very simple change and would save much of the script. I am trying to generalize this for general symmetry but I am not there yet. This might also be solved if writeNO would be enabled since it will take the psi.Matrix in the MO basis directly.
Since I am still rather new to all these environment variables I would appreciate any comments anyone might have on the script.
Best,
Shachar