KeyError: ‘chain_file’

*Hi All,

I am trying to use the following lines for my problem. I used “docker run -p 8888:8888 openmc_with_jupyter” . I took the lines from an example and created my own folder. When I run I got an error.
==================================
flux_in_each_group, micro_xs = openmc.deplete.get_microxs_and_flux(
** model=model,**
** domains=[shield_cell],**
** energies=[0, 30e6], # one energy bin from 0 to 30MeV**
** chain_file=openmc.config[‘chain_file’],**
)

And the error I got is:


KeyError Traceback (most recent call last)
Cell In[19], line 5
** 1 flux_in_each_group, micro_xs = openmc.deplete.get_microxs_and_flux(**
** 2 model=model,**
** 3 domains=[shield_cell],**
** 4 energies=[0, 30e6], # one energy bin from 0 to 30MeV**
----> 5 chain_file=openmc.config[‘chain_file’],
** 6 )**

File /openmc_venv/lib/python3.11/site-packages/openmc/config.py:18, in _Config.getitem(self, key)
** 17 def getitem(self, key):**
—> 18 return self._mapping[key]

KeyError: ‘chain_file’


Am I supposed to put a file named “chain file” in the same folder? But it seems it is supposed pull out from “chain_file=openmc.config[‘chain_file’]”.

Thank you very much

Birsen

class _Config(MutableMapping):
    def __init__(self, data=()):
        self._mapping = {'resolve_paths': True}
        self.update(data)

    def __getitem__(self, key):
        return self._mapping[key]

Maybe your chain_file (that key) variable is wrong. I am guessing that your OPENMC_CHAIN_FILE environmental variable is missing. To check that you run echo $OPENMC_CHAIN_FILE if it prints out null then you will have to set the ENV OPENMC_CHAIN_FILE.

https://docs.openmc.org/en/stable/usersguide/data.html#usersguide-data-runtime