OpenFermion icon indicating copy to clipboard operation
OpenFermion copied to clipboard

Help with one-body and two-body coefficients for orbital removal

Open buttercutter opened this issue 2 years ago • 1 comments

Cross-referenced from https://github.com/tencent-quantum-lab/tensorcircuit/issues/120 which uses openfermion.chem library

I am trying to migrate vqe_h2o.ipynb to use CO2 carbon dioxide molecule.

Note: Another relevant issues would be https://github.com/quantumlib/OpenFermion/issues/744 and https://github.com/pyscf/pyscf/issues/1202#issuecomment-1416736671 which use another method to retrieve one-body and two-body terms.

  1. For print(fh.terms[((0, 1), (0, 0))]) which is the two-body coefficients, it gives -36.01932840424451. When I try to access the one-body coefficients using the following code snippet, nothing is printed out. Could you advise how to decide which orbitals to be removed for CO2 ? The video comes with a notebook code which no longer runs since it is using deprecated qiskit-chemistry package.
one_body_terms = fh.terms
for term, coefficient in one_body_terms.items():
    if len(term) == 2:
        # Only consider terms with one creation and one annihilation operator
        i, j = term
        if i[0] == "c" and j[0] == "c":
            print("Term: c^\dagger_{} c_{} Coefficient: {}".format(i[1], j[1], coefficient))
  1. Besides, the kernel crashes when running ma = tc.quantum.PauliStringSum2COO_numpy(lsa, wa)

image

image

buttercutter avatar Feb 04 '23 15:02 buttercutter

@buttercutter sorry for how long this issue sat unattended. Can you let us know if this is still a concern, or whether we can close this issue?

mhucka avatar Jun 06 '25 18:06 mhucka

Close for now. If that is in error, please feel free to reopen it by commenting on this issue.

mhucka avatar Jul 01 '25 02:07 mhucka