Excited-state properties from Psi4 API

Hi,

Ben Levine and I at Stony Brook have been using Psi4 for a new Quantum Chemistry class we’ve launched this semester. You can see some course material here: Thomas Allison / SBU CHE525 · GitLab. It has been mostly really great, and the students have been able to do everything so far with the Psi4 API.

We are developing an exercise now where the students will scan a potential energy surface for an excited state and also calculate the transition dipole (or osc. strength etc.) to the ground state. I can converge the calculation OK and get reasonable results with eom-ccsd, but I can’t seem to figure out how to get the information returned to Python via the Psi4 API. Is it possible to have Psi4 return the excited state energies and other “properties” as variables/objects or is one stuck digging it out of the output file?

Perhaps it is possible to get it from the CCWavefunction object, but I couldn’t figure it out. Some example code would be helpful.

Thanks,
Tom

You can see an example of this for excited state energies in Psithon mode (not a Python script) here. Because the CC module is legacy code, the variables are written to globals, rather than the wavefunction. We’re not happy about this fact, but moving variables onto the wavefunction is a long-term project, not a short-term one.

Replace variable(variable_name) with psi4.core.variable(variable_name) to get something Python compliant.

Let us know if that still doesn’t work.

For “properties,” having a specific example would help me know where to look.

We are also happy to extend the python API where needed if computed energies/properties are not yet exposed.

If you are not yet aware. There is a concentrated effort for psi4’s use in education that can be found here: GitHub - Psi4Education/psi4education: Psi4Education Labs Public Repository. If you are submitting a new lab, please submit it to the psi4education-instructor repo.

Thanks a lot. You guys are awesome.

psi4.core.variable(‘CC ROOT ENERGY’) works well. I also was able to automate extraction of irreps etc. so scanning excited potentials is fairly automated now.

For reading oscillator strengths, I am still stuck with mining the output file after running a psi4.properties(…, properties= [‘oscillator_strength’]) command, but this is OK if we are only evaluating oscillator strengths at a couple geometries. Would be helpful if one could also get a matrix of transition dipoles between the different states via the Python API, or something like this.

It looks like our formatting is different, but we will try to contribute to the education repos once the dust settles on this semester!

Thanks again,
Tom

One thing I notice is that the ordering of the CC roots found (i.e. the excited states) is not the same every time, but depends on the symmetry of the ground state. Is there an easy way to also get the symmetry of a particular root into the API? For example, something like psi4.core.variable(‘CC ROOT IRREP’). If this not, this would be also be helpful in decoding the results that come out of running a calculation with many excited states.

There is not. I’ve made an issue of this. It looks like a simple change, but I have an obligation elsewhere in the codebase.