adc-connect / adcc

adcc: Seamlessly connect your program to ADC
https://adc-connect.org
GNU General Public License v3.0
32 stars 19 forks source link

Dipole Moments #81

Closed Edumars closed 4 years ago

Edumars commented 4 years ago

Hello, I would like to compute state dipole moments, i.e., dipole moments in the excited state, as opposed to transition dipole moments. I followed some of the examples, but I am getting the following error:

for i, val in enumerate(state.excitation_energy): AttributeError: 'ExcitedStates' object has no attribute 'excitation_energy'

In reference to the loop:

for i, val in enumerate(state.excitation_energy): fmt = "{0:2d} {1:12.8g} {2:9.3g} [{3:9.3g}, {4:9.3g}, {5:9.3g}]" fmt += " [{6:9.3g}, {7:9.3g}, {8:9.3g}]" print(state.kind[0], fmt.format(i, val, state.oscillator_strength[i], *state.transition_dipole_moment[i], *state.state_dipole_moment[i]))

that appears in many water examples. I guess that the syntax is now different, but I am not sure what is the new syntax. Any help would be greatly appreciated. Thanks!

maxscheurer commented 4 years ago

Hi,

Could you please post the entire script you are running and the version of adcc?

Edumars commented 4 years ago

Thanks for the prompt reply! Sorry about that. Please see below:

` adcc: Seamlessly connect your host program to ADC +------------------------------------------------------------------------------+
adcc version 0.14.2
authors Michael F. Herbst, Maximilian Scheurer
citation DOI 10.1002/wcms.1462
website https://adc-connect.org
email developers@adc-connect.org
adccore version 0.13.7
authors Michael F. Herbst, Maximilian Scheurer
+-------------------- Integrated third-party components ---------------------+ libadc version 1.1-trunk authors Michael Wormit, Adrian L. Dempwolff, Philipp H. P. Harbach, Caroline Krauter, Dirk Rehn, Matthias Schneider, Jan Wenzel citation DOI 10.1080/00268976.2013.859313
libtensor version 2.5-trunk
authors Evgeny Epifanovsky, Michael Wormit, Dmitry Zuev,
Sam Manzer, Ilya Kaliman
citation DOI 10.1002/jcc.23377
website https://github.com/epifanovsky/libtensor
`

For example, script "pyscf_ccpvdz_adc2_spectrum.py" is giving this error

pyscf_ccpvdz_adc2_spectrum.zip

maxscheurer commented 4 years ago

Okay, then I know where the error is coming from: You used the example code from a newer version of adcc (probably current master), which is not backward-compatible to adcc 0.14.2 (as you guessed, there is a new syntax now, which is state.excitation_energy, previously was state.excitation_energies. The latter one still works in the current code, but the new one does of course not work in the old code 😄)

If you upgrade your adcc to the newest version, the example scripts will work fine.

maxscheurer commented 4 years ago

@Edumars did the suggested solution work for you?

Edumars commented 4 years ago

Thanks for the follow up. It worked indeed, for the example. However, when I attempted to run a bigger molecule, I received the following error:

qt.qpa.screen: QXcbConnection: Could not connect to display localhost:10.0 Could not connect to any X display.

I suppressed now the portion related with matplotlib, because I think that this is were the error comes from, and because I am only interested in the dipole calculation anyway, so the plotting part is not important for me at the moment. My job is now in queue and I anticipate it will not be ready until late today, or tomorrow (US eastern time). Thanks a lot!

maxscheurer commented 4 years ago

Good to hear that! Hope your calculations will run fine now 👍