JADE-V-V/JADE

[Feature request] - ADD keyword RMODE0 to mcnp benchmarks

Closed this issue · 0 comments

Is your feature request related to a problem? Please describe.
When running in clusters it may be useful to run the benchmarks with the prompt version of D1SUNED which is faster with respect to vanilla MCNP. In order to do so, inputs need to have the RMODE 0 keyword in them

Describe the solution you'd like
Currently I have been using the following script to perform this operation, but it would be nicer to add it as an utility in JADE:

import os
root = r'R:\AC_ResultsDB\Jade\04_JADE_latest_root\Benchmarks_Inputs - Copy'

# walk trough the root tree, when mcnp folder is found, the RMODE 0 line has
# to be added to the input file
for dirpath, dirnames, filenames in os.walk(root):
    if 'mcnp' in dirnames:
        mcnp_dir = os.path.join(dirpath, 'mcnp')
        for filename in os.listdir(mcnp_dir):
            filepath = os.path.join(mcnp_dir, filename)
            with open(filepath, 'r') as f:
                lines = f.readlines()
            flag_no_rmode = True
            with open(filepath, 'w') as f:
                for line in lines:
                    f.write(line)
                    if 'RMODE' in line:
                        flag_no_rmode = False
                if flag_no_rmode:
                    f.write('RMODE 0\n')