Hello! I’m trying to obtain a double factorized Hamiltonian in the LCU form using the qml.qchem.basis_rotation
function. The problem is that the 1-norm of the Hamiltonian obtained through this function differs from the expected value and differs from the one calculated using qml.resource.DoubleFactorization
which appears to return the correct result.
Here the snippet that shows this:
import pennylane as qml
molname = "H2"
bond =2.1
SystemData = qml.data.load(
"qchem",
molname=molname,
bondlength=bond,
basis="STO-3G",
force = False,
attributes = ["molecule", "hamiltonian"])[0]
mol = SystemData.molecule
nuc_core, one_body, two_body = qml.qchem.electron_integrals(mol)()
coeffs, ops, unitaries = qml.qchem.basis_rotation(one_body, two_body, tol_factor=1.0e-5)
one_norm_JW = sum(sum(abs(c)) for c in coeffs)
from pennylane.resource import DoubleFactorization as DF
norm_df = DF(one_body,two_body).lamb
print(f"One norm before JW {norm_df} one norm after JW {one_norm_JW}")
I’m reaching out to check if there is some error in the implementation of basis_rotation.
Thank you very much for your support.
Output of qml.about()
:
Name: PennyLane
Version: 0.40.0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: GitHub - PennyLaneAI/pennylane: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Author:
Author-email:
License: Apache License 2.0
Location: /home/ubmachine/Master_thesis/Bench_QTE/venv/lib/python3.10/site-packages
Requires: appdirs, autograd, autoray, cachetools, diastatic-malt, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, tomlkit, typing-extensions
Required-by: PennyLane_Lightning
Platform info: Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.35
Python version: 3.10.12
Numpy version: 2.0.2
Scipy version: 1.15.2
Installed devices:
- default.clifford (PennyLane-0.40.0)
- default.gaussian (PennyLane-0.40.0)
- default.mixed (PennyLane-0.40.0)
- default.qubit (PennyLane-0.40.0)
- default.qutrit (PennyLane-0.40.0)
- default.qutrit.mixed (PennyLane-0.40.0)
- default.tensor (PennyLane-0.40.0)
- null.qubit (PennyLane-0.40.0)
- reference.qubit (PennyLane-0.40.0)
- lightning.qubit (PennyLane_Lightning-0.40.0)