====================
What's New in 0.13.1
====================

.. currentmodule:: openmc

-------
Summary
-------

This release of OpenMC includes many bug fixes as well as improvements in
geometry modeling, mesh functionality, source specification, depletion
capabilities, and other general enhancements. The depletion module features a
new transport operator, :class:`openmc.deplete.IndependentOperator`, that allows
a depletion calculation to be performed using arbitrary one-group cross sections
(e.g., generated by an external solver) along with a
:class:`openmc.deplete.MicroXS` class for managing one-group cross sections. The
track file generation capability has been significantly overhauled and a new
:class:`openmc.Tracks` class was introduced to allow access to information in
track files from the Python API. Support has been added for new ENDF thermal
scattering evaluations that use mixed coherent/incoherent elastic scattering.

------------------------------------
Compatibility Notes and Deprecations
------------------------------------

- The ``openmc.deplete.Operator`` class has been renamed
  :class:`openmc.deplete.CoupledOperator`.
- The ``openmc.deplete.ResultsList`` class has been renamed to
  :class:`openmc.deplete.Results` and no longer requires you to call the
  ``from_hdf5()`` method in order to create it; instead, you can directly
  instantiate it.
- A few methods that represent k-effective have been renamed for the sake of
  consistency:

  - ``openmc.StatePoint.k_combined`` is now :attr:`openmc.StatePoint.keff`
  - ``openmc.deplete.ResultsList.get_eigenvalue`` is now
    :meth:`openmc.deplete.Results.get_keff`

- The :class:`openmc.stats.SphericalIndependent` class, which used to
  accept a distribution for ``theta`` now accepts a distribution for ``cos_theta``
  instead in order to more easily handle the common case of specifying a uniform
  spatial distribution over a sphere (also see the new
  :func:`openmc.stats.spherical_uniform` function).

- If you are building OpenMC from source, note that several of our CMake options
  have been changed:

  ==========  ======================
  Old option  New option
  ==========  ======================
  debug       ---
  optimize    ---
  profile     OPENMC_ENABLE_PROFILE
  coverage    OPENMC_ENABLE_COVERAGE
  openmp      OPENMC_USE_OPENMP
  ---         OPENMC_USE_MPI
  dagmc       OPENMC_USE_DAGMC
  libmesh     OPENMC_USE_LIBMESH
  ==========  ======================

  The ``debug`` and ``optimize`` options have been removed; instead, use the
  standard `CMAKE_BUILD_TYPE
  <https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html>`_
  variable.

------------
New Features
------------

- Two new composite surfaces: :class:`openmc.model.IsogonalOctagon` and
  :class:`openmc.model.CylinderSector`.
- The :class:`~openmc.DAGMCUniverse` class now has a
  :attr:`~openmc.DAGMCUniverse.bounding_box` attribute and a
  :meth:`~openmc.DAGMCUniverse.bounding_region` method.
- When translating a :class:`~openmc.Region` using the
  :meth:`~openmc.Region.translate` method, there is now an ``inplace`` argument.
- The :class:`~openmc.Material` class has several new methods and attributes:

  - The :meth:`~openmc.Material.add_components` methods allows you to add
    multiple nuclides/elements to a material with a single call by passing a
    dictionary.
  - The :meth:`~openmc.Material.get_activity` method returns the activity of a
    material in Bq, Bq/g, or Bq/cm³.
  - The :meth:`~openmc.Material.remove_element` method removes an element from a
    material
  - The :meth:`~openmc.Material.get_nuclide_atoms` method gives the number of
    atoms of each nuclide in a material

- All mesh classes now have a ``volumes`` property that provides the volume of
  each mesh element as well as ``write_data_to_vtk`` methods.
- Support for externally managed MOAB meshes or libMesh meshes.
- Multiple discrete distributions can be merged with the new
  :meth:`~openmc.stats.Discrete.merge` method.
- The :func:`openmc.stats.spherical_uniform` function creates a uniform
  distribution over a sphere using the
  :class:`~openmc.stats.SphericalIndependent` class.
- Univariate distributions in the :mod:`openmc.stats` module now have
  ``sample()`` methods.
- An ``openmc_sample_external_source`` function has been added to the C API with
  a corresponding Python binding :func:`openmc.lib.sample_external_source`.
- The track file generation capability has been completely overhauled. Track
  files now include much more information, and a new :class:`~openmc.Tracks`
  class allows access to track file information from the Python API and has a
  :meth:`~openmc.Tracks.write_to_vtk` method for writing a VTK file. Multiple
  tracks are now written to a single file (one per MPI rank).
- A new :func:`openmc.wwinp_to_wws` function that converts weight windows from a
  ``wwinp`` file to a list of :class:`~openmc.WeightWindows` objects.
- The new :meth:`openmc.EnergyFilter.from_group_structure` method provides a
  way of creating an energy filter with a group structure identified by name.
- The :class:`openmc.data.Decay` class now has a
  :attr:`~openmc.data.Decay.sources` property that provides radioactive decay
  source distributions.
- A :class:`openmc.mgxs.ReducedAbsorptionXS` class produces a multigroup cross
  section representing "reduced" absorption (absorption less neutron production
  from (n,xn) reactions).
- Added support in the Python API and HDF5 nuclear data format for new ENDF
  thermal neutron scattering evaluations with mixed coherent elastic and
  incoherent elastic.
- CMake now relies on ``find_package(MPI)`` for a more standard means of
  identifying an MPI compiler configuration.

---------
Bug Fixes
---------

- `Fix bug when a rotation matrix is passed to Halfspace.rotate <https://github.com/openmc-dev/openmc/pull/1974>`_
- `Fix bug for spherical mesh string repr <https://github.com/openmc-dev/openmc/pull/1983>`_
- `Fix package_data specification to include pyx files <https://github.com/openmc-dev/openmc/pull/1989>`_
- `Allow meshes with same ID to appear in multiple files <https://github.com/openmc-dev/openmc/pull/1990>`_
- `Fix overwritten variable in get_libraries_from_xsdata <https://github.com/openmc-dev/openmc/pull/1994>`_
- `Write output files to correct directory <https://github.com/openmc-dev/openmc/pull/1998>`_
- `Allow CMake to properly find third-party packages <https://github.com/openmc-dev/openmc/pull/2006>`_
- `Fix Region.from_expression when ")(" appears in specification <https://github.com/openmc-dev/openmc/pull/2012>`_
- `Move lost particle reset from finalize() to reset() <https://github.com/openmc-dev/openmc/pull/2015>`_
- `Minor typo fixes in test_lattice.py <https://github.com/openmc-dev/openmc/pull/2024>`_
- `Fix color assignment in Universe.plot <https://github.com/openmc-dev/openmc/pull/2034>`_
- `Several depletion-related fixes <https://github.com/openmc-dev/openmc/pull/2037>`_
- `Allow control of C++ standard used by compiler <https://github.com/openmc-dev/openmc/pull/2040/files>`_
- `Fix IO format documentation for surface source read/write <https://github.com/openmc-dev/openmc/pull/2048>`_
- `Make sure basis gets set in Plot.from_geometry <https://github.com/openmc-dev/openmc/pull/2050>`_
- `Improve robustness of torus distance calculation <https://github.com/openmc-dev/openmc/pull/2053>`_
- `Allow use of redundant fission when adjusting KERMA in from_njoy <https://github.com/openmc-dev/openmc/pull/2055>`_
- `Disable GNU extensions for CMake target <https://github.com/openmc-dev/openmc/pull/2072>`_
- `Two from_xml fixes <https://github.com/openmc-dev/openmc/pull/2074>`_
- `Fix for rare infinite loop when finding cell <https://github.com/openmc-dev/openmc/pull/2075>`_
- `Allow photon heating to be tallied by nuclide <https://github.com/openmc-dev/openmc/pull/2076>`_
- `Use UTF-8 encoding when reading dose coefficients <https://github.com/openmc-dev/openmc/pull/2078>`_
- `Fix a corner case in Region.from_expression <https://github.com/openmc-dev/openmc/pull/2081>`_
- `Fix bug in spherical and cylindrical meshes <https://github.com/openmc-dev/openmc/pull/2108>`_
- `Ensure weight window bounds are flattened when writing to XML <https://github.com/openmc-dev/openmc/pull/2113>`_
- `Fix for std::cout sync bug in output.cpp <https://github.com/openmc-dev/openmc/pull/2122>`_
- `Allow compiling against fmt v9 <https://github.com/openmc-dev/openmc/pull/2136>`_
- `Fix TimeFilter for small time intervals <https://github.com/openmc-dev/openmc/pull/2168>`_

------------
Contributors
------------

- `David Andrs <https://github.com/andrsd>`_
- `Hunter Belanger <https://github.com/HunterBelanger>`_
- `Helen Brooks <https://github.com/helen-brooks>`_
- `Rémi Delaporte-Mathurin <https://github.com/RemDelaporteMathurin>`_
- `Joffrey Dorville <https://github.com/JoffreyDorville>`_
- `Christopher Fichtlscherer <https://github.com/cfichtlscherer>`_
- `Lewis Gross <https://github.com/lewisgross1296>`_
- `Andrew Johnson <https://github.com/drewejohnson>`_
- `Kalin Kiesling <https://github.com/kkiesling>`_
- `Amanda Lund <https://github.com/amandalund>`_
- `Richard Morrison <https://github.com/richmorrison>`_
- `Patrick Myers <https://github.com/myerspat>`_
- `Adam Nelson <https://github.com/nelsonag>`_
- `April Novak <https://github.com/aprilnovak>`_
- `Ethan Peterson <https://github.com/eepeterson>`_
- `Gavin Ridley <https://github.com/gridley>`_
- `Paul Romano <https://github.com/paulromano>`_
- `Jonathan Shimwell <https://github.com/Shimwell>`_
- `Patrick Shriwise <https://github.com/pshriwise>`_
- `Amelia Trainer <https://github.com/ameliojo>`_
- `John Tramm <https://github.com/jtramm>`_
- `Bob Urberger <https://github.com/burberger>`_
- `Olek Yardas <https://github.com/yardasol>`_
