The deal.II Readme on interfacing to SLEPc
Keywords: deal.II

# Interfacing deal.II to SLEPc

SLEPc is a software package that provides functionality for solving a variety of eigenspectrum problems, both standard and generalised. It relies on various different sparse and dense matrix and vector formats that are defined in the PETSc package. Naturally, this means PETSc must be correctly installed before a working copy of SLEPc can be installed as described here.

deal.II has wrapper classes to the solver and spectral transformation parts of SLEPc that loosely provide almost the same interfaces as the wrapper classes to the PETSc functionality. They are used in a simple case in step-36.

#### Installing deal.II with SLEPc

SLEPc requires the environment variables `PETSC_DIR` and `PETSC_ARCH` to be set already and usually requires you to set the environment variable `SLEPC_DIR` as well. If the environment variable is set, then deal.II will pick up on this during configuration; just as before with PETSc.

Alternatively, the `-DSLEPC_DIR=DIR` option for `cmake` can be used to override the values of `SLEPc_DIR` if, for example, these environment variables are not set at all. You can also specify `-DDEAL_II_WITH_SLEPC=OFF` as a flag during configuration to have deal.II completely ignore a SLEPc installation.

#### Installing SLEPc

Note: The version numbers (x,y,z) of your SLEPc installation must be identical to the same version numbers of your PETSc installation.

Installing SLEPc is not much of a challenge once PETSc has been correctly installed (check this first!). What is happening here, is that SLEPc scans your PETSc installation and figures out how that was configured; its location, the given `PETSC_ARCH`, MPI settings, debug mode, and so on.

This builds a simple SLEPc installation:

    	tar xvzf slepc-x-y-z.tar.gz
            cd slepc-x-y-z
    	export SLEPC_DIR=`pwd`
    	export LD_LIBRARY_PATH=$SLEPC_DIR/$PETSC_ARCH/lib:$LD_LIBRARY_PATH
    	./configure
    	make

Now let SLEPc check his own sanity:

    	make test

will self-check the serial (and MPI) implementation of SLEPc.

Finally, you may want to put the two `export` commands above into your `~/.bashrc` or `~/.cshrc` files, with the first one replaced by

    	export SLEPC_DIR=/path/to/slepc-x-y-z

The `cmake` installation should then be able to pick up where you installed SLEPc and include it automatically in the deal.II build without any further need for instructions. You will see at the bottom of the `cmake` output if that is what actually happened.