Add MOSES-aq as an ASE database (1,584,651 molecules)

#3

What this adds

data/moses_aq/ase/moses_aq_train.db — the full MOSES-aq training corpus as
an ASE database
: 1,584,651 molecules, 6.18 GiB.

What is specific about it

1. It is derived, not an upstream artifact. Every other ShEPhERD-2 asset is
a byte-identical copy of a file from coleygroup/shepherd2 or its Zenodo
record. This one is not. It was built in-repo by
docs/model_integrations/shepherd2/scripts/convert_moses_aq_to_ase.py from the
already-registered data/moses_aq/hdf5 shards (Zenodo record 22798054). The
underlying molecules, conformers and charges are entirely upstream's; only the
container is ours. MIT, inherited from the corpus.

2. It is not interchangeable with data/moses2/ase-150k. Both are ASE dbs
of "MOSES", which invites exactly the wrong assumption:

data/moses2/ase-150k data/moses_aq/ase
molecules 150,000 1,584,651
corpus MOSES2, DiffSMol's training pool MOSES-aq
conformers upstream MOSES2 xTB, aqueous implicit solvent
per-atom charges none xTB partial charges
size 168 MB 6.18 GiB

The charges are the point. They live in Atoms.initial_charges and are the
channel that makes the corpus "-aq" — ShEPhERD-2 derives its x3 electrostatic
potential from them. A model that wants ESP conditioning cannot get it from
moses2/ase-150k at any size.

3. The row schema is the platform's existing one. Rows are built through
graph3d_import.mol_to_row, so the shape matches data/moses2/ase-150k
exactly, plus the charges:

Atoms -> explicit H, raw uncentered positions, RDKit atom order
         initial_charges = xTB aqueous partial charges   <- the addition
data  -> smiles, bond_index (2,E) int32 upper-triangular,
         bond_type int8 (1=S 2=D 3=T 4=AROM), formal_charge int8,
         source="moses_aq", split="train"

Bonds come from the MOL block rather than being perceived from geometry, so the
bond ground truth is real. Aromatic bonds are stored as class 4 (molecules are
sanitized), matching graph3d_import's documented choice rather than the
kekulized form in the HDF5 source.

Why an ASE db at all, when data/moses_aq/hdf5 already exists

Not for ShEPhERD-2 — that model should keep using the HDF5 shards, which are
5.33 GB against this 6.18 GiB and are what its DataModule already reads. This
exists because an ASE db is the platform's shared representation: it is
what lets the graph3d-family models train on MOSES-aq without each one
reimplementing ShEPhERD-2's HDF5 reader.

Honest caveat: nothing reads it yet

No config in the repo points at this asset today. Shepherd2DataModule accepts
source of "pkl" or "hdf5" only (data/component/shepherd2.py:167), so
wiring source: "ase" would be a follow-up. Registering it now makes the
conversion — 13 minutes of CPU and a 1.1 GB download — something nobody has to
repeat.

Verification

  • 1,584,651 / 1,584,651 molecules converted, zero skips — no parse
    failures, no rejected bond types, no charge/atom-count mismatches.
  • 40 random rows re-checked against the source HDF5: positions exact 40/40,
    charges exact 40/40, canonical SMILES exact 40/40, bond counts 40/40.
  • Equivalence to the existing pkl path, same np.random seed, 8 items:
    x1 (96 tensor comparisons) and x4 (120) are bit-identical. x3
    differs — but the control shows x3 differs pkl-vs-pkl too, because open3d's
    Poisson-disk surface sampler has its own RNG that seeding np.random does
    not reach. So the ASE source is behaviourally indistinguishable.
  • Cost: 0.58 ms/item source access, against 0.93 ms for a random HDF5 read
    and 55.5 ms for one process_item — about 1% of loader time.
  • Corpus statistics: elements exactly {H,C,N,O,S,F,Cl,Br}, all formal charges
    0, max |Σq| = 0.0000.

Reproducing it

MolCraftDiff zoo fetch data/moses_aq/hdf5
python docs/model_integrations/shepherd2/scripts/convert_moses_aq_to_ase.py \
    hdf5 "$(MolCraftDiff zoo path data/moses_aq/hdf5)" moses_aq_train.db

~13 min, 1,980 rows/s. The script self-verifies on completion.

One known gap, not introduced here

Stereochemistry is in the stored smiles and recoverable from the stored
positions, but not from bond_index/bond_type alone — a topology-only
rebuild via build_rdkit_mol returns a flat molecule. That is a property of
the existing row schema, shared with data/moses2/ase-150k, not something this
asset changes.

🤖 Generated with Claude Code

pregH changed pull request status to merged

Sign up or log in to comment