Skip to main content

py-chargemol

py-chargemol computes DDEC6 and DDEC3 atomic charges, atomic multipoles, spin moments, bond orders, Hirshfeld and CM5 charges, and quadrupole-dipole resorbed (QDR) point charges directly from electron densities. The numerical algorithms are implemented in Python and NumPy, based on Chargemol 3.5 (September 26, 2017) and T. A. Manz's April 9, 2025 QDR program.

Supply an electron density or wavefunction from an electronic-structure calculation, or use existing Chargemol files or in-memory DDEC6 arrays for QDR.

Use DDEC6 net atomic charges to interpret electron transfer and chemical states. QDR folds part of the atomic dipoles and quadrupoles into the charges on bonded neighbours, weighted by their overlap populations. The resulting point charges are intended for atom-centred force-field models of the electrostatic potential.

Installation

Install with Python 3.14 or newer. Pip installs NumPy (2.3.3 or newer), the only required runtime dependency. Reference densities for elements 1–109 are bundled, so analyses run offline without a Chargemol executable or Fortran compiler.

python -m pip install py-chargemol
py-chargemol --version

For a local checkout, run python -m pip install . from its root. For optional Numba acceleration of partitioning, spin, and bond calculations, run python -m pip install 'py-chargemol[numba]'. Numba compiles kernels on first use and caches them for later runs. To use NumPy with Numba installed, set PY_CHARGEMOL_DISABLE_JIT=1 before starting Python. See the first-use and repeated-run benchmarks.

Usage

Starting point Python API Command line
Electron density or wavefunction read_density → compute_ddec6 py-chargemol analyze
Existing Chargemol output files calculate_qdr py-chargemol qdr
DDEC6 arrays in memory compute_qdr_from_arrays —

Run the worked examples from the root of a repository checkout or an unpacked source distribution. Both include the example inputs under test/ and the guides under docs/.

Compute directly from an electron density

To run a complete analysis, use the supplied triplet ozone wavefunction. With the default settings, this command writes the DDEC6 charges, atomic spin moments, bond orders, and QDR charges to results/ozone/.

py-chargemol analyze test/density_examples/ozone_triplet_PW91.wfx --output-dir results/ozone

The first three atom rows in DDEC6_net_atomic_charges.xyz give the charges in e. To obtain the same values in Python, use the density reader and partitioner.

from py_chargemol import compute_ddec6, read_density

grid = read_density("test/density_examples/ozone_triplet_PW91.wfx")
ozone = compute_ddec6(grid)
print(ozone.charges.round(6))  # [ 0.21533  -0.107665 -0.107665]

For your own calculation, replace the WFX path with a density file or VASP calculation directory. The density guide covers the Python workflow, file discovery, units, core counts, output files, and electron-count errors.

Compute QDR from Chargemol output

Try the carbon monoxide example with the Python API. The two values are the point charges on carbon and oxygen, in elementary-charge units.

from py_chargemol import calculate_qdr

co = calculate_qdr("test/worked_examples/CO_molecule")
print(co.charges.round(6))  # [-0.003964  0.003964]

For your own Chargemol directory, py-chargemol qdr DIR writes QDR-DDEC6_point_charges.xyz and a run log there. For filenames, output overrides, residual multipoles, and solver diagnostics, see the QDR guide.

Compute directly from arrays

Pass the DDEC6 net charges, atomic dipoles and quadrupoles, geometry, and directed overlap populations to compute_qdr_from_arrays. The array example and argument table give the units, tensor component order, and periodic-image convention.

Development

Run uv sync --locked from a checkout to install the package and development tools in editable mode. The development guide covers conda setup, local checks, optional Numba tests, and benchmarks. See the changelog and release guide for release history and publishing steps.

Compatibility with the original programs

QDR regression tests compare the six original worked examples with the Fortran program's output. Density tests include a spin-polarized ozone wavefunction, NaCl with corrected triclinic integration bounds, and a quartz cell with recorded Python results. See the validation notes for the comparisons, tolerances, and commands to reproduce them.

Citation

Publications using these analyses must cite the original methods, as the licenses require. For DDEC, bond-order, and spin calculations, cite the methods listed in LICENSE-CHARGEMOL, including the DDEC6 papers by T. A. Manz and N. Gabaldon Limas and the Chargemol 3.5 program. For QDR charges, cite both the method and the program.

  • A. C. Escobosa and T. A. Manz, "How well do various QM-derived net atomic charges reproduce the electrostatic potential surrounding a material across multiple geometric conformations?", RSC Advances, Vol. 15 (2025) 23223-23265, doi:10.1039/D4RA07900K.
  • T. A. Manz, InteractionModels program, 2025 version, ddec.sourceforge.net.

The output file keeps the Fortran program's citation text, which predates the paper's publication.

License

The QDR implementation retains the original terms, which LICENSE reproduces. The density-analysis implementation and reference data retain Chargemol's terms in LICENSE-CHARGEMOL. Both require attribution and citation of the original methods in published results.

Metadata

Release files for py-chargemol 1.2.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 py-chargemol 1.2.0
File Size Uploaded Provenance Actions
py_chargemol-1.2.0.tar.gz 3.8 MB With provenance Details for py_chargemol-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-chargemol 1.2.0
File Interpreter ABI Platform Actions
py_chargemol-1.2.0-py3-none-any.whl Python 3 none any Details for py_chargemol-1.2.0-py3-none-any.whl

Total release size: 5.7 MB

Release files / py_chargemol-1.2.0.tar.gz

Download URL py_chargemol-1.2.0.tar.gz
Size 3.8 MB
Tags Source
SHA-256 checksum
How to use checksums
51b4d48286c0bb228b07f652ccf74e47c2eac58a0608f0bb6d8461778b2f2605
BLAKE2b-256 checksum
How to use checksums
4566004c7bf8cbfd10b02be5e70508d0b8836fef75efcc7dfbb660864926c560
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / py_chargemol-1.2.0-py3-none-any.whl

Download URL py_chargemol-1.2.0-py3-none-any.whl
Size 2.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0223bed47d523b83571c32c28f9780c9c474557c587652951d7e689bd7867065
BLAKE2b-256 checksum
How to use checksums
16ec11610cede6f8a71bcf17030b6ada8daa4c042db77819f327f4d50657bfba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for py-chargemol 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for py_chargemol-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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