32 USE dbcsr_api,
ONLY: dbcsr_p_type
44 #include "./base/base_uses.f90"
50 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'et_coupling'
51 LOGICAL,
PARAMETER,
PRIVATE :: debug_this_module = .false.
64 TYPE(qs_environment_type),
POINTER :: qs_env
66 CHARACTER(len=*),
PARAMETER :: routinen =
'calc_et_coupling'
68 INTEGER :: handle, i, iw, j, k, nao, ncol_local, &
70 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
71 LOGICAL :: is_spin_constraint
72 REAL(kind=
dp) :: sda, strength, waa, wbb, wda
73 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: a, b, s_det
74 REAL(kind=
dp),
DIMENSION(2) :: eigenv
75 REAL(kind=
dp),
DIMENSION(2, 2) :: s_mat, tmp_mat, u, w_mat
76 TYPE(cp_fm_pool_p_type),
DIMENSION(:),
POINTER :: mo_mo_fm_pools
77 TYPE(cp_fm_struct_type),
POINTER :: mo_mo_fmstruct
78 TYPE(cp_fm_type) :: inverse_mat, smo, tinverse, tmp2
79 TYPE(cp_fm_type),
DIMENSION(2) :: rest_mo
80 TYPE(cp_logger_type),
POINTER :: logger
81 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s
82 TYPE(dft_control_type),
POINTER :: dft_control
83 TYPE(mp_para_env_type),
POINTER :: para_env
84 TYPE(qs_energy_type),
POINTER :: energy
85 TYPE(section_vals_type),
POINTER :: et_coupling_section
87 NULLIFY (mo_mo_fmstruct, energy, matrix_s, dft_control, para_env)
89 CALL timeset(routinen, handle)
93 "PROPERTIES%ET_COUPLING")
95 CALL get_qs_env(qs_env, dft_control=dft_control, para_env=para_env)
100 is_spin_constraint = .false.
101 ALLOCATE (a(dft_control%nspins))
102 ALLOCATE (b(dft_control%nspins))
103 ALLOCATE (s_det(dft_control%nspins))
105 CALL mpools_get(qs_env%mpools, mo_mo_fm_pools=mo_mo_fm_pools)
107 DO i = 1, dft_control%nspins
115 matrix_struct=qs_env%mos(i)%mo_coeff%matrix_struct, &
116 name=
"ET_TMP"//trim(adjustl(cp_to_string(2)))//
"MATRIX")
118 matrix_struct=mo_mo_fmstruct, &
119 name=
"INVERSE"//trim(adjustl(cp_to_string(2)))//
"MATRIX")
121 matrix_struct=mo_mo_fmstruct, &
122 name=
"T_INVERSE"//trim(adjustl(cp_to_string(2)))//
"MATRIX")
124 matrix_struct=mo_mo_fmstruct, &
125 name=
"ET_SMO"//trim(adjustl(cp_to_string(1)))//
"MATRIX")
128 matrix_struct=mo_mo_fmstruct, &
129 name=
"ET_rest_MO"//trim(adjustl(cp_to_string(j)))//
"MATRIX")
136 tmp2, nmo, 1.0_dp, 0.0_dp)
137 CALL parallel_gemm(
'T',
'N', nmo, nmo, nao, 1.0_dp, &
138 qs_env%mos(i)%mo_coeff, &
144 qs_env%et_coupling%et_mo_coeff(i), &
145 tmp2, nmo, 1.0_dp, 0.0_dp)
147 CALL parallel_gemm(
'T',
'N', nmo, nmo, nao, 1.0_dp, &
148 qs_env%mos(i)%mo_coeff, &
149 tmp2, 0.0_dp, rest_mo(1))
154 qs_env%mos(i)%mo_coeff, &
155 tmp2, nmo, 1.0_dp, 0.0_dp)
157 CALL parallel_gemm(
'T',
'N', nmo, nmo, nao, 1.0_dp, &
158 qs_env%et_coupling%et_mo_coeff(i), &
159 tmp2, 0.0_dp, rest_mo(2))
164 CALL cp_fm_get_info(inverse_mat, nrow_local=nrow_local, ncol_local=ncol_local, &
165 row_indices=row_indices, col_indices=col_indices)
170 b(i) = b(i) + rest_mo(2)%local_data(k, j)*inverse_mat%local_data(k, j)
178 a(i) = a(i) + rest_mo(1)%local_data(k, j)*tinverse%local_data(k, j)
181 IF (is_spin_constraint)
THEN
185 CALL para_env%sum(a(i))
187 CALL para_env%sum(b(i))
189 CALL cp_fm_release(tmp2)
191 CALL cp_fm_release(rest_mo(j))
193 CALL cp_fm_release(smo)
194 CALL cp_fm_release(tinverse)
195 CALL cp_fm_release(inverse_mat)
200 IF (dft_control%nspins == 2)
THEN
201 sda = s_det(1)*s_det(2)
202 wda = ((a(1) + a(2)) + (b(1) + b(2)))*0.5_dp*sda
205 wda = (a(1) + b(1))*sda
208 IF (dft_control%qs_control%ddapc_restraint)
THEN
209 waa = qs_env%et_coupling%order_p
210 wbb = dft_control%qs_control%ddapc_restraint_control(1)%ddapc_order_p
211 strength = dft_control%qs_control%ddapc_restraint_control(1)%strength
229 u(1, 1) = 1.0_dp/sqrt(eigenv(1))
230 u(2, 2) = 1.0_dp/sqrt(eigenv(2))
231 tmp_mat = matmul(u, transpose(s_mat))
232 u = matmul(s_mat, tmp_mat)
233 tmp_mat = matmul(w_mat, u)
234 w_mat = matmul(u, tmp_mat)
236 tmp_mat = matmul(u, w_mat)
239 w_mat(1, 1) = energy%total
240 w_mat(2, 2) = qs_env%et_coupling%energy
241 a(1) = (energy%total + strength*wbb)*sda - strength*wda
242 a(2) = (qs_env%et_coupling%energy + qs_env%et_coupling%e1*waa)*sda - qs_env%et_coupling%e1*wda
243 w_mat(1, 2) = (a(1) + a(2))*0.5_dp
244 w_mat(2, 1) = w_mat(1, 2)
246 s_mat = matmul(w_mat, (tmp_mat))
247 w_mat = matmul(transpose(tmp_mat), s_mat)
251 WRITE (iw,
'(T3,A,T60,(3X,F12.6))')
'Strength of constraint A :', qs_env%et_coupling%e1
252 WRITE (iw,
'(T3,A,T60,(3X,F12.6))')
'Strength of constraint B :', strength
253 WRITE (iw,
'(T3,A,T60,(3X,F12.6))')
'Final target value of constraint A:', waa
254 WRITE (iw,
'(T3,A,T60,(3X,F12.6))')
'Final target value of constraint B:', wbb
256 WRITE (iw,
'(T3,A,T60,(3X,F12.6))') &
257 'Diabatic electronic coupling matrix element(mHartree):', abs(w_mat(1, 2)*1000.0_dp)
265 CALL timestop(handle)
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
basic linear algebra operations for full matrices
subroutine, public cp_fm_det(matrix_a, det_a)
Computes the determinant (with a correct sign even in parallel environment!) of a real square matrix.
subroutine, public cp_fm_transpose(matrix, matrixt)
transposes a matrix matrixt = matrix ^ T
subroutine, public cp_fm_invert(matrix_a, matrix_inverse, det_a, eps_svd, eigval)
Inverts a cp_fm_type matrix, optionally returning the determinant of the input matrix.
pool for for elements that are retained and released
type(cp_fm_struct_type) function, pointer, public fm_pool_get_el_struct(pool)
returns the structure of the elements in this pool
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
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
calculates the electron transfer coupling elements Wu, Van Voorhis, JCP 125, 164105 (2006)
subroutine, public calc_et_coupling(qs_env)
...
Defines the basic variable types.
integer, parameter, public dp
Collection of simple mathematical functions and subroutines.
subroutine, public diamat_all(a, eigval, dac)
Diagonalize the symmetric n by n matrix a using the LAPACK library. Only the upper triangle of matrix...
Interface to the message passing library MPI.
basic linear algebra operations for full matrixes
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.
wrapper for the pools of matrixes
subroutine, public mpools_get(mpools, ao_mo_fm_pools, ao_ao_fm_pools, mo_mo_fm_pools, ao_mosub_fm_pools, mosub_mosub_fm_pools, maxao_maxmo_fm_pool, maxao_maxao_fm_pool, maxmo_maxmo_fm_pool)
returns various attributes of the mpools (notably the pools contained in it)
Definition and initialisation of the mo data type.
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kTS, mu, flexible_electron_count)
Get the components of a MO set data structure.