Skip to main content

PMEFF — Python Molecular Editor Force Field

DOI Tests PyPI Downloads

A MoleditPy plugin that adds PMEFF, a self-contained universal molecular force field covering the entire periodic table (Z = 1 – 118). It needs no external QM binary — just numpy and rdkit.

Why another force field?

The classic force fields shipped with molecular editors are excellent for organic chemistry but leave gaps: MMFF94 only parameterizes a fixed subset of main-group elements, and even UFF-style tables are hand-tuned per element.

PMEFF takes a different approach. Every parameter is derived from a single per-element property — the Pyykkö single-bond covalent radius — so no element is ever missing a parameter. Drop in a lanthanide, an actinide, a transition metal, or a superheavy element and PMEFF still produces a sensible geometry.

What it does

Once installed, PMEFF registers:

Feature Where Description
PMEFF Right-click the Optimize 3D button Relaxes the current 3D geometry with a dependency-free FIRE 2.0 + L-BFGS optimizer.
PMEFF Single-Point Energy Analysis menu Reports the force-field energy (with per-term decomposition) without modifying the geometry.
PMEFF Minimum Check (Vibrational) Analysis menu Diagonalizes the Hessian at the current geometry and reports whether it is a true minimum or a saddle point.
PMEFF Settings… Settings → PMEFF Setting menu Opens a dialog to toggle individual physics options (persisted to settings.json).

Scope: PMEFF is a pre-DFT geometry-cleanup force field. Its goal is initial structure preparation — removing clashes, correcting bond lengths, angles and torsions, and placing metal centers in the right coordination geometry. It is not designed for high-accuracy thermochemistry. For accurate energies, pair it with the ORCA or PySCF plugins.

The physics

For the full specification — functional forms, parameter derivations, gradient formulas, non-bonded bookkeeping and the optimizer — see the technical reference. In brief, PMEFF has these energy terms:

  • Bonds — by default Morse potential D(1 − e^{−α Δr})² (bounded above at the dissociation energy D; same curvature as harmonic at the minimum). The harmonic ½·k·(r − r₀)² is available as a fallback. Rest lengths and force constants follow the same covalent-radius rules in both cases, with a polar-bond contraction (a capped, quadratic function of the electronegativity difference) that pulls in bonds the plain radius sum leaves too long — Si–O 1.79→1.63 Å, P=O, B–O, the metal-oxides and C–F — while leaving organic C–C/C–O/C–N/C–H unchanged. Toggleable in settings.
  • Angles — harmonic in the bend angle, ½·k·(θ − θ₀)², with the ideal angle θ₀ inferred from the central atom's hybridization (falling back to its coordination number for metals and other cases where hybridization is ambiguous). sp³ pnictogens and chalcogens are compressed below tetrahedral by their lone pairs (4 − coordination of them): mildly for period-2 atoms (NH₃ ≈ 107°, H₂O ≈ 104.5°), strongly for heavier congeners that bond through near-pure p orbitals (H₂S/PH₃ ≈ 93°). The period-2 compression is calibrated on hydrides and opens back toward tetrahedral for bulkier substituents (dimethyl ether's C-O-C ≈ 110°, not 104.5°). Two more special cases: in-ring angles of three-membered rings take their target from the law of cosines over the bond rest lengths (60° in cyclopropane), so bonds and angles share one minimum; and linear sp centers use k·(1 + cos θ), which matches the harmonic curvature at 180° but keeps the gradient finite at the linear minimum.
  • Torsions — a cosine dihedral potential ½·V·(1 + cos(n·φ − γ)): 2-fold for sp²–sp² bonds (keeps double bonds and conjugated systems planar), 3-fold for sp³–sp³ bonds (staggered minima), and a weak 6-fold term for mixed sp²–sp³ bonds. The per-bond barrier is split evenly over all dihedrals sharing the bond, UFF-style, so it doesn't grow with substitution, and the 2-fold barrier scales with the π character of the central bond — full for a double bond, reduced for aromatic, weak for a conjugated single bond, so biphenyl can twist while ethylene stays rigid.
  • Out-of-plane — a harmonic penalty on the pyramidalization of 3-coordinate sp² centers, expressed through the sum of the three bend angles around the center (planar ⇔ 360°).
  • van der Waals — a Lennard-Jones 12-6 term whose per-atom radius is the covalent radius plus a fixed 0.90 Å offset. This reproduces the tabulated vdW radii of the common elements to within ~0.05 Å (C → 1.65 Å vs. 1.70 Å, O → 1.53 Å vs. 1.52 Å, H → 1.22 Å vs. 1.20 Å). Well depths are derived per atom from the covalent radius as a polarizability proxy (carbon anchors the scale) and combined with the Lorentz–Berthelot geometric mean. 1-2 and 1-3 pairs are excluded; 1-4 pairs get the conventional half well depth.

Optional physics terms

Settings → PMEFF Setting opens a dialog. All settings are persisted in pmeff_plugin/settings.json. The optional terms (defaults shown) are:

  • Electronic effects (on) — QEq partial charges from Slater Zeff and Allred–Rochow electronegativities feed a shielded Coulomb term; charges are re-solved as the geometry relaxes (envelope theorem keeps the gradient exact). Also enables square-planar angle targets for 4-coordinate Ni/Pd/Pt/Rh/Ir/Au and octahedral targets for 6-coordinate d-block transition metals; cis/trans assignment is read from the starting geometry so tetrahedral Pd²⁺ converges to square-planar.
  • Morse bond stretching (on) — replaces harmonic bonds with the Morse potential D(1−e^{−α Δr})²; bounded above at D, same curvature at the minimum. Improves robustness for severely distorted starting geometries at negligible computational cost.
  • Hydrogen bond correction (on) — a geometry-dependent D−H···A term (donors/acceptors: N, O, F, S) with a 12-6 radial profile and cos²(∠DHA) angular dependence. Improves H-bond distances and linearity. Fast.
  • Dispersion correction (off by default) — Becke-Johnson damped C₆/r⁶ London dispersion added on top of the LJ term. Improves aromatic stacking distances and hydrophobic contacts. Can slow optimization of large molecules.

Lone pairs are not explicit particles, but their steric effect enters through the hybridization-derived angle targets: sp³ N stays pyramidal, sp³ O stays bent, and a conjugated (sp²) amide nitrogen stays planar.

Geometry optimization uses FIRE 2.0 (Fast Inertial Relaxation Engine) for the far-from-minimum regime and hands over to an L-BFGS finisher in the quadratic basin, with a per-atom displacement clamp for stability and fully analytical gradients for all energy terms — including the dihedral and Coulomb derivatives, which are verified against numeric differentiation in the test suite. All terms are evaluated with vectorized numpy over precompiled index arrays, so evaluation cost is dominated by numpy kernels rather than Python loops. The short-range van der Waals term is truncated at a 12 Å cutoff (electrostatics, being long-range, are not) with the pair list built by an O(N) cell-list search and maintained as a Verlet list during optimization; a CHARMM-style switching function tapers the LJ term to zero over the last 2 Å with zero slope at the cutoff, so both energy and force stay continuous as a pair crosses the boundary. A finite-difference Hessian over the analytic gradient powers the vibrational minimum check.

Note: PMEFF energies are in internal, consistent units meant for relative comparison and geometry guidance, not thermochemistry. The goal is to give the DFT optimizer a sensible starting geometry — not to replace it.

Installation

Copy the pmeff_plugin/ folder into your MoleditPy user plugin directory:

  • Windows: C:\Users\<YourName>\.moleditpy\plugins\
  • Linux / macOS: ~/.moleditpy/plugins/

Then restart MoleditPy, or use Plugins → Reload All Plugins.

Standalone Python package (pmeff)

The force-field engine is also published on PyPI as pmeff — the same physics, usable from any Python script without MoleditPy. The core has no dependency beyond NumPy; RDKit is an optional extra for the convenience layer.

pip install pmeff            # core: NumPy only
pip install "pmeff[rdkit]"   # adds the RDKit convenience layer (optimize_mol)

With RDKit — Mol in, relaxed Mol out

The recommended path: hand it an RDKit molecule that has a 3D conformer, and get the same molecule back with its geometry relaxed. Connectivity, bond orders, formal charges and properties are all preserved (a raw coordinate list would throw them away).

from rdkit import Chem
from rdkit.Chem import AllChem
import pmeff

mol = Chem.AddHs(Chem.MolFromSmiles("O[SiH3]"))   # silanol
AllChem.EmbedMolecule(mol, randomSeed=1)          # give it a 3D conformer

mol, result = pmeff.optimize_mol(mol)             # relaxed in place, and returned
print(result.converged, result.energy, result.max_force)
print(Chem.MolToXYZBlock(mol))                    # -> optimized coordinates

optimize_mol takes the same physics switches as the plugin (electronic_effects, use_morse, use_hbond, use_dispersion, use_polar_contraction) plus max_iter and f_tol.

Without RDKit — plain arrays in, coordinates out

For pipelines that don't use RDKit, describe the molecule with atomic numbers, a bond list and coordinates:

import numpy as np
import pmeff

atomic_numbers = [8, 1, 1]                         # water
bonds = [(0, 1), (0, 2)]
coords = np.array([[0.0, 0, 0], [0.96, 0, 0], [-0.3, 0.9, 0.0]])

coords, result = pmeff.optimize_coords(
    atomic_numbers, bonds, coords, hybridizations=["SP3", None, None]
)
print(result.converged)
print(coords)                                      # optimized (N, 3) array

Optional charges (pmeff.qeq_charges(...)), per-bond orders and hybridizations sharpen the result. The lower-level engine — build_topology, energy_and_gradient, energy_components, optimize, vibrational_analysis — is exported too for custom workflows.

For the full programmatic guide — every option, the low-level engine, worked recipes and an API reference — see docs/USAGE.md.

The engine is a copy of pmeff_plugin/forcefield.py (the single source of truth); see PACKAGING.md for the build/release process.

Development

# Run the test suite (uses real numpy + rdkit)
python -m pytest tests/ -v

# With coverage
python -m pytest tests/ --cov=pmeff_plugin --cov-report=term-missing

# Lint
pylint pmeff_plugin/

The engine (pmeff_plugin/forcefield.py) is deliberately Qt-free and RDKit-free at its core — it operates on a plain-number Topology — which makes it fully unit-testable without a GUI. Only the thin boundary functions touch RDKit.

License

GPL-3.0. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pmeff-1.0.5.tar.gz (99.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pmeff-1.0.5-py3-none-any.whl (61.6 kB view details)

Uploaded Python 3

File details

Details for the file pmeff-1.0.5.tar.gz.

File metadata

  • Download URL: pmeff-1.0.5.tar.gz
  • Upload date:
  • Size: 99.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pmeff-1.0.5.tar.gz
Algorithm Hash digest
SHA256 b3bcc175454f2f67725495a68a0fd48219a43e5825b8a99de2cc8719c6a2efd3
MD5 10ea9de2a7e1df68cf88d7b356f09563
BLAKE2b-256 98c812ac136ec90b023e6c29c5c53a2322f12376853ea4848d3685f88ba31d18

See more details on using hashes here.

Provenance

The following attestation bundles were made for pmeff-1.0.5.tar.gz:

Publisher: release.yml on HiroYokoyama/moleditpy_pmeff-plugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pmeff-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: pmeff-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 61.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pmeff-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cc08ec181082ff28e6ab4a083b564e2493a32d7628015eff6116a8684aead34d
MD5 c9bba1ddcfd2a40b133e4096b1654fdf
BLAKE2b-256 9088f62396b64fee75193b629a8fe2100b4c9931f0292926d2c4b73d84751f35

See more details on using hashes here.

Provenance

The following attestation bundles were made for pmeff-1.0.5-py3-none-any.whl:

Publisher: release.yml on HiroYokoyama/moleditpy_pmeff-plugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.4.0

2 files

1.3.1

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

This release

1.0.5 This release

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 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