# CROSS\_SECTIONS environment variable absolute path

**URL:** <https://openmc.discourse.group/t/cross-sections-environment-variable-absolute-path/71>\
**Category:** User Support\
**Created:** [May 27, 2014, 3:02am UTC](https://openmc.discourse.group/t/cross-sections-environment-variable-absolute-path/71 "2014-05-27T03:02:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xinyan\_Wang](https://avatars.discourse-cdn.com/v4/letter/x/48db29/32.png) [@Xinyan\_Wang](https://openmc.discourse.group/u/Xinyan_Wang)\
**Post date:** [May 27, 2014, 3:02am UTC](https://openmc.discourse.group/t/cross-sections-environment-variable-absolute-path/71/1 "2014-05-27T03:02:48Z")

</div>

Hello,  
I am a beginner on openMC and new to this group.  
When I try to run openmc with the sample tests, I get prompt “ERROR: No cross\_sections.xml file was specified in settings.xml or in the CROSS\_SECTIONS environment variable” all the time.  
Could anyone tell me how to set the CROSS\_SECTIONS environment variable? Or to say how to "set the `CROSS_SECTIONS` environment variable to the absolute path of the file `openmc/data/nndc/cross_sections.xml`"?

Thank you very much!

 ![openmc.jpg](https://global.discourse-cdn.com/free1/uploads/openmc/original/1X/916c4ef664844a9cc872b2286910163e85973e86.jpeg)

---

<div class="post-metadata">

**Author:** ![Matheus\_dos\_Santos](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Matheus\_dos\_Santos](https://openmc.discourse.group/u/Matheus_dos_Santos)\
**Post date:** [May 27, 2014, 3:43am UTC](https://openmc.discourse.group/t/cross-sections-environment-variable-absolute-path/71/2 "2014-05-27T03:43:32Z")

</div>

Hi Wang, Welcome to OpenMC!

what cross section library are you using? Or which one do you intend to use?

_ **\>I get prompt “ERROR: No cross\_sections.xml file was specified …” all the time.** _  
Please, take a look in this tread (Subject: Not Clear On How To Install Cross Sections)  
[https://groups.google.com/forum/#!searchin/openmc-users/matheusp/openmc-users/r1tq9zBGhww/2J6NmbIwH-4J](https://groups.google.com/forum/#%21searchin/openmc-users/matheusp/openmc-users/r1tq9zBGhww/2J6NmbIwH-4J)

**_\>Could anyone tell me how to set the CROSS\_SECTIONS environment variable?_**  
In the file settings.xml you can set like this (an extract from previous mail):

---

<div class="post-metadata">

**Author:** ![Xinyan\_Wang](https://avatars.discourse-cdn.com/v4/letter/x/48db29/32.png) [@Xinyan\_Wang](https://openmc.discourse.group/u/Xinyan_Wang)\
**Post date:** [May 27, 2014, 3:50am UTC](https://openmc.discourse.group/t/cross-sections-environment-variable-absolute-path/71/3 "2014-05-27T03:50:48Z")

</div>

Hi,  
Thanks for your help. I am using NNDC. It seems I have to change setting.xml even when I use the provided tests.Xinyan

---

<div class="post-metadata">

**Author:** ![Adam\_Nelson](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Adam\_Nelson](https://openmc.discourse.group/u/Adam_Nelson)\
**Post date:** [May 27, 2014, 9:49am UTC](https://openmc.discourse.group/t/cross-sections-environment-variable-absolute-path/71/4 "2014-05-27T09:49:31Z")

</div>

Hi Xinyan,

Matheus has given a correct way to change the path of your cross\_sections.xml file for a given input file (settings.xml). But to set it such that you don’t need to change each settings.xml file, you can use the environmental variables feature of your linux shell. To do this, perform the following (I will assume you are using Ubuntu with the default shell with these commands, let me know if that is not the case):

1. Find out the absolute path to your NNDC cross\_sections.xml file. It will probably be /home//openmc/data/cross\_sections.xml.  
1.a. This is called the `absolute path` because the path works regardless of what directory you are currently in when you call it. A relative path would be something like …/data/cross\_sections.xml which would tell the OS to "go back one directory (…/) then look for data/cross\_sections.xml.
2. Now lets set the path temporarily and make sure it works. Go to where ever you would go to run the OpenMC tests and instead of doing the usual python run\_tests.py, prepend a command to set the environmental variable for just this command. That is:  
export CROSS\_SECTIONS=/home//openmc/data/cross\_sections.xml python run\_tests.py  
Make sure you put in the actual absolute path that we discovered in Step 1.
3. If step 2 works, then we have the right path and we have set it correctly. Now we can make this change so that you don’t need to run the export command every time you want to run OpenMC. To do this we should open up ~/.profile in whatever text editor you wish and at the end add the export command tha worked in step 2:  
export CROSS\_SECTIONS=/home//openmc/data/cross\_sections.xml
4. This won’t quite work just yet as you need to log off and then back on before it gets set for your whole user profile. To use it in the short term without re-logging in, just run the following command:  
source ~/.profile  
This will read in the changes you just made to .profile and set them for the currently open terminal window.

Hope this helps!  
Adam

---

<div class="post-metadata">

**Author:** ![Xinyan\_Wang](https://avatars.discourse-cdn.com/v4/letter/x/48db29/32.png) [@Xinyan\_Wang](https://openmc.discourse.group/u/Xinyan_Wang)\
**Post date:** [May 28, 2014, 7:59am UTC](https://openmc.discourse.group/t/cross-sections-environment-variable-absolute-path/71/5 "2014-05-28T07:59:40Z")

</div>

Hello, may I ask you guys one more question.

I set up the directory in cross sections based on your suggestions(as shown in the figures). However, I still get the prompt that the directory does not exist. Could anyone help me to figure that out? I cannot find what I did wrong.

Thanks!

 ![error_prompt.jpg](https://global.discourse-cdn.com/free1/uploads/openmc/original/1X/07845c70fd81775952e4506ec73029866077f1af.jpeg)

![my_path.jpg](https://global.discourse-cdn.com/free1/uploads/openmc/original/1X/ebc4d7150fad6859e6b2419dcdbe83486e4b5a9e.jpeg)

 ![Screenshot from 2014-05-27 04_31_18.png](https://global.discourse-cdn.com/free1/uploads/openmc/original/1X/833c999acbe4e0d789a04fe483abed4af5341e51.png)

 ![should_be_path.jpg](https://global.discourse-cdn.com/free1/uploads/openmc/original/1X/ee77bd48cf8a82ac5b439f6079de45cc58dd1f1b.jpeg)

---

<div class="post-metadata">

**Author:** ![Adam\_Nelson](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Adam\_Nelson](https://openmc.discourse.group/u/Adam_Nelson)\
**Post date:** [May 28, 2014, 9:57am UTC](https://openmc.discourse.group/t/cross-sections-environment-variable-absolute-path/71/6 "2014-05-28T09:57:22Z")

</div>

The path shown in your file manager (in should\_be\_path.jpg) is misleading. The “Home” there _actually_ means /home/our\_username/ instead of /Home/. Also notice that /home/ is not capitalized. So if you just replace the /Home/ portion of your path with /home/your\_username/, then it should work just fine.

---

<div class="post-metadata">

**Author:** ![Xinyan\_Wang](https://avatars.discourse-cdn.com/v4/letter/x/48db29/32.png) [@Xinyan\_Wang](https://openmc.discourse.group/u/Xinyan_Wang)\
**Post date:** [May 29, 2014, 8:25am UTC](https://openmc.discourse.group/t/cross-sections-environment-variable-absolute-path/71/7 "2014-05-29T08:25:54Z")

</div>

It works, thanks!  
Sorry for replying you late. Google group is blocked in China. So to use Google group, I have to switch back to Windows and launch VPN.

---

<div class="post-metadata">

**Author:** ![Adam\_Nelson](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Adam\_Nelson](https://openmc.discourse.group/u/Adam_Nelson)\
**Post date:** [May 29, 2014, 10:35am UTC](https://openmc.discourse.group/t/cross-sections-environment-variable-absolute-path/71/8 "2014-05-29T10:35:32Z")

</div>

Great! Glad to hear it!
