How josejimenezluna/delfta works
Purpose and public entry points
DelFTa is a Python toolbox for predicting DFT-level quantum properties of drug-like molecules using 3D message-passing neural networks. It supports direct prediction and Δ-learning correction over a GFN2-xTB baseline. Primary user APIs are DelftaCalculator in delfta/calculator.py and the model-asset bootstrap module delfta/download.py. Package exports begin at delfta/__init__.py.
Molecular input and validation boundary
Molecules enter as Pybel/OpenBabel objects, allowing common molecular file formats and SMILES-derived structures. Input suitability and molecular checks are separated from inference in delfta/molchecks.py; general molecular/data transformations reside in delfta/utils.py. This boundary protects model execution from unsupported or malformed chemical representations.
Calculator orchestration
delfta/calculator.py is the main control plane. DelftaCalculator selects requested property models and learning mode, coordinates molecular preprocessing, optionally obtains the semiempirical baseline, invokes neural inference, and assembles predictions. This is the principal integration point for consumers and the natural place for batching or API-level behavior changes.
Neural prediction subsystem
delfta/net.py defines the 3D message-passing network architecture used for quantum-property inference. delfta/net_utils.py provides model-oriented data preparation and inference support. Model outputs cover molecular properties such as formation/orbital energies and dipoles, plus atom- or bond-level outputs such as Mulliken charges and Wiberg bond orders. The learned-model boundary is distinct from chemistry-tool execution and asset download.
Δ-learning baseline execution
delfta/xtb.py integrates the external GFN2-xTB calculation required by Δ-learning. In this path, the system obtains xTB baseline values, then combines them with neural corrections to approximate the DFT reference level. Direct-learning bypasses this dependency and uses neural predictions alone. xTB invocation is therefore a runtime/process boundary with different failure and deployment requirements than direct inference.
Model distribution and local assets
delfta/download.py fetches required trained model files before normal use. The repository intentionally does not carry these assets in its source tree, making download/bootstrap a required operational stage. Network access is needed for initial asset acquisition; subsequently inference depends on locally available downloaded weights.
Runtime and delivery
The supported runtime is Python 3.11–3.12 on Linux, distributed through Conda and a CUDA-capable Docker image. Core external dependencies include OpenBabel/Pybel for molecular handling and xTB for Δ-learning. Packaging and container deployment are defined by setup.py, conda-recipe/meta.yaml, and Dockerfile; CI validates builds through .github/workflows/build.yml.
Main entry points: calculator.py DelftaCalculator · xtb.py GFN2-xTB execution · net.py 3D message-passing network · __init__.py Package exports
Components 16
Public API
- Package exports
delfta/__init__.py - DelftaCalculator · Selects properties and direct or Δ-learning mode.
delfta/calculator.py - Model bootstrap · Fetches trained weights for local use.
delfta/download.py
Molecular Processing
- Pybel/OpenBabel molecules · Molecules originate from files or SMILES-derived structures.
- Molecule validation
delfta/molchecks.py - Molecular transforms
delfta/utils.py
Neural Inference
- Inference preparation
delfta/net_utils.py - 3D message-passing network · Predicts molecular, atomic, and bond properties.
delfta/net.py - Downloaded model weights · Required trained assets are absent from source control.
External Runtime
- GFN2-xTB execution · Supplies semiempirical baselines for Δ-learning.
delfta/xtb.py - OpenBabel/Pybel
- xTB runtime
Distribution
- Python package
setup.py - Conda distribution · Supports Python 3.11–3.12 on Linux.
conda-recipe/meta.yaml - CUDA Docker image
Dockerfile - Build CI
.github/workflows/build.yml
Connections 18
- Package exports → DelftaCalculator: exports
- Package exports → Model bootstrap: exports
- Pybel/OpenBabel molecules → Molecule validation: validate
- Molecule validation → Molecular transforms: accepted molecules
- Molecular transforms → DelftaCalculator: prepared molecules
- DelftaCalculator → Inference preparation: coordinates inference
- Inference preparation → 3D message-passing network: model inputs
- Downloaded model weights → 3D message-passing network: loaded weights
- Model bootstrap → Downloaded model weights: fetches
- DelftaCalculator → GFN2-xTB execution: Δ-learning only
- GFN2-xTB execution → xTB runtime: invokes
- GFN2-xTB execution → DelftaCalculator: baseline values
- 3D message-passing network → DelftaCalculator: direct predictions or corrections
- OpenBabel/Pybel → Pybel/OpenBabel molecules: provides molecule objects
- Python package → Conda distribution: package metadata
- CUDA Docker image → Python package: installs package
- Build CI → Conda distribution: validates builds
- Build CI → CUDA Docker image: validates image