45#include "./base/base_uses.f90"
51 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_loc_states'
72 wf_r, wf_g, particles, coeff, evals, marked_states)
77 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: mo_local
81 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: coeff
83 INTEGER,
DIMENSION(:, :, :),
POINTER :: marked_states
85 CHARACTER(len=*),
PARAMETER :: routinen =
'get_localization_info'
87 INTEGER :: handle, ispin, max_moment, mystate, ns, &
89 INTEGER,
DIMENSION(:),
POINTER :: lstates, marked_states_spin
90 LOGICAL :: com_nl, do_homo, do_mixed, magnetic, &
92 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: scenter
94 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: ks_rmpv, matrix_s
101 CALL timeset(routinen, handle)
102 NULLIFY (mos, ks_rmpv, dft_control, loc_print_section, marked_states_spin, &
103 matrix_s, scenter, wc)
104 CALL get_qs_env(qs_env, mos=mos, matrix_ks=ks_rmpv, molecule_set=molecule_set, &
105 dft_control=dft_control, matrix_s=matrix_s)
109 do_homo = qs_loc_env%localized_wfn_control%do_homo
110 do_mixed = qs_loc_env%localized_wfn_control%do_mixed
113 CALL get_qs_env(qs_env=qs_env, wanniercentres=wc)
114 IF (.NOT.
ASSOCIATED(wc))
THEN
115 ALLOCATE (wc(dft_control%nspins))
119 IF (dft_control%restricted)
THEN
123 nspins = dft_control%nspins
129 qs_loc_env%tag_mo =
"HOMO"
131 qs_loc_env%tag_mo =
"LUMO"
134 IF (qs_loc_env%do_localize)
THEN
136 IF (output_unit > 0 .AND. do_homo)
THEN
137 WRITE (output_unit,
"(/,T2,A,I3)") &
138 "LOCALIZATION| Computing localization properties "// &
139 "for OCCUPIED ORBITALS. Spin:", ispin
141 IF (output_unit > 0 .AND. do_mixed)
THEN
142 WRITE (output_unit,
"(/,T2,A,/,T16,A,I3)") &
143 "LOCALIZATION| Computing localization properties for OCCUPIED, ", &
144 "PARTIALLY OCCUPIED and UNOCCUPIED ORBITALS. Spin:", ispin
146 IF (output_unit > 0 .AND. (.NOT. do_homo) .AND. (.NOT. do_mixed))
THEN
147 WRITE (output_unit,
"(/,T2,A,I3)") &
148 "LOCALIZATION| Computing localization properties "// &
149 "for UNOCCUPIED ORBITALS. Spin:", ispin
152 scenter => qs_loc_env%localized_wfn_control%centers_set(ispin)%array
155 myspin=ispin, ext_mo_coeff=mo_local(ispin))
166 CALL wfc_to_molecule(qs_loc_env, scenter, molecule_set, ispin, dft_control%nspins)
174 ns =
SIZE(qs_loc_env%localized_wfn_control%loc_states, 1)
175 IF (.NOT.
ASSOCIATED(wc(ispin)%centres))
THEN
176 ALLOCATE (wc(ispin)%WannierHamDiag(ns))
177 ALLOCATE (wc(ispin)%centres(3, ns))
180 wc(ispin)%centres(:, :) = scenter(1 + (ispin - 1)*3:ispin*3, :)
181 lstates => qs_loc_env%localized_wfn_control%loc_states(:, ispin)
183 ks_rmpv(ispin)%matrix, qs_env, loc_print_section=loc_print_section, &
184 wanniercentres=wc(ispin), ns=ns, states=lstates)
190 molecule_set, mo_local(ispin), coeff(ispin), &
191 evals(ispin)%array, ks_rmpv(ispin)%matrix, matrix_s(1)%matrix, qs_env, wf_r, wf_g, &
192 loc_print_section=loc_print_section, particles=particles, tag=trim(qs_loc_env%tag_mo), &
193 marked_states=marked_states_spin, ispin=ispin)
194 IF (
ASSOCIATED(marked_states_spin))
THEN
195 IF (.NOT.
ASSOCIATED(marked_states))
THEN
196 ALLOCATE (marked_states(
SIZE(marked_states_spin), dft_control%nspins, 2))
199 IF (qs_loc_env%tag_mo ==
"LUMO") mystate = 2
200 marked_states(:, ispin, mystate) = marked_states_spin(:)
201 DEALLOCATE (marked_states_spin)
207 IF (
section_get_lval(loc_print_section,
"WANNIER_SPREADS%SECOND_MOMENTS"))
THEN
209 IF (dft_control%qs_control%gapw_control%lmax_sphere < 6)
THEN
210 cpabort(
"Periodic second moments require LMAXN1>=6 In QS section")
233 CALL set_qs_env(qs_env=qs_env, wanniercentres=wc)
238 max_moment =
section_get_ival(loc_print_section,
"LOCALIZED_MOMENTS%MAX_MOMENT")
239 magnetic =
section_get_lval(loc_print_section,
"LOCALIZED_MOMENTS%MAGNETIC")
240 vel_reprs =
section_get_lval(loc_print_section,
"LOCALIZED_MOMENTS%VEL_REPRS")
243 vel_reprs, com_nl, loc_print_section)
246 CALL timestop(handle)
various utilities that regard array of different kinds: output, allocation,... maybe it is not a good...
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
represent a full matrix distributed on many processors
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
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, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
Defines the basic variable types.
integer, parameter, public dp
Routines for the calculation of moments from Wannier functions.
subroutine, public calculate_localized_moments(qs_env, qs_loc_env, mo_local, max_moment, magnetic, vel_reprs, com_nl, loc_print_section)
Calculates localized multipole moments per molecule in the Wannier MO basis.
Set of routines handling the localization for molecular properties.
subroutine, public calculate_molecular_dipole(qs_env, qs_loc_env, loc_print_key, molecule_set)
maps wfc's to molecules and also prints molecular dipoles
Set of routines handling the localization for molecular properties.
subroutine, public calculate_molecular_moments(qs_env, qs_loc_env, mo_local, loc_print_key, molecule_set)
Calculates electrical molecular moments using local operators r-r_ref r_ref: center of mass of the mo...
Routines for the calculation of molecular states.
subroutine, public construct_molecular_states(molecule_set, mo_localized, mo_coeff, mo_eigenvalues, hks, matrix_s, qs_env, wf_r, wf_g, loc_print_section, particles, tag, marked_states, ispin)
constructs molecular states. mo_localized gets overwritten!
Define the data structure for the molecule information.
represent a simple array based list of the given type
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, matrix_vhxc, 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.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, mimic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, rhoz_cneo_set, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, harris_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, wanniercentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Set the QUICKSTEP environment.
Driver for the localization that should be general for all the methods available and all the definiti...
subroutine, public qs_loc_driver(qs_env, qs_loc_env, print_loc_section, myspin, ext_mo_coeff)
set up the calculation of localized orbitals
Driver for the localization that should be general for all the methods available and all the definiti...
subroutine, public centers_second_moments_berry(qs_env, qs_loc_env, print_loc_section, ispin)
Compute the second moments of the centers using a periodic quadrupole operator.
subroutine, public centers_second_moments_loc(qs_env, qs_loc_env, print_loc_section, ispin)
Compute the second moments of the centers using the local (non-periodic) pos operators.
Set of routines handling the localization for molecular properties.
subroutine, public wfc_to_molecule(qs_loc_env, center, molecule_set, ispin, nspins)
maps wfc's to molecules and also prints molecular dipoles
subroutine, public get_localization_info(qs_env, qs_loc_env, loc_section, mo_local, wf_r, wf_g, particles, coeff, evals, marked_states)
Performs localization of the orbitals.
New version of the module for the localization of the molecular orbitals This should be able to use d...
Definition and initialisation of the mo data type.
defines the type needed for computing wannier states expectations
Routines for the calculation of wannier states.
subroutine, public construct_wannier_states(mo_localized, hks, qs_env, loc_print_section, wanniercentres, ns, states)
constructs wannier states. mo_localized should not be overwritten!
represent a pointer to a 1d array
type of a logger, at the moment it contains just a print level starting at which level it should be l...
represent a list of objects
contains all the info needed by quickstep to calculate the spread of a selected set of orbitals and i...