Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.
This repository was 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

@unpilbaek

Description

@unpilbaek

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.

Metadata

Metadata

Assignees

No one assigned

    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