# Accessing data while looping through multiple runs

**URL:** https://openmc.discourse.group/t/accessing-data-while-looping-through-multiple-runs/5364
**Category:** User Support
**Created:** [March 25, 2025, 6:59pm UTC](https://openmc.discourse.group/t/accessing-data-while-looping-through-multiple-runs/5364 "2025-03-25T18:59:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mbresnahan7](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@mbresnahan7](https://openmc.discourse.group/u/mbresnahan7)
#### Post date: [March 25, 2025, 6:59pm UTC](https://openmc.discourse.group/t/accessing-data-while-looping-through-multiple-runs/5364/1 "2025-03-25T18:59:04Z")

</div>

Hello all,  
I am constructing a phase space of two different properties of a fuel salt that I am modelling. I need to vary density and composition of my material and loop through 49 different models to obtain 49 different eigenvalues and 49 different values of nu.  
I can write a loop that will run as many times as I tell it to, however when I go into the statepoint file to obtain the eigenvalues it only records the data from the last run. I am assuming that this is because openmc auto names the statepoint file so it continuously overwrites itself. Would anyone know how to fix this? Thank you.

---

<div class="post-metadata">

### Author: ![tjlaboss](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/tjlaboss/32/1390_2.png) [@tjlaboss](https://openmc.discourse.group/u/tjlaboss)
#### Post date: [March 25, 2025, 7:16pm UTC](https://openmc.discourse.group/t/accessing-data-while-looping-through-multiple-runs/5364/2 "2025-03-25T19:16:33Z")

</div>

How about just renaming the statepoint after each iteration?

---

<div class="post-metadata">

### Author: ![mbresnahan7](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@mbresnahan7](https://openmc.discourse.group/u/mbresnahan7)
#### Post date: [March 25, 2025, 7:27pm UTC](https://openmc.discourse.group/t/accessing-data-while-looping-through-multiple-runs/5364/3 "2025-03-25T19:27:17Z")

</div>

yes, that’s what I want to do but I am not sure how

---

<div class="post-metadata">

### Author: ![cjwiguna](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/cjwiguna/32/3728_2.png) [@cjwiguna](https://openmc.discourse.group/u/cjwiguna)
#### Post date: [March 26, 2025, 9:38am UTC](https://openmc.discourse.group/t/accessing-data-while-looping-through-multiple-runs/5364/4 "2025-03-26T09:38:40Z")

</div>

Hello there!

We can change the working directory easily using

`from openmc.utility_funcs import change_directory`

then, just before we run the model,

```auto
with change_directory(working_path_to_iteration_n):
    openmc.run(....)
    # or
    model.run(....)

```

We often times can’t change the name of input/output, so change the directory is the best way to go.

Cheers!  
Chris.
