自动切割表面
进行表面slab模型的搭建需要在晶体conventional cell的基础上,切相应miller指数的晶面,手动切面需要用到Materials studio、p4vasp、VESTA等程序,这些程序难以实现大规模批处理。如果需要批处理表面模型,实现自动化表面切割就很重要了
切割表面要考虑以下几个问题:
表面slab的厚度,真空层的厚度,表面supercell的大小,表面切断的位置(暴露的表面原子),表面的重构。
使用到的模块是
pymatgen.core.surface
,该模块非常智能,这些内容全都可以通过pymatgen程序实现。切割金属表面Au(111)面:
from pymatgen.analysis.adsorption import * from pymatgen.core.surface import Slab, SlabGenerator, generate_all_slabs, Structure, Lattice, ReconstructionGenerator from pymatgen.symmetry.analyzer import SpacegroupAnalyzer from pymatgen.core.structure import Structure from pymatgen.ext.matproj import MPRester from matplotlib import pyplot as plt from pymatgen.io.vasp.inputs import Poscar mpr = MPRester('yourPrivateKey') mp_id = "mp-81" struct = mpr.get_structure_by_material_id(mp_id) #下一步必须确认已经将结构转化为常用晶胞 struct = SpacegroupAnalyzer(struct).get_conventional_standard_structure() slab = SlabGenerator(struct, miller_index=[1, 1, 1], min_slab_size=8.0,\ min_vacuum_size=15.0, center_slab=True) for n, slabs in enumerate(slab.get_slabs()): slabs_bak = slabs.copy() slabs.make_supercell([[2,0,0], [0,2,0], [0,0,1]]) fig = plt.figure() ax = fig.add_subplot(111) plot_slab(slabs, ax, adsorption_sites=True) plt.savefig(str(n) + '-Au-111.png', img_format='png') #以POSCAR格式导出 open('POSCAR' + mp_id + '-' + str(n), 'w').write(str(Poscar(slabs)))
如果想要从cif文件里导入结构,用IStructure.from_file也可以导入structure类的结构。
from pymatgen.core.structure import Structure, IStructure struct = IStructure.from_file("LaSiRu_mp-4579_primitive.cif")
详细如何导入结构文件参见后文Mannul部分。
切割复杂化合物表面,LiFePO4-(001)-Fe-terminal:
对于复杂化合物,切表面时候往往不只一种表面暴露情况,比如LiFePO4,就可以是Li暴露,Fe暴露,P暴露,O暴露的,也可能表面有一些分子钝化表面,比如OH,H集团来饱和表面的原子。
```python from pymatgen.analysis.adsorption import * from pymatgen.core.surface import Slab, SlabGenerator, generate_all_slabs, Structure, Lattice, ReconstructionGenerator from pymatgen.symmetry.analyzer import SpacegroupAnalyzer from pymatgen.core.structure import Structure from pymatgen.ext.matproj import MPRester from matplotlib import pyplot as plt from pymatgen.io.vasp.inputs import Poscar mpr = MPRester('yourPrivateKey')
mp_id = "mp-19017"
struct = mpr.get_structure_by_material_id(mp_id)
struct = SpacegroupAnalyzer(struct).get_conventional_standard_structure()
slab = SlabGenerator(struct, miller_index=[0, 0, 1], min_slab_size=8.0,\
min_vacuum_size=15.0, center_slab=True)
for n, slabs in enumerate(slab.get_slabs(bonds = {('P', 'O'): 3})):
slabs_bak = slabs.copy()
slabs.make_supercell([[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
fig = plt.figure()
ax = fig.add_subplot(111)
plot_slab(slabs, ax, adsorption_sites=True)
plt.savefig(str(n) + '-LiFePO4-001.png', img_format='png')
open('POSCAR' + mp_id + '-' + str(n), 'w').write(str(Poscar(slabs)))
```
其中在`get_slabs()`中,添加了`bonds = {('P', 'O'): 3}`,对于P-O键在3 A以内的键,切表面的时候不允许截断,这在多酸化合物中是个准则。最后得到了两种表面:

第一种是上表面暴露O,下表面暴露Fe;第二种是上下表面都暴露Fe。两种情况体相中PO4都得以保留。