Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4 : ! !
5 : ! SPDX-License-Identifier: GPL-2.0-or-later !
6 : !--------------------------------------------------------------------------------------------------!
7 :
8 : ! **************************************************************************************************
9 : !> \brief Calculation of commutator [H,r] matrices
10 : !> \par History
11 : !> JGH: [7.2016]
12 : !> \author Juerg Hutter
13 : ! **************************************************************************************************
14 : MODULE qs_commutators
15 : USE commutator_rkinetic, ONLY: build_com_tr_matrix
16 : USE commutator_rpnl, ONLY: build_com_rpnl
17 : USE cp_control_types, ONLY: dft_control_type
18 : USE cp_dbcsr_api, ONLY: dbcsr_create,&
19 : dbcsr_p_type,&
20 : dbcsr_set
21 : USE cp_dbcsr_cp2k_link, ONLY: cp_dbcsr_alloc_block_from_nbl
22 : USE cp_dbcsr_operations, ONLY: dbcsr_allocate_matrix_set
23 : USE kinds, ONLY: dp
24 : USE qs_environment_types, ONLY: get_qs_env,&
25 : qs_environment_type
26 : USE qs_kind_types, ONLY: qs_kind_type
27 : USE qs_neighbor_list_types, ONLY: neighbor_list_set_p_type
28 :
29 : !$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num
30 : #include "./base/base_uses.f90"
31 :
32 : IMPLICIT NONE
33 :
34 : PRIVATE
35 :
36 : ! *** Global parameters ***
37 :
38 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_commutators'
39 :
40 : ! *** Public subroutines ***
41 :
42 : PUBLIC :: build_com_hr_matrix
43 :
44 : CONTAINS
45 :
46 : ! **************************************************************************************************
47 : !> \brief Calculation of the [H,r] commutators matrices over Cartesian Gaussian functions.
48 : !> \param qs_env ...
49 : !> \param matrix_hr ...
50 : !> \date 26.07.2016
51 : !> \par History
52 : !> \author JGH
53 : !> \version 1.0
54 : ! **************************************************************************************************
55 0 : SUBROUTINE build_com_hr_matrix(qs_env, matrix_hr)
56 :
57 : TYPE(qs_environment_type), POINTER :: qs_env
58 : TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
59 : POINTER :: matrix_hr
60 :
61 : CHARACTER(len=*), PARAMETER :: routineN = 'build_com_hr_matrix'
62 :
63 : INTEGER :: handle, ir
64 : REAL(KIND=dp) :: eps_ppnl
65 0 : TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: matrix_s
66 : TYPE(dft_control_type), POINTER :: dft_control
67 : TYPE(neighbor_list_set_p_type), DIMENSION(:), &
68 0 : POINTER :: sab_orb, sap_ppnl
69 0 : TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
70 :
71 0 : CALL timeset(routineN, handle)
72 :
73 0 : NULLIFY (sab_orb, sap_ppnl)
74 0 : CALL get_qs_env(qs_env=qs_env, sab_orb=sab_orb, sap_ppnl=sap_ppnl)
75 : !
76 0 : CALL get_qs_env(qs_env=qs_env, qs_kind_set=qs_kind_set, dft_control=dft_control)
77 0 : eps_ppnl = dft_control%qs_control%eps_ppnl
78 : !
79 0 : CALL get_qs_env(qs_env=qs_env, matrix_s_kp=matrix_s)
80 0 : CPASSERT(.NOT. ASSOCIATED(matrix_hr))
81 0 : CALL dbcsr_allocate_matrix_set(matrix_hr, 3)
82 0 : DO ir = 1, 3
83 0 : ALLOCATE (matrix_hr(ir)%matrix)
84 : CALL dbcsr_create(matrix_hr(ir)%matrix, template=matrix_s(1, 1)%matrix, &
85 0 : name="COMMUTATOR")
86 0 : CALL cp_dbcsr_alloc_block_from_nbl(matrix_hr(ir)%matrix, sab_orb)
87 0 : CALL dbcsr_set(matrix_hr(ir)%matrix, 0.0_dp)
88 : END DO
89 :
90 0 : CALL build_com_tr_matrix(matrix_hr, qs_kind_set, "ORB", sab_orb)
91 0 : CALL build_com_rpnl(matrix_hr, qs_kind_set, sab_orb, sap_ppnl, eps_ppnl)
92 :
93 0 : CALL timestop(handle)
94 :
95 0 : END SUBROUTINE build_com_hr_matrix
96 :
97 : END MODULE qs_commutators
98 :
|