Installation

Choose your platform:

Install on Linux

  1. Clone the repository:

    git clone --recursive git@github.com:plasmonX/plasmonX.git
    
  2. Install python:

    2.1. If you are on a local system, the suggested option is to install python and all the requirements by:

    sudo apt update
    sudo apt install python3 python3-pip
    
    pip3 install -r python/requirements.txt
    

    2.2. Alternatively, use conda:

    conda env create -f python/requirements.yaml
    conda activate plasmonX-env
    

    If you don’t have conda, you can install Miniconda with [do not run it into plasmonX folder]:

    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
    bash Miniconda3-latest-Linux-x86_64.sh
    source ~/.bashrc
    
  3. Install gfortran [tested versions: 9 - 13]

    sudo apt-get install gfortran
    
  4. Install Lapack and BLAS:

    sudo apt-get install libblas-dev liblapack-dev
    

    Suggested for better performance: Install MKL. Follow the instructions at the link.

  5. Install CMake [minumum version required: 3.15]

    sudo apt-get install cmake
    
  6. Run setup.sh [see Configuration with setup.sh for available options]

    ./setup.sh -omp -b BUILD_DIR
    
  7. Compile the code

    cd BUILD_DIR
    make -j
    
  8. Run the tests [Please, avoid the -j option]

    ctest
    

Install on macOS

  1. Clone the repository:

    git clone --recursive git@github.com:plasmonX/plasmonX.git
    
  2. Install python:

    2.1. If you are on a local system, the suggested option is to install python and all the requirements by:

    brew install python
    
    pip3 install -r python/requirements.txt
    

    If you need to install Homebrew [do not run it into plasmonX folder]:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    

    On Apple Silicon systems, you may need to add Homebrew to your shell environment:

    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
    

    2.2. Alternatively, use conda:

    conda env create -f python/requirements.yaml
    conda activate plasmonX-env
    

    If you don’t have conda, you can install Miniconda with [do not run it into plasmonX folder]:

    curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
    bash Miniconda3-latest-MacOSX-x86_64.sh
    source ~/.bash_profile
    
  3. Install gfortran [tested versions: 9 - 13]

    brew install gcc
    
  4. Install CMake [minimum version required: 3.15]

    brew install cmake
    
  5. Run setup.sh [see Configuration with setup.sh for available options]

    ./setup.sh -omp -b BUILD_DIR
    
  6. Compile the code

    cd BUILD_DIR
    make -j
    
  7. Run the tests [Please, avoid the -j option]

    ctest
    

Install on Windows

  1. Install Windows Subsystem for Linux (WSL) on Windows and a LTS version of Ubuntu (latest suggested). Follow the instructions here.

  2. Once activated the Ubuntu UNIX terminal, edit the file /etc/wsl.conf by inserting:

    [automount]
    options = "metadata"
    
  3. Follow the instructions Install on Linux using option 2.2.

Configuration with setup.sh

The compilation of plasmonX is configured using the helper script setup.sh.

Basic usage:

PATH_TO_PLASMONX/setup.sh [-h] [-b build_dir] [-bt build_type] [-fc fortran_compiler] [-omp yes|no]

The setup.sh script supports the following options:

Option

Required

Description

-b

Optional

Build directory. Default: build

-bt

Optional

Build type: Release, Debug, Warning Default: Release

-fc

Optional

Fortran compiler executable (default: gfortran)

-omp

Optional

Enable OpenMP support: yes or no (default: yes)

-h

Optional

Print the help message

The selected build type controls the compiler flags passed to CMake via CMAKE_BUILD_TYPE:

Build type

Enabled compilation options

Release

High optimization (-O3), loop unrolling, architecture-specific optimizations

Warning

Moderate optimization (-O2) with extended compiler warnings enabled

Debug

No optimization (-O0), debug symbols, runtime checks, bounds checking, variable initialization

The exact compiler flags depend on the Fortran compiler (GNU or Intel) and are defined internally in the CMake configuration (CMakeLists.txt).