54#include "./base/base_uses.f90" 
   60   CHARACTER(len=*), 
PARAMETER, 
PRIVATE :: moduleN = 
'localization_tb' 
   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
 
   88      TYPE(
cp_fm_type), 
ALLOCATABLE, 
DIMENSION(:)        :: homo_localized, occupied_orbs
 
   89      TYPE(
cp_fm_type), 
DIMENSION(:), 
POINTER            :: mo_loc_history
 
  101      TYPE(
qs_kind_type), 
DIMENSION(:), 
POINTER          :: qs_kind_set
 
  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 
  129         cpwarn_if(explicit, 
"Localization using LIST of states not implemented for TB methods")
 
  131         cpwarn_if(explicit, 
"Localization using energy range not implemented for TB methods")
 
  133         cpwarn_if(explicit, 
"Localization of unoccupied states not implemented for TB methods")
 
  136            WRITE (iounit, 
"(/,T11,A)") 
" +++++++++++++ Start Localization of Orbitals +++++++++++++" 
  140                         dft_control=dft_control, &
 
  141                         do_kpoints=do_kpoints, &
 
  143                         particle_set=particle_set, &
 
  144                         atomic_kind_set=atomic_kind_set, &
 
  145                         qs_kind_set=qs_kind_set)
 
  149            cpwarn(
"Localization not implemented for k-point calculations!")
 
  150         ELSEIF (dft_control%restricted) 
THEN 
  151            IF (iounit > 0) 
WRITE (iounit, *) &
 
  152               " Unclear how we define MOs / localization in the restricted case ... skipping" 
  155            nspins = dft_control%nspins
 
  156            ALLOCATE (occupied_orbs(nspins))
 
  157            ALLOCATE (occupied_evals(nspins))
 
  158            ALLOCATE (homo_localized(nspins))
 
  160               CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, &
 
  161                               eigenvalues=mo_eigenvalues)
 
  162               occupied_orbs(ispin) = mo_coeff
 
  163               occupied_evals(ispin)%array => mo_eigenvalues
 
  164               CALL cp_fm_create(homo_localized(ispin), occupied_orbs(ispin)%matrix_struct)
 
  165               CALL cp_fm_to_fm(occupied_orbs(ispin), homo_localized(ispin))
 
  168            CALL get_qs_env(qs_env, mo_loc_history=mo_loc_history)
 
  172            CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, pw_pools=pw_pools)
 
  173            CALL auxbas_pw_pool%create_pw(wf_r)
 
  174            CALL auxbas_pw_pool%create_pw(wf_g)
 
  176            NULLIFY (marked_states, qs_loc_env_homo)
 
  177            ALLOCATE (qs_loc_env_homo)
 
  180            CALL qs_loc_init(qs_env, qs_loc_env_homo, localize_section, homo_localized, do_homo, &
 
  181                             .false., mo_loc_history=mo_loc_history)
 
  183                                       wf_r, wf_g, particles, occupied_orbs, occupied_evals, marked_states)
 
  186            IF (qs_loc_env_homo%localized_wfn_control%use_history) 
THEN 
  188               CALL set_qs_env(qs_env, mo_loc_history=mo_loc_history)
 
  193                                   homo_localized, do_homo)
 
  195            DEALLOCATE (occupied_orbs)
 
  196            DEALLOCATE (occupied_evals)
 
  198            IF (qs_loc_env_homo%do_localize) 
THEN 
  199               CALL loc_dipole(qs_env%input, dft_control, qs_loc_env_homo, logger, qs_env)
 
  201            CALL auxbas_pw_pool%give_back_pw(wf_g)
 
  202            CALL auxbas_pw_pool%give_back_pw(wf_r)
 
  204            DEALLOCATE (qs_loc_env_homo)
 
  205            IF (
ASSOCIATED(marked_states)) 
THEN 
  206               DEALLOCATE (marked_states)
 
  212      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_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, 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, 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, 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.
 
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)
...
 
Provides all information about an atomic kind.
 
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
 
contained for different pw related things
 
to create arrays of pools
 
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
 
Provides all information about a quickstep kind.
 
contains all the info needed by quickstep to calculate the spread of a selected set of orbitals and i...