(git:0341268)
Loading...
Searching...
No Matches
qs_commutators.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
8! **************************************************************************************************
9!> \brief Calculation of commutator [H,r] matrices
10!> \par History
11!> JGH: [7.2016]
12!> \author Juerg Hutter
13! **************************************************************************************************
15 USE cell_types, ONLY: cell_type
19 USE cp_dbcsr_api, ONLY: dbcsr_add,&
27 USE kinds, ONLY: dp
33
34!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num
35#include "./base/base_uses.f90"
36
37 IMPLICIT NONE
38
39 PRIVATE
40
41! *** Global parameters ***
42
43 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_commutators'
44
45! *** Public subroutines ***
46
47 PUBLIC :: build_com_hr_matrix
48
49CONTAINS
50
51! **************************************************************************************************
52!> \brief Calculation of the [H,r] commutators matrices over Cartesian Gaussian functions.
53!> \param qs_env ...
54!> \param matrix_hr ...
55!> \date 26.07.2016
56!> \par History
57!> \author JGH
58!> \version 1.0
59! **************************************************************************************************
60 SUBROUTINE build_com_hr_matrix(qs_env, matrix_hr)
61
62 TYPE(qs_environment_type), POINTER :: qs_env
63 TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
64 POINTER :: matrix_hr
65
66 CHARACTER(len=*), PARAMETER :: routinen = 'build_com_hr_matrix'
67
68 INTEGER :: handle, ir
69 REAL(kind=dp) :: eps_ppnl
70 TYPE(cell_type), POINTER :: cell
71 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_nl
72 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: matrix_s
73 TYPE(dft_control_type), POINTER :: dft_control
74 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
75 POINTER :: sab_orb, sap_ppnl
76 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
77 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
78
79 CALL timeset(routinen, handle)
80
81 NULLIFY (cell, matrix_nl, particle_set, sab_orb, sap_ppnl)
82 CALL get_qs_env(qs_env=qs_env, sab_orb=sab_orb, sap_ppnl=sap_ppnl, cell=cell, &
83 particle_set=particle_set)
84 !
85 CALL get_qs_env(qs_env=qs_env, qs_kind_set=qs_kind_set, dft_control=dft_control)
86 eps_ppnl = dft_control%qs_control%eps_ppnl
87 !
88 CALL get_qs_env(qs_env=qs_env, matrix_s_kp=matrix_s)
89 cpassert(.NOT. ASSOCIATED(matrix_hr))
90 CALL dbcsr_allocate_matrix_set(matrix_hr, 3)
91 DO ir = 1, 3
92 ALLOCATE (matrix_hr(ir)%matrix)
93 CALL dbcsr_create(matrix_hr(ir)%matrix, template=matrix_s(1, 1)%matrix, &
94 name="COMMUTATOR")
95 CALL cp_dbcsr_alloc_block_from_nbl(matrix_hr(ir)%matrix, sab_orb)
96 CALL dbcsr_set(matrix_hr(ir)%matrix, 0.0_dp)
97 END DO
98
99 CALL build_com_tr_matrix(matrix_hr, qs_kind_set, "ORB", sab_orb)
100 IF (ASSOCIATED(sap_ppnl)) THEN
101 CALL dbcsr_allocate_matrix_set(matrix_nl, 3)
102 DO ir = 1, 3
103 ALLOCATE (matrix_nl(ir)%matrix)
104 CALL dbcsr_create(matrix_nl(ir)%matrix, template=matrix_s(1, 1)%matrix, &
105 name="NONLOCAL COMMUTATOR")
106 CALL cp_dbcsr_alloc_block_from_nbl(matrix_nl(ir)%matrix, sab_orb)
107 CALL dbcsr_set(matrix_nl(ir)%matrix, 0.0_dp)
108 END DO
109
110 CALL build_com_mom_nl(qs_kind_set, sab_orb, sap_ppnl, eps_ppnl, particle_set, cell, &
111 matrix_rv=matrix_nl)
112 ! build_com_mom_nl returns [r,Vnl]; [H,r] requires [Vnl,r].
113 DO ir = 1, 3
114 CALL dbcsr_scale(matrix_nl(ir)%matrix, alpha_scalar=-1.0_dp)
115 CALL dbcsr_add(matrix_hr(ir)%matrix, matrix_nl(ir)%matrix, alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
116 END DO
117 CALL dbcsr_deallocate_matrix_set(matrix_nl)
118 END IF
119
120 CALL timestop(handle)
121
122 END SUBROUTINE build_com_hr_matrix
123
124END MODULE qs_commutators
Handles all functions related to the CELL.
Definition cell_types.F:15
Calculation of commutator of kinetic energy and position operator.
subroutine, public build_com_tr_matrix(matrix_tr, qs_kind_set, basis_type, sab_nl)
Calculation of commutator [T,r] over Cartesian Gaussian functions.
Calculation of the non-local pseudopotential contribution to the core Hamiltonian <a|V(non-local)|b> ...
subroutine, public build_com_mom_nl(qs_kind_set, sab_all, sap_ppnl, eps_ppnl, particle_set, cell, matrix_rv, matrix_rxrv, matrix_rrv, matrix_rvr, matrix_rrv_vrr, matrix_r_rxvr, matrix_rxvr_r, matrix_r_doublecom, pseudoatom, ref_point)
Calculate [r,Vnl] (matrix_rv), r x [r,Vnl] (matrix_rxrv) or [rr,Vnl] (matrix_rrv) in AO basis....
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_scale(matrix, alpha_scalar)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
DBCSR operations in CP2K.
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.
Calculation of commutator [H,r] matrices.
subroutine, public build_com_hr_matrix(qs_env, matrix_hr)
Calculation of the [H,r] commutators matrices over Cartesian Gaussian functions.
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
Define the neighbor list data types and the corresponding functionality.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
Provides all information about a quickstep kind.