-
Notifications
You must be signed in to change notification settings - Fork 3
/
awr.py
26 lines (20 loc) · 845 Bytes
/
awr.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# read awr and print in format, compatible with xsdirconvert.pl (script for converting mcnp xsdir to serpent format)
from __future__ import print_function
from sys import argv
# Assume that an existing xsdir file containing the AWR section is given as the
# command line argument to this script.
in_awr_block = False
for l in open(argv[1], 'r'):
if not in_awr_block:
if 'atomic' in l:
# The AWR block starts with a line containing 'atomic weight ratios'
in_awr_block = True
else:
if '/' in l or 'dir' in l:
# The AWR block ends with a line containing date in the DD/MM/YYYY
# format, following with a line containing 'directory'
break
else:
t = l.split()
for t1, t2 in zip(t[:-1:2], t[1::2]):
print(t1, t2)