# MANDALA: datasets and trained models

This record holds the electronic-structure datasets used to train and evaluate
the three numerical examples of the MANDALA paper, and the trained models
reported there. Code: https://github.com/Mandala-org/Mandala

## Contents

| File(s) | What |
|---|---|
| `Silicon_hsd_best_model.pt` | Silicon model (Hamiltonian, overlap, density) |
| `SiO2_hamiltonian_best_model.pt` | SiO2 glass Hamiltonian model |
| `ZnCu2Sn_SeS_2_hamiltonian_best_model.pt` | ZnCu2Sn(SeS)2 Hamiltonian model |
| `Silicon_hsd_retrained_best_model.pt` | Silicon model, retrained with the current code (see Models) |
| `SiO2_hamiltonian_retrained_best_model.pt` | SiO2 glass Hamiltonian model, retrained with the current code |
| `ZnCu2Sn_SeS_2_hamiltonian_retrained_best_model.pt` | ZnCu2Sn(SeS)2 Hamiltonian model, retrained with the current code |
| `silicon_perturbed_part01of01.tar.zst` | 100 perturbed 8-atom diamond silicon cells |
| `zncu2sn_ses2_part01of03.tar.zst` … `part03of03` | 100 perturbed 32-atom ZnCu2Sn(SeS)2 cells |
| `sio2_glass_part01of03.tar.zst` … `part03of03` | 165 MD-generated 150-atom amorphous SiO2 configurations |
| `<dataset>_manifest.json` | Shard layout and checksums for each dataset |

All reference calculations used OpenMX 3.9 with the PBE functional,
norm-conserving PBE19 pseudopotentials, scalar non-spin-polarized settings and
a 1e-8 Hartree SCF convergence threshold. The paper lists the per-material
basis sets and k-point meshes.

## Models

The three model files without `retrained` in their name are the models reported in the paper. They
were trained with an earlier version of the FiLM conditioning layer, which is
equivariant under rotations but not exactly under inversion. Load them with
the FiLM semantics `legacy_2026_07` to reproduce the published predictions,
for example with
`scripts/report/evaluate_validation_error_distribution.py --film-semantics legacy_2026_07`.

The three `*_retrained_best_model.pt` files were trained from scratch with the
v2 recipes (`scripts/reproduce_examples/<material>_v2.json`) and the corrected,
E(3)-equivariant FiLM layer. They load with the default settings of the
current code. Their splits hold out a test set that was not used for training
or model selection (`scripts/reproduce_examples/<material>_v2_split.json`).
Hamiltonian MAE on these test structures, published model / retrained model:

| Material | Test structures | Published | Retrained |
|---|---:|---:|---:|
| Silicon | 6 | 0.434 meV | 0.071 meV |
| SiO2 | 10 | 2.00 meV | 2.19 meV |
| ZnCu2Sn(SeS)2 | 10 | 3.04 meV | 3.00 meV |

For the published models, these test structures were part of the validation set.

## Shard layout

Each dataset is split into one or more shards. A shard is a tar archive
compressed with zstd, at most 16 GB, holding whole structure directories (no
structure is split across shards). Shard boundaries carry no meaning: they
are not the train/validation split.

| Shard | Structures |
|---|---|
| `silicon_perturbed_part01of01` | `Si_scale_1_001` … `Si_scale_1_100` (100) |
| `zncu2sn_ses2_part01of03` | `ZnCu2Sn_SeS_2_scale_1_001` … `_041` (41) |
| `zncu2sn_ses2_part02of03` | `ZnCu2Sn_SeS_2_scale_1_042` … `_082` (41) |
| `zncu2sn_ses2_part03of03` | `ZnCu2Sn_SeS_2_scale_1_083` … `_100` (18) |
| `sio2_glass_part01of03` … `part03of03` | 57 + 57 + 51 directories, named `<run>_<MD step>` |

The `<dataset>_manifest.json` file gives the full list of structures in every
shard, plus each shard's size, md5 and sha256. The source directory and
excluded patterns are recorded there too.

Each structure directory contains the OpenMX input (`*.dat` / `conf.dat`),
the OpenMX output (`*.out`, `log.out`), structure files (`*.cif`, `*.xyz`),
and `HS.out`, a text dump of the Hamiltonian, overlap and density matrix
blocks that the MANDALA loader reads. Restart directories, SCF binary
files (`*.scfout`, whose content `HS.out` already holds), scheduler logs and
preprocessing caches are not included.

## Unpacking

Check the downloads, then unpack each shard into the directory layout the
MANDALA recipes expect:

```bash
sha256sum *.tar.zst    # compare with the manifests

mkdir -p data/perturbed_snapshots_Si/scale_1 data/ZnCuSnSeS/scale_1 data/SiOx_new
zstd -dc silicon_perturbed_part01of01.tar.zst | tar -x -C data/perturbed_snapshots_Si/scale_1
for f in zncu2sn_ses2_part*.tar.zst; do zstd -dc "$f" | tar -x -C data/ZnCuSnSeS/scale_1; done
for f in sio2_glass_part*.tar.zst;   do zstd -dc "$f" | tar -x -C data/SiOx_new; done
```

The silicon and ZnCu2Sn(SeS)2 shards must go into a `scale_1` subdirectory,
because the recipes select scale 1 of these datasets. Then set `data_path` in
the recipes under `scripts/reproduce_examples/` in the code repository to
`data/perturbed_snapshots_Si`, `data/ZnCuSnSeS` and `data/SiOx_new`. Unpacked,
the data take about 3.6 GB (Si), 125 GB (ZnCu2Sn(SeS)2) and 155 GB (SiO2).

The SiO2 dataset contains all 165 configurations. The paper's runs used 100 of
them, chosen by the deterministic split procedure in the code.
