diff --git a/src/state_point.F90 b/src/state_point.F90 index e31e7dea91..4cf62c7c10 100644 --- a/src/state_point.F90 +++ b/src/state_point.F90 @@ -232,6 +232,13 @@ contains end if + ! Indicate where source bank is stored in statepoint + if (source_separate) then + call sp % write_data(0, "source_present") + else + call sp % write_data(1, "source_present") + end if + ! Check for the no-tally-reduction method if (.not. reduce_tallies) then ! If using the no-tally-reduction method, we need to collect tally @@ -275,13 +282,6 @@ contains end if - ! Indicate where source bank is stored in statepoint - if (source_separate) then - call sp % write_data(0, "source_present") - else - call sp % write_data(1, "source_present") - end if - ! Close the file for serial writing call sp % file_close() @@ -730,6 +730,20 @@ contains end do TALLY_METADATA + ! Check for source in statepoint if needed + call sp % read_data(int_array(1), "source_present") + if (int_array(1) == 1) then + source_present = .true. + else + source_present = .false. + end if + + ! Check to make sure source bank is present + if (path_source_point == path_state_point .and. .not. source_present) then + message = "Source bank must be contained in statepoint restart file" + call fatal_error() + end if + ! Read tallies to master if (master) then @@ -766,20 +780,6 @@ contains end if end if - ! Check for source in statepoint if needed - call sp % read_data(int_array(1), "source_present") - if (int_array(1) == 1) then - source_present = .true. - else - source_present = .false. - end if - - ! Check to make sure source bank is present - if (path_source_point == path_state_point .and. .not. source_present) then - message = "Source bank must be contained in statepoint restart file" - call fatal_error() - end if - ! Read source if in eigenvalue mode if (run_mode == MODE_EIGENVALUE) then diff --git a/src/utils/statepoint.py b/src/utils/statepoint.py index 0bfb66716b..d64ad09663 100644 --- a/src/utils/statepoint.py +++ b/src/utils/statepoint.py @@ -298,6 +298,13 @@ class StatePoint(object): f.stride = stride stride *= f.length + # Source bank present + source_present = self._get_int(path='source_present')[0] + if source_present == 1: + self.source_present = True + else: + self.source_present = False + # Set flag indicating metadata has already been read self._metadata = True @@ -342,10 +349,9 @@ class StatePoint(object): if not self._results: self.read_results() - # Source bank present - source_present = self._get_int(path='source_present')[0] - if source_present != 1: - print('Source bank not present.') + # Check if source bank is in statepoint + if not self.source_present: + print('Source not in statepoint file.') return # For HDF5 state points, copy entire bank