summaryrefslogtreecommitdiff
path: root/sim/src/parameters/xe
blob: df69fa2caab4862f9133e6b2afac591f009f57cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /usr/bin/python

import os
import sys
import re

hevpat = re.compile(" HAS ENERGY VALUE +([\d\.-]+)")
betapat = re.compile(" COORD 1= *([\d\.-]+)")
potpat = re.compile("     POTENTIAL SURFACE MAP INPUT")
orgpat = re.compile(" HAS ORIGIN= *([\d\.-]+)")


Hartree = 4.3597482 # attoJoules
Bohr = 0.5291772083 # Angstroms

def findnext(f,pat):
    while 1:
        card = f.readline()
        if not card: return None
        m = pat.match(card)
        if m: return m        

def ending(nam,suf):
    if suf==nam[-len(suf):]: return nam
    else: return nam+suf

def xeread(name):
    f=open(ending(name,'.log'),"r")
    x = []
    e= []

    findnext(f, potpat)
    #org=float(findnext(f,orgpat).group(1))
    
    while 1:
        m = findnext(f, betapat)
        m1 = findnext(f,hevpat)
        if not (m and m1): break
        x += [float(m.group(1))]
        e += [float(m1.group(1))*Hartree]

    f.close()
    return x,e
 

name = sys.argv[1]
x,e = xeread(name)

for i in range(len(x)):
    print x[i],e[i]