检测VASP的执行结果(Python脚本实现-check_output.py)
代码描述
- 找出设定地址下的所有output/slurm文件,注slurm文件以其后数字中最大的为准。
- 输出文件的最后几行
对文件的要求
实现过程
使用方法
修改文件中os.walk()中的地址即可
import os,subprocess
def command_inout(command):
open_processer=subprocess.Popen(command,shell=True,stdout=subprocess.PIPE)
out=open_processer.stdout.read().decode()
open_processer.stdout.close()
return out
for a,b,c in os.walk("/public3/home/sc52397/work/makaichuang/doped_with_Al_and_In/simulation"):
max=0
for x in c :
if x=="output":
command="cd "+a+";"+"tail "+x
print(command)
print(command_inout(command))
continue
if x[:4]=="slur":
if max<eval(x[6:12]):
max=eval(x[6:12])
xx=x
try:
command="cd "+a+";"+"tail "+xx
except:
continue
if xx=="null":
continue
xx="null"
print(command)
print(command_inout(command))