Skip to content

Commit 4a8509d

Browse files
authored
CP2K reframe config and patch for 2024.3 (#156)
Add `reframe.yaml`, and patch version 2024.3 with cp2k/cp2k#3688.
1 parent c7a6a05 commit 4a8509d

File tree

5 files changed

+162
-0
lines changed

5 files changed

+162
-0
lines changed

Diff for: recipes/cp2k/2024.3/gh200/extra/reframe.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
develop:
2+
features:
3+
- cp2k-dev
4+
- cuda
5+
- mpi
6+
cc: mpicc
7+
cxx: mpic++
8+
ftn: mpifort
9+
views:
10+
- develop
11+
modules:
12+
features:
13+
- cp2k-dev
14+
- cuda
15+
- mpi
16+
cc: mpicc
17+
cxx: mpic++
18+
ftn: mpifort
19+
views:
20+
- modules
21+
activation:
22+
- module load cmake cosma costa cray-mpich cuda dbcsr elpa fftw gcc hdf5 libint libxc netlib-scalapack ninja openblas plumed sirius spfft spglib spla tiled-mm
23+
run:
24+
features:
25+
- cp2k
26+
- cuda
27+
- mpi
28+
cc: mpicc
29+
cxx: mpic++
30+
ftn: mpifort
31+
views:
32+
- cp2k
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
diff --git a/src/qs_dispersion_d4.F b/src/qs_dispersion_d4.F
2+
index 74df989b4..e513ed435 100644
3+
--- a/src/qs_dispersion_d4.F
4+
+++ b/src/qs_dispersion_d4.F
5+
@@ -26,6 +26,7 @@ MODULE qs_dispersion_d4
6+
#endif
7+
USE kinds, ONLY: dp
8+
USE particle_types, ONLY: particle_type
9+
+ USE periodic_table, ONLY: get_ptable_info, ptable
10+
USE qs_dispersion_types, ONLY: qs_dispersion_type
11+
USE qs_force_types, ONLY: qs_force_type
12+
USE message_passing, ONLY: mp_para_env_type
13+
@@ -76,7 +77,8 @@ CONTAINS
14+
TYPE(structure_type) :: mol
15+
TYPE(realspace_cutoff) :: cutoff
16+
17+
- INTEGER :: iatom, natom, ind_atom
18+
+ LOGICAL :: found
19+
+ INTEGER :: iatom, natom, ind_atom, zatom
20+
INTEGER, ALLOCATABLE, DIMENSION(:) :: el_num
21+
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: gradient, xyz
22+
REAL(KIND=dp), DIMENSION(3, 3) :: stress
23+
@@ -94,7 +96,9 @@ CONTAINS
24+
DO iatom = 1, natom
25+
xyz(:, iatom) = particle_set(iatom)%r(:)
26+
CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
27+
- el_num(iatom) = ikind
28+
+ CALL get_ptable_info(particle_set(iatom)%atomic_kind%element_symbol, &
29+
+ ielement=zatom, found=found)
30+
+ el_num(iatom) = zatom
31+
END DO
32+
33+
!get information about cell / lattice
34+
@@ -125,7 +129,7 @@ CONTAINS
35+
IF (para_env%num_pe > 1 .AND. para_env%mepos > 0) virial = 0.00_dp
36+
END IF
37+
DO iatom = 1, natom
38+
- ikind = el_num(iatom)
39+
+ CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
40+
ind_atom = atom_of_kind(iatom)
41+
force(ikind)%dispersion(:, ind_atom) = force(ikind)%dispersion(:, ind_atom) + gradient(:, iatom)
42+
END DO
43+
diff --git a/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES b/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES
44+
index 047421204..c817677df 100644
45+
--- a/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES
46+
+++ b/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES
47+
@@ -3,7 +3,7 @@
48+
# e.g. 0 means do not compare anything, running is enough
49+
# 1 compares the last total energy in the file
50+
# for details see cp2k/tools/do_regtest
51+
-pbe_dftd4.inp 33 1.0E-14 -0.00141644869634
52+
+pbe_dftd4.inp 33 1.0E-14 -0.00283102230260
53+
pbe_dftd4_force.inp 72 1.0E-07 0.00007217
54+
-pbe_dftd4_stress.inp 31 1.0E-07 -5.16289312880E-03
55+
+pbe_dftd4_stress.inp 31 1.0E-07 -2.14003785359E-02
56+
#EOF

Diff for: recipes/cp2k/2024.3/gh200/repo/packages/cp2k/package.py

+9
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage):
5959
version("7.1", sha256="ccd711a09a426145440e666310dd01cc5772ab103493c4ae6a3470898cd0addb")
6060
version("master", branch="master", submodules="True")
6161

62+
# depends_on("c", type="build") # generated
63+
# depends_on("cxx", type="build") # generated
64+
# depends_on("fortran", type="build") # generated
65+
6266
variant("mpi", default=True, description="Enable MPI support")
6367
variant("openmp", default=True, description="Enable OpenMP support")
6468
variant(
@@ -358,13 +362,18 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage):
358362
# These patches backport 2023.x fixes to previous versions
359363
patch("backport_avoid_null_2022.x.patch", when="@2022.1:2022.2 %aocc@:4.0")
360364
patch("backport_avoid_null_9.1.patch", when="@9.1 %aocc@:4.0")
365+
361366
patch("cmake-fixes-2023.2.patch", when="@2023.2 build_system=cmake")
362367

363368
# Allow compilation with build_type=RelWithDebInfo and build_type=MinSizeRel
364369
# after NDEBUG support was dropped in https://github.com/cp2k/cp2k/pull/3172
365370
# The patch applies https://github.com/cp2k/cp2k/pull/3251 to version 2024.1
366371
patch("cmake-relwithdebinfo-2024.1.patch", when="@2024.1 build_system=cmake")
367372

373+
# Bugfix for D4 dispersion correction in CP2K 2024.3
374+
# https://github.com/cp2k/cp2k/issues/3688
375+
patch("d4-dispersion-bugfix-2024.3.patch", when="@2024.3")
376+
368377
# Patch for an undefined constant due to incompatible changes in ELPA
369378
@when("@9.1:2022.2 +elpa")
370379
def patch(self):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
diff --git a/src/qs_dispersion_d4.F b/src/qs_dispersion_d4.F
2+
index 74df989b4..e513ed435 100644
3+
--- a/src/qs_dispersion_d4.F
4+
+++ b/src/qs_dispersion_d4.F
5+
@@ -26,6 +26,7 @@ MODULE qs_dispersion_d4
6+
#endif
7+
USE kinds, ONLY: dp
8+
USE particle_types, ONLY: particle_type
9+
+ USE periodic_table, ONLY: get_ptable_info, ptable
10+
USE qs_dispersion_types, ONLY: qs_dispersion_type
11+
USE qs_force_types, ONLY: qs_force_type
12+
USE message_passing, ONLY: mp_para_env_type
13+
@@ -76,7 +77,8 @@ CONTAINS
14+
TYPE(structure_type) :: mol
15+
TYPE(realspace_cutoff) :: cutoff
16+
17+
- INTEGER :: iatom, natom, ind_atom
18+
+ LOGICAL :: found
19+
+ INTEGER :: iatom, natom, ind_atom, zatom
20+
INTEGER, ALLOCATABLE, DIMENSION(:) :: el_num
21+
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: gradient, xyz
22+
REAL(KIND=dp), DIMENSION(3, 3) :: stress
23+
@@ -94,7 +96,9 @@ CONTAINS
24+
DO iatom = 1, natom
25+
xyz(:, iatom) = particle_set(iatom)%r(:)
26+
CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
27+
- el_num(iatom) = ikind
28+
+ CALL get_ptable_info(particle_set(iatom)%atomic_kind%element_symbol, &
29+
+ ielement=zatom, found=found)
30+
+ el_num(iatom) = zatom
31+
END DO
32+
33+
!get information about cell / lattice
34+
@@ -125,7 +129,7 @@ CONTAINS
35+
IF (para_env%num_pe > 1 .AND. para_env%mepos > 0) virial = 0.00_dp
36+
END IF
37+
DO iatom = 1, natom
38+
- ikind = el_num(iatom)
39+
+ CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
40+
ind_atom = atom_of_kind(iatom)
41+
force(ikind)%dispersion(:, ind_atom) = force(ikind)%dispersion(:, ind_atom) + gradient(:, iatom)
42+
END DO
43+
diff --git a/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES b/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES
44+
index 047421204..c817677df 100644
45+
--- a/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES
46+
+++ b/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES
47+
@@ -3,7 +3,7 @@
48+
# e.g. 0 means do not compare anything, running is enough
49+
# 1 compares the last total energy in the file
50+
# for details see cp2k/tools/do_regtest
51+
-pbe_dftd4.inp 33 1.0E-14 -0.00141644869634
52+
+pbe_dftd4.inp 33 1.0E-14 -0.00283102230260
53+
pbe_dftd4_force.inp 72 1.0E-07 0.00007217
54+
-pbe_dftd4_stress.inp 31 1.0E-07 -5.16289312880E-03
55+
+pbe_dftd4_stress.inp 31 1.0E-07 -2.14003785359E-02
56+
#EOF

Diff for: recipes/cp2k/2024.3/mc/repo/packages/cp2k/package.py

+9
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage):
5959
version("7.1", sha256="ccd711a09a426145440e666310dd01cc5772ab103493c4ae6a3470898cd0addb")
6060
version("master", branch="master", submodules="True")
6161

62+
# depends_on("c", type="build") # generated
63+
# depends_on("cxx", type="build") # generated
64+
# depends_on("fortran", type="build") # generated
65+
6266
variant("mpi", default=True, description="Enable MPI support")
6367
variant("openmp", default=True, description="Enable OpenMP support")
6468
variant(
@@ -358,13 +362,18 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage):
358362
# These patches backport 2023.x fixes to previous versions
359363
patch("backport_avoid_null_2022.x.patch", when="@2022.1:2022.2 %aocc@:4.0")
360364
patch("backport_avoid_null_9.1.patch", when="@9.1 %aocc@:4.0")
365+
361366
patch("cmake-fixes-2023.2.patch", when="@2023.2 build_system=cmake")
362367

363368
# Allow compilation with build_type=RelWithDebInfo and build_type=MinSizeRel
364369
# after NDEBUG support was dropped in https://github.com/cp2k/cp2k/pull/3172
365370
# The patch applies https://github.com/cp2k/cp2k/pull/3251 to version 2024.1
366371
patch("cmake-relwithdebinfo-2024.1.patch", when="@2024.1 build_system=cmake")
367372

373+
# Bugfix for D4 dispersion correction in CP2K 2024.3
374+
# https://github.com/cp2k/cp2k/issues/3688
375+
patch("d4-dispersion-bugfix-2024.3.patch", when="@2024.3")
376+
368377
# Patch for an undefined constant due to incompatible changes in ELPA
369378
@when("@9.1:2022.2 +elpa")
370379
def patch(self):

0 commit comments

Comments
 (0)