Hi. I am working on a full python plugin for psi4 and I tried to get the ao dipoles using libmints and found that it is not apart of exported_mints. Is there a way to get the ao dipoles?
You can use MintsHelper. The below will only work in C1 symmetry:
# Compute the reference wavefunction scf_e, scf_wfn = energy('SCF', return_wfn=True) # Grab a MintsHelper object and orbitals orbitals mints = MintsHelper(scf_wfn.basisset()) Co = np.asarray(scf_wfn.Ca_subset("AO", "OCC")) Cv = np.asarray(scf_wfn.Ca_subset("AO", "VIR")) # Grab perturbation tensors in MO basis tmp_dipoles = mints.so_dipole() dipoles_xyz =  for num in range(3): Fia = 2 * (Co.T).dot(tmp_dipoles[num]).dot(Cv) dipoles_xyz.append(Fia)
@dgasmith is there any reason why
MintsHelper::ao_dipole has no python binding while
MintsHelper::so_dipole does? If this is just a case of “never needed it, never added it” I can set up an install where that binding is available, and we can use it for the plugin @rglenn.
If I am missing something, and there is a real reason why I shouldn’t do this ( and It will lead to me wasting a bunch of time trying to get it to work). Please tell me!
@amjames It was probably just missed. It should be a single line addition in export_mints.cc. However, for C1 symmetry it doesnt matter, both return the same result.
Were in the middle of a major python overhaul. Ill fix this in the new patch-- no point in making a new PR for it right now.
Thank you Daniel. I ran the script that you gave me and it gives three matrices (x,y,z) which are ndocc x nvirtual. shouldn’t it be nmo x nmo
@rglenn I only partially transformed them into (o x v) as thats what you usually need. You can grab the full C like the following:
C = np.asarray(scf_wfn.Ca_subset("AO", "ALL"))
C = np.asarray(scf_wfn.Ca())
and transform accordingly.
I see. Thank you. I appreciate your help.