PyMPFIT is a free, open-source software for performing partial atomic charge fitting using the Gaussian distributed multipole analysis (GDMA). Features include:
- Built on open-source libraries: OpenFF Recharge, OpenFF Toolkit, and NumPy
- Direct interface to Psi4 / GDMA and from wavefunctions stored within QCFractal (i.e., QCArchive)
- Generating multipole moments for multi-conformer molecules
- An SQLite database backend for efficient high-throughput scaling
- Bayesian methods (Pyro) for flexible virtual site fitting
PyMPFIT depends on OpenFF packages and Psi4/GDMA, which are distributed via conda-forge. Works with conda, mamba, or micromamba.
conda create -n pympfit python=3.12 openff-recharge openff-interchange openff-utilities psi4 libint=2.9 pygdma -c conda-forge -y
conda activate pympfitNote: The
libint=2.9pin is a temporary workaround for a psi4/libint2 compatibility issue. This will be resolved in psi4 v1.10 build 3.
pip install pympfitpip install pyro-ppl arviz matplotlib sphericart-torchgit clone https://github.com/shehan807/pympfit.git
cd pympfit
pip install -e ".[test]"from openff.toolkit import Molecule
from openff.recharge.utilities.molecule import extract_conformers
from pympfit import (
GDMASettings, Psi4GDMAGenerator, MoleculeGDMARecord,
MPFITSVDSolver, generate_mpfit_charge_parameter,
)
# Create molecule
molecule = Molecule.from_smiles("CCO")
molecule.generate_conformers(n_conformers=1)
[conformer] = extract_conformers(molecule)
# Compute multipoles via Psi4/GDMA
settings = GDMASettings(method="pbe0", basis="def2-SVP", limit=4)
coords, multipoles = Psi4GDMAGenerator.generate(
molecule, conformer, settings, minimize=True
)
# Fit partial charges to multipoles
record = MoleculeGDMARecord.from_molecule(molecule, coords, multipoles, settings)
charges = generate_mpfit_charge_parameter([record], MPFITSVDSolver())
import numpy as np
print(f"MPFIT SMILES : {charges.smiles}")
print(f"MPFIT CHARGES : {np.round(charges.value, 4)}")Output:
MPFIT SMILES : [H:1][O:2][C:3]([H:4])([H:5])[C:6]([H:7])([H:8])[H:9]
MPFIT CHARGES : [ 0.34 0.6064 -0.6405 -0.1101 -0.1218 -0.113 -0.1281 -0.1534 0.3205]
See examples/tutorials/quickstart.py for more.
The main package is released under the MIT license.
Copyright (c) 2026, Shehan M. Parmar
Project based on the Computational Molecular Science Python Cookiecutter version 1.11.
