How to Set Environment Variables for Tutorial Scripts

by Pasquale Pavone for exciting carbon

Purpose: Here, it will be explained how to set those environment variables which are needed for running examples presented in the tutorials. Furthermore, some general information is given about the scripts that are used in exciting tutorials.


0. Did you already download exciting?


1. Setting environment variables

The next instructions have to be executed only once before starting your first tutorial!

Very important: Before starting, the following environment variable must be set by the user

  • EXCITINGROOT = Directory where exciting has been downloaded, e.g.: /home/tutorials/exciting .

Furthermore, one can define the following optional environment variable

  • EXCITINGRUNDIR = Scratch directory used for running calculation by some exciting scripts. Example of definition: /home/tmpdir . If this variable is not defined, a running directory called xc-rundir will be created inside the directory where the scripts are executed.

The above variables are used to define other environment variables

  • EXCITINGBIN = Path to the exciting executable files, defined as $EXCITINGROOT/bin .
  • EXCITINGSCRIPTS = Directory where the tutorial scripts are located, defined as $EXCITINGROOT/tools .
  • EXCITINGSTM = Directory containing the STM scripts, defined as $EXCITINGSCRIPTS/stm .
  • EXCITINGVISUAL = Directory containing several visualization templates.
  • EXCITINGCONVERT = Directory containing several conversion templates.
  • TIMEFORMAT = Output format for writing on the screen the running elapsed time, used in some script.

The setting of these variables can be done in a bash shell. In order to do this, edit the ~/.bashrc file in your $HOME directory (or create the file if it does not exist yet). Then, append the following lines to the ~/.bashrc file.

#=====================================================================================
# The following shell variables are needed for executing scripts in exciting tutorials
# 
export EXCITINGROOT=/home/tutorials/exciting
export EXCITINGBIN=$EXCITINGROOT/bin
export EXCITINGRUNDIR=
export EXCITINGSCRIPTS=$EXCITINGROOT/tools
export EXCITINGSTM=$EXCITINGSCRIPTS/stm
export EXCITINGVISUAL=$EXCITINGROOT/xml/visualizationtemplates
export EXCITINGCONVERT=$EXCITINGROOT/xml/inputfileconverter
#-------------------------------------------------------------------------------------
export TIMEFORMAT="   Elapsed time = %0lR"
#-------------------------------------------------------------------------------------
export WRITEMINMAX="1"
#-------------------------------------------------------------------------------------
export PYTHONPATH=$PYTHONPATH:$EXCITINGSTM
export PATH=$PATH:$EXCITINGSCRIPTS:$EXCITINGBIN:$EXCITINGSTM
#-------------------------------------------------------------------------------------
function DOS  () { xsltproc $EXCITINGVISUAL/xmldos2grace.xsl dos.xml > $1 ; }
function BAND () { xsltproc $EXCITINGVISUAL/xmlband2agr.xsl bandstructure.xml ; }
#=====================================================================================

Please note again: Explicit paths given above (such as /home/tutorials/exciting and /home/tmpdir) are only valid as examples which can be changed by the user to the appropriate ones. In order to activate changes, any time you modify the ~/.bashrc file, you have to start a new shell or source ~/.bashrc.

$ source ~/.bashrc

If you have already used previous versions of exciting: You have probably some environmental variables defined inside your ~/.bashrc file. In this case, you must delete the old definitions before setting the new ones. In order to apply correctly the new settings you have to log out your account and enter it again.

Remark on the species files directory in exciting: It is not possible to define the directory containing the species files by linking directly to the exciting-code site.


2. Tutorial scripts

All the scripts used in the exciting tutorials can be found in the directory $EXCITINGROOT/tools.

General classification of script types
  • SETUP-xxxxxx.py: Python scripts for preparing appropriate input files for exciting calculations.
  • EXECUTE-xxxxxx.sh: (Bash) shell scripts for running exciting calculations.
  • CHECKFIT-xxxxxx.py: Python scripts used for post-processing results of exciting calculations.
  • OPTIMIZE-xxxxxx.xx: Scripts used for lattice optimization.
  • ElaStic@exciting-xxxxxx.xx: Scripts which use the ElaStic tool.
  • STRESS-exciting-xxxxxx.xx: Scripts which use the STRESS-exciting tool.
  • PLOT-xxxxxx.py: Python visualization tools.
  • PLOT-xxxxxx.gnu: Gnuplot visualization tools.
Minimal requirements for running tutorial scripts
  • Bash shell
  • Python 2.6.6
  • Matplotlib 0.99.3
  • Gnuplot 4.4
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License