Skip to content

Thresholding in QHAT #31

Description

@reuben-tate

There are some discrepancies in Hamiltonian term count for molecular Hamiltonians that only difference in interatomic distances. Theoretically, they should have the same number of terms, but I believe that thresholding is occurring that eliminates terms whose coefficients are considered too small. I believe the thresholding is happening in OpenFermion. Consider the following function call sequence:

apply_active_space [in hamiltonian_generator/hamgen.py of QHAT]
-> get_molecular_hamiltonian [in openfermion/chem/molecular_data.py]
-> spinorb_from_spatial [in openfermion/chem/molecular_data.py]

In the last function, there are the following two lines which seem to indicate thresholding:

# Truncate.
    one_body_coefficients[numpy.absolute(one_body_coefficients) < EQ_TOLERANCE] = 0.0
    two_body_coefficients[numpy.absolute(two_body_coefficients) < EQ_TOLERANCE] = 0.0

In openfermion/config.py the EQ_TOLERANCE is set to 10^(-8) by default. There could be other places where thresholding/truncation is also happening, I have not checked thoroughly.

I am not necessarily suggesting a specific code change or fix, but I think this is something that should be considered and we should be intentional regarding our decisions on this. Some specific things to consider:

  • Is the thresholding really the issue that is causing the discrepancy mentioned in the first paragraph?
  • Which parts of the QHAT script result in some thresholding taking place?
  • Is it possible to modify QHAT to remove thresholding entirely or to adjust it?
  • Does removing the thresholding result in the expected number of Hamiltonian terms?
  • Do we have an easy way of knowing how many Hamiltonian terms there should be (without thresholding) for testing purposes?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions