Image size: 5.5 GB

For more on pulling from the registry, see the ilifu documentation.

First, once: add the registry and make it your default

singularity remote add --no-login idia-registry https://sregistry.idia.ac.za
singularity remote use idia-registry

If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.

Log in, for a private collection

singularity remote login idia-registry

Paste a token from your token page when asked. Public collections need no login.

Pull the container

singularity pull library://sharc/sharc:v4.1-2026-11-03

Shell into the container

singularity shell library://sharc/sharc:v4.1-2026-11-03

Run the container

singularity run library://sharc/sharc:v4.1-2026-11-03

First, once: add the registry and make it your default

apptainer remote add --no-login idia-registry https://sregistry.idia.ac.za
apptainer remote use idia-registry

If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.

Log in, for a private collection

apptainer remote login idia-registry

Paste a token from your token page when asked. Public collections need no login.

Pull the container

apptainer pull library://sharc/sharc:v4.1-2026-11-03

Shell into the container

apptainer shell library://sharc/sharc:v4.1-2026-11-03

Run the container

apptainer run library://sharc/sharc:v4.1-2026-11-03
SHARC 4.1 with OpenMolcas v25.10.
Bootstrap: docker
From: ubuntu:24.04

%help
    SHARC 4.1 with OpenMolcas v25.10.

%labels
    Maintainer IDIA <support@ilifu.ac.za>

%environment
    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8
    export PATH=/opt/miniconda/envs/sharc4.1/bin:$PATH
    export SHARC=/opt/sharc4
    export SHARCLIB=/opt/sharc4/lib
    export PATH=$SHARC/bin:$PATH
    export LD_LIBRARY_PATH=/opt/miniconda/envs/sharc4.1/lib:$LD_LIBRARY_PATH
    export PYTHONPATH=/opt/sharc4/lib:/opt/sharc4/pysharc:$PYTHONPATH
    export MOLCAS=/opt/OpenMolcas
    export PATH=/opt/OpenMolcas:$PATH

%post
    set -e
    export DEBIAN_FRONTEND=noninteractive
    export CONDA_PLUGINS_AUTO_ACCEPT_TOS=true

    # 1. Install system dependencies
    apt-get update && apt-get install -y \
        wget \
        git \
        build-essential \
        gfortran \
        libblas-dev \
        liblapack-dev \
        libfftw3-dev \
        make \
        ca-certificates \
        gnuplot \
        python3-pyparsing \
        libopenblas64-0-openmp \
        libhdf5-dev \
        cmake \
        cmake-curses-gui \
        && rm -rf /var/lib/apt/lists/*

    # 2. Install Miniconda
    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh
    bash /tmp/miniconda.sh -b -p /opt/miniconda
    rm /tmp/miniconda.sh

    export PATH=/opt/miniconda/bin:$PATH

    # 3. Create the SHARC 4.1 Conda environment
    conda create -n sharc4.1 -y -c conda-forge \
        python=3.12 \
        numpy=2.2 \
        scipy=1.15 \
        h5py \
        matplotlib \
        pyparsing \
        netcdf4 \
        gfortran_linux-64 \
        pyscf \
        openmm \
        numba \
        sympy \
        pyyaml \
        pytorch \
        pytest \
        ase \
        opt_einsum \
        threadpoolctl \
        pip \
        joblib

    # 4. Activate environment for subsequent installations
    . /opt/miniconda/etc/profile.d/conda.sh
    conda activate sharc4.1

    # 5. Install machine learning interfaces and optional python tools
    pip install schnetpack==1.0.1
    git clone https://github.com/schnarc/SchNarc.git
    cd SchNarc && pip install . && cd ..
    rm -rf SchNarc

    pip install tequila-basic qulacs promdens parmed

    # 6. Clone SHARC 4 repository
    cd /opt
    git clone https://github.com/sharc-md/sharc4.git sharc4
    cd sharc4

    # Configure Makefile for GNU toolchain
    sed -i 's/USE_COMPILER\s*:=\s*intel/USE_COMPILER := gnu/g' source/Makefile
    sed -i 's/USE_LIBS\s*:=\s*mkl/USE_LIBS := gnu/g' source/Makefile

    # Enable PySharc & NetCDF support
    sed -i 's/USE_PYSHARC\s*:=\s*false/USE_PYSHARC := true/g' source/Makefile || true
    sed -i 's/USE_PYSHARC\s*=\s*false/USE_PYSHARC = true/g' source/Makefile || true

    # Patch data_extractor_NetCDFmodule.f90 for strict gfortran rules
    cd source
    if [ -f data_extractor_NetCDFmodule.f90 ]; then
        sed -i 's/laser_b\s*==\s*\.false\./laser_b .eqv. .false./g' data_extractor_NetCDFmodule.f90
        sed -i 's/laser_egrad\s*==\s*\.false\./laser_egrad .eqv. .false./g' data_extractor_NetCDFmodule.f90
        sed -i 's/laser_e\s*==\s*\.true\./laser_e .eqv. .true./g' data_extractor_NetCDFmodule.f90
    fi
    cd ..

    # 7. Compile PySharc and main binaries
    export PYTHONPATH=/opt/sharc4/lib:/opt/sharc4/pysharc:$PYTHONPATH
    cd pysharc
    make install
    cd ../source
    make install

    # 8. Link binaries, tests directory, and register PySharc package path
    cd /opt/sharc4
    ln -sf bin/* .
    ln -s /opt/sharc4/tests /opt/tests
    ln -sfn /opt/sharc4/pysharc /opt/miniconda/envs/sharc4.1/lib/python3.12/site-packages/pysharc

    # 9. Clone and Build OpenMolcas
    cd /opt
    git clone https://gitlab.com/Molcas/OpenMolcas.git OpenMolcas
    cd OpenMolcas
    git checkout v25.10
    mkdir build && cd build
    export CMAKE_POLICY_VERSION_MINIMUM=3.5
    cmake -D LINALG=Manual -D LINALG_LIBRARIES=/usr/lib/x86_64-linux-gnu/libopenblas64.so.0 -DCMAKE_INSTALL_PREFIX=/opt/OpenMolcas ..
    make -j"$(nproc)"
    make install
    cd /opt

%runscript
    exec "$@"
Download sharc-sharc_v4.1-2026-11-03.def
#!/bin/sh

    exec "$@"
# /.singularity.d/env/10-docker2singularity.sh
#!/bin/sh
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# /.singularity.d/env/90-environment.sh
#!/bin/sh
# Custom environment shell code should follow


    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8
    export PATH=/opt/miniconda/envs/sharc4.1/bin:$PATH
    export SHARC=/opt/sharc4
    export SHARCLIB=/opt/sharc4/lib
    export PATH=$SHARC/bin:$PATH
    export LD_LIBRARY_PATH=/opt/miniconda/envs/sharc4.1/lib:$LD_LIBRARY_PATH
    export PYTHONPATH=/opt/sharc4/lib:/opt/sharc4/pysharc:$PYTHONPATH
    export MOLCAS=/opt/OpenMolcas
    export PATH=/opt/OpenMolcas:$PATH