forked from JohnCremona/CMFs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwt1.sage
More file actions
47 lines (40 loc) · 1.09 KB
/
Copy pathwt1.sage
File metadata and controls
47 lines (40 loc) · 1.09 KB
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
import os
import sys
from char import NChars
nargs = len(sys.argv)
assert nargs >= 3
try:
N1 = int(sys.argv[1])
except ValueError:
print("{} is not valid argument (arg 1)".format(sys.argv[1]))
raise RuntimeError
try:
N2 = int(sys.argv[2])
except ValueError:
print("{} is not valid argument (arg 2)".format(sys.argv[2]))
raise RuntimeError
dmax = 0
if nargs >= 4:
try:
dmax = int(sys.argv[3])
except ValueError:
print("{} is not valid argument (arg 3)".format(sys.argv[3]))
raise RuntimeError
nan = 1000
if nargs >= 5:
try:
nan = int(sys.argv[4])
except ValueError:
print("{} is not valid argument (arg 4)".format(sys.argv[4]))
raise RuntimeError
print("read args N1={}, N2={}, dmax={}, nan={}".format(N1,N2,dmax,nan))
outfile = "wt1input.{}-{}".format(N1,N2)
out = open(outfile, mode='w')
nspaces=0
for N in [N1..N2]:
nch = NChars(N)
nspaces += nch
for o in range(nch):
out.write("{} {} {} {} {}\n".format(N,1,o+1,dmax,nan))
out.close()
print("finished writing {} lines to {}".format(nspaces,outfile))