Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect coefficients in Jordan-Wigner Transform #67

Open
kvmto opened this issue Feb 4, 2025 · 0 comments
Open

Incorrect coefficients in Jordan-Wigner Transform #67

kvmto opened this issue Feb 4, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@kvmto
Copy link
Collaborator

kvmto commented Feb 4, 2025

Description

There is a discrepancy in the Pauli string coefficients between OpenFermion and CUDA-QX.

  • The Pauli strings themselves match in both OpenFermion and CUDA-QX for all molecules.
  • The coefficients match for H_2 but not for other molecules. For example, mismatches are observed for H_4.
  • Some coefficients differ only by sign, suggesting a possible parity flip or phase shift issue.

Steps to Reproduce

  1. Setup & Imports

    • Import necessary libraries: CUDA-Q, CUDA-QX, SciPy, PySCF, and NumPy.
    • Define the molecular structure for H_4 using Cartesian coordinates.
  2. Compute Molecular Energies

    • FCI Energy (PySCF): Compute exact energy using Full Configuration Interaction (FCI).
    • OpenFermion Energy (CUDA-Q): Generate Hamiltonian, compute lowest eigenvalue.
    • CUDA-QX Energy: Generate Hamiltonian using CASCI, compute lowest eigenvalue.
  3. Extract & Compare Pauli Terms

    • Convert Hamiltonians into Pauli string representations with coefficients.
    • Compare OpenFermion and CUDA-QX coefficients.
    • Print mismatches where coefficients differ beyond a tolerance (1e-15).

Purpose: Identify discrepancies between OpenFermion and CUDA-QX Hamiltonians, specifically in Pauli string coefficients.

Expected Behavior

Pauli string coefficients should match between OpenFermion and CUDA-QX for all molecules.

Actual Behavior

For molecules other than H_2, some coefficients do not match. Even when using PySCF-verified integrals, CUDA-QX produces incorrect eigenvalue energies, suggesting the issue lies in the Jordan-Wigner implementation in CUDA-QX.

@kvmto kvmto changed the title Incorrect coefficients in Jordan-Wigner Encoding Incorrect coefficients in Jordan-Wigner Transform Feb 4, 2025
@kvmto kvmto self-assigned this Feb 4, 2025
@kvmto kvmto added the bug Something isn't working label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant