PySCF is an open-source, Python-based framework for *ab initio* quantum chemistry simulations. It offers a comprehensive suite of electronic structure methods, including Hartree-Fock, Density Functional Theory (DFT), MP2, Coupled Cluster, and various multi-reference methods, for both molecular and periodic systems. The library is actively developed, with version 2.12.1 being the current stable release, and minor versions released roughly every 3-4 months, indicating a robust and ongoing development cycle.
pip install pyscfVerified import paths — ran on the pinned version, not inferred.
This quickstart defines a water molecule using the `gto` module and then performs a Restricted Hartree-Fock (RHF) calculation using the `scf` module. It demonstrates the basic workflow of defining a system and running a mean-field calculation, printing the total energy.
Upgrade PySCF to version 2.12.1 or newer. If issues persist, reinstall PySCF in an environment with your target NumPy version already installed (`pip install --no-cache-dir --force-reinstall pyscf`).
Always call `mol.build()` after directly changing any attributes of a `gto.Mole` or `gto.Cell` instance. The `gto.M()` shortcut implicitly calls `build()`.
Apply linear dependency removal using `mf.apply(scf.addons.remove_linear_dep_)` or enable partial Cholesky orthonormalization. For example: `mf = scf.RHF(mol).apply(scf.addons.remove_linear_dep_).run()`
Carefully review the documentation for specific post-SCF methods when using smearing. If possible, avoid smearing for molecular systems or when subsequent methods explicitly require integer occupations.
Use a larger basis set (e.g., a double-zeta or triple-zeta quality basis set like 6-31g, def2-svp, or cc-pvdz). Minimal basis sets are generally not suitable for correlated methods as they lack the flexibility to describe electron correlation.
Ensure that PySCF and NumPy are compatible. The most robust solution is to create a new Python environment, install NumPy first (preferably the latest compatible version), and then install PySCF: `conda create -n pyscf_env python=3.x numpy scipy h5py` then `conda activate pyscf_env` then `pip install pyscf`.
Consult the PySCF documentation or GitHub issues for known workarounds or specific auxiliary basis set recommendations for your system. If possible, try disabling density fitting for that particular step or exploring alternative implementations if available within PySCF for your specific calculation type.