Skip to content
Snippets Groups Projects
Commit 7564d1dc authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Write run-time configuration options if set to non-default values

parent 58bf1660
No related branches found
No related tags found
No related merge requests found
...@@ -328,6 +328,14 @@ def load_model(model_file): ...@@ -328,6 +328,14 @@ def load_model(model_file):
for j in range(expected_radii): for j in range(expected_radii):
sconf['rcf'][i][j] = float(model['particle_settings']['rad_frac'][i][j]) sconf['rcf'][i][j] = float(model['particle_settings']['rad_frac'][i][j])
# Create the gconf dict # Create the gconf dict
try:
use_refinement = False if model['system_settings']['refinement'] == "0" else True
except KeyError:
use_refinement = False
try:
dyn_orders = False if model['radiation_settings']['dyn_orders'] == "0" else True
except KeyError:
use_refinement = False
str_polar = model['radiation_settings']['polarization'] str_polar = model['radiation_settings']['polarization']
if (str_polar not in ["LINEAR", "CIRCULAR"]): if (str_polar not in ["LINEAR", "CIRCULAR"]):
print("ERROR: %s is not a recognized polarization state."%str_polar) print("ERROR: %s is not a recognized polarization state."%str_polar)
...@@ -338,6 +346,8 @@ def load_model(model_file): ...@@ -338,6 +346,8 @@ def load_model(model_file):
model['input_settings']['geometry_file'] model['input_settings']['geometry_file']
) )
} }
gconf['use_refinement'] = use_refinement
gconf['dyn_orders'] = dyn_orders
gconf['nsph'] = sconf['nsph'] gconf['nsph'] = sconf['nsph']
gconf['application'] = model['particle_settings']['application'] gconf['application'] = model['particle_settings']['application']
gconf['li'] = int(model['geometry_settings']['li']) gconf['li'] = int(model['geometry_settings']['li'])
...@@ -865,6 +875,12 @@ def write_legacy_gconf(conf): ...@@ -865,6 +875,12 @@ def write_legacy_gconf(conf):
output.write(str_line) output.write(str_line)
str_line = " {0:d}\n0\n".format(conf['jwtm']) str_line = " {0:d}\n0\n".format(conf['jwtm'])
output.write(str_line) output.write(str_line)
if (gconf['use_refinement']):
str_line = "USE_REFINEMENT=1\n"
output.write(str_line)
if (not gconf['dyn_orders']):
str_line = "USE_DYN_ORDER=0\n"
output.write(str_line)
output.close() output.close()
return result return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment