27 USE dbcsr_api,
ONLY: dbcsr_add,&
32 dbcsr_type_antisymmetric,&
33 dbcsr_type_no_symmetry
49#include "./base/base_uses.f90"
55 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'soc_pseudopotential_methods'
75 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: mat_v_soc_xyz
77 CHARACTER(LEN=*),
PARAMETER :: routinen =
'V_SOC_xyz_from_pseudopotential'
79 INTEGER :: handle, nder, xyz
80 LOGICAL :: calculate_forces, use_virial
81 REAL(kind=
dp) :: eps_ppnl
83 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s
84 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: mat_l, mat_l_nosym, mat_pot_dummy, &
88 POINTER :: sab_orb, sap_ppnl
94 CALL timeset(routinen, handle)
96 NULLIFY (qs_kind_set, dft_control, sab_orb, sap_ppnl, particle_set, atomic_kind_set)
97 CALL get_qs_env(qs_env=qs_env, qs_kind_set=qs_kind_set, dft_control=dft_control, &
98 matrix_s=matrix_s, atomic_kind_set=atomic_kind_set, &
99 particle_set=particle_set, sab_orb=sab_orb, sap_ppnl=sap_ppnl)
101 eps_ppnl = dft_control%qs_control%eps_ppnl
106 ALLOCATE (mat_l(xyz, 1)%matrix)
107 CALL dbcsr_create(mat_l(xyz, 1)%matrix, template=matrix_s(1)%matrix, &
108 matrix_type=dbcsr_type_antisymmetric)
110 CALL dbcsr_set(mat_l(xyz, 1)%matrix, 0.0_dp)
114 cpassert(
ASSOCIATED(sap_ppnl))
117 calculate_forces = .false.
119 NULLIFY (mat_pot_dummy)
121 ALLOCATE (mat_pot_dummy(1, 1)%matrix)
122 CALL dbcsr_create(mat_pot_dummy(1, 1)%matrix, template=matrix_s(1)%matrix)
124 CALL dbcsr_set(mat_pot_dummy(1, 1)%matrix, 0.0_dp)
127 calculate_forces, use_virial, nder, &
128 qs_kind_set, atomic_kind_set, particle_set, sab_orb, sap_ppnl, &
129 eps_ppnl, nimages=1, basis_type=
"ORB", matrix_l=mat_l)
131 NULLIFY (mat_l_nosym)
134 ALLOCATE (mat_l_nosym(xyz, 1)%matrix)
135 CALL dbcsr_create(mat_l_nosym(xyz, 1)%matrix, template=matrix_s(1)%matrix, &
136 matrix_type=dbcsr_type_no_symmetry)
137 CALL dbcsr_desymmetrize(mat_l(xyz, 1)%matrix, mat_l_nosym(xyz, 1)%matrix)
141 NULLIFY (mat_v_soc_xyz)
144 ALLOCATE (mat_v_soc_xyz(xyz, 1)%matrix)
145 CALL dbcsr_create(mat_v_soc_xyz(xyz, 1)%matrix, template=matrix_s(1)%matrix, &
146 matrix_type=dbcsr_type_no_symmetry)
149 CALL dbcsr_add(mat_v_soc_xyz(xyz, 1)%matrix, mat_l_nosym(xyz, 1)%matrix, 0.0_dp, 0.5_dp)
156 CALL timestop(handle)
171 SUBROUTINE h_ks_spinor(cfm_ks_spinor_ao, fm_ks, n_spin, mat_V_SOC_xyz, cfm_s_double, fm_s, &
176 TYPE(dbcsr_p_type),
DIMENSION(:) :: mat_v_soc_xyz
181 CHARACTER(LEN=*),
PARAMETER :: routinen =
'H_KS_spinor'
183 INTEGER :: handle, nao, s
186 CALL timeset(routinen, handle)
193 str => fm_ks(1)%matrix_struct
202 IF (
PRESENT(cfm_soc_spinor_ao))
THEN
203 CALL cp_cfm_create(cfm_soc_spinor_ao, cfm_ks_spinor_ao%matrix_struct)
213 cpassert(
SIZE(fm_ks) == 2)
216 cpabort(
"We have either one or two spin channels.")
219 IF (
PRESENT(cfm_s_double))
THEN
220 cpassert(
PRESENT(fm_s))
227 CALL timestop(handle)
245 TYPE(dbcsr_p_type),
DIMENSION(:) :: mat_v_soc_xyz
246 REAL(kind=
dp) :: e_win
249 REAL(kind=
dp),
DIMENSION(:) :: eigenval
252 CHARACTER(LEN=*),
PARAMETER :: routinen =
'remove_soc_outside_energy_window_ao'
254 INTEGER :: handle, i_glob, iib, j_glob, jjb, nao, &
255 ncol_local, nrow_local, xyz
256 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
257 REAL(kind=
dp) :: e_homo, e_i, e_j, e_lumo
260 CALL timeset(routinen, handle)
267 nrow_local=nrow_local, &
268 ncol_local=ncol_local, &
269 row_indices=row_indices, &
270 col_indices=col_indices)
274 e_homo = eigenval(homo)
275 e_lumo = eigenval(homo + 1)
282 CALL parallel_gemm(transa=
"N", transb=
"N", m=nao, n=nao, k=nao, alpha=1.0_dp, &
283 matrix_a=fm_v_ao, matrix_b=fm_mo_coeff, beta=0.0_dp, matrix_c=fm_work)
285 CALL parallel_gemm(transa=
"T", transb=
"N", m=nao, n=nao, k=nao, alpha=1.0_dp, &
286 matrix_a=fm_mo_coeff, matrix_b=fm_work, beta=0.0_dp, matrix_c=fm_v_mo)
288 DO jjb = 1, ncol_local
289 j_glob = col_indices(jjb)
290 DO iib = 1, nrow_local
291 i_glob = row_indices(iib)
293 e_i = eigenval(i_glob)
294 e_j = eigenval(j_glob)
296 IF (e_i < e_homo - 0.5_dp*e_win .OR. e_i > e_lumo + 0.5_dp*e_win .OR. &
297 e_j < e_homo - 0.5_dp*e_win .OR. e_j > e_lumo + 0.5_dp*e_win)
THEN
298 fm_v_mo%local_data(iib, jjb) = 0.0_dp
305 CALL parallel_gemm(transa=
"N", transb=
"T", m=nao, n=nao, k=nao, alpha=1.0_dp, &
306 matrix_a=fm_v_mo, matrix_b=fm_mo_coeff, beta=0.0_dp, matrix_c=fm_work)
308 CALL parallel_gemm(transa=
"N", transb=
"N", m=nao, n=nao, k=nao, alpha=1.0_dp, &
309 matrix_a=fm_mo_coeff, matrix_b=fm_work, beta=0.0_dp, matrix_c=fm_v_ao)
311 CALL parallel_gemm(transa=
"N", transb=
"N", m=nao, n=nao, k=nao, alpha=1.0_dp, &
312 matrix_a=fm_s, matrix_b=fm_v_ao, beta=0.0_dp, matrix_c=fm_work)
314 CALL parallel_gemm(transa=
"N", transb=
"N", m=nao, n=nao, k=nao, alpha=1.0_dp, &
315 matrix_a=fm_work, matrix_b=fm_s, beta=0.0_dp, matrix_c=fm_v_ao)
325 CALL timestop(handle)
339 REAL(kind=
dp) :: e_win
340 REAL(kind=
dp),
DIMENSION(:) :: eigenval
341 REAL(kind=
dp) :: e_homo, e_lumo
343 CHARACTER(LEN=*),
PARAMETER :: routinen =
'remove_soc_outside_energy_window_mo'
345 INTEGER :: handle, i_glob, iib, j_glob, jjb, &
346 ncol_global, ncol_local, nrow_global, &
348 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
349 REAL(kind=
dp) :: e_i, e_j
357 CALL timeset(routinen, handle)
360 nrow_global=nrow_global, &
361 ncol_global=ncol_global, &
362 nrow_local=nrow_local, &
363 ncol_local=ncol_local, &
364 row_indices=row_indices, &
365 col_indices=col_indices)
367 cpassert(nrow_global ==
SIZE(eigenval))
368 cpassert(ncol_global ==
SIZE(eigenval))
370 DO jjb = 1, ncol_local
371 j_glob = col_indices(jjb)
372 DO iib = 1, nrow_local
373 i_glob = row_indices(iib)
375 e_i = eigenval(i_glob)
376 e_j = eigenval(j_glob)
378 IF (e_i < e_homo - 0.5_dp*e_win .OR. e_i > e_lumo + 0.5_dp*e_win .OR. &
379 e_j < e_homo - 0.5_dp*e_win .OR. e_j > e_lumo + 0.5_dp*e_win)
THEN
380 cfm_ks_spinor%local_data(iib, jjb) = 0.0_dp
386 CALL timestop(handle)
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> ...
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)
...
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_create(matrix, matrix_struct, name)
Creates a new full matrix with the given structure.
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.
subroutine, public cp_cfm_set_all(matrix, alpha, beta)
Set all elements of the full matrix to alpha. Besides, set all diagonal matrix elements to beta (if g...
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Routines that link DBCSR and CP2K concepts together.
subroutine, public cp_dbcsr_alloc_block_from_nbl(matrix, sab_orb, desymmetrize)
allocate the blocks of a dbcsr based on the neighbor list
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr matrix.
represent the structure of a full matrix
represent a full matrix distributed on many processors
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
complex(kind=dp), parameter, public z_one
complex(kind=dp), parameter, public gaussi
complex(kind=dp), parameter, public z_zero
basic linear algebra operations for full matrixes
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, 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_nonbond, sab_almo, sab_kp, sab_kp_nosym, 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, 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, ecoul_1c, rho0_s_rs, rho0_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, 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, rhs)
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 h_ks_spinor(cfm_ks_spinor_ao, fm_ks, n_spin, mat_v_soc_xyz, cfm_s_double, fm_s, cfm_soc_spinor_ao)
Spinor KS-matrix H_µν,σσ' = h_µν,σ*δ_σσ' + sum_α V^SOC_µν^(α)*Pauli-matrix^(α)_σσ',...
subroutine, public v_soc_xyz_from_pseudopotential(qs_env, mat_v_soc_xyz)
Compute V^SOC_µν^(α) = ħ/2 < ϕ_µ | sum_ℓ ΔV_ℓ^SO(r,r') L^(α) | ϕ_ν >, α = x, y, z,...
subroutine, public remove_soc_outside_energy_window_ao(mat_v_soc_xyz, e_win, fm_mo_coeff, homo, eigenval, fm_s)
Remove SOC outside of energy window (otherwise, numerical problems arise because energetically low se...
subroutine, public remove_soc_outside_energy_window_mo(cfm_ks_spinor, e_win, eigenval, e_homo, e_lumo)
...
subroutine, public add_dbcsr_submat(cfm_mat_target, mat_source, fm_struct_source, nstart_row, nstart_col, factor, add_also_herm_conj)
...
subroutine, public add_fm_submat(cfm_mat_target, fm_mat_source, nstart_row, nstart_col)
...
subroutine, public create_cfm_double(fm_orig, cfm_double)
...
Provides all information about an atomic kind.
Represent a complex full matrix.
keeps the information about the structure of a full matrix
Provides all information about a quickstep kind.