CROSS_SECTIONS environment variable absolute path

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!

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

>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):

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

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

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!

my_path.jpg

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.

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.

Great! Glad to hear it!