Last change
on this file since 59b70a was e1a46d, checked in by Frederik Heber <heber@…>, 16 years ago |
All of my python script put into ESPACK and adapted with @PYTHON@ and so on.
|
-
Property mode
set to
100755
|
File size:
1.1 KB
|
Line | |
---|
1 | #!@PYTHON@
|
---|
2 | #
|
---|
3 | # parses elements.db and valence.db and runs CreateVspeShapes.py
|
---|
4 |
|
---|
5 | import os, sys, math
|
---|
6 | werr = sys.stderr.write
|
---|
7 |
|
---|
8 | if len(sys.argv)<2:
|
---|
9 | werr("Usage is " + sys.argv[0] + " <DIR to .db's>\n")
|
---|
10 | sys.exit(1)
|
---|
11 |
|
---|
12 | dbdir=sys.argv[1]
|
---|
13 |
|
---|
14 | # parse databases
|
---|
15 | elements=open(dbdir+"/elements.db", "r")
|
---|
16 | valence=open(dbdir+"/valence.db", "r")
|
---|
17 |
|
---|
18 | # create empty array
|
---|
19 | ElementsLookup=[]
|
---|
20 | for nr in range(128):
|
---|
21 | ElementsLookup.append( [0,0] )
|
---|
22 |
|
---|
23 | nr=0
|
---|
24 | for line in elements:
|
---|
25 | if "#" in line:
|
---|
26 | continue
|
---|
27 | else:
|
---|
28 | values = line.split()
|
---|
29 | #print "Setting entry "+str(nr)+",0 to "+values[1]+"."
|
---|
30 | ElementsLookup[nr][0] = values[1]
|
---|
31 | nr=nr+1
|
---|
32 |
|
---|
33 | for line in valence:
|
---|
34 | if "#" in line:
|
---|
35 | continue
|
---|
36 | else:
|
---|
37 | values = line.split()
|
---|
38 | ElementsLookup[int(values[0])-1][1] = float(values[1])
|
---|
39 |
|
---|
40 | elements.close()
|
---|
41 | valence.close()
|
---|
42 |
|
---|
43 | # loop through all and call ShapeCreator
|
---|
44 | #for j in range(len(ElementsLookup)):
|
---|
45 | for j in range(0,80):
|
---|
46 | print str(ElementsLookup[j][0])+"\t"+str(ElementsLookup[j][1])
|
---|
47 | os.system("python CreateVspeShapes.py "+str(ElementsLookup[j][0])+" "+str(int((ElementsLookup[j][1]))))
|
---|
48 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.