diff --git a/openmc/data/library.py b/openmc/data/library.py index 748a018891..dba5eabc16 100644 --- a/openmc/data/library.py +++ b/openmc/data/library.py @@ -23,7 +23,8 @@ class DataLibrary(object): root = ET.Element('cross_sections') # Determine common directory for library paths - common_dir = os.path.commonpath([lib['path'] for lib in self.libraries]) + common_dir = os.path.dirname(os.path.commonprefix( + [lib['path'] for lib in self.libraries])) if common_dir == '': common_dir = '.' diff --git a/src/angle_distribution.F90 b/src/angle_distribution.F90 index 830ba836ca..a4fea6ff77 100644 --- a/src/angle_distribution.F90 +++ b/src/angle_distribution.F90 @@ -1,8 +1,9 @@ module angle_distribution + use hdf5, only: HID_T, HSIZE_T + use constants, only: ZERO, ONE, HISTOGRAM, LINEAR_LINEAR use distribution_univariate, only: DistributionContainer, Tabular - use hdf5, only: HID_T, HSIZE_T use hdf5_interface, only: read_attribute, get_shape, read_dataset, & open_dataset, close_dataset use random_lcg, only: prn @@ -81,9 +82,9 @@ contains dset_id = open_dataset(group_id, 'energy') call get_shape(dset_id, dims) n_energy = int(dims(1), 4) - allocate(this%energy(n_energy)) - allocate(this%distribution(n_energy)) - call read_dataset(this%energy, dset_id) + allocate(this % energy(n_energy)) + allocate(this % distribution(n_energy)) + call read_dataset(this % energy, dset_id) call close_dataset(dset_id) ! Get outgoing energy distribution data @@ -105,8 +106,8 @@ contains end if ! Create and initialize tabular distribution - allocate(Tabular :: this%distribution(i)%obj) - select type (mudist => this%distribution(i)%obj) + allocate(Tabular :: this % distribution(i) % obj) + select type (mudist => this % distribution(i) % obj) type is (Tabular) mudist % interpolation = interp(i) allocate(mudist % x(n), mudist % p(n), mudist % c(n)) diff --git a/src/endf_header.F90 b/src/endf_header.F90 index 8b6ad63f19..c4b4ef3ad8 100644 --- a/src/endf_header.F90 +++ b/src/endf_header.F90 @@ -1,9 +1,10 @@ module endf_header + use hdf5, only: HID_T, HSIZE_T + use constants, only: ZERO, HISTOGRAM, LINEAR_LINEAR, LINEAR_LOG, & LOG_LINEAR, LOG_LOG use hdf5_interface - use hdf5, only: HID_T, HSIZE_T use search, only: binary_search implicit none @@ -157,25 +158,25 @@ contains ! Determine number of regions nr = nint(xss(idx)) - this%n_regions = nr + this % n_regions = nr ! Read interpolation region data if (nr > 0) then - allocate(this%nbt(nr)) - allocate(this%int(nr)) - this%nbt(:) = nint(xss(idx + 1 : idx + nr)) - this%int(:) = nint(xss(idx + nr + 1 : idx + 2*nr)) + allocate(this % nbt(nr)) + allocate(this % int(nr)) + this % nbt(:) = nint(xss(idx + 1 : idx + nr)) + this % int(:) = nint(xss(idx + nr + 1 : idx + 2*nr)) end if ! Determine number of pairs ne = int(XSS(idx + 2*nr + 1)) - this%n_pairs = ne + this % n_pairs = ne ! Read (x,y) pairs - allocate(this%x(ne)) - allocate(this%y(ne)) - this%x(:) = xss(idx + 2*nr + 2 : idx + 2*nr + 1 + ne) - this%y(:) = xss(idx + 2*nr + 2 + ne : idx + 2*nr + 1 + 2*ne) + allocate(this % x(ne)) + allocate(this % y(ne)) + this % x(:) = xss(idx + 2*nr + 2 : idx + 2*nr + 1 + ne) + this % y(:) = xss(idx + 2*nr + 2 + ne : idx + 2*nr + 1 + 2*ne) end subroutine tabulated1d_from_ace subroutine tabulated1d_from_hdf5(this, dset_id) @@ -185,19 +186,19 @@ contains real(8), allocatable :: xy(:,:) integer(HSIZE_T) :: dims(2) - call read_attribute(this%nbt, dset_id, 'breakpoints') - call read_attribute(this%int, dset_id, 'interpolation') - this%n_regions = size(this%nbt) + call read_attribute(this % nbt, dset_id, 'breakpoints') + call read_attribute(this % int, dset_id, 'interpolation') + this % n_regions = size(this % nbt) call get_shape(dset_id, dims) - this%n_pairs = int(dims(1), 4) - allocate(this%x(this%n_pairs)) - allocate(this%y(this%n_pairs)) + this % n_pairs = int(dims(1), 4) + allocate(this % x(this % n_pairs)) + allocate(this % y(this % n_pairs)) allocate(xy(dims(1), dims(2))) call read_dataset(xy, dset_id) - this%x(:) = xy(:,1) - this%y(:) = xy(:,2) + this % x(:) = xy(:,1) + this % y(:) = xy(:,2) end subroutine tabulated1d_from_hdf5 pure function tabulated1d_evaluate(this, x) result(y) diff --git a/src/energy_distribution.F90 b/src/energy_distribution.F90 index 54ae3f90c9..c45762bb0a 100644 --- a/src/energy_distribution.F90 +++ b/src/energy_distribution.F90 @@ -1,9 +1,10 @@ module energy_distribution + use hdf5 + use constants, only: ZERO, ONE, HALF, TWO, PI, HISTOGRAM, LINEAR_LINEAR use endf_header, only: Tabulated1D use hdf5_interface - use hdf5 use math, only: maxwell_spectrum, watt_spectrum use random_lcg, only: prn use search, only: binary_search diff --git a/src/hdf5_interface.F90 b/src/hdf5_interface.F90 index 0bfe04051f..d745f3201c 100644 --- a/src/hdf5_interface.F90 +++ b/src/hdf5_interface.F90 @@ -10,13 +10,13 @@ module hdf5_interface ! can be combined into one simply accepting an assumed-shape array. !============================================================================== - use error, only: fatal_error - use tally_header, only: TallyResult + use, intrinsic :: ISO_C_BINDING use hdf5 use h5lt - use, intrinsic :: ISO_C_BINDING + use error, only: fatal_error + use tally_header, only: TallyResult #ifdef PHDF5 use message_passing, only: MPI_COMM_WORLD, MPI_INFO_NULL #endif diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 0fc96ef4b1..3c8291e9c8 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -1,5 +1,7 @@ module input_xml + use hdf5 + use cmfd_input, only: configure_cmfd use constants use dict_header, only: DictIntInt, ElemKeyValueCI @@ -10,6 +12,7 @@ module input_xml use error, only: fatal_error, warning use geometry_header, only: Cell, Lattice, RectLattice, HexLattice use global + use hdf5_interface use list_header, only: ListChar, ListInt, ListReal use mesh_header, only: RegularMesh use multipole, only: multipole_read @@ -25,9 +28,6 @@ module input_xml use tally_initialize, only: add_tallies use xml_interface - use hdf5 - use hdf5_interface - implicit none save @@ -2087,14 +2087,14 @@ contains call read_materials_xml(libraries, library_dict) ! Read continuous-energy cross sections - if (run_CE) then + if (run_CE .and. run_mode /= MODE_PLOTTING) then call time_read_xs%start() call read_ce_cross_sections(libraries, library_dict) call time_read_xs%stop() end if ! Normalize atom/weight percents - call normalize_ao() + if (run_mode /= MODE_PLOTTING) call normalize_ao() ! Clear dictionary call library_dict % clear() @@ -3295,11 +3295,6 @@ contains ! If a specific nuclide was specified word = to_lower(sarray(j)) -!!$ ! Append default_xs specifier to nuclide if needed -!!$ if ((default_xs /= '') .and. (.not. ends_with(sarray(j), 'c'))) then -!!$ word = trim(word) // "." // trim(default_xs) -!!$ end if - ! Search through nuclides pair_list => nuclide_dict % keys() do while (associated(pair_list)) diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index be61ff8b9e..9cff8a5d58 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -2,13 +2,14 @@ module nuclide_header use, intrinsic :: ISO_FORTRAN_ENV + use hdf5, only: HID_T, HSIZE_T, SIZE_T, h5iget_name_f + use h5lt, only: h5ltpath_valid_f + use constants use dict_header, only: DictIntInt use endf, only: reaction_name, is_fission, is_disappearance use endf_header, only: Function1D, Constant1D, Polynomial, Tabulated1D use error, only: fatal_error, warning - use hdf5, only: HID_T, HSIZE_T, SIZE_T, h5iget_name_f - use h5lt, only: h5ltpath_valid_f use hdf5_interface, only: read_attribute, open_group, close_group, & open_dataset, read_dataset, close_dataset, get_shape use list_header, only: ListInt diff --git a/src/product_header.F90 b/src/product_header.F90 index fbe0ee71f0..f20adf0d40 100644 --- a/src/product_header.F90 +++ b/src/product_header.F90 @@ -1,10 +1,11 @@ module product_header + use hdf5, only: HID_T + use angleenergy_header, only: AngleEnergyContainer use constants, only: ZERO, MAX_WORD_LEN, EMISSION_PROMPT, EMISSION_DELAYED, & EMISSION_TOTAL, NEUTRON, PHOTON use endf_header, only: Tabulated1D, Function1D, Constant1D, Polynomial - use hdf5, only: HID_T use hdf5_interface, only: read_attribute, open_group, close_group, & open_dataset, close_dataset, read_dataset use random_lcg, only: prn diff --git a/src/reaction_header.F90 b/src/reaction_header.F90 index 74198dd78b..9829f6e8f6 100644 --- a/src/reaction_header.F90 +++ b/src/reaction_header.F90 @@ -1,6 +1,7 @@ module reaction_header use hdf5, only: HID_T, HSIZE_T + use hdf5_interface, only: read_attribute, open_group, close_group, & open_dataset, read_dataset, close_dataset, get_shape use product_header, only: ReactionProduct diff --git a/src/secondary_correlated.F90 b/src/secondary_correlated.F90 index 0576b28f63..e163fdcc24 100644 --- a/src/secondary_correlated.F90 +++ b/src/secondary_correlated.F90 @@ -1,9 +1,10 @@ module secondary_correlated + use hdf5, only: HID_T, HSIZE_T + use angleenergy_header, only: AngleEnergy use constants, only: ZERO, ONE, HALF, TWO, HISTOGRAM, LINEAR_LINEAR use distribution_univariate, only: DistributionContainer, Tabular - use hdf5, only: HID_T, HSIZE_T use hdf5_interface, only: get_shape, read_attribute, open_dataset, & read_dataset, close_dataset use random_lcg, only: prn diff --git a/src/secondary_kalbach.F90 b/src/secondary_kalbach.F90 index 920d17869c..4b5e690b5d 100644 --- a/src/secondary_kalbach.F90 +++ b/src/secondary_kalbach.F90 @@ -1,8 +1,9 @@ module secondary_kalbach + use hdf5, only: HID_T, HSIZE_T + use angleenergy_header, only: AngleEnergy use constants, only: ZERO, HALF, ONE, TWO, HISTOGRAM, LINEAR_LINEAR - use hdf5, only: HID_T, HSIZE_T use hdf5_interface, only: read_attribute, read_dataset, open_dataset, & close_dataset, get_shape use random_lcg, only: prn diff --git a/src/secondary_nbody.F90 b/src/secondary_nbody.F90 index d45c598793..14ae949a9e 100644 --- a/src/secondary_nbody.F90 +++ b/src/secondary_nbody.F90 @@ -1,8 +1,9 @@ module secondary_nbody + use hdf5, only: HID_T + use angleenergy_header, only: AngleEnergy use constants, only: ONE, TWO, PI - use hdf5, only: HID_T use hdf5_interface, only: read_attribute use math, only: maxwell_spectrum use random_lcg, only: prn diff --git a/src/secondary_uncorrelated.F90 b/src/secondary_uncorrelated.F90 index 3158913cc6..fc215484a9 100644 --- a/src/secondary_uncorrelated.F90 +++ b/src/secondary_uncorrelated.F90 @@ -1,13 +1,14 @@ module secondary_uncorrelated + use h5lt, only: h5ltpath_valid_f + use hdf5, only: HID_T + use angle_distribution, only: AngleDistribution use angleenergy_header, only: AngleEnergy use constants, only: ONE, TWO, MAX_WORD_LEN use energy_distribution, only: EnergyDistribution, LevelInelastic, & ContinuousTabular, MaxwellEnergy, Evaporation, WattEnergy, DiscretePhoton use error, only: warning - use h5lt, only: h5ltpath_valid_f - use hdf5, only: HID_T use hdf5_interface, only: read_attribute, open_group, close_group use random_lcg, only: prn