Skip to main content
PyMPFIT

GitHub Actions Build Status codecov Documentation Status

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

Installation

PyMPFIT depends on OpenFF packages which are distributed via conda-forge.

conda create -n pympfit python=3.12 openff-recharge openff-interchange openff-utilities psi4 pygdma -c conda-forge -y
conda activate pympfit
pip install pympfit

Bayesian Virtual Site Fitting

For Bayesian optimization of virtual site parameters:

pip install pyro-ppl arviz matplotlib sphericart-torch

Development Installation

conda create -n pympfit-dev python=3.12 openff-recharge openff-interchange openff-utilities psi4 pygdma -c conda-forge -y
conda activate pympfit-dev
git clone https://github.com/shehan807/pympfit.git
cd pympfit
pip install -e ".[test]"

Works with conda, mamba, or micromamba.

Quick Example

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.

License

The main package is released under the MIT license.

Copyright

Copyright (c) 2026, Shehan M. Parmar

Acknowledgements

Project based on the Computational Molecular Science Python Cookiecutter version 1.11.

Metadata

Release files for pympfit 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pympfit 1.0.0
File Size Uploaded
pympfit-1.0.0.tar.gz 47.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pympfit 1.0.0
File Interpreter ABI Platform
pympfit-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 98.2 kB

Release files / pympfit-1.0.0.tar.gz

Download URL pympfit-1.0.0.tar.gz
Size 47.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e29f54057fc8491e7fc360007dfea65b1fe3cd58627b25511c27b62dc353e9f5
BLAKE2b-256 checksum
How to use checksums
04320801dec7bae96aaf7666a4e1b70f9ff509320af8c5c81d3f2a67c0f19a66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / pympfit-1.0.0-py3-none-any.whl

Download URL pympfit-1.0.0-py3-none-any.whl
Size 50.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9104172ee951fb86957fc1946137df86d76356b1a4ba8a33300046ef4d96ef8c
BLAKE2b-256 checksum
How to use checksums
9e155f858889488b0c9e852e5b7070b20912df72c5506f9e230f5b9fe08424e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page