(git:a0df33d)
Loading...
Searching...
No Matches
soc_pseudopotential_methods.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
10 USE core_ppnl, ONLY: build_core_ppnl
11 USE cp_cfm_types, ONLY: cp_cfm_get_info,&
14 USE cp_dbcsr_api, ONLY: dbcsr_add,&
19 dbcsr_set,&
20 dbcsr_type_antisymmetric,&
21 dbcsr_type_no_symmetry
25 USE kinds, ONLY: dp
26 USE kpoint_types, ONLY: get_kpoint_info,&
35 USE virial_types, ONLY: virial_type
36 !USE physcon, ONLY: evolt
37#include "./base/base_uses.f90"
38
39 IMPLICIT NONE
40
41 PRIVATE
42
43 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'soc_pseudopotential_methods'
44
47
48CONTAINS
49
50! **************************************************************************************************
51!> \brief V^SOC_µν^(α),R = ħ/2 < ϕ_µ cell O | sum_ℓ ΔV_ℓ^SO(r,r') L^(α) | ϕ_ν cell R>, α = x,y,z
52!> see Hartwigsen, Goedecker, Hutter, Eq.(18), (19) (doi.org/10.1103/PhysRevB.58.3641)
53!> Caution: V^SOC_µν^(α) is purely imaginary and Hermitian; V^SOC_µν^(α) is stored as real
54!> dbcsr matrix mat_V_SOC_xyz without symmetry; V^SOC_µν^(α) is stored without
55!> the imaginary unit, i.e. mat_V_SOC_xyz is real and antisymmetric
56!> \param qs_env ...
57!> \param mat_V_SOC_xyz ...
58!> \par History
59!> * 09.2023 created
60!> \author Jan Wilhelm
61! **************************************************************************************************
62 SUBROUTINE v_soc_xyz_from_pseudopotential(qs_env, mat_V_SOC_xyz)
63 TYPE(qs_environment_type), POINTER :: qs_env
64 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: mat_v_soc_xyz
65
66 CHARACTER(LEN=*), PARAMETER :: routinen = 'V_SOC_xyz_from_pseudopotential'
67
68 INTEGER :: handle, img, nder, nimages, xyz
69 INTEGER, DIMENSION(:, :, :), POINTER :: cell_to_index
70 LOGICAL :: calculate_forces, do_kp, do_symmetric, &
71 use_virial
72 REAL(kind=dp) :: eps_ppnl
73 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
74 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: mat_l, mat_l_nosym, mat_pot_dummy, &
75 matrix_dummy, matrix_s
76 TYPE(dft_control_type), POINTER :: dft_control
77 TYPE(kpoint_type), POINTER :: kpoints
78 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
79 POINTER :: sab_orb, sap_ppnl
80 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
81 TYPE(qs_force_type), DIMENSION(:), POINTER :: force
82 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
83 TYPE(virial_type), POINTER :: virial
84
85 CALL timeset(routinen, handle)
86
87 NULLIFY (qs_kind_set, dft_control, sab_orb, sap_ppnl, particle_set, atomic_kind_set, &
88 cell_to_index)
89 CALL get_qs_env(qs_env=qs_env, qs_kind_set=qs_kind_set, dft_control=dft_control, &
90 matrix_s_kp=matrix_s, kpoints=kpoints, atomic_kind_set=atomic_kind_set, &
91 particle_set=particle_set, sab_orb=sab_orb, sap_ppnl=sap_ppnl)
92
93 eps_ppnl = dft_control%qs_control%eps_ppnl
94 nimages = dft_control%nimages
95 do_kp = (nimages > 1)
96 CALL get_neighbor_list_set_p(neighbor_list_sets=sab_orb, symmetric=do_symmetric)
97 CALL get_kpoint_info(kpoint=kpoints, cell_to_index=cell_to_index)
98
99 NULLIFY (mat_l, mat_pot_dummy)
100 CALL dbcsr_allocate_matrix_set(mat_l, 3, nimages)
101 DO xyz = 1, 3
102 DO img = 1, nimages
103 ALLOCATE (mat_l(xyz, img)%matrix)
104 CALL dbcsr_create(mat_l(xyz, img)%matrix, template=matrix_s(1, 1)%matrix, &
105 matrix_type=dbcsr_type_antisymmetric)
106 CALL cp_dbcsr_alloc_block_from_nbl(mat_l(xyz, img)%matrix, sab_orb)
107 CALL dbcsr_set(mat_l(xyz, img)%matrix, 0.0_dp)
108 END DO
109 END DO
110
111 ! get mat_l; the next CPASSERT fails if the atoms do not have any SOC parameters, i.e.
112 ! SOC is zero and one should not activate the SOC section
113 cpassert(ASSOCIATED(sap_ppnl))
114 nder = 0
115 use_virial = .false.
116 calculate_forces = .false.
117
118 NULLIFY (mat_pot_dummy)
119 CALL dbcsr_allocate_matrix_set(mat_pot_dummy, 1, nimages)
120 DO img = 1, nimages
121 ALLOCATE (mat_pot_dummy(1, img)%matrix)
122 CALL dbcsr_create(mat_pot_dummy(1, img)%matrix, template=matrix_s(1, 1)%matrix)
123 CALL cp_dbcsr_alloc_block_from_nbl(mat_pot_dummy(1, img)%matrix, sab_orb)
124 CALL dbcsr_set(mat_pot_dummy(1, img)%matrix, 0.0_dp)
125 END DO
126
127 CALL build_core_ppnl(mat_pot_dummy, matrix_dummy, force, virial, &
128 calculate_forces, use_virial, nder, &
129 qs_kind_set, atomic_kind_set, particle_set, sab_orb, sap_ppnl, &
130 eps_ppnl, nimages=nimages, cell_to_index=cell_to_index, &
131 basis_type="ORB", matrix_l=mat_l)
132
133 NULLIFY (mat_l_nosym)
134 CALL dbcsr_allocate_matrix_set(mat_l_nosym, 3, nimages)
135 DO xyz = 1, 3
136 DO img = 1, nimages
137
138 ALLOCATE (mat_l_nosym(xyz, img)%matrix)
139 IF (do_kp) THEN
140 CALL dbcsr_create(mat_l_nosym(xyz, img)%matrix, template=matrix_s(1, 1)%matrix, &
141 matrix_type=dbcsr_type_antisymmetric)
142 CALL dbcsr_copy(mat_l_nosym(xyz, img)%matrix, mat_l(xyz, img)%matrix)
143 ELSE
144 CALL dbcsr_create(mat_l_nosym(xyz, img)%matrix, template=matrix_s(1, 1)%matrix, &
145 matrix_type=dbcsr_type_no_symmetry)
146 CALL dbcsr_desymmetrize(mat_l(xyz, img)%matrix, mat_l_nosym(xyz, img)%matrix)
147 END IF
148
149 END DO
150 END DO
151
152 NULLIFY (mat_v_soc_xyz)
153 CALL dbcsr_allocate_matrix_set(mat_v_soc_xyz, 3, nimages)
154 DO xyz = 1, 3
155 DO img = 1, nimages
156 ALLOCATE (mat_v_soc_xyz(xyz, img)%matrix)
157 IF (do_kp) THEN
158 ! mat_V_SOC_xyz^R with neighbor cell R actually has no symmetry
159 ! mat_V_SOC_xyz^R_µν = mat_V_SOC_xyz^R_νµ* (the actual symmetry is
160 ! mat_V_SOC_xyz^R_µν = mat_V_SOC_xyz^-R_νµ* ) but rskp_transform
161 ! for mat_V_SOC_xyz^R -> mat_V_SOC_xyz(k) requires symmetry...
162 CALL dbcsr_create(mat_v_soc_xyz(xyz, img)%matrix, template=matrix_s(1, 1)%matrix, &
163 matrix_type=dbcsr_type_antisymmetric)
164 ELSE
165 CALL dbcsr_create(mat_v_soc_xyz(xyz, img)%matrix, template=matrix_s(1, 1)%matrix, &
166 matrix_type=dbcsr_type_no_symmetry)
167 END IF
168 CALL cp_dbcsr_alloc_block_from_nbl(mat_v_soc_xyz(xyz, img)%matrix, sab_orb)
169 ! factor 0.5 from ħ/2 prefactor
170 CALL dbcsr_add(mat_v_soc_xyz(xyz, img)%matrix, mat_l_nosym(xyz, img)%matrix, &
171 0.0_dp, 0.5_dp)
172 END DO
173 END DO
174
175 CALL dbcsr_deallocate_matrix_set(mat_pot_dummy)
176 CALL dbcsr_deallocate_matrix_set(mat_l_nosym)
178
179 CALL timestop(handle)
180
181 END SUBROUTINE v_soc_xyz_from_pseudopotential
182
183! **************************************************************************************************
184!> \brief ...
185!> \param cfm_ks_spinor ...
186!> \param e_win_cbm ...
187!> \param temp_smear ...
188!> \param eigenval ...
189!> \param e_fermi ...
190! **************************************************************************************************
191 SUBROUTINE remove_soc_outside_energy_window_mo(cfm_ks_spinor, e_win_cbm, temp_smear, &
192 eigenval, e_fermi)
193 TYPE(cp_cfm_type) :: cfm_ks_spinor
194 REAL(kind=dp) :: e_win_cbm, temp_smear
195 REAL(kind=dp), DIMENSION(:) :: eigenval
196 REAL(kind=dp) :: e_fermi
197
198 CHARACTER(LEN=*), PARAMETER :: routinen = 'remove_soc_outside_energy_window_mo'
199
200 INTEGER :: handle, i_glob, iib, j_glob, jjb, &
201 ncol_global, ncol_local, nrow_global, &
202 nrow_local
203 INTEGER, DIMENSION(:), POINTER :: col_indices, row_indices
204 REAL(kind=dp) :: e_i, e_j, w_i, w_j, x_i, x_j
205
206!REAL(KIND=dp) :: E_HOMO, E_LUMO, e_fermi
207
208 ! Remove SOC outside of energy window (otherwise, numerical problems arise
209 ! because energetically low semicore states and energetically very high
210 ! unbound states couple to the states around the Fermi level).
211 ! This routine is for cfm_ks_spinor being in the molecular-orbital (mo) with
212 ! corresponding eigenvalues "eigenval".
213
214 CALL timeset(routinen, handle)
215
216 CALL cp_cfm_get_info(matrix=cfm_ks_spinor, &
217 nrow_global=nrow_global, &
218 ncol_global=ncol_global, &
219 nrow_local=nrow_local, &
220 ncol_local=ncol_local, &
221 row_indices=row_indices, &
222 col_indices=col_indices)
223
224 cpassert(nrow_global == SIZE(eigenval))
225 cpassert(ncol_global == SIZE(eigenval))
226
227 ! Apply a smooth energy window to the SOC coupling matrix. Each state gets a
228 ! weight in [0,1]: 1 = full SOC, decaying to 0 outside the window via a
229 ! Fermi-like function of width temp_smear. A matrix element coupling states i
230 ! and j is scaled by SQRT(w_i*w_j), applying the damping symmetrically to both.
231 DO jjb = 1, ncol_local
232 j_glob = col_indices(jjb)
233 DO iib = 1, nrow_local
234 i_glob = row_indices(iib)
235
236 e_i = eigenval(i_glob)
237 e_j = eigenval(j_glob)
238 IF (e_i <= e_fermi) THEN
239 !x_i = ABS(E_i - e_fermi) - 0.5_dp * e_win_vbm
240 w_i = 1.0_dp
241 ELSE
242 x_i = abs(e_i - e_fermi) - e_win_cbm
243 w_i = 1.0_dp/(exp(x_i/temp_smear) + 1.0_dp)
244 END IF
245
246 IF (e_j <= e_fermi) THEN
247 !x_j = ABS(E_j - e_fermi) - 0.5_dp * e_win_vbm
248 w_j = 1.0_dp
249 ELSE
250 x_j = abs(e_j - e_fermi) - e_win_cbm
251 w_j = 1.0_dp/(exp(x_j/temp_smear) + 1.0_dp)
252 END IF
253
254 cfm_ks_spinor%local_data(iib, jjb) = &
255 cfm_ks_spinor%local_data(iib, jjb)*sqrt(w_i*w_j)
256
257 END DO
258 END DO
259
260 CALL timestop(handle)
261
263
Define the atomic kind types and their sub types.
Calculation of the non-local pseudopotential contribution to the core Hamiltonian <a|V(non-local)|b> ...
Definition core_ppnl.F:15
subroutine, public build_core_ppnl(matrix_h, matrix_p, force, virial, calculate_forces, use_virial, nder, qs_kind_set, atomic_kind_set, particle_set, sab_orb, sap_ppnl, eps_ppnl, nimages, cell_to_index, basis_type, deltar, matrix_l, atcore)
...
Definition core_ppnl.F:90
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, matrix_struct, para_env)
Returns information about a full matrix.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_desymmetrize(matrix_a, matrix_b)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
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
Types and basic routines needed for a kpoint calculation.
subroutine, public get_kpoint_info(kpoint, kp_scheme, nkp_grid, kp_shift, symmetry, verbose, full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, sab_nl, sab_nl_nosym, inversion_symmetry_only, symmetry_backend, symmetry_reduction_method, gamma_centered)
Retrieve information from a kpoint environment.
Define the data structure for the particle information.
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, 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.
subroutine, public get_neighbor_list_set_p(neighbor_list_sets, nlist, symmetric)
Return the components of the first neighbor list set.
subroutine, public v_soc_xyz_from_pseudopotential(qs_env, mat_v_soc_xyz)
V^SOC_µν^(α),R = ħ/2 < ϕ_µ cell O | sum_ℓ ΔV_ℓ^SO(r,r') L^(α) | ϕ_ν cell R>, α = x,...
subroutine, public remove_soc_outside_energy_window_mo(cfm_ks_spinor, e_win_cbm, temp_smear, eigenval, e_fermi)
...
Provides all information about an atomic kind.
Represent a complex full matrix.
Contains information about kpoints.
Provides all information about a quickstep kind.