Find T_min and F_max in selective dynamics of POSCAR

#! /share/apps/anaconda3/bin/python
# to find maximal "F" and minimum "T"in VASP's POSCAR Selective Dynamics
# Attention:only suitable for all "T" (T T T) and all "F" (F F F)

with open('POSCAR')as pos:
    lines = pos.readlines()
    poss = []   #total file,saved as list
    atoms = []  #to calculate total atoms
    coor = []   #to save atom coordinate
    total = 0   #total atoms
    F_max = 0 
    T_min = 1
    for i in lines:
      poss.append(i.rstrip())
    tem=poss[6]
    atoms=tem.split()
    for k in atoms:
       total = total + int(k)
    for j in poss[9:(9+total)]:
      coor=j.split()
      z=coor[2]
      z=float(z.rstrip())
      tf=coor[3]
      if tf=='T':
        if z < T_min:
          T_min = z
      if tf=='F':
        if z > F_max:
          F_max = z
    print'T_min is', T_min
    print'F_max is', F_max 

vasp计算中POSCAR根据原子z轴坐标的值控制其原子的固定与否("T T T" or "F F F")

此脚本得到固定原子的z坐标的最大值、非固定原子的z坐标的最小值,即用于获取qvasp处理后得到 “qvasp -fix  ? ” 的?值区间

特别鸣谢:Dr. Wencai Yi , qvasp

posted @ 2021-07-08 21:00  BangBro  阅读(142)  评论(0编辑  收藏  举报