Help with one-body and two-body coefficients for orbital removal
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.
- 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 forCO2? The video comes with a notebook code which no longer runs since it is using deprecatedqiskit-chemistrypackage.
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))
- Besides, the kernel crashes when running
ma = tc.quantum.PauliStringSum2COO_numpy(lsa, wa)


@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?
Close for now. If that is in error, please feel free to reopen it by commenting on this issue.