# Simulating the Schrödinger wave equation using the Crank-Nicolson method in 2+1 dimensions

[Gitea repo](https://gitea.balaton.dev/FYS3150/Project-5)

[GitHub repo](https://github.uio.no/FYS3150-G2-2023/Project-5)

[Documentation](https://pages.github.uio.no/FYS3150-G2-2023/Project-5/)

![Double slit animation](./images/animation.gif)

## Requirements

### Operating systems

- Linux
  - Has been tested on [Fedora 38](https://fedoraproject.org/)
  - Will most likely work on other Linux distributions
- macOS
  - Will most likely not work due to the use of getopt, which is GNU specific.
- Windows
  - Will most likely not work

### Libraries

- Python
  - [matplotlib](https://matplotlib.org/)
  - [numpy](https://numpy.org/)
  - [seaborn](https://seaborn.pydata.org/)

- C++
  - [Armadillo](https://arma.sourceforge.net/)

## Compiling

The commands shown here should be run from the root of this project.

### Normal binaries

Compiling regular binaries is as easy as running this command:

```shell
    make
```

The binaries will then be inside the **bin** directory.

### Debugging binaries

If you want to debug the code, then use this command:

```shell
    make debug
```

The binaries will then be inside the **debug** directory.

## Running programs

### C++ binaries

To run any of the programs, just use the following command:

```shell
    ./<bin|debug>/<program-name> <args>
```

For the **wave_simulation** program, you can use a file where each line contains
a configuration for the WaveSimulation class and what to output to a file.
This different values should be separated by semicolons. 
Here is the order of what variables should be in one line:

    h; dt; T; x_c; y_c; sigma_x; sigma_y; p_x; p_y; <thickness; pos_x; ap_sep; ap; slits>; <write_each step || the steps to write to file>

where <> is optional.

An example of a file can be found under the args directory.

### Python scripts

#### Install libraries

Before running the scripts, make sure that all libraries are installed.
Using pip, you can install all requirements like this:

```shell
    pip install -r requirements.txt
```

This recursively install all the packages that are listed in **requirements.txt**.

#### Running scripts

For the Python scripts, run them from the root of the project:

```shell
    python python_scripts/<script-name>
```

If you have any problems running the scripts, you might have to run this instead:

```shell
    python3 python_scripts/<script-name>
```

## Credits

The Doxygen theme used here is
[doxygen-awesome-css](https://github.com/jothepro/doxygen-awesome-css).
