22 USE dbcsr_api,
ONLY: dbcsr_p_type,&
38 #include "./base/base_uses.f90"
46 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_energy_matrix_w'
62 TYPE(qs_environment_type),
POINTER :: qs_env
63 LOGICAL,
INTENT(IN) :: calc_forces
65 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_energies_compute_w'
67 INTEGER :: handle, is, ispin, nao, nspin
68 LOGICAL :: do_kpoints, has_unit_metric
69 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks, matrix_s, matrix_w, &
71 TYPE(dft_control_type),
POINTER :: dft_control
72 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
73 TYPE(mo_set_type),
POINTER :: mo_set
74 TYPE(qs_rho_type),
POINTER :: rho
75 TYPE(scf_control_type),
POINTER :: scf_control
77 CALL timeset(routinen, handle)
80 CALL get_qs_env(qs_env, has_unit_metric=has_unit_metric)
82 IF (calc_forces .AND. .NOT. has_unit_metric)
THEN
87 TYPE(cp_fm_struct_type),
POINTER :: ao_ao_fmstruct
88 TYPE(cp_fm_type),
POINTER :: mo_coeff
89 TYPE(cp_fm_type),
DIMENSION(2) :: fmwork
90 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_s_kp, matrix_w_kp
91 TYPE(kpoint_type),
POINTER :: kpoints
92 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
96 matrix_w_kp=matrix_w_kp, &
97 matrix_s_kp=matrix_s_kp, &
102 CALL get_mo_set(mos(1), mo_coeff=mo_coeff, nao=nao)
104 template_fmstruct=mo_coeff%matrix_struct)
106 DO is = 1,
SIZE(fmwork)
107 CALL cp_fm_create(fmwork(is), matrix_struct=ao_ao_fmstruct)
115 matrix_s_kp(1, 1)%matrix, sab_nl, fmwork)
117 DO is = 1,
SIZE(fmwork)
118 CALL cp_fm_release(fmwork(is))
124 NULLIFY (dft_control, rho_ao)
127 matrix_ks=matrix_ks, &
129 mo_derivs=mo_derivs, &
130 scf_control=scf_control, &
133 dft_control=dft_control)
140 IF (dft_control%roks)
THEN
141 IF (scf_control%use_ot)
THEN
144 CALL dbcsr_set(matrix_w(ispin)%matrix, 0.0_dp)
147 matrix_w(ispin)%matrix, matrix_s(1)%matrix)
150 CALL calculate_w_matrix(mo_set=mo_set, &
151 matrix_ks=matrix_ks(ispin)%matrix, &
152 matrix_p=rho_ao(ispin)%matrix, &
153 matrix_w=matrix_w(ispin)%matrix)
156 IF (scf_control%use_ot)
THEN
158 matrix_w(ispin)%matrix, matrix_s(1)%matrix)
160 CALL calculate_w_matrix(mo_set, matrix_w(ispin)%matrix)
168 CALL timestop(handle)
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
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
Routines needed for kpoint calculation.
subroutine, public kpoint_density_transform(kpoint, denmat, wtype, tempmat, sab_nl, fmwork, for_aux_fit, pmat_ext)
generate real space density matrices in DBCSR format
subroutine, public kpoint_density_matrices(kpoint, energy_weighted, for_aux_fit)
Calculate kpoint density matrices (rho(k), owned by kpoint groups)
Types and basic routines needed for a kpoint calculation.
collects routines that calculate density matrices
subroutine, public calculate_w_matrix_ot(mo_set, mo_deriv, w_matrix, s_matrix)
Calculate the W matrix from the MO coefs, MO derivs could overwrite the mo_derivs for increased memor...
Utility subroutine for qs energy calculation.
subroutine, public qs_energies_compute_w(qs_env, calc_forces)
Refactoring of qs_energies_scf. Moves computation of matrix_w into separate subroutine.
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.
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.
Define the neighbor list data types and the corresponding functionality.
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_get(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
returns info about the density described by this object. If some representation is not available an e...
parameters that control an scf iteration