Skip to content
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

trexio possible issue with ERI basis #103

Open
kgasperich opened this issue Jan 17, 2025 · 3 comments
Open

trexio possible issue with ERI basis #103

kgasperich opened this issue Jan 17, 2025 · 3 comments

Comments

@kgasperich
Copy link

I've noticed something that seems a bit unclear (and hopefully this post might provide clarity for others).

The trexio.write_eri function always writes the input ERIs as if they are in the MO basis (i.e. it writes them under mo_2e_int in the trexio h5 file), but in some of the tests, the AO ERIs are passed to this function (1, 2), so when used in this way, the trexio h5 output will contain the AO ERIs labeled incorrectly as MO ERIs.

It might be clearer to rename the function to write_mo_eri or maybe to provide another argument to select AOs or MOs?
It might also make sense to make a function that takes the scf object, and that will contain everything needed to get the ERIs in either basis.
My usual workflow is to get the AO ERIs with mol.intor('int2e') and then ao2mo.kernel(eri_ao, mf.mo_coeff) to get the MO ERIs if needed, but I wouldn't be surprised if there were maybe cleaner ways to do this that I'm not aware of (e.g. I didn't know about scf._eri)

@sunqm
Copy link
Contributor

sunqm commented Jan 20, 2025

There is no essential difference between AO ERIs and MO ERIs. AO ERIs can be viewed as MO ERIs with the MO coefficients set to the identity matrix. In the tests, AO ERIs are passed to this function to verify the handling of indices. It does not indicate special meaning for the input ERIs. Does TrexIO provide different entries or labels for AO and MO ERIs? If not, I don't think it's necessary to distinguish the two when dumping ERIs. They can be easily converted to each other before calling this function.

@kgasperich
Copy link
Author

Yes, TREXIO does provide different labels for AO and MO ERIs (without this distinction, I agree that there is no real difference between the two other than the basis in which they're represented, and it would be up to the user to pay attention and convert as needed).

There is nothing wrong with the function itself as written, but it does put some responsibility on the user to make sure they are passing the MO ERIs (because they will be saved under mo_2e_int in the trexio). The main issue I have is just that the only included examples show this being used incorrectly (i.e. storing the scf _eri object (AO ERIs) as MO ERIs in the trexio)

@kgasperich
Copy link
Author

I opened a draft PR to give an example of what I had in mind; I wouldn't consider it totally clean and ready to merge, but it shows the gist of what I was thinking.

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

No branches or pull requests

2 participants