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
78 TYPE(
cp_fm_type) :: inverse_mat, smo, tinverse, tmp2
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)
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)
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)
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))
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)
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_pp, 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, 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)
Get the QUICKSTEP environment.