A RESTful API service for predicting crystal structures from XRD patterns using CDVAE-XRD model
粉末X射线衍射(PXRD)是材料表征的重要手段。将XRD图谱转换为晶体结构是一个重要但具有挑战性的问题。最近,基于图神经网络的CDVAE-XRD模型展示了从XRD图谱预测晶体结构的可能性。
XRDNet API是一个基于CDVAE-XRD模型的RESTful API服务,提供从XRD图谱到晶体结构的预测功能。
https://api.xrdnet.ouro.foundationPOST /predict/xrd-to-cif
从XRD图谱预测晶体结构
请求参数:
{ "xrd_data": { "two_theta": [10.0, 10.1, 10.2, ...], "intensity": [100, 150, 200, ...], "wavelength": 1.5406 }, "composition": "Fe2O3", "num_candidates": 5, "max_atoms": 100 }
响应:
{ "success": true, "predictions": [ { "rank": 1, "cif": "...", "confidence": 0.92, "space_group": "R-3c", "lattice_params": { "a": 5.038, "b": 5.038, "c": 13.772, "alpha": 90, "beta": 90, "gamma": 120 } } ], "processing_time_ms": 1250 }
POST /predict/cif-to-xrd
从晶体结构生成XRD图谱
请求参数:
{ "cif": "...", "wavelength": 1.5406, "two_theta_range": [5, 90], "step_size": 0.02 }
响应:
{ "success": true, "xrd_pattern": { "two_theta": [5.0, 5.02, 5.04, ...], "intensity": [0, 0, 0, ...] }, "peaks": [ {"two_theta": 33.15, "intensity": 100, "hkl": "104"} ] }
GET /health
健康检查
响应:
{ "status": "healthy", "model_version": "1.0.0", "gpu_available": true }
import requests # 初始化客户端 api_url = "https://api.xrdnet.ouro.foundation" api_key = "your_api_key" # XRD到CIF预测 response = requests.post( f"{api_url}/predict/xrd-to-cif", headers={"Authorization": f"Bearer {api_key}"}, json={ "xrd_data": { "two_theta": two_theta_values, "intensity": intensity_values, "wavelength": 1.5406 }, "composition": "Fe2O3", "num_candidates": 3 } ) predictions = response.json()["predictions"] for pred in predictions: print(f"Rank {pred['rank']}: {pred['space_group']}, Confidence: {pred['confidence']}")
curl -X POST https://api.xrdnet.ouro.foundation/predict/xrd-to-cif \ -H "Authorization: Bearer your_api_key" \ -H "Content-Type: application/json" \ -d '{ "xrd_data": { "two_theta": [10, 20, 30, 40, 50], "intensity": [100, 200, 150, 300, 250] }, "composition": "Fe2O3" }'
基于CDVAE-XRD模型
使用PyTorch和PyTorch Geometric
GPU加速推理
FastAPI高性能异步框架
自动API文档生成
支持批量请求
Docker容器化
Kubernetes集群部署
自动扩缩容
使用ICSD数据库中的已知结构
测试集准确率:85%(Top-5预测包含正确结构)
平均响应时间:<2秒
吞吐量:>100请求/秒
GPU利用率:>80%
快速解析XRD数据
辅助结构鉴定
大规模材料筛选
自动化数据分析
材料科学教学
快速原型开发
GitHub: https://github.com/xrdnet/api
Guo, G., et al. Automated crystal structure extraction from X-ray diffraction patterns using graph neural networks. arXiv:2406.10796 (2024).
Xie, T., & Grossman, J. C. Crystal graph convolutional neural networks for accurate prediction of material properties. Physical Review Letters 120, 145301 (2018).