[ PROMPT_NODE_27130 ]
transformations_workflows
[ SKILL_DOCUMENTATION ]
# Pymatgen 转换与常见工作流
本参考文档记录了 Pymatgen 的转换框架,并提供了常见材料科学工作流的方案。
## 转换框架
转换提供了一种系统化的方式来修改结构,同时跟踪修改历史。
### 标准转换
位于 `pymatgen.transformations.standard_transformations` 中。
#### SupercellTransformation (超胞转换)
使用任意缩放矩阵创建超胞。
python
from pymatgen.transformations.standard_transformations import SupercellTransformation
# 简单的 2x2x2 超胞
trans = SupercellTransformation([[2,0,0], [0,2,0], [0,0,2]])
new_struct = trans.apply_transformation(struct)
# 非正交超胞
trans = SupercellTransformation([[2,1,0], [0,2,0], [0,0,2]])
new_struct = trans.apply_transformation(struct)
#### SubstitutionTransformation (取代转换)
替换结构中的物种。
python
from pymatgen.transformations.standard_transformations import SubstitutionTransformation
# 将所有 Fe 替换为 Mn
trans = SubstitutionTransformation({"Fe": "Mn"})
new_struct = trans.apply_transformation(struct)
# 部分取代 (50% Fe -> Mn)
trans = SubstitutionTransformation({"Fe": {"Mn": 0.5, "Fe": 0.5}})
new_struct = trans.apply_transformation(struct)
#### RemoveSpeciesTransformation (移除物种转换)
从结构中移除特定物种。
python
from pymatgen.transformations.standard_transformations import RemoveSpeciesTransformation
trans = RemoveSpeciesTransformation(["H"]) # 移除所有氢
new_struct = trans.apply_transformation(struct)
#### OrderDisorderedStructureTransformation (有序化转换)
对具有部分占位情况的无序结构进行有序化。
python
from pymatgen.transformations.standard_transformations import OrderDisorderedStructureTransformation
trans = OrderDisorderedStructureTransformation()
new_struct = trans.apply_transformation(disordered_struct)
#### PrimitiveCellTransformation (原胞转换)
转换为原胞。
python
from pymatgen.transformations.standard_transformations import PrimitiveCellTransformation
trans = PrimitiveCellTransformation()
primitive_struct = trans.apply_transformation(struct)
#### ConventionalCellTransformation (惯用胞转换)
转换为惯用胞。
python
from pymatgen.transformations.standard_transformations import ConventionalCellTransformation
trans = ConventionalCellTransformation()
conventional_struct = trans.apply_transformation(struct)
#### RotationTransformation (旋转转换)
旋转结构