Skip to main content

Real-space quantum Monte Carlo (QMC) methods for electronic structure calculations.

Project description

Python package Documentation Status

PyQMC

PyQMC is a Python package for real-space quantum Monte Carlo (QMC) electronic structure calculations, designed to interoperate closely with PySCF.

Full documentation is available at pyqmc.readthedocs.io.

Features

  • Variational Monte Carlo (VMC) and Diffusion Monte Carlo (DMC)
  • Wavefunction optimization via stochastic reconfiguration
  • Ensemble wave function optimization for excited state computation
  • Trial wavefunctions: Slater-Jastrow, multi-determinant (CASSCF/selected CI), geminal, and three-body Jastrow
  • Observables: energy, one- and two-body density matrices, extensible to your problem.
  • Periodic boundary conditions with twist averaging and supercell support
  • Parallel execution via MPI (mpi4py) or Dask
  • GPU and JAX backends for high-performance evaluation
  • HDF5-based checkpointing for restartable workflows

Installation

pip install pyqmc

to get the latest development version,

pip install git+https://github.com/WagnerGroup/pyqmc.git

Requirements: Python >= 3.10, PySCF >= 2.8, SciPy, h5py, pandas.

Quick Start

The high-level recipes interface handles a complete optimize -> VMC -> DMC workflow:

import pyscf
import pyqmc.recipes

# 1. Run a DFT/HF calculation with PySCF and save a checkpoint
mol = pyscf.gto.M(atom="He 0. 0. 0.", basis="ccECP_cc-pVDZ", ecp="ccecp", unit="bohr")
mf = pyscf.scf.RHF(mol)
mf.chkfile = "he_dft.hdf5"
mf.kernel()

# 2. Optimize the Slater-Jastrow wavefunction
pyqmc.recipes.OPTIMIZE("he_dft.hdf5", "he_sj.hdf5", slater_kws={"optimize_orbitals": True})

# 3. Run VMC
pyqmc.recipes.VMC("he_dft.hdf5", "he_sj_vmc.hdf5", load_parameters="he_sj.hdf5", nblocks=40)

# 4. Run DMC
pyqmc.recipes.DMC("he_dft.hdf5", "he_sj_dmc.hdf5", load_parameters="he_sj.hdf5",
                  nblocks=4000, tstep=0.02)

Results are saved as HDF5 files and can be read back with pyqmc.recipes.read_mc_output.

Parallel Execution

PyQMC supports parallelism via MPI using mpi4py.futures or any other futures object such as dask or concurrent:

import mpi4py.futures
import pyqmc.recipes

if __name__ == "__main___":
    npartitions = 4
    with mpi4py.futures.MPIPoolExecutor(max_workers=npartitions) as client:
        pyqmc.recipes.OPTIMIZE("he_dft.hdf5", "he_sj.hdf5", client=client, npartitions=npartitions)

Run with: mpiexec -n 5 python -m mpi4py.futures script.py

Package Structure

Module Description
pyqmc.recipes High-level OPTIMIZE, VMC, DMC functions
pyqmc.wf Wavefunctions: Slater, JastrowSpin, MultiplyWF, AddWF, geminal
pyqmc.method Core algorithms: VMC, DMC, line minimization, variance optimization
pyqmc.observables Energy, one body density matrix, two body density matrix, ECP
pyqmc.pbc Periodic boundary conditions, supercell construction, twist averaging
pyqmc.wf.jax JAX-based wavefunction and GTO evaluation

Citation

If you use PyQMC in your research, please cite the relevant papers listed in the documentation.

License

MIT License. Copyright (c) 2019-2026 The PyQMC Developers.

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

pyqmc-0.8.1.tar.gz (118.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyqmc-0.8.1-py3-none-any.whl (156.4 kB view details)

Uploaded Python 3

File details

Details for the file pyqmc-0.8.1.tar.gz.

File metadata

  • Download URL: pyqmc-0.8.1.tar.gz
  • Upload date:
  • Size: 118.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyqmc-0.8.1.tar.gz
Algorithm Hash digest
SHA256 db26df517ca85eea0ea34e049fd0db5c95f2b7bb07369d3c7b15cdf0506dfe2d
MD5 1e952957abcb7b42b92b07567b945b3c
BLAKE2b-256 c8bdcd0296fbeb27f38c9f7421a5a4265ded3e83adce5d1ba28c6efe89ca1db2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyqmc-0.8.1.tar.gz:

Publisher: publish-to-pypi.yml on WagnerGroup/pyqmc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyqmc-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: pyqmc-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 156.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyqmc-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ffc2728754e2a032c2850988139584ee87e7e1e3e219e6dc863ce08746620dfc
MD5 4a2090a71aff927422e729569396da4c
BLAKE2b-256 4a9bd701615a05d78b7de4cf82c31f1619cb3744f051131b59537855203ecccb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyqmc-0.8.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on WagnerGroup/pyqmc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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