-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdfcomp.py
55 lines (49 loc) · 1.41 KB
/
pdfcomp.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
import sys,os,subprocess
cwd = os.getcwd()
def readpara(fpar):
L=[]
fparam=open(fpar,'r')
countp=0
for i in fparam:
if "##" not in i:
if i.split()[0]!='pdf':
try:
L.append([i.split()[0],float(i.split()[1])])
continue
except ValueError:
print i
print "Error reading paramters card!"
return 0
break
else:
try:
L.append([i.split()[0],i.split()[1]])
continue
except ValueError:
print i
print "Error reading paramters card!"
return 0
break
fparam.close()
return L
dparam=readpara('param.dat')
pdf=dparampdf=dparam[52][1]
fin=open('src/pdfbkp.f','r')
fout=open('src/pdf.f','w')
for line in fin:
if 'data name' not in line:
fout.write(line)
else:
fout.write(' data name /\''+pdf+'\'/\n')
fin.close()
fout.close()
#os.chdir(cwd+'/src')
#os.system("gfortran -c MSQ*.F cuba*.F")
#os.system("gfortran -c pdf.F random.F")
#os.system("ar rc libCalc.a MSQ*.o cuba*.o pdf.o random.o")
#os.system("mv libCalc.a ../lib")
#os.system("f2py -c -m --fcompiler='gfortran' gen22 gen22.F -lLHAPDF -L../lib -lCalc")
#os.system("f2py -c -m --fcompiler='gfortran' gen21 gen21.F -lLHAPDF -L../lib -lCalc")
#os.system("cp gen22.so ../lib")
#os.system("cp gen21.so ../lib")
#os.system("cp classes.py ../lib")