OpenFermion

repository·main·Indexed 23 days ago

https://github.com/quantumlib/openfermion

An open-source Python package for compiling and analyzing quantum algorithms to simulate fermionic systems, such as those in quantum chemistry. It provides tools for manipulating fermionic and qubit Hamiltonians and includes a modular plugin architecture for high-performance simulators (OpenFermion-FQE), circuit compilation (Forest-OpenFermion, SFOpenBoson), and electronic structure packages (Psi4, PySCF, DIRAC, Q-Chem). It also features a cloud library for molecular data and resource estimation for periodic systems.

Tokens
24.2K
Snippets
51
Records
125
Agent score
83%

What's inside OpenFermion

  1. Overview of OpenFermion

    main
    OpenFermion is an open-source library designed for compiling and analyzing quantum algorithms used to simulate fermionic systems, such as those found in quantum chemistry. It provides specialized data structures and tools for creating, obtaining, and manipulating representations of both fermionic and qubit Hamiltonians.
  2. Explore OpenFermion projects and use cases

    main

    You can find implementation examples and research projects that utilize OpenFermion:

    • Hackathon Quantum Autoencoder (QCompress): Combines OpenFermion with Rigetti's framework to compress molecular representations using an autoencoder.
    • CUSP Implementation: Uses OpenFermion and Cirq to implement the Compressed Unsupervised State Preparation (CUSP) protocol, which utilizes quantum autoencoders to synthesize compact circuits for algorithms like VQE.
  3. Explore OpenFermion plugins

    main

    OpenFermion uses a modular plugin architecture to extend its functionality for simulation, circuit compilation, and electronic structure calculations.

    High-performance simulators

    • OpenFermion-FQE: A high-performance emulator of fermionic quantum evolutions that exploits symmetries like spin and particle number.

    Circuit compilation plugins

    Electronic structure package plugins

    • OpenFermion-Psi4: Integrates with Psi4.
    • OpenFermion-PySCF: Integrates with PySCF.
    • OpenFermion-Dirac: Integrates with DIRAC.
    • OpenFermion-QChem: Integrates with Q-Chem.
  4. Extend OpenFermion with plugins

    main

    OpenFermion uses a modular plugin architecture to extend its core functionality. Users can install specific plugins to enable circuit compilation, quantum circuit simulation, or integration with classical electronic structure calculation packages.

    Circuit compilation and simulation plugins

    To integrate OpenFermion with specific quantum computing frameworks, use:

    Electronic structure package plugins

    To perform classical electronic structure calculations using established chemistry software, use:

    • OpenFermion-Psi4: For integration with Psi4.
    • OpenFermion-PySCF: For integration with PySCF.
    • OpenFermion-Dirac: For integration with DIRAC.
  5. Install OpenFermion via Docker (Windows/Alternative)

    main
    OpenFermion is primarily tested on Mac and Linux because its electronic structure plugins require these environments. For Windows users or those facing installation issues, a Docker image is available in the docker/ folder of the repository. This image provides a virtual environment with OpenFermion and selected plugins pre-installed and can run on any operating system.
  6. Upload data files to the OpenFermion Cloud Library

    main

    Contributing data to the OpenFermion Cloud Library involves a multi-step process using Google Cloud Storage and GitHub. Follow these steps to share your molecular data:

    1. Prepare files: Generate your data files and compress them into a single archive (e.g., .zip). If using a different compression format, specify it in your pull request.
    2. Create a manifest: Open a pull request on the OpenFermion repository. Create a new file (for a new dataset) or edit an existing one (to expand a dataset). The filename must match the dataset name. The first line must describe the dataset, and subsequent lines must list the filenames within the dataset.
    3. Request a Signed URL: Provide your email address in the pull request or contact the OpenFermion team via email to request a signed URL for uploading.
    4. Upload to staging: Once you receive the signed URL via email, upload your compressed file to the staging bucket using curl.
    5. Review: OpenFermion administrators will perform a security review. Once approved, your data will be moved to the production bucket, and your pull request will be merged to signal public availability.
    curl -X PUT --upload-file <your_files.zip> <signed_url>
  7. Run Jupyter Notebook with a Docker backend

    main

    To run Jupyter notebooks (like OpenFermion demos) in your web browser using the Docker container as the backend, follow these steps:

    1. Find the VM IP: Determine the IP address of your Docker virtual machine using docker-machine ip default.
    2. Start the container with port mapping: Run the container using the -p flag to map the Jupyter port (e.g., 8888) from the container to your host.
    3. Launch Jupyter: Inside the container terminal, execute the jupyter-notebook command with specific flags to allow root access and remote connections.
    4. Access via Browser: Copy the token provided in the terminal output and navigate to [virtual machine ip]:8888 in your browser.
  8. Install OpenFermion for developers

    main

    To install the latest version of OpenFermion in development mode, clone the repository and install it using pip with the -e (editable) flag. This allows you to make changes to the source code and have them reflected immediately without re-installing.

    git clone https://github.com/quantumlib/OpenFermion
    cd OpenFermion
    python -m pip install -e .
  9. Integrate OpenFermion with quantum computing frameworks

    main

    Several plugin libraries allow OpenFermion to interface with quantum computing and simulation frameworks:

    • Forest-OpenFermion: Integrates with Rigetti's Forest framework to compile quantum simulation algorithms to NISQ circuits.
    • PennyLane: The pennylane.qchem module integrates OpenFermion with Xanadu's PennyLane framework, enabling optimization of quantum simulation algorithms using TensorFlow and PyTorch on quantum hardware.
    • SFOpenBoson: Integrates with Xanadu's Strawberry Fields framework for compiling quantum simulation algorithms related to boson simulation.
    • OpenFermion-ProjectQ (Deprecated): An older integration with the ProjectQ framework for simulating quantum circuits.