SST Lab Dokuwiki Header header picture

ユーザ用ツール

サイト用ツール


playground:private_pages

Private Pages

out

#
import sys
args = sys.argv
filename = args[1]
fp = open(filename)
lines = fp.readlines()
fp.close()
kpts = {}
energies = {}
for line in lines:
  tokens = line.split()
  if len(tokens) == 0:
    continue
  if tokens[0] == 'KPT:':
    if len(tokens) == 6:
      if tokens[1].isdigit():
        kpt = int(tokens[1])
        kpts[kpt] = [float(tokens[2]), float(tokens[3]), float(tokens[4])]
        energies[kpt] = []
  if tokens[0] == 'EIG':
    if tokens[2].isdigit():
      kpt = int(tokens[2])
      energies[kpt].append(float(tokens[3]))
nbands = list(range(1, len(energies[1]) + 1))
print('"kpt","kx","ky","kz"', *nbands, sep = ',')
for kpt in kpts.keys():
  print(kpt, *kpts[kpt], *energies[kpt], sep = ',')
playground/private_pages.txt · 最終更新: 2024/12/16 22:55 by kimi

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki