diff --git a/src/settings.cpp b/src/settings.cpp index a9276ed73..0c1f3c0fa 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -646,6 +646,25 @@ void read_settings_xml() } } + // Check if the user has specified to read surface source. + if (check_for_node(root, "surf_src_read")) { + surf_src_read = true; + // Get surface source read node + xml_node node_ss = root.child("surf_src_read"); + + settings::path_source = "surface_source.h5"; + // Check if the user has specified different file for surface source reading + if (check_for_node(node_ss, "file")) { + settings::path_source = get_node_value(node_ss, "file", false, true); + } + + // Check if surface source file exists + if (!file_exists(settings::path_source)) { + fatal_error(fmt::format("Source file '{}' does not exist.", + settings::path_source)); + } + } + // If source is not seperate and is to be written out in the statepoint file, // make sure that the sourcepoint batch numbers are contained in the // statepoint list diff --git a/src/source.cpp b/src/source.cpp index 0ecf259a7..97a722acf 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -81,11 +81,6 @@ IndependentSource::IndependentSource(pugi::xml_node node) settings::path_source)); } - // Check if it is a surface source file. - if (check_for_node(node, "surf_src_read")) { - settings::surf_src_read = get_node_value_bool(node, "surf_src_read"); - } - } else if (check_for_node(node, "library")) { settings::path_source_library = get_node_value(node, "library", false, true); if (!file_exists(settings::path_source_library)) {