DFTD4 problem 2026.1 version

34 views
Skip to first unread message

Hehe

unread,
Mar 31, 2026, 3:30:06 AM (5 days ago) Mar 31
to cp2k
Hi all, 
           Before going on the details of the installation, i had a problem with using DFTD4 on HPC slurm cluster.
 
D4_input.png
I get a bunch of 

#0  0x14c26f63fc2f in ???

#1  0x0 in ???

and

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.


Backtrace for this error:

==== backtrace (tid: 155441) ====

 0 0x000000000003fc30 __GI___sigaction()  :0

=================================

and 

Caught signal 11 (Segmentation fault: address not mapped to object at address (nil))

I commented out the VDW potential and it worked fine. No issues in my slurm.

so i tried:

DFTD4_work.png

This worked completely fine as well. Pretty fast as well.

I wonder if my DFTD4 build is the problem? or the openMPI incompatibility with DFTD4?

-----

Details of installation 

Cluster available modules 

module load gcc/11.3.0
module load openmpi/4.1.4-gcc-11.3.0
module load openblas/0.3.20-gcc-11.3.0
module load flexiblas/3.2.0-gcc-11.3.0
module load fftw/3.3.10-gcc-11.3.0
module load scalapack/2.2.0-gompi-2022a-fb
module load cmake/3.24.3-gcccore-11.3.0
module load ninja/1.10.2-gcccore-11.3.0
module load libxsmm/1.17-gcc-11.3.0
module load libint/2.7.2-gcc-11.3.0-lmax-6-cp2k
module load libvori/220621-gcccore-11.3.0

full details of rest below. As an aside, i tested some inp files and the single point energies were fine. ran the regtest.py and tests in bin and they did not point any issues.

dbcsr, dftd4, tblite,libxc,cp2k 

git clone --recursive https://github.com/cp2k/dbcsr.git

cmake -S dbcsr -B dbcsr/build -GNinja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX="$CP2K_PREFIX/deps/dbcsr" \
  -DUSE_MPI=ON \
  -DUSE_OPENMP=ON \
  -DUSE_SMM=blas \
  -DBUILD_TESTING=OFF

cmake --build dbcsr/build -j 16
cmake --install dbcsr/build

git clone --branch v3.7.0 https://github.com/dftd4/dftd4.git dftd4

export CC=gcc
export FC=gfortran
cmake -S "$BUILDROOT/dftd4" -B "$BUILDROOT/dftd4/build" -GNinja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX="$CP2K_PREFIX/deps/dftd4" \
  -DBLA_VENDOR=OpenBLAS \
  -DBLAS_LIBRARIES=/sw/auto/rocky9a/epyc3/software/OpenBLAS/0.3.20-GCC-11.3.0/lib/libopenblas.so \
  -DLAPACK_LIBRARIES=/sw/auto/rocky9a/epyc3/software/OpenBLAS/0.3.20-GCC-11.3.0/lib/libopenblas.so

cmake --build "$BUILDROOT/dftd4/build" -j 16
cmake --install "$BUILDROOT/dftd4/build"

git clone --branch v0.5.0 https://github.com/tblite/tblite.git

export CC=gcc
export FC=gfortran
cmake -S "$BUILDROOT/tblite" -B "$BUILDROOT/tblite/build" -GNinja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX="$CP2K_PREFIX/deps/tblite" \
  -DBLA_VENDOR=OpenBLAS \
  -DBLAS_LIBRARIES=/sw/auto/rocky9a/epyc3/software/OpenBLAS/0.3.20-GCC-11.3.0/lib/libopenblas.so \
  -DLAPACK_LIBRARIES=/sw/auto/rocky9a/epyc3/software/OpenBLAS/0.3.20-GCC-11.3.0/lib/libopenblas.so

cmake --build "$BUILDROOT/tblite/build" -j 16
cmake --install "$BUILDROOT/tblite/build"


git clone --branch 7.0.0 https://gitlab.com/libxc/libxc.git libxc-7.0.0

cd "$BUILDROOT"
export CC=gcc
export FC=gfortran
cmake -S "$BUILDROOT/libxc-7.0.0" -B "$BUILDROOT/libxc-7.0.0/build" -GNinja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX="$CP2K_PREFIX/deps/libxc" \
  -DBUILD_SHARED_LIBS=ON \
  -DENABLE_FORTRAN=ON

cmake --build "$BUILDROOT/libxc-7.0.0/build" -j 16
cmake --install "$BUILDROOT/libxc-7.0.0/build"

git clone --branch v2026.1 https://github.com/cp2k/cp2k.git

export CC=mpicc
export CXX=mpicxx
export FC=mpifort

export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1

export PKG_CONFIG_PATH="$HOME/pkgconfig-fixes:$EBROOTLIBXSMM/lib:$CP2K_PREFIX/deps/libxc/lib/pkgconfig:$CP2K_PREFIX/deps/libxc/lib64/pkgconfig:$CP2K_PREFIX/deps/dftd4/lib/pkgconfig:$CP2K_PREFIX/deps/dftd4/lib64/pkgconfig:$CP2K_PREFIX/deps/tblite/lib/pkgconfig:$CP2K_PREFIX/deps/tblite/lib64/pkgconfig"


cmake -S "$BUILDROOT/cp2k" -B "$BUILDROOT/cp2k/build" -GNinja \
  -DCMAKE_BUILD_TYPE=Release \
  -DBUILD_SHARED_LIBS=OFF \
  -DCMAKE_INSTALL_PREFIX="$CP2K_PREFIX" \
  -DCMAKE_INSTALL_RPATH="$CP2K_PREFIX/deps/libxc/lib64;/sw/auto/rocky9a/epyc3/software/Libint/2.7.2-GCC-11.3.0-lmax-6-cp2k/lib;/sw/auto/rocky9a/epyc3/software/libxsmm/1.17-GCC-11.3.0/lib" \
  -DCMAKE_PREFIX_PATH="$CP2K_PREFIX/deps/dbcsr;$CP2K_PREFIX/deps/dftd4;$CP2K_PREFIX/deps/tblite;$CP2K_PREFIX/deps/libxc;$EBROOTLIBVORI;$EBROOTLIBINT" \
  -DCMAKE_MODULE_PATH="$CP2K_PREFIX/deps/dftd4/lib64/cmake/multicharge;$CP2K_PREFIX/deps/dftd4/lib64/cmake/dftd4" \
  -Dtblite_DIR="$CP2K_PREFIX/deps/tblite/lib64/cmake/tblite" \
  -Dtoml-f_DIR="$CP2K_PREFIX/deps/tblite/lib64/cmake/toml-f" \
  -DBLA_VENDOR=OpenBLAS \
  -DBLAS_LIBRARIES=/sw/auto/rocky9a/epyc3/software/OpenBLAS/0.3.20-GCC-11.3.0/lib/libopenblas.so \
  -DLAPACK_LIBRARIES=/sw/auto/rocky9a/epyc3/software/OpenBLAS/0.3.20-GCC-11.3.0/lib/libopenblas.so \
  -DCP2K_USE_MPI=ON \
  -DCP2K_USE_LIBXC=ON \
  -DCP2K_USE_DFTD4=ON \
  -DCP2K_USE_FFTW3=ON \
  -DCP2K_ENABLE_FFTW3_OPENMP_SUPPORT=ON \
  -DCP2K_USE_LIBXSMM=ON \
  -DCP2K_USE_VORI=ON \
  -DCP2K_USE_TBLITE=ON \
  -DCP2K_USE_LIBINT2=ON \
  -DCP2K_USE_SIRIUS=OFF \
  -DCP2K_USE_SPGLIB=OFF \
  -DCP2K_USE_ELPA=OFF \
  -DCP2K_USE_COSMA=OFF \
  -DCP2K_USE_SPLA_GEMM_OFFLOADING=OFF


Johann Pototschnig

unread,
Mar 31, 2026, 10:32:07 AM (5 days ago) Mar 31
to cp2k
The reference code is not MPI parallel, so it should take longer, but still run. 

Can you also test a run with 
REFERENCE_FUNCTIONAL r2SCAN

With _LIBXC I don't know what actually happens. 
The list of available parameters is under: 

Hehe

unread,
Apr 1, 2026, 1:12:17 AM (4 days ago) Apr 1
to cp2k
Hi Johann, 
                    Thanks for the swift reply. 
Yes, using REFERENCE_FUNCTIONAL r2SCAN worked. Not sure whats happening under the hood when libxc is invoked... but my calculation is running fine now :) 
Thanksss

Kind regards,
hehe
Reply all
Reply to author
Forward
0 new messages