You need to agree to share your Hugging Face information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

Diffra XRD

Diffra XRD 包含 100,315 个晶体结构和 10,031,500 条模拟粉末 XRD。 每个晶体对应 100 条随机模拟谱,simulation ID 为 0–99。 晶体结构来自 Materials Project,模拟使用 SimXRD / Pysimxrd 与 pymatgen。

数据规模

项目 数值
晶体结构数 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 递增。

文件结构

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,0≤v<100. r=100i+v,\qquad 0\leq v<100.

样本名称为 {sample_id_prefix}__sim-{simulation_id:02d},例如 mp-1001824__sim-00。角度网格为

2θj=10+80j3499,j=0,…,3499. 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×1000003+101×entry_id+simulation_id)  232. 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

下载与读取

完整下载:

hf download Licht0812/Diffra --repo-type dataset --local-dir ./Diffra-XRD

读取第一个晶体的 100 条谱:

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)

读取对应晶体结构:

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 读取。

Downloads last month
202