1 Star 0 Fork 2

shenzx/AbacusHighThroughput

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
getRes.py 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
shenzx 提交于 2021-01-06 12:26 . add getRes.py
#!~/software/anaconda3/bin/python
import os
STRUPATH='$YourPath/InputPoscar/'
with open('results.dat', 'w') as f:
f.write('{0:<25s} {1:<25s} {2:<25s}\n'.format(
'# StructureName',
'Energy(eV)',
'Magnetism(Bohr mag/cell)'))
for root, dirs, files in os.walk(top=STRUPATH, topdown=True):
for file in files:
name = file.split('.')[0]
cmd1 = ("grep '!FINAL_ETOT_IS' " + name + "/OUT.ABACUS/running_scf.log | awk '{print $2} ' > tmpE")
cmd2 = ("grep 'total magnetism' " + name +
"/OUT.ABACUS/running_scf.log | tail -n 1 | awk '{print $6}' > tmpMag")
os.system(cmd1)
os.system(cmd2)
with open('tmpE', 'r') as f:
ele = f.readline()
if(ele == ''):
energy = 'NULL'
else:
energy = ele.split()[0]
with open('tmpMag', 'r') as f:
ele = f.readline()
if (ele == ''):
mag = 'NULL'
else:
mag = ele.split()[0]
with open('results.dat', 'a') as f:
f.write('{0:<25s} {1:<25s} {2:<25s}\n'.format(name, energy, mag))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ShenZhenXiong/AbacusHighThroughput.git
git@gitee.com:ShenZhenXiong/AbacusHighThroughput.git
ShenZhenXiong
AbacusHighThroughput
AbacusHighThroughput
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385