Skip to content

Qubit Operator converted from fermionic op and majoranic op does not match #1232

@Gopal-Dahale

Description

@Gopal-Dahale

Describe the issue

For small examples (eg. H2 with sto3g), they match but for the given example they don't. Is this supposed to be the case?

openfermionpyscf version is 0.5.

What version of this software are you using?

1.7.1

How can the issue be reproduced?

from openfermion import MolecularData, jordan_wigner
from openfermion.transforms import (
    get_fermion_operator, 
    get_majorana_operator,
)
from openfermionpyscf import run_pyscf

geometry = [
    ('H', (-0.1129, 0.3052, 0.0000)),
    ('Be',(1.0381, -0.3601, 0.0000)),
    ('H', (2.1898, -1.0243, 0.0000))
]
basis = '3-21g'
multiplicity = 1
charge = 0

# Make molecule and print out a few interesting facts about it.
molecule = MolecularData(geometry, basis, multiplicity, charge)
molecule = run_pyscf(molecule, run_scf=True)

molecular_hamiltonian = molecule.get_molecular_hamiltonian()
fermionic_hamiltonian = get_fermion_operator(molecular_hamiltonian)
majorana_hamiltonian = get_majorana_operator(fermionic_hamiltonian)

qubit_op = jordan_wigner(fermionic_hamiltonian)
qubit_op_majorana = jordan_wigner(majorana_hamiltonian)

qubit_op.compress()
qubit_op_majorana.compress()

print(qubit_op == qubit_op_majorana)
print("Number of qubit terms from fermionic hamiltonian:", len(qubit_op.terms))
print("Number of qubit terms from majorana hamiltonian:", len(qubit_op_majorana.terms))

Result:

False
Number of qubit terms from fermionic hamiltonian: 18916
Number of qubit terms from majorana hamiltonian: 19888

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions