Python-based quantum chemistry framework providing electronic structure methods for molecular simulations
—
Advanced techniques including relativistic methods, solvation models, QM/MM interfaces, and computational acceleration methods for specialized quantum chemistry applications.
Methods for treating relativistic effects in heavy element systems including scalar and spin-orbit coupling.
class X2C:
"""
Exact two-component relativistic method.
Provides scalar relativistic effects through exact decoupling
of positive/negative energy states with 2-component efficiency.
"""
def __init__(self, mol):
"""Initialize X2C method."""
def RHF(self):
"""X2C enhanced restricted Hartree-Fock."""
def sfx2c1e(mf):
"""
Spin-free X2C with 1-electron X-matrix approximation.
Efficient scalar relativistic treatment including effects
only in 1-electron integrals.
"""Implicit solvation methods for modeling solvent effects on molecular properties and reactions.
class PCM:
"""
Polarizable Continuum Model.
Treats solvent as continuous dielectric medium with
molecular-shaped cavity for solute.
Attributes:
- eps: float, solvent dielectric constant
- method: str, PCM variant ('IEF-PCM', 'SS(V)PE', 'C-PCM')
"""
class COSMO:
"""
Conductor-like Screening Model.
Approximates solvent as conductor with dielectric scaling
for realistic solvent response.
"""
class ddCOSMO:
"""
Domain decomposition COSMO with linear scaling.
Efficient COSMO implementation with linear scaling
for large molecular systems.
"""Quantum mechanics/molecular mechanics methods for treating large systems with multi-scale approaches.
class QMMMole:
"""
QM/MM molecule combining quantum and classical regions.
Partitions system into QM (high accuracy) and MM (efficiency)
regions with proper boundary treatment.
Attributes:
- qm_atoms: list, atoms in QM region
- mm_atoms: list, atoms in MM region
- qm_charge: float, total charge of QM region
"""
class QMMM:
"""
QM/MM method interface.
Handles coupling between quantum mechanical and molecular
mechanical descriptions including electrostatic embedding.
"""Computational acceleration through resolution of identity approximations for large molecule calculations.
def density_fit(mf, auxbasis=None, with_df=None, only_dfj=False):
"""
Add density fitting acceleration to SCF method.
Parameters:
- mf: SCF object to enhance
- auxbasis: str, auxiliary basis set name
- with_df: DF object for custom fitting
- only_dfj: bool, fit only Coulomb integrals
Returns:
density-fitted SCF object with reduced computational scaling
"""
class DF:
"""
Density fitting base class.
Implements 3-center integral approximation (μν|P) for
efficient 4-center integral evaluation.
"""
class GDF:
"""
Gaussian density fitting.
Specialized DF implementation for Gaussian basis sets
with optimal auxiliary basis selection.
"""Semi-numerical techniques for computational efficiency in large molecular systems.
def sgx_fit(mol, auxbasis=None):
"""
Semi-numerical exchange fitting procedure.
Reduces computational cost of exact exchange evaluation
through numerical fitting techniques.
"""
def make_sgx(mf):
"""
Create semi-numerical exchange object.
Transforms SCF method to use semi-numerical exchange
for improved efficiency in large systems.
"""Sophisticated correlation methods using Green's function techniques.
class GW:
"""
GW approximation for quasi-particle energies.
Calculates ionization potentials and electron affinities
through self-energy corrections to mean-field results.
"""
class AGF2:
"""
Auxiliary second-order Green's function method.
Efficient implementation of self-consistent GF(2)
for accurate ionization and excitation energies.
"""
class ADC:
"""
Algebraic Diagrammatic Construction.
Systematic approach to excited states through
Green's function pole analysis.
"""import pyscf
# X2C for heavy elements
mol_au = pyscf.M(atom='Au 0 0 0; H 0 0 1.5', basis='cc-pvdz-pp')
mf_x2c = pyscf.scf.X2C(mol_au).RHF()
mf_x2c.run()
print(f"X2C energy: {mf_x2c.e_tot}")
# Spin-free X2C approximation
mf_sfx2c = pyscf.scf.sfx2c1e(mol_au.RHF())
mf_sfx2c.run()# PCM solvation in water
mol = pyscf.M(atom='H2CO', basis='6-31g')
mf = mol.RHF()
# Add PCM solvent
mf_pcm = pyscf.solvent.PCM(mf)
mf_pcm.eps = 78.4 # water dielectric constant
mf_pcm.run()
print(f"Solvation energy: {mf_pcm.e_tot - mf.run().e_tot}")
# ddCOSMO for large systems
mf_cosmo = pyscf.solvent.ddCOSMO(mf)
mf_cosmo.run()# Density fitting for large molecules
mol_big = pyscf.M(atom='protein.xyz', basis='6-31g')
mf = mol_big.RHF()
# Add density fitting
mf_df = pyscf.scf.density_fit(mf, auxbasis='cc-pvdz-jkfit')
mf_df.run()
# DF for post-SCF methods
mp2_df = pyscf.mp.DFMP2(mf_df)
mp2_df.run()# QM/MM setup
mol_system = pyscf.M(atom='large_system.xyz', basis='6-31g')
# Define QM region (first 10 atoms)
qmmm = pyscf.qmmm.QMMM(mol_system, qm_atoms=list(range(10)))
mf_qmmm = qmmm.RHF()
mf_qmmm.run()from typing import List, TypedDict
from typing_extensions import Literal
# Relativistic method types
RelativisticMethod = Literal['X2C', 'DKH', 'ZORA']
# Solvation parameters
SolvationParams = TypedDict('SolvationParams', {
'eps': float,
'eps_inf': float,
'method': str
})
# QM/MM region specification
QMRegion = List[int] # atom indices
MMRegion = List[int] # atom indicesInstall with Tessl CLI
npx tessl i tessl/pypi-pyscf