Skip to content

Commit

Permalink
Install cp2k from conda-forge (#170)
Browse files Browse the repository at this point in the history
Installing CP2K from conda provides an easy way to change the CP2K version and
greatly reduces the size of the Dockerfile used for testing.

Using the `mamba` installer allows keeping the installation time low.
  • Loading branch information
yakutovicha authored Mar 27, 2024
1 parent 628febb commit f237e46
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
6 changes: 4 additions & 2 deletions .docker/cp2k-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ label: cp2k
computer: localhost
description:
default_calc_job_plugin: cp2k
filepath_executable: /usr/bin/cp2k
filepath_executable: /opt/conda/envs/cp2k/bin/cp2k.psmp
append_text:
prepend_text:
prepend_text: |
eval "$(command conda shell.bash hook 2> /dev/null)"
conda activate cp2k
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,19 @@ ARG AIIDA_VERSION=2.5.0

FROM aiidateam/aiida-core-with-services:${AIIDA_VERSION}


# To prevent the container to exit prematurely.
ENV KILL_ALL_RPOCESSES_TIMEOUT=50


USER root
# Install statically linked CP2K which is a considerably newer release than Debian builtin.
# The statically linked CP2K is a non-MPI binary, but we're running all tests with 1 MPI proc.
RUN set -ex ; \
apt-get update ; \
apt-get install -y --no-install-recommends openmpi-bin locate; \
wget --no-verbose -O /usr/bin/cp2k https://github.com/cp2k/cp2k/releases/download/v8.2.0/cp2k-8.2-Linux-x86_64.ssmp ; \
echo "1e6fccf901873ebe9c827f45fb29331f599772f6e6281e988d8956c7a3aa143c /usr/bin/cp2k" | sha256sum -c ; \
chmod +x /usr/bin/cp2k
apt-get install -y --no-install-recommends libsymspg1

USER aiida

RUN mamba create --yes -c conda-forge -n cp2k cp2k=9.1 && mamba clean --all -f -y

# Install aiida-cp2k plugin.
COPY --chown="${SYSTEM_UID}:${SYSTEM_GID}" . /home/aiida/aiida-cp2k
RUN pip install ./aiida-cp2k[dev,docs]
Expand Down
6 changes: 5 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

@pytest.fixture(scope="function")
def cp2k_code(aiida_local_code_factory):
return aiida_local_code_factory("cp2k", "cp2k")
return aiida_local_code_factory(
entry_point="cp2k",
executable="/opt/conda/envs/cp2k/bin/cp2k.psmp",
prepend_text='eval "$(command conda shell.bash hook 2> /dev/null)"\nconda activate cp2k\n',
)


@pytest.fixture(scope="function", autouse=True)
Expand Down

0 comments on commit f237e46

Please sign in to comment.