Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2025 CP2K developers group <https://cp2k.org> !
4 : ! !
5 : ! SPDX-License-Identifier: GPL-2.0-or-later !
6 : !--------------------------------------------------------------------------------------------------!
7 :
8 : ! **************************************************************************************************
9 : !> \brief Full parametrization of Fock matrix, ie. the identity parametrization.
10 : !> \author Ole Schuett
11 : ! **************************************************************************************************
12 : MODULE pao_linpot_full
13 : USE basis_set_types, ONLY: gto_basis_set_type
14 : USE kinds, ONLY: dp
15 : USE qs_environment_types, ONLY: get_qs_env,&
16 : qs_environment_type
17 : USE qs_kind_types, ONLY: get_qs_kind,&
18 : qs_kind_type
19 : #include "./base/base_uses.f90"
20 :
21 : IMPLICIT NONE
22 :
23 : PRIVATE
24 :
25 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'pao_linpot_full'
26 :
27 : PUBLIC :: linpot_full_count_terms, linpot_full_calc_terms
28 :
29 : CONTAINS
30 :
31 : ! **************************************************************************************************
32 : !> \brief Count number of terms for given atomic kind
33 : !> \param qs_env ...
34 : !> \param ikind ...
35 : !> \param nterms ...
36 : ! **************************************************************************************************
37 108 : SUBROUTINE linpot_full_count_terms(qs_env, ikind, nterms)
38 : TYPE(qs_environment_type), POINTER :: qs_env
39 : INTEGER, INTENT(IN) :: ikind
40 : INTEGER, INTENT(OUT) :: nterms
41 :
42 : INTEGER :: n
43 : TYPE(gto_basis_set_type), POINTER :: basis_set
44 108 : TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
45 :
46 108 : CALL get_qs_env(qs_env, qs_kind_set=qs_kind_set)
47 108 : CALL get_qs_kind(qs_kind_set(ikind), basis_set=basis_set)
48 108 : n = basis_set%nsgf
49 108 : nterms = n + n*(n - 1)/2
50 :
51 108 : END SUBROUTINE linpot_full_count_terms
52 :
53 : ! **************************************************************************************************
54 : !> \brief Builds potential terms
55 : !> \param V_blocks ...
56 : ! **************************************************************************************************
57 39 : SUBROUTINE linpot_full_calc_terms(V_blocks)
58 : REAL(dp), DIMENSION(:, :, :), INTENT(OUT) :: V_blocks
59 :
60 : INTEGER :: i, j, kterm, n, nterms
61 :
62 39 : N = SIZE(V_blocks, 1)
63 39 : CPASSERT(SIZE(V_blocks, 2) == N)
64 39 : nterms = SIZE(V_blocks, 3)
65 :
66 50550 : V_blocks = 0.0_dp
67 : kterm = 0
68 250 : DO i = 1, N
69 987 : DO j = i, N
70 737 : kterm = kterm + 1
71 737 : V_blocks(i, j, kterm) = 1.0_dp
72 948 : V_blocks(j, i, kterm) = 1.0_dp
73 : END DO
74 : END DO
75 :
76 39 : CPASSERT(kterm == nterms)
77 39 : END SUBROUTINE linpot_full_calc_terms
78 :
79 : END MODULE pao_linpot_full
|