Skip to main content

Qiskit Nature PySCF: Third-party integration plugin of Qiskit Nature + PySCF.

Project description

Qiskit Nature PySCF

License

Qiskit Nature PySCF is a third-party integration plugin of Qiskit Nature + PySCF.

Installation

We encourage installing Qiskit Nature PySCF via the pip tool (a python package manager).

pip install qiskit-nature-pyscf

pip will handle all dependencies automatically and you will always install the latest (and well-tested) version. It will also install Qiskit Nature if needed.

If you want to work on the very latest work-in-progress versions, either to try features ahead of their official release or if you want to contribute to Qiskit Nature PySCF, then you can install from source.

Usage

This plugin couples the APIs of PySCF and Qiskit Nature, enabling a user of PySCF to leverage Quantum-based algorithms implemented in Qiskit to be used in-place of their classical counterparts.

Active Space Calculations

One very common approach is to use a Quantum algorithm to find the ground state in an active space calculation. To this extent, this plugin provides the QiskitSolver class, which you can inject directly into your CASCI or CASSCF simulation objects of PySCF.

Below we show a simple example of how to do this.

from pyscf import gto, scf, mcscf

import numpy as np

from qiskit.algorithms.minimum_eigensolvers import VQE
from qiskit.algorithms.optimizers import SLSQP
from qiskit.primitives import Estimator
from qiskit_nature.second_q.algorithms import GroundStateEigensolver
from qiskit_nature.second_q.circuit.library import HartreeFock, UCCSD
from qiskit_nature.second_q.mappers import ParityMapper

from qiskit_nature_pyscf import QiskitSolver

mol = gto.M(atom="Li 0 0 0; H 0 0 1.6", basis="sto-3g")

h_f = scf.RHF(mol).run()

norb = 2
nalpha, nbeta = 1, 1
nelec = nalpha + nbeta

cas = mcscf.CASCI(h_f, norb, nelec)

mapper = ParityMapper(num_particles=(nalpha, nbeta))

ansatz = UCCSD(
    norb,
    (nalpha, nbeta),
    mapper,
    initial_state=HartreeFock(
        norb,
        (nalpha, nbeta),
        mapper,
    ),
)

vqe = VQE(Estimator(), ansatz, SLSQP())
vqe.initial_point = np.zeros(ansatz.num_parameters)

algorithm = GroundStateEigensolver(mapper, vqe)

cas.fcisolver = QiskitSolver(algorithm)

cas.run()

More detailed documentation can be found at Documentation. For more detailed explanations we recommend to check out the documentation of PySCF and Qiskit Nature.

Citation

If you use this plugin, please cite the following references:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qiskit-nature-pyscf-0.1.1.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

qiskit_nature_pyscf-0.1.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file qiskit-nature-pyscf-0.1.1.tar.gz.

File metadata

  • Download URL: qiskit-nature-pyscf-0.1.1.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for qiskit-nature-pyscf-0.1.1.tar.gz
Algorithm Hash digest
SHA256 18eb4a64c0380d39fc6753cf6f497a69927ee2e2629e9bd6e70b8e42bc640df8
MD5 7053ecc6ea20079c5c2e26ac62e02801
BLAKE2b-256 13f5c3634ae3be05b353747430db77f0a86736a9de29e8087facaa6646a75f64

See more details on using hashes here.

File details

Details for the file qiskit_nature_pyscf-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for qiskit_nature_pyscf-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e355c643d80bc6ab88bc6bbd81be909438612928d3724c4cf831b36b8ba3f2ac
MD5 ba0df8e725d4870c526dca5ee98607e1
BLAKE2b-256 b0f4ef28528a5dbb71a2e458e7b0b2160cf32c2441202e034bdcd3e47e6217aa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page