MO basis - dipole moments and amplitudes at positions

i see there is a way to calculate the AO dipole matrix (<i| r |j> i believe for the AO basis) here (Calculating transition and state density matrices and dipole moment matrices), and in this post (Electron Integrals for Orthogonalized Basis) it mentions that you can transform from the AO basis to the MO one, but doesn’t say how. how precisely would i do that?

i’m also curious how to get the MO amplitude at a given point in space (phi_j(r)), i.e. for each MO that i care about.

thanks in advance!


are you aware of the pythonAPI in psi4? (also checkout the psi4numpy project on github for real world examples) That is usually the way to go.

PSI4 cannot plot MO amplitudes in real space natively.
It’s possible to do it yourself with a python script but that’s only suitable for small calculations I’d guess.

i see mo_transform but the arguments aren’t documented. i’ll take a look at the numpy site for examples - originally i was looking through the c++ code for building a plugin but that seems less documented.

i don’t need the MO amplitudes at lots of locations for my purpose, although it would be nice to plot a transformation of them that i have in mind for understanding. does the psi4numpy site have an example of getting MO amplitudes?

I wrote a simple script to plot density/amplitude a little while ago:

But absolutely no warranty on correctness is given. Best to validate against something other program.
But maybe it gets you started if you really need it.

An example of the mo_transform function can be found here:

Programming questions can be difficult in the forum. Feel free to join the psi4 slack channel (see github)
where more people have eyes on questions.

thanks @hokru! your amplitude gist at least gives me a starting point for MO amplitudes, though if i may make a feature request, i’d love to see that sort of thing become part of psi4. being able to plot and see orbitals can give some greater understanding of what’s going on. i’ll see if there’s an issue on github that i can +1 on, otherwise i’ll open one.

looks like mo_transform is for 2-electron integrals (4-orbital inner products), and i only need 1-electron (2-orbital) products for the dipole. i guess it would be something like this (using this as an example):

C = np.asarray(wfn.Ca()) # restricted only
dipole_ao = mints.ao_dipole()
dipole_mo = [np.einsum('uj,vi,uv', C, C, dao) for dao in dipole_ao]

i’ll try a few things and check out slack if i get stuck. thanks for the help!