# Installation {#sec:installation}

## TL;DR

Type the following in the MATLAB shell

``` bash
cd src
makeRESCU -agreeToLicense y
```

and copy `license.lic` from the
[portal](https://portal.nanoacademic.com/) in
`$HOME/.nanoacademic/RESCU`.

## Walk-through

In this section, I describe the installation procedure of RESCU in the
MATLAB environment. Start a MATLAB session and change the current
directory to the root of the RESCU package. Before doing anything, I
advise to save your current MATLAB path

``` matlab
savepath folderName/pathdef.m
```

and then clear the MATLAB path using the `restoredefaultpath` command as
shown in `matRestorepath`{.interpreted-text role="numref"}.

<figure>
<img src="figs/matRestorepath.PNG" id="matRestorepath"
alt="figs/matRestorepath.PNG" />
<figcaption>Clean MATLAB path.</figcaption>
</figure>

This prevents name space conflicts with other codes. There are five
directories in the RESCU package directory:

1.  `bin` RESCU binary.
2.  `doc` RESCU documentation.
3.  `examples` Input file examples.
4.  `license` License files.
5.  `src` RESCU source code.

Go to the `src` directory and type `makeRESCU` to install RESCU (as in
`matmakeRESCU`{.interpreted-text role="numref"}).

<figure>
<img src="figs/matMakeRESCU.PNG" id="matmakeRESCU"
alt="figs/matMakeRESCU.PNG" />
<figcaption>Build RESCU.</figcaption>
</figure>

The *End User License Agreement* will be displayed and you will be
prompted to accept the agreement. You can directly notify RESCU of your
agreement by typing `makeRESCU -agreeToLicense y`.

:::: warning
::: title
Warning
:::

makeRESCU will try to add RESCU permanently to the MATLAB path, but you
may not have the permissions to do that. MATLAB path management is
explained
[here](https://www.mathworks.com/help/matlab/matlab_env/what-is-the-matlab-search-path.html)
or you can simply type `addpath /path/to/rescu/src` when launching
MATLAB.
::::

RESCU is now built and needs to be activated. To activate RESCU, sign up
or sign in your account on the [Nanoacademic
portal](portal.nanoacademic.com). Go to the product section and click on
RESCU. Then click on the `Start Your Free Trial` button and you should
see a panel like `act_instruct`{.interpreted-text role="numref"}

<figure>
<img src="figs/act_instruct.PNG" id="act_instruct"
alt="figs/act_instruct.PNG" />
<figcaption>Generate RESCU license.</figcaption>
</figure>

Download the file `license.lic` by clicking the download link and copy
it in the directory `$HOME/.nanoacademic/RESCU`. Alternatively, you may
copy it anywhere and set the environment variable `RESCU_LICENSE_PATH`
as, say

``` shell
export RESCU_LICENSE_PATH=/home/vincentm/licenses/license.lic
```

You can finally check that RESCU works properly by running one of the
input files in the `examples` directory. For example,

``` matlab
rescu -i al_lcao_scf.input
```

:::: warning
::: title
Warning
:::

You may have to modify the input file to let RESCU know where are the
required pseudopotential files.
::::

:::: note
::: title
Note
:::

Instructions on more advanced configurations, including LAN and parallel
installations are found in `sec:advancedinstallation`{.interpreted-text
role="ref"}.
::::
