What is the syntax for the Da function?


#1

I have a wavefunction from an energy calculation with return_wfn=True. There is a Da function in the wavefunction class that returns the alpha density matrix. If I write
dm = wfn.Da()
or
dm = np.array(wfn.Da())
I expect to get the density matrix as a Psi4 matrix or numpy array. However either seems to be silently executed with a null result. What is the correct syntax?


#2

Da returns a psi4 Matrix class. If this matrix has irreps, simple np.array() conversion does not work.

Then you can use the general way:
dm = wfn.Da().to_array()

http://psicode.org/psi4manual/master/numpy.html


#3

Thank you; I don’t want it separated into irreps, but using “symmetry C1” gives me what I want.