Skip to content

[qcor-py] Raw fermion operators sneak in to the qreg::weighted_sum #242

@1tnguyen

Description

@1tnguyen

Repro test case:

geom = '''
Na  0.0   0.0      0.0
H   0.0   0.0  1.914388
'''
fo = [0, 1, 2, 3, 4, 10, 11, 12, 13, 14]
ao = [5, 9, 15, 19]

H = createOperator('pyscf', {'basis': 'sto-3g', 'geometry': geom,
                                       'frozen-spin-orbitals': fo, 'active-spin-orbitals': ao})

energy = ansatz.observe(H, qalloc(4), 1.234)

This will eventually invoke qreg::weighted_sum, which assumes the observable is of Pauli-type.

Note: the workaround is to explicitly apply operatorTransform("jw", H)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions