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

find_index_order return an incorrect ERI "IndexType" #1366

Open
emamars95 opened this issue Jul 17, 2024 · 0 comments
Open

find_index_order return an incorrect ERI "IndexType" #1366

emamars95 opened this issue Jul 17, 2024 · 0 comments
Labels

Comments

@emamars95
Copy link

emamars95 commented Jul 17, 2024

Environment

  • Qiskit Nature version: 0.7.2
  • Python version: 3.9.19
  • Operating system: Linux

What is happening?

From the module qiskit_nature.second_q.operators.tensor_ordering, the function find_index_order returns the wrong IndexType once the ERI is converted to PHYSICIST notation.

The problem arises from the following statement in the find_index_order function:

if isinstance(two_body_tensor, SymmetricTwoBodyIntegrals):
        return IndexType.CHEMIST

which checks if the two_body_tensor object is an instance of the SymmetricTwoBodyIntegrals class. If the ERI is converted from CHEMIST to PHYSICIST notation (using to_physicist_ordering function) the returned object belong to the SymmetricTwoBodyIntegrals class and the statement returns the wrong IndexType .

How can we reproduce the issue?

Generate an ERI that respect the permutation symmetry in CHEMIST notation

from qiskit_nature.second_q.drivers import PySCFDriver
from qiskit_nature.second_q.operators import tensor_ordering, symmetric_two_body

driver = PySCFDriver()
problem = driver.run()

mo_hamiltonian = problem.hamiltonian
eri = symmetric_two_body.unfold(mo_hamiltonian.electronic_integrals.alpha["++--"])
print(tensor_ordering.find_index_order(eri))

It returns the CORRECT chemist index: IndexType.CHEMIST

Convert to PHYSICIST notation

eri_physicist = tensor_ordering.to_physicist_ordering(eri)
print(tensor_ordering.find_index_order(eri_physicist))

It returns the WRONG index: IndexType.CHEMIST

What should happen?

The correct result should be return:
IndexType.PHYSICIST

Any suggestions?

Remove the following lines from find_index_order function:

 from .symmetric_two_body import SymmetricTwoBodyIntegrals

    if isinstance(two_body_tensor, SymmetricTwoBodyIntegrals):
        return IndexType.CHEMIST

Alternatevely convert the output of _phys_to_chem and _chem_to_phys function as np.array(permuted_tensor)

@emamars95 emamars95 added the bug label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant