|
Download README.md from Licht0812/Diffra: direct link, hf CLI and curl.
- Browser
- Download file 5.06 kB
-
https://huggingface.co/datasets/Licht0812/Diffra/resolve/main/README.md
- Command line
-
hf download hf://datasets/Licht0812/Diffra/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/datasets/Licht0812/Diffra/resolve/main/README.md
5.06 kB
| pretty_name: Diffra XRD | |
| language: | |
| - zh | |
| tags: | |
| - materials-science | |
| size_categories: | |
| - 10M<n<100M | |
| # Diffra XRD | |
| Diffra XRD 包含 **100,315 个晶体结构和 10,031,500 条模拟粉末 XRD**。 | |
| 每个晶体对应 100 条随机模拟谱,simulation ID 为 0–99。 | |
| 晶体结构来自 [Materials Project](https://materialsproject.org/),模拟使用 | |
| [SimXRD / Pysimxrd](https://github.com/Bin-Cao/SimXRD) 与 pymatgen。 | |
| - 预训练模型:[Licht0812/Diffra](https://huggingface.co/Licht0812/Diffra) | |
| - 代码与方法:[Bin-Cao/Diffra](https://github.com/Bin-Cao/Diffra) | |
| - 模拟实现:[codebook/src/xrd_data.py](https://github.com/Bin-Cao/Diffra/blob/main/codebook/src/xrd_data.py) | |
| ## 数据规模 | |
| | 项目 | 数值 | | |
| |---|---:| | |
| | 晶体结构数 | 100,315 | | |
| | 每晶体模拟谱数 | 100 | | |
| | XRD 总数 | 10,031,500 | | |
| | 每条谱的强度点数 | 3,500 | | |
| | 数据类型 | float32 | | |
| | 衍射角范围 | 2θ = 10–90°,含两端点 | | |
| | 强度范围 | 0–100,每条谱最大值为 100 | | |
| | XRD 分片总大小 | 140.441 GB | | |
| | NumPy 分片数 | 1,004 | | |
| 每个完整分片包含 100 个晶体、10,000 条谱;最后一个分片包含 15 个晶体、1,500 条谱。 | |
| 谱按晶体索引排列,同一晶体内按 simulation ID 递增。 | |
| ## 文件结构 | |
| ```text | |
| Diffra/ | |
| ├── README.md | |
| ├── manifest.json | |
| ├── structures.jsonl | |
| ├── splits.json | |
| ├── MP500.db | |
| ├── data/ | |
| │ ├── shard-000000.npy | |
| │ ├── ... | |
| │ └── shard-001003.npy | |
| └── cif_descriptor/ | |
| ├── descriptor.npz | |
| └── manifest.json | |
| ``` | |
| `manifest.json` 记录角度范围、样本数量、模拟参数和各分片的全局起始行。 | |
| `structures.jsonl` 的每行对应一个晶体,字段为 `structure_index`、`entry_id`、 | |
| `unique_id`、`label`、`mpid` 和 `sample_id_prefix`。`entry_id` 对应 ASE 数据库 | |
| `MP500.db` 中的行 ID。数据库保存元素、原子坐标、晶胞和周期性边界条件。 | |
| 晶体索引 $i$ 与 simulation ID $v$ 对应的全局 XRD 行号为 | |
| $$ | |
| r=100i+v,\qquad 0\leq v<100. | |
| $$ | |
| 样本名称为 `{sample_id_prefix}__sim-{simulation_id:02d}`,例如 | |
| `mp-1001824__sim-00`。角度网格为 | |
| $$ | |
| 2\theta_j=10+\frac{80j}{3499},\qquad j=0,\ldots,3499. | |
| $$ | |
| ## 模拟设置 | |
| 使用 Cu Kα 辐射,波长 1.54184 Å。晶体转为常规晶胞后,pymatgen 计算峰位和 | |
| 基础强度,再加入晶粒尺寸、织构、热振动、仪器几何、背景和噪声变化。 | |
| 峰形计算采用 0.02° 网格,随后线性插值至 3,500 点。 | |
| | 随机参数 | 均匀采样范围 | | |
| |---|---| | |
| | 晶粒尺寸 | 10–100 Å | | |
| | 织构参数 `prefect_orientation` | −0.3–0.3 | | |
| | 热振动参数 | 0–2 Å | | |
| | 探测器到样品距离 | 300–600 mm | | |
| | 探测器狭缝半高 | 3–8 mm | | |
| | 样品半高 | 1–4 mm | | |
| | 背景比例 | 0.02–0.20 | | |
| | 噪声比例 | 0.01–0.10 | | |
| 背景为六阶随机多项式。全局 seed 为 42,每条谱的随机种子由 `entry_id` 和 | |
| `simulation_id` 确定: | |
| $$ | |
| s=(42\times1000003+101\times\mathrm{entry\_id}+\mathrm{simulation\_id})\bmod2^{32}. | |
| $$ | |
| ## 晶体级划分 | |
| `splits.json` 保存与 Foundation 和 CIF probe 相同的晶体级划分,采用 | |
| `torch.randperm(100315, generator=torch.Generator().manual_seed(42))`。 | |
| 同一晶体的 100 条谱归属同一个 split。JSON 中的索引对应 `structure_index`。 | |
| | Split | 晶体数 | XRD 数 | | |
| |---|---:|---:| | |
| | train | 90,283 | 9,028,300 | | |
| | validation | 5,015 | 501,500 | | |
| | test | 5,017 | 501,700 | | |
| ## CIF descriptor | |
| `cif_descriptor/descriptor.npz` 通过 `entry_id` 与晶体及 XRD 配对。 | |
| | 字段 | 形状 | 含义 | | |
| |---|---|---| | |
| | `entry_id` | `[100315]` | ASE 数据库行 ID | | |
| | `mpid` | `[100315]` | Materials Project 材料标识 | | |
| | `cell` | `[100315, 8]` | primitive Niggli cell 的 log 长度、cos 夹角、log 原子体积、log1p 原子数 | | |
| | `pair_hist` | `[100315, 64]` | 0–10 Å 周期性原子对距离分布,每原子归一化 | | |
| | `crystal_system` | `[100315]` | 7 类晶系,编号 0–6 | | |
| | `space_group` | `[100315]` | 国际空间群编号 1–230 | | |
| | `bravais_lattice` | `[100315]` | 14 类 Bravais lattice,类别顺序见 descriptor manifest | | |
| ## 下载与读取 | |
| 完整下载: | |
| ```bash | |
| hf download Licht0812/Diffra --repo-type dataset --local-dir ./Diffra-XRD | |
| ``` | |
| 读取第一个晶体的 100 条谱: | |
| ```python | |
| import numpy as np | |
| from huggingface_hub import hf_hub_download | |
| path = hf_hub_download( | |
| repo_id="Licht0812/Diffra", | |
| repo_type="dataset", | |
| filename="data/shard-000000.npy", | |
| ) | |
| spectra = np.load(path, mmap_mode="r").reshape(-1, 100, 3500) | |
| xrd = spectra[0] # [100, 3500] | |
| angles = np.linspace(10.0, 90.0, 3500) | |
| ``` | |
| 读取对应晶体结构: | |
| ```python | |
| from ase.db import connect | |
| from huggingface_hub import hf_hub_download | |
| path = hf_hub_download("Licht0812/Diffra", "MP500.db", repo_type="dataset") | |
| with connect(path) as db: | |
| atoms = db.get_atoms(id=1) | |
| ``` | |
| 该分片格式可直接由 Diffra 的 `foundation.src.data.StoredXRDDataset` 和 | |
| `codebook.src.xrd_data.StoredXRDDataset` 读取。 | |