Materials Viewer
Materials Viewer 是一个基于 Python + Tkinter 的图形化工具,用于查询和可视化 Materials Project 数据库中的材料信息。
功能特性
- 根据化学式查询 Materials Project 数据库
- 显示材料信息:ID、空间群(含序号)、能量、形成能、带隙
- 支持带隙范围筛选(如 0.05 - 10 eV)
- 支持空间群筛选(符号或序号,如 P4mm 或 99)
- 支持点击表头排序
- 支持下载 CIF 和 POSCAR 格式
- 支持3D结构可视化(VESTA/ASE)
- 支持批量下载
- API Key 和 VESTA 路径自动保存
- 化学式输入框支持回车键触发查询
安装
使用 pip 安装(推荐)
pip install materials-viewer-mp
从源码安装
git clone https://github.com/haiw201/materials-viewer.git
cd materials-viewer
pip install -e .
使用方法
命令行启动
# 使用简短命令
mv
# 或使用完整命令
materials-viewer
Python 代码中调用
from materials_viewer import MaterialsViewer
import tkinter as tk
root = tk.Tk()
app = MaterialsViewer(root)
root.mainloop()
首次使用配置
-
设置 API Key:点击"🔑 输入API Key"按钮,输入你的 Materials Project API Key
- 获取 API Key:https://materialsproject.org/api
- API Key 会自动加密保存到配置文件
-
设置 VESTA 路径(可选):点击"⚙️ 设置VESTA路径"按钮,选择 VESTA 可执行文件路径
- VESTA 用于3D结构可视化
- 下载地址:https://jp-minerals.org/vesta/en/download.html
使用指南
查询材料
- 在"化学式"输入框中输入化学式(如
BaTiO3、SiO2) - 按 回车键 或点击"🔍 查询"按钮
- 等待查询结果显示
筛选材料
- 带隙筛选:在"带隙范围"输入框中输入最小值和最大值,点击"应用筛选"
- 空间群筛选:在"空间群"输入框中输入空间群符号(如
P4mm)或序号(如99) - 重置筛选:点击"重置"按钮清除所有筛选条件
下载材料
- 单个下载:点击表格中的"C"或"P"按钮下载 CIF 或 POSCAR 文件
- 批量下载:点击"⬇ 下载全部"按钮下载所有查询结果
查看3D结构
双击表格中的任意一行,使用 VESTA 查看3D晶体结构(需要先设置 VESTA 路径)
系统要求
- Python 3.8 或更高版本
- 操作系统:Windows、macOS、Linux
依赖包
- pymatgen >= 2023.0.0
- ase >= 3.22.0
配置文件
配置文件保存在用户主目录下的 .materials_viewer 文件夹中:
config.json:API Key(加密存储)和 VESTA 路径app.log:应用程序日志
常见问题
Q: 查询时提示 API Key 错误?
A: 请确保已正确设置 Materials Project API Key。获取地址:https://materialsproject.org/api
Q: 空间群显示为空?
A: 部分材料的空间群信息可能缺失,程序会显示为 "N/A"。
Q: 如何更新到最新版本?
A: 运行 pip install --upgrade materials-viewer-mp
许可证
本项目采用 MIT 许可证 开源。
贡献
欢迎提交 Issue 和 Pull Request!
联系方式
- 项目主页:https://github.com/haiw201/materials-viewer
- 问题反馈:https://github.com/haiw201/materials-viewer/issues
致谢
- Materials Project 提供材料数据
- pymatgen 提供材料分析工具
- ASE 提供原子模拟环境
Metadata
Release files for materials-viewer-mp 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| materials_viewer_mp-1.0.0.tar.gz | 18.3 kB | Without provenance | Details for materials_viewer_mp-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| materials_viewer_mp-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for materials_viewer_mp-1.0.0-py3-none-any.whl |
Total release size: 34.7 kB
Release files / materials_viewer_mp-1.0.0.tar.gz
| Download URL | materials_viewer_mp-1.0.0.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f8fea064415636eff7f8c573e1d06114271ce2235964006ff3e6af4693bc746
|
|
BLAKE2b-256 checksum How to use checksums |
a18f2590bad91562b2f45452ee01a917c0f09e6a78a10fd3c43bff9116f87c90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / materials_viewer_mp-1.0.0-py3-none-any.whl
| Download URL | materials_viewer_mp-1.0.0-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
240a2c5b4e86927b39bd5371a8b4aa15b6c4f9e9663208423405f464f98ca892
|
|
BLAKE2b-256 checksum How to use checksums |
2f372b1571b419297cd6b1053ff0a5b56e3d2a235568059c14ec37202392e11a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Security for materials-viewer-mp 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.