# Voxel file generating problem

**URL:** <https://openmc.discourse.group/t/voxel-file-generating-problem/3788>\
**Category:** User Support\
**Created:** [January 1, 2024, 12:06pm UTC](https://openmc.discourse.group/t/voxel-file-generating-problem/3788 "2024-01-01T12:06:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pfproton](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pfproton](https://openmc.discourse.group/u/pfproton)\
**Post date:** [January 1, 2024, 12:06pm UTC](https://openmc.discourse.group/t/voxel-file-generating-problem/3788/1 "2024-01-01T12:06:42Z")

</div>

Dear experts @pshriwise @paulromano , I want to create a voxel image on a simple model in OpenMC. Even though I added the voxel creation scripts to my Python code, the voxel.h5 file does not appear among my output files. How can I solve this problem?

```auto
%matplotlib inline
import math
import openmc
import vtk
fuel = openmc.Material(name="uo2")
fuel.add_element("U", 1, percent_type="ao", enrichment=4.25)
fuel.add_element("O", 2)
fuel.set_density("g/cc", 10.4)

clad = openmc.Material(name="clad")
clad.add_element("Zr", 1)
clad.set_density("g/cc", 6)

water = openmc.Material(name="water")
water.add_element("O", 1)
water.add_element("H", 2)
water.set_density("g/cc", 1.0)
water.add_s_alpha_beta("c_H_in_H2O")
materials = openmc.Materials([fuel, clad, water])
materials.export_to_xml()
radii = [0.42, 0.45]
pin_surfaces = [openmc.ZCylinder(r=r) for r in radii]
pin_univ = openmc.model.pin(pin_surfaces, materials)
bound_box = openmc.model.rectangular_prism(1.24, 1.24, boundary_type="reflective")
root_cell = openmc.Cell(fill=pin_univ, region=bound_box)
geometry = openmc.Geometry([root_cell])
geometry.export_to_xml()
vox_plot = openmc.Plot()
vox_plot.type = 'voxel'
vox_plot.filename= 'voxel.h5'
vox_plot.width = (100., 100., 50.)
vox_plot.pixels = (400, 400, 200)
plots.append(vox_plot)
plots= openmc.Plots()
plots.export_to_xml()
settings = openmc.Settings()
settings.particles = 1000
settings.inactive = 10
settings.batches = 50
settings.export_to_xml()
openmc.run()

```

---

<div class="post-metadata">

**Author:** ![pshriwise](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pshriwise/32/3863_2.png) [@pshriwise](https://openmc.discourse.group/u/pshriwise)\
**Post date:** [January 2, 2024, 4:26pm UTC](https://openmc.discourse.group/t/voxel-file-generating-problem/3788/2 "2024-01-02T16:26:45Z")

</div>

Hiya @pfproton,

To produce a voxel file, you’ll need to run OpenMC in “plotting mode”. You can do this by replacing the `openmc.run()` line in your script with `openmc.plot_geometry()`.

---

<div class="post-metadata">

**Author:** ![pfproton](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pfproton](https://openmc.discourse.group/u/pfproton)\
**Post date:** [January 2, 2024, 5:09pm UTC](https://openmc.discourse.group/t/voxel-file-generating-problem/3788/3 "2024-01-02T17:09:41Z")

</div>

It created a voxel.h5 file, but I got an error when I ran this script.

```auto
import openmc
import vtk
!openmc-voxel-to-vtk voxel.h5 --output
Traceback (most recent call last):
  File "/home/user/.local/bin/openmc-voxel-to-vtk", line 4, in <module>
    __import__ ('pkg_resources').run_script('openmc==0.14.0', 'openmc-voxel-to-vtk')
  File "/usr/lib/python3/dist-packages/pkg_resources/ __init__.py", line 656, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/ __init__.py", line 1441, in run_script
    raise ResolutionError(
pkg_resources.ResolutionError: Script 'scripts/openmc-voxel-to-vtk' not found in metadata at '/home/user/.local/lib/python3.10/site-packages/openmc-0.14.0.dist-info'

```

---

<div class="post-metadata">

**Author:** ![emilmammadzada](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@emilmammadzada](https://openmc.discourse.group/u/emilmammadzada)\
**Post date:** [January 2, 2024, 5:19pm UTC](https://openmc.discourse.group/t/voxel-file-generating-problem/3788/4 "2024-01-02T17:19:48Z")

</div>

You need to set the path of the code script correctly.Example

```auto
user@DESKTOP: $HOME/openmc/scripts/openmc-voxel-to-vtk voxel.h5

```
