From 043c56f3384e738be9eba41ac1d8e5aa4dd17766 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 11 Aug 2016 11:31:29 -0400 Subject: [PATCH] Now track OpenCG lattice names. Now strip hyphens on nuclide names --- openmc/nuclide.py | 10 +++++++++- openmc/opencg_compatible.py | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/openmc/nuclide.py b/openmc/nuclide.py index 14609161fe..961ab201f4 100644 --- a/openmc/nuclide.py +++ b/openmc/nuclide.py @@ -1,5 +1,6 @@ from numbers import Integral import sys +import warnings from openmc.checkvalue import check_type @@ -98,7 +99,14 @@ class Nuclide(object): @name.setter def name(self, name): check_type('name', name, basestring) - self._name = name + + if '-' in name: + new_name = name.strip('-', '') + msg = 'OpenMC nuclide names follow the GND standard. Nuclide ' \ + '"{}" is being transformed to "{}".'.format(name, new_name) + warnings.warn(msg, DeprecationWarning) + + self._name = name.replace('-', '') @xs.setter def xs(self, xs): diff --git a/openmc/opencg_compatible.py b/openmc/opencg_compatible.py index 93a257f465..a3b35e0555 100644 --- a/openmc/opencg_compatible.py +++ b/openmc/opencg_compatible.py @@ -911,6 +911,7 @@ def get_openmc_lattice(opencg_lattice): if lattice_id in OPENMC_LATTICES: return OPENMC_LATTICES[lattice_id] + name = opencg_lattice.name dimension = opencg_lattice.dimension width = opencg_lattice.width offset = opencg_lattice.offset @@ -941,7 +942,7 @@ def get_openmc_lattice(opencg_lattice): ((np.array(width, dtype=np.float64) * np.array(dimension, dtype=np.float64))) / -2.0 - openmc_lattice = openmc.RectLattice(lattice_id=lattice_id) + openmc_lattice = openmc.RectLattice(lattice_id=lattice_id, name=name) openmc_lattice.pitch = width openmc_lattice.universes = universe_array openmc_lattice.lower_left = lower_left