Skip to content

Additional operator integrals and selection of gauge origin #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 52 commits into from
Mar 19, 2025

Conversation

frieschneider
Copy link
Contributor

@frieschneider frieschneider commented Aug 3, 2023

Operator integrals:

  • In pyscf.py and veloxchem.py the selection of the gauge origin is possible for gauge-origin dependent operator integrals
  • pyscf.py includes additional operator integrals (diamagnetic magnetizability, electric quadrupole (traced, traceless and velocity)

Reference State

  • added nuclear quadrupole (gauge_origin dependent)

Testing:

  • properties_test.py add gauge origin dependency (transition magnetic dipole moments and rotatory strengths) and test transition_quadrupole_moments
  • ReferenceState_refdata_test.py add nuclear quadrupoles
  • backends_crossref_test.py add some crossref checks between pyscf and veloxchem to verify gauge origin selection
  • pyscf_test.py and veloxchem_test.py extend operators test to gauge origin dependent tests.

ToDo:

  • new referencedata (see dump_pyscf.py: dump nuclear quadrupole moments)
  • rename nabla to electric_dipole_velocity in DataHfProvider.py and dump_pyscf.py when generating new testdata

Copy link
Member

@maxscheurer maxscheurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! Some initial comments from a first quick look 😁
Can you please have a look at this, too, @apapapostolou @Drrehn?

@frieschneider
Copy link
Contributor Author

The selection of the origin is now an argument of the respective property, i.e. state.reference_state.operators.magnetic_dipole('mass_center').

I changed the tests so that I can reproduce some reference data I previously generated. However, I think my tests and how I generated this reference data can still be improved.
(So far I still need to change the generation of the reference data for the new implementation. )

Thus, @apapapostolou , @Drrehn , @maxscheurer maybe we should talk about how I should generate reference data and how to change the tests?

Copy link
Contributor

@apapapostolou apapapostolou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the reference data, I think you should not regenerate all the reference data for each gauge origin but only have different operator integrals.

@maxscheurer maxscheurer mentioned this pull request Oct 17, 2024
12 tasks
@frieschneider
Copy link
Contributor Author

Concerning the new tests:

I updated the test and in order to do that I also needed to generate new hf data with pyscf.
I adapted the dump_pyscf.py script (from the submodule adcc-testdata).

You can find the modified file in my HeiBox:
https://heibox.uni-heidelberg.de/d/7d2e9c3c6dbc4f8eb217/

I needed to regenerate new adcc reference data, I changed the file generate_adcc_reference.py, however, this changed file can be found in this pull request.

The new reference files can be generated with the provided scripts. Should I add the updated reference data to the HeiBox as well?

@maxscheurer
Copy link
Member

Probably the reference data (adcc ref, that is) need to be re-generated once #175 is merged because that affects the data as well.

@frieschneider frieschneider force-pushed the tests_operators branch 2 times, most recently from 3b7733e to 08e2af4 Compare March 14, 2025 10:09
[product_trace(comp, tdm) for comp in mag_dipole_integrals]
for tdm in self.transition_dm
])
return g_origin_dep_trans_magdip_moment
Copy link
Contributor

@jonasleitner jonasleitner Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the idea to return callables just to make mark_excitation_property work. It also leads to (in my opinion) non-intuitive behavior for ExcitedStates.excitation_property_keys since getattr(ExcitedStates, key) may now also return a callable, while otherwise e.g. a numpy array is returned. For this reason you might also have to adjust the ExcitedStates.to_dataframe export - the only other part of the code except Excitation where ExcitedStates.excitation_property_keys is used.
Maybe it is also fine to not decorate the gauge dependent member functions with mark_excitation_propertyfor now and add them at a later point? I think we need to iterate over ExcitedStates and Excitation anyway for #168.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree with that. I think it makes sense to return them as callables:

  • It would be unintuitive to exclude them, since they are actually excitation properties as well, and transition_magnetic_dipole_moments were included before as well.
  • However, it will not work to return them as numpy arrays, since they are no longer a constant value, but depend on the choice of gauge origin.

Therefore, I don't want to simply exclude them. I think it would make more sense to adjust ExcitedStates.to_dataframe. It could also take a gauge_origin parameter. I also need to extend it so that it can handle two-dimensional operators as well, which are needed for transition_electric_quadrupole_moments for example.

@frieschneider frieschneider force-pushed the tests_operators branch 3 times, most recently from 2e22ab0 to 4794532 Compare March 17, 2025 14:01
Copy link
Contributor

@apapapostolou apapapostolou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to me. I agree with @frieschneider and think that we can leave the gauge-dependent excitation properties as they are for now. If ExcitedStates and Excitation are changed in the future, we can reconsider this as well.

If @jonasleitner also gives his approval, I think this is ready to be merged.

@apapapostolou apapapostolou merged commit 88b786e into adc-connect:master Mar 19, 2025
15 checks passed
@frieschneider frieschneider deleted the tests_operators branch March 19, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants