(git:5e7fe52)
Loading...
Searching...
No Matches
rirs_grid_utils_unittest.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
9 USE kinds, ONLY: dp
12
13 IMPLICIT NONE
14
15 INTEGER :: n_candidates
16 REAL(kind=dp), ALLOCATABLE :: points(:, :)
17 TYPE(particle_type), DIMENSION(2), TARGET :: particles
18 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
19
20 particle_set => particles
21 particle_set(1)%r = [0.0_dp, 0.0_dp, 0.0_dp]
22 particle_set(2)%r = [2.0_dp, 0.0_dp, 0.0_dp]
23 ALLOCATE (points(3, 4))
24 points(:, :) = reshape([ &
25 0.0_dp, 0.0_dp, 0.0_dp, &
26 0.5_dp, 0.0_dp, 0.0_dp, &
27 1.0_dp, 0.0_dp, 0.0_dp, &
28 1.5_dp, 0.0_dp, 0.0_dp], [3, 4])
29
30 CALL initialize_rirs_grid(points, 2, 1, particle_set, n_candidates)
31 IF (n_candidates /= 3) error stop "incorrect RI-RS Voronoi candidate count"
32 IF (maxval(abs(points(:, 1) - [0.0_dp, 0.0_dp, 0.0_dp])) > 1.0e-14_dp) THEN
33 error stop "RI-RS maximin selection did not start at the origin"
34 END IF
35 IF (maxval(abs(points(:, 2) - [1.0_dp, 0.0_dp, 0.0_dp])) > 1.0e-14_dp) THEN
36 error stop "RI-RS maximin selection returned the wrong second point"
37 END IF
38
39 DEALLOCATE (points)
40 ALLOCATE (points(3, 5))
41 points(:, :) = reshape([ &
42 0.0_dp, 0.0_dp, 0.0_dp, &
43 0.5_dp, 0.0_dp, 0.0_dp, &
44 1.0_dp, 0.0_dp, 0.0_dp, &
45 1.5_dp, 0.0_dp, 0.0_dp, &
46 2.0_dp, 0.0_dp, 0.0_dp], [3, 5])
47 CALL initialize_rirs_grid(points, 4, 1, particle_set, n_candidates)
48 IF (n_candidates /= 3) error stop "incorrect RI-RS Voronoi fallback candidate count"
49 IF (SIZE(points, 2) /= 4) error stop "RI-RS Voronoi fallback returned the wrong grid size"
50 IF (maxval(abs(points(:, 2) - [2.0_dp, 0.0_dp, 0.0_dp])) > 1.0e-14_dp) THEN
51 error stop "RI-RS Voronoi fallback did not select from the full source grid"
52 END IF
53
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Define the data structure for the particle information.
Shared RI-RS grid I/O and contracted-Gaussian evaluation utilities.
subroutine, public initialize_rirs_grid(points, n_select, center_atom, particle_set, n_voronoi_candidates)
Build one deterministic atom-specific grid from a tabulated source grid.
program rirs_grid_utils_unittest