-
Notifications
You must be signed in to change notification settings - Fork 0
/
transitions.py
executable file
·86 lines (81 loc) · 2.98 KB
/
transitions.py
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/python
#Arnfinn Hykkerud Steindal, Tromso July 2011
#Get the excitation energies and transitions from an Dalton
#output-file
import re
import sys
import shutil
import string
from mymodules import *
print "WARNING: Better to use get_transitions.py"
for i in sys.argv[1:]:
try:
file = open(i,'r')
except:
print 'Did not find file '+i
break
lines = file.readlines()
a = len(lines)
file.seek(0)
prline = ''
convergence = False
opa = False
tpa = False
threepa = False
for j in range(a):
try:
line = file.readline()
except:
break
words = line.split()
leng = len(words)
if leng==4:
if words[0]=='Orbital' and words[1]=='occupations' and words[2]==':':
reduce = int(words[3])
if leng==7:
if words[1]=='THE' and words[2]=='REQUESTED' and words[6]=='CONVERGED':
convergence = True
if convergence:
if leng==8:
if words[1]=='Excited' and words[2]=='state' and words[3]=='no:':
opa = True
# print words[4] + ' ' + get_opa_ex(file,line)
opa=get_opa_ex(file,line).split('(')
spc = 3-len(words[4])
printline=words[4] + spc*' ' + '& ' + opa[0] + ' & ' + opa[1][0:5]+'& & '
for i in range(8):
file.readline()
for i in range(100):
line=file.readline()
words=line.split()
try:
int(words[0])
except:
a=len(printline)
print printline[0:a-1]+" \\\\"
break
low=int(words[1].split('(')[0])
high=int(words[2].split('(')[0])
# if high-low==1:
# reduce=low
# else:
# reduce=127
# down=str(low-91)
# up=str(high-92)
# print low
# print reduce
down=str(low-reduce)
up=str(high-reduce-1)
if down=='0':
mo1='H'
else:
mo1='H'+down
if up=='0':
mo2='L'
else:
mo2='L+'+up
percent=2*100.0*float(words[3])**2+0.5
if percent>=5.0:
printline=printline+str(percent).split('.')[0]+'\%('+mo1+'$\\to$'+mo2+')+'
# print str(percent).split('.')[0]+'\%('+mo1+'$\\to$'+mo2+')'
file.close()