In order to use provided python utils package it is stronlgy recommended to use Anaconda package.


Clone this project along with nanocpp-src to your local workstation.

$ git clone
$ git clone

The nanocpp-src folder contains all core functionality of the NANOCPP code, which written in C++.

The nanocpp-utils contains two folders: utils and examples. Utils folder provides an auxiliary python functions you may need. The examples folder contains all executable examples from this tutotial.


Since NANOCPP has been written on C++, you need C++ language compiler along with MPI. In case you are using workstation provided bu KAUST , it is recommend to add the following strings to your .bashrc file

export mgcc='gcc/8.3.0/gcc-7.4.0-pemb2ot'
export mmpi='mpich/3.3/gcc-5.4.0-l4j7i4b'
export NANOCPP_SOURCE="path-to/nanocpp-src"
export NANOCPP_UTILS="path-to/nanocpp-extras/utils"

in order to specify right gcc-mpi combination. Please make sure to substitute “path-to” with your actual path.

After you have completed this step, you can compile C++ source code by typing

make clean

Now you’re ready to launch simulations and start the other tutorials. The NANOCPP FIRST SIM is the most common starting point, and provides the basic functions needed run FDTD simulations with the NANOCPP package.

  • NANOCPP FIRST SIM: the tutorial covers basic functionalities of NANOCPP package.
  • NANOCPP UTILS: the tutorial covers auxillary python wrapping libraries.
  • DISPERSION: the tutorial covers basic usage of dispersion in NANOCPP simulations.

Note: remember to recompile with make clean every time a change is made in compilation parameters in input.txt.

PYTHON SETTING (Ananconda users)

It is recommend to create a separate virtual environment for this tasks. To do that, simply create an environment from provided ‘prima.yml’ file by typing

conda env create -f prima.yml

in your shell. The final step is to add utils folder to the PYTHONPATH variable: