54 #include "./base/base_uses.f90"
60 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'localization_tb'
76 TYPE(qs_environment_type),
POINTER :: qs_env
77 CHARACTER(LEN=*) :: tb_type
79 CHARACTER(len=*),
PARAMETER :: routinen =
'wfn_localization_tb'
81 INTEGER :: handle, iounit, ispin, nspins
82 INTEGER,
DIMENSION(:, :, :),
POINTER :: marked_states
83 LOGICAL :: do_homo, do_kpoints, explicit, &
85 REAL(kind=
dp),
DIMENSION(:),
POINTER :: mo_eigenvalues
86 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
87 TYPE(cp_1d_r_p_type),
DIMENSION(:),
POINTER :: occupied_evals
88 TYPE(cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: homo_localized, occupied_orbs
89 TYPE(cp_fm_type),
DIMENSION(:),
POINTER :: mo_loc_history
90 TYPE(cp_fm_type),
POINTER :: mo_coeff
91 TYPE(cp_logger_type),
POINTER :: logger
92 TYPE(dft_control_type),
POINTER :: dft_control
93 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
94 TYPE(particle_list_type),
POINTER :: particles
95 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
96 TYPE(pw_c1d_gs_type) :: wf_g
97 TYPE(pw_env_type),
POINTER :: pw_env
98 TYPE(pw_pool_p_type),
DIMENSION(:),
POINTER :: pw_pools
99 TYPE(pw_pool_type),
POINTER :: auxbas_pw_pool
100 TYPE(pw_r3d_rs_type) :: wf_r
101 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
102 TYPE(qs_loc_env_type),
POINTER :: qs_loc_env_homo
103 TYPE(qs_subsys_type),
POINTER :: subsys
104 TYPE(section_vals_type),
POINTER :: dft_section, loc_print_section, &
107 CALL timeset(routinen, handle)
112 cpassert(
ASSOCIATED(qs_env))
118 IF (trim(tb_type) ==
"xTB")
THEN
121 IF (loc_explicit)
THEN
122 cpwarn(
"Wfn localization for this TB type not implemented")
123 loc_explicit = .false.
127 IF (loc_explicit)
THEN
130 cpwarn(
"Localization using LIST of states not implemented for TB methods")
134 cpwarn(
"Localization using energy range not implemented for TB methods")
138 cpwarn(
"Localization of unoccupied states not implemented for TB methods")
142 WRITE (iounit,
"(/,T11,A)")
" +++++++++++++ Start Localization of Orbitals +++++++++++++"
146 dft_control=dft_control, &
147 do_kpoints=do_kpoints, &
149 particle_set=particle_set, &
150 atomic_kind_set=atomic_kind_set, &
151 qs_kind_set=qs_kind_set)
155 cpwarn(
"Localization not implemented for k-point calculations!!")
156 ELSEIF (dft_control%restricted)
THEN
157 IF (iounit > 0)
WRITE (iounit, *) &
158 " Unclear how we define MOs / localization in the restricted case ... skipping"
161 nspins = dft_control%nspins
162 ALLOCATE (occupied_orbs(nspins))
163 ALLOCATE (occupied_evals(nspins))
164 ALLOCATE (homo_localized(nspins))
166 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, &
167 eigenvalues=mo_eigenvalues)
168 occupied_orbs(ispin) = mo_coeff
169 occupied_evals(ispin)%array => mo_eigenvalues
170 CALL cp_fm_create(homo_localized(ispin), occupied_orbs(ispin)%matrix_struct)
171 CALL cp_fm_to_fm(occupied_orbs(ispin), homo_localized(ispin))
174 CALL get_qs_env(qs_env, mo_loc_history=mo_loc_history)
178 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, pw_pools=pw_pools)
179 CALL auxbas_pw_pool%create_pw(wf_r)
180 CALL auxbas_pw_pool%create_pw(wf_g)
182 NULLIFY (marked_states, qs_loc_env_homo)
183 ALLOCATE (qs_loc_env_homo)
186 CALL qs_loc_init(qs_env, qs_loc_env_homo, localize_section, homo_localized, do_homo, &
187 .false., mo_loc_history=mo_loc_history)
189 wf_r, wf_g, particles, occupied_orbs, occupied_evals, marked_states)
192 IF (qs_loc_env_homo%localized_wfn_control%use_history)
THEN
194 CALL set_qs_env(qs_env, mo_loc_history=mo_loc_history)
199 homo_localized, do_homo)
200 CALL cp_fm_release(homo_localized)
201 DEALLOCATE (occupied_orbs)
202 DEALLOCATE (occupied_evals)
204 IF (qs_loc_env_homo%do_localize)
THEN
205 CALL loc_dipole(qs_env%input, dft_control, qs_loc_env_homo, logger, qs_env)
207 CALL auxbas_pw_pool%give_back_pw(wf_g)
208 CALL auxbas_pw_pool%give_back_pw(wf_r)
210 DEALLOCATE (qs_loc_env_homo)
211 IF (
ASSOCIATED(marked_states))
THEN
212 DEALLOCATE (marked_states)
218 CALL timestop(handle)
Define the atomic kind types and their sub types.
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
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 ...
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
Defines the basic variable types.
integer, parameter, public dp
Localization/Wannier functions for TB.
subroutine, public wfn_localization_tb(qs_env, tb_type)
wfn localization
represent a simple array based list of the given type
Define the data structure for the particle information.
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
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.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, 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, 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, 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, rhs)
Set the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
subroutine, public loc_dipole(input, dft_control, qs_loc_env, logger, qs_env)
Computes and prints the Dipole (using localized charges)
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...
subroutine, public qs_loc_env_release(qs_loc_env)
...
subroutine, public qs_loc_env_create(qs_loc_env)
...
Some utilities for the construction of the localization environment.
subroutine, public loc_write_restart(qs_loc_env, section, mo_array, coeff_localized, do_homo, evals, do_mixed)
...
subroutine, public qs_loc_control_init(qs_loc_env, loc_section, do_homo, do_mixed, do_xas, nloc_xas, spin_xas)
initializes everything needed for localization of the HOMOs
subroutine, public retain_history(mo_loc_history, mo_loc)
copy old mos to new ones, allocating as necessary
subroutine, public qs_loc_init(qs_env, qs_loc_env, localize_section, mos_localized, do_homo, do_mo_cubes, mo_loc_history, evals, tot_zeff_corr, do_mixed)
initializes everything needed for localization of the molecular orbitals
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.
types that represent a quickstep subsys
subroutine, public qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
...