59#include "./base/base_uses.f90"
67 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'wannier_states'
69 LOGICAL,
PARAMETER,
PRIVATE :: debug_this_module = .true.
90 Hks, qs_env, loc_print_section, WannierCentres, ns, states)
97 INTEGER,
INTENT(IN) :: ns
98 INTEGER,
INTENT(IN),
POINTER :: states(:)
100 CHARACTER(len=*),
PARAMETER :: routinen =
'construct_wannier_states'
102 CHARACTER(default_string_length) :: unit_str
103 CHARACTER(LEN=12) :: symbol
104 CHARACTER(LEN=12),
DIMENSION(:),
POINTER :: bcgf_symbol
105 CHARACTER(LEN=2) :: element_symbol
106 CHARACTER(LEN=40) :: fmtstr1, fmtstr2, fmtstr3
107 CHARACTER(LEN=6),
DIMENSION(:),
POINTER :: bsgf_symbol
108 INTEGER :: after, before, from, handle, i, iatom, icgf, ico, icol, ikind, iproc, irow, iset, &
109 isgf, ishell, iso, jcol, left, lmax, lshell, natom, ncgf, ncol, ncol_global, nrow_global, &
110 nset, nsgf, nstates(2), output_unit, right, to, unit_mat
111 INTEGER,
DIMENSION(:),
POINTER :: nshell
112 INTEGER,
DIMENSION(:, :),
POINTER :: l
113 LOGICAL :: print_cartesian
114 REAL(kind=
dp) :: unit_conv
115 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: cmatrix, smatrix
124 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
130 CALL timeset(routinen, handle)
131 NULLIFY (logger, para_env)
134 atomic_kind_set=atomic_kind_set, &
135 qs_kind_set=qs_kind_set, &
136 particle_set=particle_set)
143 ncol_global=ncol_global, &
144 nrow_global=nrow_global)
147 nstates(2) = para_env%mepos
149 NULLIFY (fm_struct_tmp, print_key)
158 para_env=mo_localized%matrix_struct%para_env, &
159 context=mo_localized%matrix_struct%context)
167 para_env=mo_localized%matrix_struct%para_env, &
168 context=mo_localized%matrix_struct%context)
173 wanniercentres%WannierHamDiag = 0.0_dp
176 "WANNIER_STATES", extension=
".whks", &
177 ignore_should_output=.false.)
178 IF (unit_mat > 0)
THEN
179 WRITE (unit_mat,
'(a16,1(i0,1x))')
"Wannier states: ", ns
180 WRITE (unit_mat,
'(a16)')
"#No x y z energy "
189 IF (unit_mat > 0)
WRITE (unit_mat,
'(i0,1x,4(f16.8,2x))') states(i), &
190 wanniercentres%centres(1:3, states(i))*unit_conv, wanniercentres%WannierHamDiag(states(i))
193 IF (unit_mat > 0)
WRITE (unit_mat, *)
195 IF (output_unit > 0)
THEN
196 WRITE (output_unit, *)
""
197 WRITE (output_unit, *)
"NUMBER OF Wannier STATES ", ns
198 WRITE (output_unit, *)
"ENERGY original MO-index"
200 WRITE (output_unit,
'(f16.8,2x,i0)') wanniercentres%WannierHamDiag(i), states(i)
211 ALLOCATE (smatrix(nrow_global, ncol_global))
214 IF (unit_mat > 0)
THEN
217 NULLIFY (bsgf_symbol)
219 NULLIFY (bsgf_symbol)
227 ncol = int(56/(before + after + 3))
229 fmtstr1 =
"(T2,A,21X, ( X,I5, X))"
230 fmtstr2 =
"(T2,A,9X, (1X,F . ))"
231 fmtstr3 =
"(T2,A,I5,1X,I5,1X,A,1X,A6, (1X,F . ))"
233 right = max((after - 2), 1)
234 left = (before + after + 3) - right - 5
236 IF (print_cartesian)
THEN
237 WRITE (unit=unit_mat, fmt=
"(T2,A,16X,A)")
"WS|",
"Wannier states in the cartesian AO basis"
239 WRITE (unit=unit_mat, fmt=
"(T2,A,16X,A)")
"WS|",
"Wannier states in the spherical AO basis"
241 WRITE (unit=fmtstr1(11:12), fmt=
"(I2)") ncol
242 WRITE (unit=fmtstr1(14:15), fmt=
"(I2)") left
243 WRITE (unit=fmtstr1(21:22), fmt=
"(I2)") right
245 WRITE (unit=fmtstr2(10:11), fmt=
"(I2)") ncol
246 WRITE (unit=fmtstr2(17:18), fmt=
"(I2)") before + after + 2
247 WRITE (unit=fmtstr2(20:21), fmt=
"(I2)") after
249 WRITE (unit=fmtstr3(27:28), fmt=
"(I2)") ncol
250 WRITE (unit=fmtstr3(34:35), fmt=
"(I2)") before + after + 2
251 WRITE (unit=fmtstr3(37:38), fmt=
"(I2)") after
254 IF (print_cartesian)
THEN
256 ALLOCATE (cmatrix(ncgf, ncgf))
263 NULLIFY (orb_basis_set, dftb_parameter)
264 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
266 basis_set=orb_basis_set, &
267 dftb_parameter=dftb_parameter)
268 IF (
ASSOCIATED(orb_basis_set))
THEN
274 DO ishell = 1, nshell(iset)
275 lshell = l(ishell, iset)
276 CALL dgemm(
"T",
"N",
nco(lshell), ncol_global,
nso(lshell), 1.0_dp, &
278 smatrix(isgf, 1), nsgf, 0.0_dp, &
279 cmatrix(icgf, 1), ncgf)
280 icgf = icgf +
nco(lshell)
281 isgf = isgf +
nso(lshell)
284 ELSE IF (
ASSOCIATED(dftb_parameter))
THEN
286 DO ishell = 1, lmax + 1
288 CALL dgemm(
"T",
"N",
nco(lshell), nsgf,
nso(lshell), 1.0_dp, &
290 smatrix(isgf, 1), nsgf, 0.0_dp, &
291 cmatrix(icgf, 1), ncgf)
292 icgf = icgf +
nco(lshell)
293 isgf = isgf +
nso(lshell)
303 DO icol = 1, ncol_global, ncol
306 to = min((from + ncol - 1), ncol_global)
308 WRITE (unit=unit_mat, fmt=
"(T2,A)")
"WS|"
309 WRITE (unit=unit_mat, fmt=fmtstr1)
"WS|", (jcol, jcol=from, to)
310 WRITE (unit=unit_mat, fmt=fmtstr2)
"WS| Energies", &
311 (wanniercentres%WannierHamDiag(states(jcol)), jcol=from, to)
312 WRITE (unit=unit_mat, fmt=
"(T2,A)")
"WS|"
318 IF (iatom /= 1)
WRITE (unit=unit_mat, fmt=
"(T2,A)")
"WS|"
320 NULLIFY (orb_basis_set, dftb_parameter)
322 element_symbol=element_symbol, kind_number=ikind)
323 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set, &
324 dftb_parameter=dftb_parameter)
326 IF (print_cartesian)
THEN
328 NULLIFY (bcgf_symbol)
329 IF (
ASSOCIATED(orb_basis_set))
THEN
338 DO ishell = 1, nshell(iset)
339 lshell = l(ishell, iset)
340 DO ico = 1,
nco(lshell)
341 WRITE (unit=unit_mat, fmt=fmtstr3) &
342 "WS|", irow, iatom, adjustr(element_symbol), bcgf_symbol(icgf), &
343 (cmatrix(irow, jcol), jcol=from, to)
349 ELSE IF (
ASSOCIATED(dftb_parameter))
THEN
352 DO ishell = 1, lmax + 1
354 DO ico = 1,
nco(lshell)
357 WRITE (unit=unit_mat, fmt=fmtstr3) &
358 "WS|", irow, iatom, adjustr(element_symbol), symbol, &
359 (cmatrix(irow, jcol), jcol=from, to)
370 IF (
ASSOCIATED(orb_basis_set))
THEN
378 DO ishell = 1, nshell(iset)
379 lshell = l(ishell, iset)
380 DO iso = 1,
nso(lshell)
381 WRITE (unit=unit_mat, fmt=fmtstr3) &
382 "WS|", irow, iatom, adjustr(element_symbol), bsgf_symbol(isgf), &
383 (smatrix(irow, jcol), jcol=from, to)
389 ELSE IF (
ASSOCIATED(dftb_parameter))
THEN
392 DO ishell = 1, lmax + 1
394 DO iso = 1,
nso(lshell)
395 symbol =
sgf_symbol(1, lshell, -lshell + iso - 1)
397 WRITE (unit=unit_mat, fmt=fmtstr3) &
398 "WS|", irow, iatom, adjustr(element_symbol), symbol, &
399 (smatrix(irow, jcol), jcol=from, to)
414 WRITE (unit=unit_mat, fmt=
"(T2,A)")
"WS|"
416 IF (print_cartesian)
THEN
426 CALL timestop(handle)
static void dgemm(const char transa, const char transb, const int m, const int n, const int k, const double alpha, const double *a, const int lda, const double *b, const int ldb, const double beta, double *c, const int ldc)
Convenient wrapper to hide Fortran nature of dgemm_, swapping a and b.
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius, npgf_seg_sum)
...
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
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_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_get_element(matrix, irow_global, icol_global, alpha, local)
returns an element of a fm this value is valid on every cpu using this call is expensive
subroutine, public cp_fm_get_submatrix(fm, target_m, start_row, start_col, n_rows, n_cols, transpose)
gets a submatrix of a full matrix op(target_m)(1:n_rows,1:n_cols) =fm(start_row:start_row+n_rows,...
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
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public nco
integer, dimension(:, :), allocatable, public indco
integer, dimension(:), allocatable, public nso
character(len=12) function, public cgf_symbol(n, lxyz)
Build a Cartesian orbital symbol (orbital labels for printing).
character(len=6) function, public sgf_symbol(n, l, m)
Build a spherical orbital symbol (orbital labels for printing).
basic linear algebra operations for full matrixes
Define the data structure for the particle information.
Definition of the DFTB parameter types.
Working with the DFTB parameter types.
subroutine, public get_dftb_atom_param(dftb_parameter, name, typ, defined, z, zeff, natorb, lmax, skself, occupation, eta, energy, cutoff, xi, di, rcdisp, dudq)
...
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.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, basis_type, total_zeff_corr, npgf_seg)
Get attributes of an atomic kind set.
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!
Provides all information about an atomic kind.
keeps the information about the structure of a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.