Ty-Perez commited on
Commit
517e3ce
·
verified ·
1 Parent(s): 54eed37

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +132 -0
README.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPICE (v1.1.4 `SPICE1` & v2.0.1 `SPICE2`)
2
+
3
+ ## Overview
4
+ SPICE (Small-molecule/Protein Interaction Chemical Energies) is a quantum-chemistry dataset
5
+ of **single-point calculations** (ωB97M-D3(BJ)/def2-TZVPPD, Psi4) over many **conformations**
6
+ of small molecules, dimers, ion pairs, and solvated amino acids / dipeptides, built for
7
+ training machine-learned force fields. It is a **molecular** (non-periodic) **conformer-ensemble**
8
+ dataset — stored the GEOM way, one conformer stack per molecule — carrying per-atom **forces**
9
+ and per-conformer **energies**. Two versions ship as two datasets with one shared loader:
10
+ - **`SPICE1`** — v**1.1.4**: 19,238 molecules / 1,110,165 conformations, **15 elements**
11
+ (matches the *Scientific Data* paper).
12
+ - **`SPICE2`** — v**2.0.1**: 113,985 molecules / 2,008,126 conformations, **17 elements**
13
+ (adds **B, Si**; new PubChem sets, an Amino-Acid–Ligand set, solvated PubChem, water clusters).
14
+
15
+ SPICE 2.0 is *not* a strict superset of a stable v1; use `SPICE1` to reproduce the paper.
16
+
17
+ ## Statistics
18
+ <!-- from spice1_stats.json / spice2_stats.json (atom/conformer ranges + element set exact; distributions from an 8,000-molecule sample) -->
19
+
20
+ | property | SPICE1 (v1.1.4) | SPICE2 (v2.0.1) |
21
+ |---|---|---|
22
+ | molecules / conformations | 19,238 / 1,110,165 | 113,985 / 2,008,126 |
23
+ | atoms per molecule (min / mean / max) | 2 / 33.4 / 96 | 2 / 49.5 / 110 |
24
+ | conformers per molecule (min / mean / max) | 1 / 57.7 / 4,869 | 1 / 17.6 / 4,869 |
25
+ | distinct elements | 15 | 17 |
26
+ | element set | H, Li, C, N, O, F, Na, Mg, P, S, Cl, K, Ca, Br, I | + B, Si |
27
+ | per-atom force magnitude, eV/Å (sampled min/mean/max) | 0.003 / 1.45 / 65.3 | 0.003 / 0.82 / 51.6 |
28
+ | subset groups (`subset=`) | 6 (des370k, des_monomers, dipeptides, ion_pairs, pubchem, solvated_amino_acids) | 10 (+ amino_acid_ligand, pubchem_boron_silicon, solvated_pubchem, water_clusters) |
29
+
30
+ Distributions in the figures (`spice1_histogram.png` / `spice2_histogram.png`) are from a random
31
+ sample of 8,000 molecules (one random conformer each); atom/conformer ranges and the element set
32
+ are exact. `energy` (`y`) is the **total** DFT energy, so its magnitude scales with molecule size
33
+ (per-conformer *relative* energies are the useful signal). SPICE2 excludes 1 molecule that has zero
34
+ conformations in the release.
35
+
36
+ ## Usage / loading
37
+ ```python
38
+ from StructureCloud.Datasets import SPICE1, SPICE2 # SPICE2 has the identical interface
39
+ from StructureCloud.Datasets import sample_by_relative, sample_by_boltzmann
40
+
41
+ ds = SPICE1() # sample=True: one RANDOM conformer per molecule, eV units
42
+ d = ds[0] # torch_geometric.data.Data
43
+ # d.pos [N,3] Å, d.z [N], d.forces [N,3] eV/Å, d.energy () eV, d.y = energy,
44
+ # d.formation_energy () eV, d.smiles str, d.subset str
45
+
46
+ SPICE1(sample=False) # flatten: every (molecule, conformer) pair
47
+ SPICE1(sample_fn=sample_by_relative('energy', 0.0)) # lowest-energy conformer per molecule
48
+ SPICE1(sample_fn=sample_by_boltzmann(T=500)) # thermally-weighted conformer
49
+ SPICE1(subset='pubchem') # one subset group (see ds.available_subsets)
50
+ SPICE1(units='raw') # native bohr / hartree / hartree·bohr⁻¹
51
+ SPICE1(extra_fields=['mbis_charges']) # attach extra fields (lazily downloaded)
52
+ SPICE2(subset='pubchem_boron_silicon') # SPICE2-only B/Si subset
53
+ ```
54
+
55
+ **Sampling** (one conformer returned per access): `sample=True` (default) random conformer per
56
+ molecule (`len` = #molecules); `sample=False` flatten to every (molecule, conformer) pair
57
+ (`len` = #conformations); `sample_fn=…` a custom sampler over a molecule's conformer stack — use
58
+ the shared `sample_by_relative(key='energy'|'force'|'formation_energy'|'index', frac, window)` and
59
+ `sample_by_boltzmann(T)`. `subset=<id>` restricts to one subset group *before* sampling. Loading is
60
+ memory-mapped (`mmap=True` default; `mmap=False` loads into RAM).
61
+
62
+ **Units** (`units=`): `'eV'` (default) — `pos` Å, `energy`/`formation_energy` eV, `forces` eV/Å;
63
+ `'raw'` — native bohr / hartree / hartree·bohr⁻¹. Conversion factors: bohr→Å ×0.52917721,
64
+ hartree→eV ×27.211386, hartree/bohr→eV/Å ×51.42208. Extra multipole/bond fields are **always** in
65
+ atomic units.
66
+
67
+ ### Fields on a returned sample
68
+ Default (always present): `pos`, `z`, `forces`, `energy`, `formation_energy`, `y` (=`energy`),
69
+ `smiles`, `subset` (raw subset name). Extra (only via `extra_fields=[…]`, lazily downloaded, always
70
+ atomic units):
71
+
72
+ | field | shape | what | group file |
73
+ |---|---|---|---|
74
+ | `mbis_charges` | (N, 1) | per-atom MBIS partial charge (e) | `_charges` |
75
+ | `mbis_dipoles` | (N, 3) | per-atom MBIS dipole | `_multipoles` |
76
+ | `mbis_quadrupoles` | (N, 3, 3) | per-atom MBIS quadrupole | `_multipoles` |
77
+ | `mbis_octupoles` | (N, 3, 3, 3) | per-atom MBIS octupole | `_multipoles` |
78
+ | `scf_dipole` | (3,) | whole-molecule SCF dipole | `_multipoles` |
79
+ | `scf_quadrupole` | (3, 3) | whole-molecule SCF quadrupole | `_multipoles` |
80
+ | `mayer_indices` | (N, N) | Mayer bond-order matrix | `_bonds` |
81
+ | `wiberg_lowdin_indices` | (N, N) | Wiberg–Löwdin bond-order matrix | `_bonds` |
82
+
83
+ The 4 `mbis_*` fields are **missing for 121 molecules** (both versions) → NaN there.
84
+
85
+ ## Preprocessed (collated) format
86
+ Ships as a memory-mappable **main** file plus three **grouped, lazily-downloaded** extras files.
87
+ `num_structures` counts **molecules**. Everything is stored in **raw atomic units** (the loader
88
+ converts on access). Offset tables: `mol_pos_ptr` (per-atom-conformer rows for `pos`/`forces`/MBIS
89
+ per-atom fields), `z_ptr` (one `z` per molecule), `conf_ptr` (per-conformer scalars: `energy`,
90
+ `formation_energy`, `scf_*`), `bond_ptr` (per-conformer N×N bond matrices).
91
+ - `preprocessed/all.pt` — `pos`, `forces`, `z`, `energy`, `formation_energy`, offset tables,
92
+ `n_atoms`/`n_conf`, `subset_code` + packed `subset_vocab`, packed `smiles`, raw-unit strings.
93
+ - `preprocessed/all_charges.pt` — `mbis_charges` (tiny).
94
+ - `preprocessed/all_multipoles.pt` — MBIS dipoles/quadrupoles/octupoles + SCF dipole/quadrupole.
95
+ - `preprocessed/all_bonds.pt` — `mayer_indices`, `wiberg_lowdin_indices` (large; fetched only when a
96
+ `_bonds`-group field is requested).
97
+
98
+ ## Labels
99
+ - `energy` (returned as `y`) — total DFT energy, per conformer, **eV** (raw hartree).
100
+ - `formation_energy` — formation energy relative to atomic references, per conformer, **eV**.
101
+ - `forces` — per-atom, `[N,3]`, **eV/Å** (= −`dft_total_gradient`).
102
+ - MBIS/SCF multipoles and bond-order matrices — extra fields (see table), atomic units.
103
+
104
+ ## Splits
105
+ One physical split `'all'` (one file per repo). Subsets are **not** splits — select one with the
106
+ `subset=<id>` argument (`ds.available_subsets`). The `subset` attribute on each sample is the raw
107
+ SPICE subset name. Groups: **SPICE1** — des370k, des_monomers, dipeptides, ion_pairs, pubchem,
108
+ solvated_amino_acids (6). **SPICE2** — those + amino_acid_ligand, pubchem_boron_silicon,
109
+ solvated_pubchem, water_clusters (10). PubChem "Set N" shards are merged into `pubchem`.
110
+
111
+ ## Preprocessing & cleaning
112
+ - All fields from the source HDF5 are preserved (common ones in the main file, the rest in the three
113
+ grouped extras files). Conformer stacks are kept per molecule (not flattened) so all sampling
114
+ modes are available. `forces = −dft_total_gradient`.
115
+ - Stored in raw units (bohr / hartree / hartree·bohr⁻¹); the loader converts to eV/Å by default.
116
+ `energy`/`formation_energy` are stored float64 to preserve conformer-energy precision.
117
+ - **121 molecules lack the 4 `mbis_*` multipole fields** (both versions); their `mbis_*` extras are NaN.
118
+ - **SPICE2 only:** 1 molecule with **zero conformations** in the release is dropped (113,986 → 113,985).
119
+
120
+ ## Data distribution
121
+ SPICE1:
122
+ ![SPICE1 atom / bounding-box / element / force / energy distributions](./spice1_histogram.png)
123
+ SPICE2:
124
+ ![SPICE2 atom / bounding-box / element / force / energy distributions](./spice2_histogram.png)
125
+
126
+ ## Sources & citation
127
+ - SPICE 1.1.4: Zenodo DOI [10.5281/zenodo.8222043](https://doi.org/10.5281/zenodo.8222043).
128
+ SPICE 2.0.1: Zenodo DOI [10.5281/zenodo.10975225](https://doi.org/10.5281/zenodo.10975225).
129
+ Repo: <https://github.com/openmm/spice-dataset>. CC-BY-4.0.
130
+ - Eastman et al., *SPICE, A Dataset of Drug-like Molecules and Peptides for Training Machine
131
+ Learning Potentials*, Sci. Data 10, 11 (2023). DOI 10.1038/s41597-022-01882-6. arXiv:2209.10702.
132
+ - Eastman et al., *Nutmeg and SPICE: Models and Data for Biomolecular Machine Learning* (SPICE 2), 2024.