Skip to navigation

Install

View as MarkdownOpen in Claude

The container NVIDIA distributes does not include VASP binaries, source code, or any of the pseudopotential files (POTCARs) required to run VASP calculations. Follow the instructions below to add them to the webservice.

Building the Container

Start by acquiring the two components needed to build the container:

  1. The Dockerfile that adds VASP to the webservice container.

    The Dockerfile starts from the container provided through NGC, then builds VASP in the form that the webservice requires.

    Download Dockerfile
    Dockerfile.vasp
    # Dockerfile to build VASP inside the container containing the webservice
    ARG DEVEL_IMAGE="nvcr.io/nvidia/nvhpc:26.11-devel-cuda13.4-ubuntu24.04"
    ARG SERVICE_IMAGE="alchemi-vasp:latest"
    # Source only so we can copy a file out of the base image
    FROM ${SERVICE_IMAGE} AS base
    # Install the oneAPI MKL development package
    FROM ${DEVEL_IMAGE} AS oneapi
    USER root
    RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
    --mount=type=cache,target=/var/lib/apt,sharing=locked \
    set -eux; \
    apt update; \
    apt install -y gpg gpg-agent wget rsync; \
    wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null; \
    echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list; \
    apt update; \
    apt install -y --no-install-recommends intel-oneapi-mkl-devel=2026.0.0-908; \
    apt-get autoremove -y; \
    rm -rf /var/lib/apt/lists/*
    # Build the VASP image using the NVHPC development image as the base, with oneAPI libs copied in
    FROM oneapi AS build
    SHELL ["/bin/bash", "-o", "pipefail", "-c"]
    # Set the environment variables
    ARG VASP_TARGET_GPU="cc75,cc80,cc86,cc89,cc90,cc100,cc120,cuda13.4"
    ARG VASP_TARGET_CPU="x86-64-v3"
    ARG MAKE_JOBS="8"
    ARG VASP_ARCHIVE="vasp.6.6.0.tgz"
    # Optional: SHA-256 checksum of VASP_ARCHIVE. When set, the build fails if the
    # supplied archive does not match, guarding against a tampered or
    # wrong-version download from the VASP portal being baked into the image.
    ARG VASP_ARCHIVE_SHA256=""
    ENV VASP_TARGET_GPU=${VASP_TARGET_GPU} \
    VASP_TARGET_CPU=${VASP_TARGET_CPU}
    # Extract VASP and copy the build script
    WORKDIR /opt/vasp_build
    COPY ${VASP_ARCHIVE} /tmp/vasp.tar.gz
    COPY --from=base /opt/vasp_build/vasp/makefile.vasp.include /opt/vasp_build/vasp/run_vasp.sh ./
    RUN set -eux; \
    if [ -n "${VASP_ARCHIVE_SHA256}" ]; then \
    echo "${VASP_ARCHIVE_SHA256} /tmp/vasp.tar.gz" | sha256sum -c -; \
    else \
    echo "WARNING: VASP_ARCHIVE_SHA256 not set; skipping checksum verification of ${VASP_ARCHIVE}"; \
    fi
    RUN mkdir -p /opt/vasp_build/vasp; \
    tar --strip-components=1 -C /opt/vasp_build/vasp -xzf /tmp/vasp.tar.gz; \
    rm /tmp/vasp.tar.gz; \
    mv makefile.vasp.include /opt/vasp_build/vasp/makefile.include; \
    install -Dm0755 run_vasp.sh /usr/bin/vasp_std; \
    install -Dm0755 run_vasp.sh /usr/bin/vasp_gam; \
    install -Dm0755 run_vasp.sh /usr/bin/vasp_ncl; \
    cd /opt/vasp_build/vasp; \
    . /opt/intel/oneapi/setvars.sh; \
    make DEPS=1 -j "${MAKE_JOBS}" all
    # Set up the runtime container
    FROM ${SERVICE_IMAGE} AS runtime
    # Install the oneapi runtime
    USER root
    RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
    --mount=type=cache,target=/var/lib/apt,sharing=locked \
    set -eux; \
    apt update; \
    apt install -y gpg gpg-agent wget rsync; \
    which gpg; \
    wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null; \
    echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list; \
    apt update; \
    apt install -y --no-install-recommends intel-oneapi-mkl; \
    apt autoremove -y; \
    rm -rf /var/lib/apt/lists/*
    # Configure the environment variables
    ARG APP_USER="appuser"
    ARG APP_UID="1001"
    ARG APP_GID="1001"
    ENV APP_USER=${APP_USER} \
    APP_UID=${APP_UID} \
    APP_GID=${APP_GID} \
    ALCHEMI_VASP_CMD=/usr/bin/vasp \
    ALCHEMI_VASP_PP_DIR=/opt/potcar \
    HOME=/home/${APP_USER} \
    USER=${APP_USER}
    # Get only the VASP binaries
    COPY --from=build /usr/bin/vasp_std /usr/bin/vasp_ncl /usr/bin/vasp_gam /usr/bin/
    COPY --from=build /opt/vasp_build/vasp/bin/ /opt/vasp_build/vasp/bin/
    # Make the groups and install the POTCAR directory with the right ownership and permissions
    RUN set -eux; \
    if ! getent group "${APP_GID}" >/dev/null; then groupadd --gid "${APP_GID}" "${APP_USER}"; fi; \
    if ! id -u "${APP_USER}" >/dev/null 2>&1; then \
    useradd --uid "${APP_UID}" --gid "${APP_GID}" --home-dir "${HOME}" \
    --create-home --shell /usr/sbin/nologin "${APP_USER}"; \
    fi; \
    install -d -m0755 -o "${APP_UID}" -g "${APP_GID}" /opt/potcar
    # Switch back to the user account
    USER ${APP_UID}:${APP_GID}
  2. The VASP 6.6 source code from the VASP portal as a .tar.gz file.

    Name the file vasp.6.6.0.tgz or change the name used during the Docker build process or set the name using the VASP_ARCHIVE build argument.

    Use the VASP_ARCHIVE_SHA256 build argument to assure the archive used in the container build matches the expected version.

Place all files in the same directory and then invoke the build command:

docker build \
-f Dockerfile.vasp \
-t alchemi-vasp:latest .

The Dockerfile uses a container that NVIDIA provides through NGC. It contains the code for the webservice, the NVIDIA HPC SDK compilers, and an optimized Makefile.

The alchemi-vasp container created by the build process contains licensed VASP material. It must not be shared outside the licensee’s research group or organization.

Hardware Optimization

The container supports many GPUs and uses only generic CPU instructions by default. Use the VASP_TARGET_CPU and VASP_TARGET_GPU build arguments to specify the target architectures the nvfortran compiler uses for CPU and GPU, respectively.

docker build \
--build-arg VASP_TARGET_CPU=host \
--build-arg VASP_TARGET_GPU=cc89,cuda13.1 \
-f Dockerfile.vasp \
--target base \
-t alchemi-vasp:latest .