# Qiskit Nature PySCF
[![License](https://img.shields.io/github/license/qiskit-community/qiskit-nature-pyscf.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)
**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).
```bash
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.
```python
from pyscf import gto, scf, mcscf
import numpy as np
from qiskit.primitives import Estimator
from qiskit_algorithms import VQE
from qiskit_algorithms.optimizers import SLSQP
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 information for this plugin can be found in its
[Documentation](https://qiskit-community.github.io/qiskit-nature-pyscf/). For further
information and explanations we recommend to check out the documentation of
[PySCF](https://pyscf.org/) and [Qiskit Nature](https://qiskit-community.github.io/qiskit-nature/).
## Citation
If you use this plugin, please cite the following references:
- PySCF, as per [these instructions](https://github.com/pyscf/pyscf#citing-pyscf).
- Qiskit, as per the provided [BibTeX file](https://github.com/Qiskit/qiskit/blob/master/Qiskit.bib).
- Qiskit Nature, as per https://doi.org/10.5281/zenodo.7828767
Raw data
{
"_id": null,
"home_page": "https://github.com/qiskit-community/qiskit-nature-pyscf",
"name": "qiskit-nature-pyscf",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "qiskit sdk quantum nature chemistry physics pyscf",
"author": "Qiskit Nature PySCF Development Team",
"author_email": "qiskit@us.ibm.com",
"download_url": "https://files.pythonhosted.org/packages/4b/56/8550c157ecb66e0b999c53c4ad4568ba3539f93dbe3d2740ce9e233af1f3/qiskit-nature-pyscf-0.4.0.tar.gz",
"platform": null,
"description": "# Qiskit Nature PySCF\n\n[![License](https://img.shields.io/github/license/qiskit-community/qiskit-nature-pyscf.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)\n\n**Qiskit Nature PySCF** is a third-party integration plugin of Qiskit Nature + PySCF.\n\n## Installation\n\nWe encourage installing Qiskit Nature PySCF via the pip tool (a python package manager).\n\n```bash\npip install qiskit-nature-pyscf\n```\n\n**pip** will handle all dependencies automatically and you will always install the latest\n(and well-tested) version. It will also install Qiskit Nature if needed.\n\nIf you want to work on the very latest work-in-progress versions, either to try features ahead of\ntheir official release or if you want to contribute to Qiskit Nature PySCF, then you can install from source.\n\n\n## Usage\n\nThis plugin couples the APIs of PySCF and Qiskit Nature, enabling a user of PySCF to leverage\nQuantum-based algorithms implemented in Qiskit to be used in-place of their classical counterparts.\n\n### Active Space Calculations\n\nOne very common approach is to use a Quantum algorithm to find the ground state in an active space\ncalculation. To this extent, this plugin provides the `QiskitSolver` class, which you can inject\ndirectly into your `CASCI` or `CASSCF` simulation objects of PySCF.\n\nBelow we show a simple example of how to do this.\n\n```python\nfrom pyscf import gto, scf, mcscf\n\nimport numpy as np\n\nfrom qiskit.primitives import Estimator\nfrom qiskit_algorithms import VQE\nfrom qiskit_algorithms.optimizers import SLSQP\nfrom qiskit_nature.second_q.algorithms import GroundStateEigensolver\nfrom qiskit_nature.second_q.circuit.library import HartreeFock, UCCSD\nfrom qiskit_nature.second_q.mappers import ParityMapper\n\nfrom qiskit_nature_pyscf import QiskitSolver\n\nmol = gto.M(atom=\"Li 0 0 0; H 0 0 1.6\", basis=\"sto-3g\")\n\nh_f = scf.RHF(mol).run()\n\nnorb = 2\nnalpha, nbeta = 1, 1\nnelec = nalpha + nbeta\n\ncas = mcscf.CASCI(h_f, norb, nelec)\n\nmapper = ParityMapper(num_particles=(nalpha, nbeta))\n\nansatz = UCCSD(\n norb,\n (nalpha, nbeta),\n mapper,\n initial_state=HartreeFock(\n norb,\n (nalpha, nbeta),\n mapper,\n ),\n)\n\nvqe = VQE(Estimator(), ansatz, SLSQP())\nvqe.initial_point = np.zeros(ansatz.num_parameters)\n\nalgorithm = GroundStateEigensolver(mapper, vqe)\n\ncas.fcisolver = QiskitSolver(algorithm)\n\ncas.run()\n```\n\nMore detailed information for this plugin can be found in its\n[Documentation](https://qiskit-community.github.io/qiskit-nature-pyscf/). For further \ninformation and explanations we recommend to check out the documentation of\n[PySCF](https://pyscf.org/) and [Qiskit Nature](https://qiskit-community.github.io/qiskit-nature/).\n\n\n## Citation\n\nIf you use this plugin, please cite the following references:\n\n- PySCF, as per [these instructions](https://github.com/pyscf/pyscf#citing-pyscf).\n- Qiskit, as per the provided [BibTeX file](https://github.com/Qiskit/qiskit/blob/master/Qiskit.bib).\n- Qiskit Nature, as per https://doi.org/10.5281/zenodo.7828767\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Qiskit Nature PySCF: Third-party integration plugin of Qiskit Nature + PySCF.",
"version": "0.4.0",
"project_urls": {
"Bug Tracker": "https://github.com/qiskit-community/qiskit-nature-pyscf/issues",
"Documentation": "https://qiskit-community.github.io/qiskit-nature-pyscf/",
"Homepage": "https://github.com/qiskit-community/qiskit-nature-pyscf",
"Source Code": "https://github.com/qiskit-community/qiskit-nature-pyscf"
},
"split_keywords": [
"qiskit",
"sdk",
"quantum",
"nature",
"chemistry",
"physics",
"pyscf"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d2f84c6bf854ef1cd6baaa3b167ede4094af74f1e5487c597230e69a17c14d1a",
"md5": "4139369bf2aab622209b89ea7ee3ecfd",
"sha256": "833910cca49dc625d432fd01068185dbca5da27a54db9a0f1f7263f172bb533b"
},
"downloads": -1,
"filename": "qiskit_nature_pyscf-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4139369bf2aab622209b89ea7ee3ecfd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 15841,
"upload_time": "2024-02-23T13:38:31",
"upload_time_iso_8601": "2024-02-23T13:38:31.904951Z",
"url": "https://files.pythonhosted.org/packages/d2/f8/4c6bf854ef1cd6baaa3b167ede4094af74f1e5487c597230e69a17c14d1a/qiskit_nature_pyscf-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4b568550c157ecb66e0b999c53c4ad4568ba3539f93dbe3d2740ce9e233af1f3",
"md5": "588ae31d99f726f4e64292618b047ad0",
"sha256": "6a2440ecf5992006f04f571e5f8ea2b1c44702733e9bb8a1a9d36545bd0c981a"
},
"downloads": -1,
"filename": "qiskit-nature-pyscf-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "588ae31d99f726f4e64292618b047ad0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 17688,
"upload_time": "2024-02-23T13:38:34",
"upload_time_iso_8601": "2024-02-23T13:38:34.044547Z",
"url": "https://files.pythonhosted.org/packages/4b/56/8550c157ecb66e0b999c53c4ad4568ba3539f93dbe3d2740ce9e233af1f3/qiskit-nature-pyscf-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-23 13:38:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "qiskit-community",
"github_project": "qiskit-nature-pyscf",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "qiskit-nature",
"specs": [
[
">=",
"0.7.1"
]
]
},
{
"name": "pyscf",
"specs": [
[
">=",
"2.0"
]
]
}
],
"tox": true,
"lcname": "qiskit-nature-pyscf"
}