|
本帖最后由 huangxl 于 2023-2-26 02:33 编辑
ABACUS中建议真空层设在x或y方向,平常我们一般通过MS等建立的真空层沿着z方向,我通过一段Mathematica代码可以把POSCAR中的真空层由z方向改为x或y方向。
- poscar = Import[NotebookDirectory[]<>"POSCAR-Fractional","Table"];
- RM=RotationMatrix[(2\[Pi])/3,{1,1,1}];(*将{x,y,z}变换到{z,x,y}的变换矩阵*)
- {poscar[[3]],poscar[[4]],poscar[[5]]}={RM . poscar[[5]],RM . poscar[[3]],RM . poscar[[4]]}(*{a,b,c}轮换*)
- atomnum=Total[poscar[[7]]];
- Table[poscar[[i]]=RM . poscar[[i]],{i,9,8+atomnum}];(*以{a,b,c}为基的分数坐标轮换*)
- Export[NotebookDirectory[]<>"POSCAR-NEW.dat",poscar]
复制代码 代码中需要导入分数坐标形式的POSCAR文件,我这里导入的文件为POSCAR-Fractional,然后变换之后导出为POSCAR-NEW.dat。将.dat变为.vasp可以用VESTA可视化查看结构。
变换前后展示:
POSCAR-Fractional
- TaAs
- 1.0
- 3.4658000469 0.0000000000 0.0000000000
- 0.0000000000 3.4658000469 0.0000000000
- 0.0000000000 0.0000000000 95.2611999512
- Ta As
- 28 28
- Direct
- 0.000000000 0.000000000 0.184029995
- -0.000000000 -0.000000000 0.307350003
- 0.000000000 0.000000000 0.430670012
- -0.000000000 -0.000000000 0.553980009
- 0.000000000 0.000000000 0.677299978
- -0.000000000 -0.000000000 0.800619987
- -0.000000000 -0.000000000 0.923939995
- 0.500000000 0.500000000 0.122370000
- 0.500000000 0.500000000 0.245689999
- 0.500000000 0.500000000 0.369010008
- 0.500000000 0.500000000 0.492330016
- 0.500000000 0.500000000 0.615639974
- 0.500000000 0.500000000 0.738960022
- 0.500000000 0.500000000 0.862280031
- -0.000000000 0.500000000 0.091539998
- 0.000000000 0.500000000 0.214860017
- -0.000000000 0.500000000 0.338180025
- -0.000000000 0.500000000 0.461499994
- -0.000000000 0.500000000 0.584810032
- 0.000000000 0.500000000 0.708130000
- -0.000000000 0.500000000 0.831450009
- 0.500000000 -0.000000000 0.153200003
- 0.500000000 -0.000000000 0.276520021
- 0.500000000 0.000000000 0.399839990
- 0.500000000 0.000000000 0.523150027
- 0.500000000 -0.000000000 0.646469996
- 0.500000000 0.000000000 0.769789964
- 0.500000000 -0.000000000 0.893109973
- -0.000000000 -0.000000000 0.112230005
- -0.000000000 -0.000000000 0.235550004
- 0.000000000 0.000000000 0.358869992
- -0.000000000 -0.000000000 0.482179990
- -0.000000000 -0.000000000 0.605499999
- 0.000000000 0.000000000 0.728820007
- 0.000000000 0.000000000 0.852140016
- 0.500000000 0.500000000 0.173890000
- 0.500000000 0.500000000 0.297210008
- 0.500000000 0.500000000 0.420520026
- 0.500000000 0.500000000 0.543839994
- 0.500000000 0.500000000 0.667159963
- 0.500000000 0.500000000 0.790480052
- 0.500000000 0.500000000 0.913799980
- -0.000000000 0.500000000 0.143059997
- 0.000000000 0.500000000 0.266380006
- 0.000000000 0.500000000 0.389690003
- 0.000000000 0.500000000 0.513010012
- -0.000000000 0.500000000 0.636330021
- 0.000000000 0.500000000 0.759650029
- 0.000000000 0.500000000 0.882969958
- 0.500000000 -0.000000000 0.081399998
- 0.500000000 0.000000000 0.204720002
- 0.500000000 -0.000000000 0.328040010
- 0.500000000 -0.000000000 0.451350008
- 0.500000000 -0.000000000 0.574670016
- 0.500000000 0.000000000 0.697989985
- 0.500000000 -0.000000000 0.821309994
复制代码
POSCAR-NEW.vasp
- TaAs
- 1.
- 95.2611999512 0. 0.
- 0. 3.4658000469 0.
- 0. 0. 3.4658000469
- Ta As
- 28 28
- Direct
- 0.184029995 0. 0.
- 0.307350003 0. 0.
- 0.430670012 0. 0.
- 0.553980009 0. 0.
- 0.677299978 0. 0.
- 0.800619987 0. 0.
- 0.923939995 0. 0.
- 0.12237 0.5 0.5
- 0.245689999 0.5 0.5
- 0.369010008 0.5 0.5
- 0.492330016 0.5 0.5
- 0.615639974 0.5 0.5
- 0.738960022 0.5 0.5
- 0.862280031 0.5 0.5
- 0.091539998 0. 0.5
- 0.214860017 0. 0.5
- 0.338180025 0. 0.5
- 0.461499994 0. 0.5
- 0.584810032 0. 0.5
- 0.70813 0. 0.5
- 0.831450009 0. 0.5
- 0.153200003 0.5 0.
- 0.276520021 0.5 0.
- 0.39983999 0.5 0.
- 0.523150027 0.5 0.
- 0.646469996 0.5 0.
- 0.769789964 0.5 0.
- 0.893109973 0.5 0.
- 0.112230005 0. 0.
- 0.235550004 0. 0.
- 0.358869992 0. 0.
- 0.48217999 0. 0.
- 0.605499999 0. 0.
- 0.728820007 0. 0.
- 0.852140016 0. 0.
- 0.17389 0.5 0.5
- 0.297210008 0.5 0.5
- 0.420520026 0.5 0.5
- 0.543839994 0.5 0.5
- 0.667159963 0.5 0.5
- 0.790480052 0.5 0.5
- 0.91379998 0.5 0.5
- 0.143059997 0. 0.5
- 0.266380006 0. 0.5
- 0.389690003 0. 0.5
- 0.513010012 0. 0.5
- 0.636330021 0. 0.5
- 0.759650029 0. 0.5
- 0.882969958 0. 0.5
- 0.081399998 0.5 0.
- 0.204720002 0.5 0.
- 0.32804001 0.5 0.
- 0.451350008 0.5 0.
- 0.574670016 0.5 0.
- 0.697989985 0.5 0.
- 0.821309994 0.5 0.
复制代码
|
|