Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

Error on running the H6 simulation using LowRankTrotterAnsatz (raises the ValueError 'one_body_matrix is not Hermitian.') #323

Open
unpilbaek opened this issue Feb 1, 2019 · 2 comments

Comments

@unpilbaek
Copy link

I have set up the H6 molecule as below and used the LowRankTrotterAnsatz in the ./configs/sample_config.py:

molecule_settings = MoleculeSettings(
    geometry=[('H', (0., 0., -2.5)),
              ('H', (0., 0., -1.5)),
              ('H', (0., 0., -0.5)),
              ('H', (0., 0., 0.5)),
              ('H', (0., 0., 1.5)),
              ('H', (0., 0., 2.5))
              ],
    basis='sto-3g',
    multiplicity=1,
    charge=0,
    description = 'H6-sto-3g-1.0')

molecule = molecule_maker.get_molecule(molecule_settings)

ansatz=LowRankTrotterAnsatz(molecule.get_molecular_hamiltonian())

and ran my vqe_ensemble.py for the analysis purposes. However, I get the following error message:

Traceback (most recent call last):
  File "vqe_ensemble.py", line 9, in <module>
    import determinant_ansatz as determinant_ansatz
  File "/Users/user/git-repo/offdiagonal/determinant_ansatz.py", line 5, in <module>
    from settings import CONFIG
  File "/Users/user/git-repo/offdiagonal/settings.py", line 26, in <module>
    spec.loader.exec_module(CONFIG)
  File "./configs/sample_config.py", line 41, in <module>
    ansatz=LowRankTrotterAnsatz(molecule.get_molecular_hamiltonian())
  File "/Users/user/git-repo/OpenFermion-Cirq/openfermioncirq/variational/ansatzes/low_rank.py", line 158, in __init__
    one_body_squares[j]))
  File "/Users/user/anaconda3/envs/vqe/lib/python3.6/site-packages/openfermion/utils/_low_rank.py", line 209, in prepare_one_body_squared_evolution
    raise ValueError('one_body_matrix is not Hermitian.')
ValueError: one_body_matrix is not Hermitian.

I was able to run the same code for the linear H2 and H4 molecules without getting the ValueError at the end. It seems like there may be some numerical error that makes the one_body_matrix non-Hermitian.

@kevinsung
Copy link
Contributor

@babbush @jarrodmcc thoughts?

@babbush
Copy link
Contributor

babbush commented Feb 21, 2019

I agree with @unpilbaek that its quite possibly due to some sort of numerical round-off error. I won't have time to get to the bottom of this right now though. The low rank factorization stuff is very prone to numerical instabilities.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants