changing the name of openmc executable and python API at compilation time

Hello All,

I have a small question. I am not much familiar with cmake and make and i was thinking to installing stable (0.10.0) and develop branch alongside. what is the way to change the name of executable and python API so both these versions can co-exist peacefully :-).

TYI and keep up the good work

Hi Khurrum,

It’s kind of tough to change the name of the executable and the Python module so I’d like to suggest an alternative if you don’t mind. For my workflow, I have multiple versions of OpenMC installed and I switch between them by source-ing different environments.

For example, I might have different versions of OpenMC under $HOME/openmc_dev and $HOME/openmc_v10. I’ll then build each OpenMC, but I don’t run the make install command. Instead, I modify my PATH, PYTHONPATH, LD_LIBRARY_PATH environment variables to point to which ever version is appropriate at the moment (e.g. PATH=$HOME/openmc_dev/build/bin:$PATH). Generally, I keep a bunch of different bash scripts for my different versions of OpenMC. These scripts each have lines like export PATH=… and export OPENMC_CROSS_SECTIONS=… that set the appropriate environment variables. I can then run source on the bash file to switch to that version of OpenMC.

Let me know if I can make any of that more clear

Thanks Sterling Harper !!!!

@Sterling Harper, can you please share such a script. OpenMC executable is working fine but i am having issue with using python api in spyder or ipython. import openmc gives error that no module named openmc.

currently i have placed “export PYTHONPATH=/home/osboxes/openmc-0.10.0/openmc/:$PYTHONPATH” to my bash script which i source to use a specific version of openmc.

Thanks in advance.

Sure, I’ll attach an example bash script here.

Does it work if you instead use “export PYTHONPATH=/home/osboxes/openmc-0.10.0:$PYTHONPATH”? You want the python path to point to the root openmc directory, i.e., the one with the subdirectories “src”, “tests”, “openmc”, “vendor”, etc.

If that doesn’t work, it’s good to check the python path from within the python shell you’re using. You can run “import sys” and then “print(sys.path)” to verify that setting your environment variable worked.

example_openmc_env.sh (354 Bytes)

Thanks @Sterling Harper.