MolDscript is a Python workflow that converts Density Functional Theory (DFT) and related quantum chemistry outputs into descriptor tables ready for machine learning or benchmarking. It wraps cclib, RDKit, DBSTEP, and pandas to align Gaussian, ORCA, and xTB calculations and write consistent molecule-, bond-, and atom-level CSV files.
- Parse optimization, single-point, NBO, NMR, charge, FMO, and Fukui calculations without manual file editing.
- Read CREST and ORCA GOAT multi-conformer XYZ files directly and summarize steric variation without requiring a higher-level calculation.
- Match quantum-chemistry conformer ensembles, apply SMARTS-based substructure filters, and compute DBSTEP buried volumes on demand.
- Generate ensembles (Boltzmann weighted, min/max within population windows, lowest-energy snapshots) in a single run.
- Emit descriptor CSVs alongside a single run audit log (
MOLDSCRIPT.dat) for traceability.
git clone https://github.com/patonlab/molDscript.git
cd molDscript
pip install -e .Open Babel (optional) can be installed from conda-forge:
conda install -c conda-forge openbabelpython -m moldscript \
--opt calculations/opt --fmo calculations/fmo
--suffix_fmo fmo_suffix --suffix_nbo nbo_suffix
--nbo calculations/nbo
Prefer storing options in a key:value text file? Use --varfile inputs.txt; command-line flags override values loaded from the file.
For a geometry-only conformer ensemble:
python -m moldscript \
--ensemble conformer_search \
--ensemble_radii "[3.5]"For matched MACE-POLAR neutral, reduced, and oxidized EXTXYZ files:
python -m moldscript \
--mlip_neutral mace_polar_results/extxyz/neutral \
--mlip_reduced mace_polar_results/extxyz/reduced \
--mlip_oxidized mace_polar_results/extxyz/oxidized \
--molecular_sterics \
--substructure "[S,O:1]=[N,P]" \
--no_bond_filter \
--output moldscript_features/The MLIP reader pairs states by conformer_id (falling back to the source
filename), verifies identical atom order and fixed coordinates, and rejects
missing or mismatched states. Scalar atomic properties are retained for every
state. Vector properties are expanded into reproducible scalar columns, so a
four-component mace_density_coefficients array produces 12 atom-level
columns across the three states and a three-component force produces nine.
The canonical molecule-level dipole is its scalar magnitude. When present in
the neutral EXTXYZ header, finite-field MACE polarizability is exposed in both
Angstrom cubed and the atomic-unit convention used by xTB/AQME. MLIP state
energies also produce sign-correct IP, EA, chemical potential, hardness, and
softness descriptors in eV-based units.
MLIP SMARTS matching is performed directly on connectivity inferred from the
EXTXYZ coordinates. When atom map :1 is present, that mapped atom is retained
in atom_level.csv; bonds explicitly present in the SMARTS are retained in
bond_level.csv. Embedded is_moldscript_target and is_target_partner
arrays, when present, are strict audit checks rather than substitutes for the
SMARTS match. The combined SMARTS above selects sulfur in S=N substrates and
oxygen in P=O catalysts while retaining the corresponding S=N or P=O bond.
Directory input recognizes CREST crest_conformers.xyz /
*_crest_conformers.xyz files and ORCA GOAT *.finalensemble.xyz files. Any
equivalent multi-frame XYZ filename can be passed directly. Comment-line
energies are interpreted as Hartree; the minimum is retained internally but is
not added as an ensemble descriptor.
Only compact steric summaries are added to molecule_level.csv: min, max, and
range for mass-weighted radius of gyration and relative shape anisotropy.
Buried volume is instead an atom-level descriptor: every atom is used as a
center, and every requested radius adds the minimum, maximum,
Boltzmann-weighted mean, and lowest-energy-conformer %Vbur to
atom_level.csv. The Boltzmann mean uses --temp (298.15 K by default).
For a pre-mapped atom, add
buried_volume_center_index_0based=N to every comment line in that ensemble.
Only the declared center is evaluated, while all atom-level arrays retain
their original length and ordering. This avoids calculating unused centers in
large MLIP-derived ensembles.
An ensemble-only run with buried volume writes molecule_level.csv and
atom_level.csv, but no bond table. When quantum outputs are also supplied,
the ensemble descriptors are merged into their normal molecule and atom
tables, and the normal bond table is retained. No raw conformer table or
separate ensemble results folder is created. Buried volumes use DBSTEP's
Bondi-radius table, molDscript's existing 1.17 scale factor, a 0.25 Angstrom
grid, and non-hydrogen occupancy atoms by default.
--opt PATH- baseline optimization files and conformer metadata for quantum-output workflows; not required for single-point-only or ensemble-only analysis.--spc PATH- single-point energies that replace optimization SCF energies.--nbo,--nmr,--charges,--fmoPATH - add module-specific descriptors; pair with--suffix_*to specify filename tokens specific to calculation type (required for proper comformer matching).--fukui_neutral,--fukui_reduced,--fukui_oxidizedPATH - supply all three charge states for vertical IE/EA and condensed Fukui functions. Again, pair with--suffix_*for proper conformer matching.--mlip_neutral,--mlip_reduced,--mlip_oxidizedPATH - read paired MACE-POLAR EXTXYZ state directories, including scalar and vector atomic arrays, vertical IE/EA, dipoles, and charge-derived Fukui descriptors.--molecular_sterics- compute whole-molecule RDKit 3D volume (Angstrom cubed) and FreeSASA solvent-accessible surface area (Angstrom squared) from either quantum-chemistry or MLIP coordinates. FreeSASA uses periodic-table van der Waals radii and a 1.4 Angstrom solvent probe.--substructure SMARTS- limit atom/bond descriptors to a SMARTS match; combine with--volumeor--valland optional--radiuslist for DBSTEP buried volumes.--ensemble PATH- analyze a multi-frame.xyzfile, or recursively find standard CREST and GOAT ensemble files below a directory. This can be used alone or alongside quantum-output modules.--suffix_ensemble TAG- remove a trailing filename tag when matching an ensemble to existing quantum-output molecule keys.--ensemble_radii "[3.5]"- sphere radii (Angstrom) for atom-level buried-volume summaries; every atom is evaluated unless the XYZ comments declareburied_volume_center_index_0based=N. Set[]to omit this comparatively expensive descriptor.--ensemble_grid 0.25- buried-volume voxel spacing in Angstrom.--ensemble_include_h- allow hydrogen atoms to contribute to buried-volume occupancy. Hydrogen atoms still receive centered buried-volume descriptors when this flag is omitted.--ensemble_exclude "[1, 2]"- additional 1-based atoms that cannot contribute to buried-volume occupancy. Excluded atoms still receive their own centered descriptors.
Per-atom ensemble descriptors require the same atom identity and ordering in every XYZ frame, including among atoms of the same element. Changes in element order are rejected. A permutation of two same-element atoms is usually undetectable from XYZ element labels alone, but remains unsupported because it mixes atom identities across conformers.
--boltz,--min_max,--lowe- compute Boltzmann-weighted averages, min/max/range tables (using--cut), and lowest-energy snapshots for conformer rows.--boltzand--lowealso support MLIP EXTXYZ input. MLIP conformers are grouped by the explicitcomponent_idmetadata field when available; older inputs fall back to a case-insensitive_conf_1/_CONF_01filename convention. Ensemble-only XYZ input ignores these reducers because its steric ranges are already summarized internally. Adjust--temp(K) as needed.--temp FLOAT- temperature in Kelvin for standard conformer reducers and the atom-level ensemble%VburBoltzmann mean.--output PREFIX- prepend every generated filename; append a slash to target a directory. Use--no_mol,--no_atom,--no_bond, or--no_bond_filterto tailor CSV output.--workers N- parse independent quantum output files in parallel. Start with a modest value such as--workers 4for large batches, then increase if memory use is acceptable.--write_args arguments.txt- save the effective options for the current run as a reusable--varfile.
molecule_level.csv,bond_level.csv,atom_level.csv- aligned descriptors per calculation, bond pair, or atom.ensemble_*.csv,boltzmann_weights.csv- created when--boltzis enabled. The weight table records component IDs, relative energies, temperature, and the energy-minimum marker.min_max_range_*.csv,lowest_energy_*.csv- created when--min_maxor--loweare requested.--loweadditionally writeslowest_energy_conformers.csvas a selection audit.--ensembleadds radius-of-gyration and shape min/max/range columns tomolecule_level.csv, and per-atom buried-volume min/max/Boltzmann-mean/lowest-energy columns toatom_level.csvwhen radii are requested. It does not create additional ensemble-specific CSV files or directories.MOLDSCRIPT.dat- a single run log capturing provenance, parsed files, module sections, and CPU-time summaries.
For 500 aryl bromides, linear centered kernel alignment (CKA) measures how similarly four computational methods describe the same atoms, bonds, and molecules. Bond-length CKA rounds to 1.00 for every method pair. At the atom level, CKA between the MLIP and each DFT method ranges from 0.34 to 0.37 for the charge and Fukui descriptors.
Data, plotting script, and instructions to reproduce the figure
The Read the Docs site (coming soon) will provide the full user guide: https://moldscript.readthedocs.io
Key Python dependencies include pandas, cclib (latest GitHub version for the most up-to-date package compatability), dbstep, rdkit, networkx, numpy, periodictable, rich, and tqdm.
- Gaussian
- ORCA
- xTB (optimizations)
Run pytest -v from the project root to execute the test suite.
This work was carried out in the Paton Laboratory at Colorado State University, supported by the NSF Center for Computer-Assisted Synthesis (grant CHE-1925607).
Contributors include Shree Sowndarya, Jake King, and Robert Paton.
