Conformers
ETKDG on Metal — distance geometry in 4D, ETK in 3D, then MMFF94 — for N molecules × k conformers in one batch. Every conformer passes RDKit’s embedding checks.
generate_conformers_nkOpen source · MIT · Apple silicon
Molecular modelling on the Apple GPU. Conformers, force fields, clustering and semi-empirical quantum chemistry, written as batched MLX and Metal kernels.
pip install mlxmolkit-rdkitRuns on macOS with Apple silicon (M1–M4). RDKit reads the molecules: conda install -c conda-forge rdkit
generate_conformers_nk (ETKDGv3 + MMFF94), aligned on the ring.ETKDG on Metal — distance geometry in 4D, ETK in 3D, then MMFF94 — for N molecules × k conformers in one batch. Every conformer passes RDKit’s embedding checks.
generate_conformers_nkMorgan fingerprints, Tanimoto neighbour lists and Butina clustering for 150,000+ molecules, with divide-and-conquer memory.
butina_tanimoto_mlxMNDO, RM1, AM1, PM3, PM6 and PM7 with their corrections: scalar and batched SCF, gradients and geometry optimisation, no MOPAC needed.
mlxmolkit.nddoGFN0, GFN1, GFN2 and g-xTB energies, analytical gradients, ANCOPT geometry optimisation and ALPB water solvation.
mlxmolkit.xtbσ-profiles, σ-potentials, activity coefficients and solubility in solvent mixtures.
mlxmolkit.cosmoERG fingerprints, dense cosine similarity, CHEESE embeddings, Connolly surfaces and dipole atom features.
from mlxmolkit import …Every stage after the extraction runs on the GPU. An attempt is kept only if it passes RDKit’s embedding checks — chirality, E/Z, tetrahedral centres — after each minimisation.
RDKit reads each of the N SMILES and builds its constraints once.
The k conformers of a molecule share its constraints: ~50% less memory.
Molecules short of k conformers get new random starts, in bounded rounds.
At 200 iterations the fused kernel beats RDKit on 14 threads by 1.22×, but only 800 of 2,500 conformers reach RDKit’s energy. Matching it takes ~2,000 iterations, which leaves Metal ~6× behind. The kernel is fast; the optimiser converges slowly.
The measurements, and three ways to get them wrongfrom mlxmolkit import generate_conformers_nk, butina_tanimoto_mlx
import mlx.core as mx
# 3D conformers — N molecules × k conformers, one GPU batch
result = generate_conformers_nk(
smiles_list=["c1ccccc1", "CC(=O)O", "CC(=O)Oc1ccccc1C(=O)O"],
n_confs_per_mol=10,
run_mmff=True,
)
# Clustering — 150k+ molecules
clusters = butina_tanimoto_mlx(mx.array(fp_bytes), cutoff=0.4)
# Semi-empirical SCF
from mlxmolkit.nddo import nddo_energy
e = nddo_energy(atoms=[8, 1, 1],
coords=[[0, 0, 0], [0.97, 0, 0.93], [-0.97, 0, 0.93]],
method="PM6_D")
# xTB
from mlxmolkit.xtb import gfn2_energy
e = gfn2_energy(atoms, coords)