Datasets:
Download scripts/dedup/README.md from SciLM/MaterialsSaddles: direct link, hf CLI and curl.
- Browser
- Download file 4.97 kB
-
https://huggingface.co/datasets/SciLM/MaterialsSaddles/resolve/main/scripts/dedup/README.md
- Command line
-
hf download hf://datasets/SciLM/MaterialsSaddles/scripts/dedup/README.md
-
curl -L -o README.md https://huggingface.co/datasets/SciLM/MaterialsSaddles/resolve/main/scripts/dedup/README.md
How MaterialsSaddles v2 was produced from v1
These are the scripts that were run, with one change. We removed the 2 broken triplets of step 7 in a separate
step after the write. Here, steps 7 to 9 do this removal. The scripts write the same rows and tables as the
release. Absolute paths inside them are those of the original run
(ROOT = the v1 files, OUT = a work directory) and must be adapted. Dependencies: numpy, scipy,
pyarrow, ase, ase_db_backends, lmdb, huggingface_hub; fairchem-core only for one check in
v2_verify.py.
Duplicate detection and split (computed on the v1 files)
dedup_pass1.py— reads every row once. A triplet is the three consecutivems_ids3k, 3k+1, 3k+2(asserted against the storedsidewhere present). Per triplet it stores the reactant, saddle and product positions, atomic numbers, FixAtoms mask and cell, bucketed by a hash of the exact composition, plus the chemical system, reduced formula and upstream source identifier.dedup_pass2.py— within each exact composition (all subsets together), triplets inms_idorder are leader-clustered: a triplet joins the first cluster whose representative has- the same lattice: cell lengths within 2 %, angles within 1°, every cell-matrix entry within 2 % of the longest cell vector;
- a saddle within 0.2 Å max-atom distance;
- reactant and product both within 0.2 Å, in the same or the swapped orientation.
Max-atom distance = largest atomic displacement after per-species Hungarian matching (minimum summed squared distance) under the minimum-image convention, fractional coordinates mapped into the mean cell. The representative of each cluster (its lowest
ms_id) is kept.dedup_pass3.py— drops non-representatives and assigns every chemical system (element set of the cell) as a whole to train / val / test with probabilities 0.90 / 0.05 / 0.05 (numpy.random.default_rng(0)), one draw per chemical system, globally across subsets. Writes the per-splitms_idlists andduplicates.parquet(every triplet → its representative).Audits:
verify_integrity.py(every v1 row:ms_ids are exactly 0..3N−1, the three rows of a triplet share atomic numbers, cell and pbc,side=ms_id % 3 − 1) andverify_dedup.py(an independent distance implementation re-checks removed triplets against their representative, searches kept triplets against all same-composition triplets for missed duplicates, and checks the split files).
Rewrite into the v2 layout (from the SciLM v1 files, which carry energies and forces)
v2_sha.py— checks every downloaded v1 file against the SHA-256 recorded by Hugging Face.v2_index.py— indexes every row of a set of files:ms_id, file, LMDB key, SHA-1 of the stored bytes, and hashes of the geometry and ofdata.info. Run on the v1 files the deduplication was computed from and on the SciLM v1 files;v2_compare.pythen shows both hold the samems_ids with identical geometry andinfo, and that every row has finite energy and forces.v2_write.py— writes<subset>/<split>/<subset>_<split>_<NNNN>.aselmdb, at most 50,000 triplets per file, in ascendingms_idorder. Rows are not re-serialised: the stored (compressed JSON) value of each row is copied unchanged under the new ASE row id, andnextidis written asase_db_backendsdoes.v2_write.pycuts the files on the full split lists. Then it skips the 2 broken triplets (saddlems_id35584423 and 79800988, forces at the saddle above 100 million eV/Å). As a result,lemat_train_0213andlemat_train_0479hold 49,999 triplets each. The other files do not change.v2_verify.py— reads every row of every output file and checks: keys1..N+nextid; complete, adjacent R, S, P triplets in ascendingms_idorder; every stored value byte-identical to the v1 row with the samems_id; files of a split named consecutively, inms_idorder, all but the last full (exceptlemat_train_0213andlemat_train_0479, each one broken triplet short); each split directory holds exactly thems_ids of its split, less the 2 broken triplets; the union is exactly the kept set, less the 2 broken triplets; no removed or broken triplet present. It also compares a random sample of rows read throughase.dbagainst the v1 rows and opens files with fairchem'sAseDBDataset.v2_metadata.py— buildsmetadata/triplets.parquetandmetadata/removed_duplicates.parquetfrom whatv2_verify.pyobserved in the written files (refuses to run if verification failed).removed_duplicates.parquetlists each removed duplicate with its kept triplet (reason=duplicate) and the 2 broken triplets with no kept triplet (reason=broken). A later commit removed 2 triplets whose cell has 1 atom and added them with no kept triplet (reason=one_atom).