An overview of PySCF

PySCF is an ab initio computational chemistry program implemented in Python program language. The package aims to provide a simple, light-weight and efficient platform for electronic structure theory developing and simulation. The package offers a wide range of functions to support the electronic structure mean-field and post-mean-field calculations of finite size systems and periodic systems. Users can run simulations with input script as the regular quantum chemistry package offers, or investigate new features by combining primitive functions, or modifying source code to rapidly achieve certain requirements as they want. Although most functions are written in Python, the computation critical modules are intensively optimized in C. The package works as efficient as other C/Fortran based quantum chemistry program.

Features

  • Hartree-Fock (up to ~5000 basis)
    • Non-relativistic restricted open-shell, unrestricted HF
    • scalar relativistic HF
    • 2-component relativistic HF
    • 4-component relativistic Dirac-Hartree-Fock
    • density fitting HF
    • Second order SCF
    • General JK contraction function
  • DFT (up to ~5000 basis)
    • Non-relativistic restricted, restricted open-shell, unrestricted Kohn-Sham
    • scalar relativistic DFT
    • density fitting DFT
    • General XC functional evaluator (for Libxc or XcFun)
    • General AO evaluator
  • TDDFT
    • TDHF
    • TDDFT
    • TDHF gradients
    • TDDFT gradients
  • General CASCI/CASSCF solver (up to ~3000 basis)
    • State-average CASCI/CASSCF
    • State-specific CASCI/CASSCF for excited states
    • Multiple roots CASCI
    • Support DMRG as plugin CI solver to do DMRG-CASSCF
    • Support FCIQMC as plugin CI solver to do FCIQMC-CASSCF
    • UHF-based UCASSCF
    • Density-fitting CASSCF
    • DMET-CAS and AVAS active space constructor
  • MP2 (up to ~200 occupied, ~1500 virtual orbitals)
    • RHF-based MP2
    • RI-MP2
  • CCSD (up to ~100 occupied, ~1500 virtual orbitals)
    • canonical RCCSD, UCCSD
    • canonical RCCSD lambda solver
    • CCSD 1-particle and 2-particle density matrices
    • CCSD gradients
    • EOM-IP/EA/EE-CCSD
  • CCSD(T)
    • canonical CCSD(T)
    • canonical density matrices
    • canonical gradients
  • CI
    • CISD 1, 2-particle density matrices
    • Selected-CI
    • Selected-CI 1, 2-particle density matrices
  • Full CI
    • Direct-CI solver for spin degenerated Hamiltonian
    • Direct-CI solver for spin non-degenerated Hamiltonian
    • 1, and 2-particle transition density matrices
    • 1, 2, 3, and 4-particle density matrices
    • CI wavefunction overlap
  • Gradients
    • non-relativistic RHF gradients
    • 4-component DHF gradients
    • non-relativistic DFT gradients
    • non-relativistic CCSD gradients
    • non-relativistic TDHF and TDDFT gradients
  • Hessian
    • non-relativistic RHF hessian
    • non-relativistic RKS hessian
  • NMR
    • non-relativistic RHF NMR shielding
    • 4-component DHF NMR shielding
    • non-relativistic DFT NMR shielding
  • MRPT
    • Strongly contracted NEVPT2
    • DMRG-NEVPT2
    • IC-MPS-PT2
  • Extended systems with periodic boundary condition
    • gamma point RHF, UHF, RKS, UKS
    • gamma point TDDFT, MP2, CCSD
    • PBC RHF, UHF, RKS, UKS with k-point sampling
    • PBC CCSD with k-point sampling
    • PBC AO integrals
    • PBC MO integral transformation
    • PBC density fitting
    • Smearing for mean-field calculation
    • Low-dimensional (0D, 1D, 2D) PBC systems
  • AO integrals
    • Interface to call Libcint library
    • 41 types of 1-electron real-GTO integrals
    • 29 types of 1-electron spinor-GTO integrals
    • 9 types of 2-electron real-GTO integrals
    • 33 types of 2-electron spinor-GTO integrals
    • 4 types of 3-center 2-electron real-GTO integrals
    • 6 types of 3-center 2-electron spinor-GTO integrals
    • General basis value evaluator (for numeric integration)
    • PBC 1-electron integrals
    • PBC 2-electron integrals
  • MO integrals
    • 2-electron integral transformation for any integrals provided by Libcint library
    • Support for 4-index integral transformation with 4 different orbitals
    • PBC 2-electron MO integrals
  • Localizer
    • Boys
    • Edmiston
    • Meta-Lowdin
    • Natural atomic orbital (NAO)
    • Intrinsic atomic orbital (IAO)
    • Pipek-Mezey
  • D2h symmetry and linear molecule symmetry
    • Molecule symmetry detection
    • Symmetry adapted basis
    • Label orbital symmetry on the fly
    • Hot update symmetry information
    • Function to symmetrize given orbital space
  • Tools
    • fcidump
    • molden
    • cubegen
    • Molpro XML reader
  • Interface to integral package Libcint
  • Interface to DMRG CheMPS2
  • Interface to DMRG Block
  • Interface to FCIQMC NECI
  • Interface to XC functional library XCFun
  • Interface to XC functional library Libxc

PySCF Python-based simulations of chemistry framework

How to use

There are two ways to access the documentation: the docstrings come with the code, and an online program reference, available from http://www.sunqm.net/pyscf/index.html

We recommend the enhanced Python interpreter IPython and the web-based Python IDE Ipython notebook to try out the package:

>>> from pyscf import gto, scf
>>> mol = gto.M(atom='H 0 0 0; H 0 0 1.2', basis='cc-pvdz')
>>> mol.apply(scf.RHF).run()
converged SCF energy = -1.06111199785749
-1.06111199786

Submodules

In pyscf, most submodules requires explict import:

>>> from pyscf import gto, scf
gto
Molecular structure and basis sets.
scf
Non-relativistic and relativistic Hartree-Fock.
mcscf
CASCI, 1-step and 2-step CASSCF
ao2mo
General 2-electron AO to MO integral transformation
dft
Non-relativistic DFT
df
Density fitting
fci
Full CI
cc
Coupled Cluster
dmrgscf
DMRGCI, 1-step and 2-step DMRG-CASSCF
fciqmcscf
2-step FCIQMC-CASSCF
grad
Gradients
lo
Localization and orbital orthogonalization
lib
Basic functions and C extensions
nmr
NMR
mp
Moller-Plesset perturbation theory
symm
Symmetry
pbc
A complete tool sets for periodic boundary condition.
tools
fcidump, molden etc

Pure function and Class

Class are designed to hold only the final results and the control parameters such as maximum number of iterations, convergence threshold, etc. The intermediate status are not saved in the class. If the .kernel() function is finished without any errors, the solution will be saved in the class (see documentation).

Most useful functions are implemented at module level, and can be accessed in both class or module, e.g. scf.hf.get_jk(mol, dm) and SCF(mol).get_jk(mol, dm) have the same functionality. As a result, most functions and class are pure, i.e. no status are saved, and the argument are not changed inplace. Exceptions (destructive functions and methods) are suffixed with underscore in the function name, eg mcscf.state_average_(mc) changes the attribute of its argument mc

Stream functions

For most methods, there are three stream functions to pipe computing stream:

1 .set function to update object attributes, eg mf = scf.RHF(mol).set(conv_tol=1e-5) is identical to proceed in two steps mf = scf.RHF(mol); mf.conv_tol=1e-5

2 .run function to execute the kernel function (the function arguments are passed to kernel function). If keyword arguments is given, it will first call .set function to update object attributes then execute the kernel function. Eg mf = scf.RHF(mol).run(dm_init, conv_tol=1e-5) is identical to three steps mf = scf.RHF(mol); mf.conv_tol=1e-5; mf.kernel(dm_init)

3 .apply function to apply the given function/class to the current object (function arguments and keyword arguments are passed to the given function). Eg mol.apply(scf.RHF).run().apply(mcscf.CASSCF, 6, 4, frozen=4) is identical to mf = scf.RHF(mol); mf.kernel(); mcscf.CASSCF(mf, 6, 4, frozen=4)

Table Of Contents

Previous topic

Welcome to PySCF documentation!

Next topic

Tutorial

This Page