(git:871dbd5)
Loading...
Searching...
No Matches
qs_loc_utils.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Some utilities for the construction of
10!> the localization environment
11!> \author MI (05-2005)
12! **************************************************************************************************
14
15 USE ai_moments, ONLY: contract_cossin,&
16 cossin
20 USE cell_types, ONLY: cell_type,&
21 pbc
24 USE cp_dbcsr_api, ONLY: dbcsr_copy,&
27 dbcsr_set,&
30 USE cp_files, ONLY: close_file,&
37 USE cp_fm_types, ONLY: &
44 USE cp_output_handling, ONLY: cp_p_file,&
50 USE input_constants, ONLY: &
57 USE kinds, ONLY: default_path_length,&
59 dp
60 USE mathconstants, ONLY: twopi
63 USE orbital_pointers, ONLY: ncoset
68 USE qs_kind_types, ONLY: get_qs_kind,&
71 USE qs_loc_types, ONLY: get_qs_loc_env,&
78 USE qs_mo_methods, ONLY: make_mo_eig
79 USE qs_mo_types, ONLY: get_mo_set,&
87 USE qs_scf_types, ONLY: ot_method_nr
89#include "./base/base_uses.f90"
90
91 IMPLICIT NONE
92
93 PRIVATE
94
95! *** Global parameters ***
96
97 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_loc_utils'
98
99! *** Public ***
103
104CONTAINS
105
106! **************************************************************************************************
107!> \brief copy old mos to new ones, allocating as necessary
108!> \param mo_loc_history ...
109!> \param mo_loc ...
110! **************************************************************************************************
111 SUBROUTINE retain_history(mo_loc_history, mo_loc)
112
113 TYPE(cp_fm_type), DIMENSION(:), POINTER :: mo_loc_history
114 TYPE(cp_fm_type), DIMENSION(:), INTENT(IN) :: mo_loc
115
116 CHARACTER(len=*), PARAMETER :: routinen = 'retain_history'
117
118 INTEGER :: handle, i, ncol_hist, ncol_loc
119
120 CALL timeset(routinen, handle)
121
122 IF (.NOT. ASSOCIATED(mo_loc_history)) THEN
123 ALLOCATE (mo_loc_history(SIZE(mo_loc)))
124 DO i = 1, SIZE(mo_loc_history)
125 CALL cp_fm_create(mo_loc_history(i), mo_loc(i)%matrix_struct)
126 END DO
127 END IF
128
129 DO i = 1, SIZE(mo_loc_history)
130 CALL cp_fm_get_info(mo_loc_history(i), ncol_global=ncol_hist)
131 CALL cp_fm_get_info(mo_loc(i), ncol_global=ncol_loc)
132 cpassert(ncol_hist == ncol_loc)
133 CALL cp_fm_to_fm(mo_loc(i), mo_loc_history(i))
134 END DO
135
136 CALL timestop(handle)
137
138 END SUBROUTINE retain_history
139
140! **************************************************************************************************
141!> \brief rotate the mo_new, so that the orbitals are as similar
142!> as possible to ones in mo_ref.
143!> \param mo_new ...
144!> \param mo_ref ...
145!> \param matrix_S ...
146! **************************************************************************************************
147 SUBROUTINE rotate_state_to_ref(mo_new, mo_ref, matrix_S)
148
149 TYPE(cp_fm_type), INTENT(IN) :: mo_new, mo_ref
150 TYPE(dbcsr_type), POINTER :: matrix_s
151
152 CHARACTER(len=*), PARAMETER :: routinen = 'rotate_state_to_ref'
153
154 INTEGER :: handle, ncol, ncol_ref, nrow
155 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: eigenvalues
156 TYPE(cp_fm_struct_type), POINTER :: fm_struct_tmp
157 TYPE(cp_fm_type) :: o1, o2, o3, o4, smo
158
159 CALL timeset(routinen, handle)
160
161 CALL cp_fm_get_info(mo_new, nrow_global=nrow, ncol_global=ncol)
162 CALL cp_fm_get_info(mo_ref, ncol_global=ncol_ref)
163 cpassert(ncol == ncol_ref)
164
165 NULLIFY (fm_struct_tmp)
166 CALL cp_fm_create(smo, mo_ref%matrix_struct)
167
168 CALL cp_fm_struct_create(fm_struct_tmp, nrow_global=ncol, &
169 ncol_global=ncol, para_env=mo_new%matrix_struct%para_env, &
170 context=mo_new%matrix_struct%context)
171 CALL cp_fm_create(o1, fm_struct_tmp)
172 CALL cp_fm_create(o2, fm_struct_tmp)
173 CALL cp_fm_create(o3, fm_struct_tmp)
174 CALL cp_fm_create(o4, fm_struct_tmp)
175 CALL cp_fm_struct_release(fm_struct_tmp)
176
177 ! o1 = (mo_new)^T matrix_S mo_ref
178 CALL cp_dbcsr_sm_fm_multiply(matrix_s, mo_ref, smo, ncol)
179 CALL parallel_gemm('T', 'N', ncol, ncol, nrow, 1.0_dp, mo_new, smo, 0.0_dp, o1)
180
181 ! o2 = (o1^T o1)
182 CALL parallel_gemm('T', 'N', ncol, ncol, ncol, 1.0_dp, o1, o1, 0.0_dp, o2)
183
184 ! o2 = (o1^T o1)^-1/2
185 ALLOCATE (eigenvalues(ncol))
186 CALL choose_eigv_solver(o2, o3, eigenvalues)
187 CALL cp_fm_to_fm(o3, o4)
188 eigenvalues(:) = 1.0_dp/sqrt(eigenvalues(:))
189 CALL cp_fm_column_scale(o4, eigenvalues)
190 CALL parallel_gemm('N', 'T', ncol, ncol, ncol, 1.0_dp, o3, o4, 0.0_dp, o2)
191
192 ! o3 = o1 (o1^T o1)^-1/2
193 CALL parallel_gemm('N', 'N', ncol, ncol, ncol, 1.0_dp, o1, o2, 0.0_dp, o3)
194
195 ! mo_new o1 (o1^T o1)^-1/2
196 CALL parallel_gemm('N', 'N', nrow, ncol, ncol, 1.0_dp, mo_new, o3, 0.0_dp, smo)
197 CALL cp_fm_to_fm(smo, mo_new)
198
199 ! XXXXXXX testing
200 ! CALL parallel_gemm('N','T',ncol,ncol,ncol,1.0_dp,o3,o3,0.0_dp,o1)
201 ! WRITE(*,*) o1%local_data
202 ! CALL parallel_gemm('T','N',ncol,ncol,ncol,1.0_dp,o3,o3,0.0_dp,o1)
203 ! WRITE(*,*) o1%local_data
204
205 CALL cp_fm_release(o1)
206 CALL cp_fm_release(o2)
207 CALL cp_fm_release(o3)
208 CALL cp_fm_release(o4)
209 CALL cp_fm_release(smo)
210
211 CALL timestop(handle)
212
213 END SUBROUTINE rotate_state_to_ref
214
215! **************************************************************************************************
216!> \brief allocates the data, and initializes the operators
217!> \param qs_loc_env new environment for the localization calculations
218!> \param localized_wfn_control variables and directives for the localization
219!> \param qs_env the qs_env in which the qs_env lives
220!> \param myspin ...
221!> \param do_localize ...
222!> \param loc_coeff ...
223!> \param mo_loc_history ...
224!> \par History
225!> 04.2005 created [MI]
226!> \author MI
227!> \note
228!> similar to the old one, but not quite
229! **************************************************************************************************
230 SUBROUTINE qs_loc_env_init(qs_loc_env, localized_wfn_control, qs_env, myspin, do_localize, &
231 loc_coeff, mo_loc_history)
232
233 TYPE(qs_loc_env_type), POINTER :: qs_loc_env
234 TYPE(localized_wfn_control_type), POINTER :: localized_wfn_control
235 TYPE(qs_environment_type), POINTER :: qs_env
236 INTEGER, INTENT(IN), OPTIONAL :: myspin
237 LOGICAL, INTENT(IN), OPTIONAL :: do_localize
238 TYPE(cp_fm_type), DIMENSION(:), INTENT(IN), &
239 OPTIONAL :: loc_coeff
240 TYPE(cp_fm_type), DIMENSION(:), OPTIONAL, POINTER :: mo_loc_history
241
242 CHARACTER(len=*), PARAMETER :: routinen = 'qs_loc_env_init'
243
244 INTEGER :: dim_op, handle, i, iatom, imo, imoloc, &
245 ispin, j, l_spin, lb, nao, naosub, &
246 natoms, nmo, nmosub, nspins, s_spin, ub
247 REAL(kind=dp) :: my_occ, occ_imo
248 REAL(kind=dp), DIMENSION(:), POINTER :: occupations
249 REAL(kind=dp), DIMENSION(:, :), POINTER :: vecbuffer
250 TYPE(cell_type), POINTER :: cell
251 TYPE(cp_fm_struct_type), POINTER :: tmp_fm_struct
252 TYPE(cp_fm_type), DIMENSION(:), POINTER :: moloc_coeff
253 TYPE(cp_fm_type), POINTER :: mat_ptr, mo_coeff
254 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
255 TYPE(distribution_1d_type), POINTER :: local_molecules
256 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
257 TYPE(mp_para_env_type), POINTER :: para_env
258 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
259
260 CALL timeset(routinen, handle)
261
262 NULLIFY (mos, matrix_s, moloc_coeff, particle_set, para_env, cell, &
263 local_molecules, occupations, mat_ptr)
264 IF (PRESENT(do_localize)) qs_loc_env%do_localize = do_localize
265 IF (qs_loc_env%do_localize) THEN
266 CALL get_qs_env(qs_env=qs_env, matrix_s=matrix_s, cell=cell, &
267 local_molecules=local_molecules, particle_set=particle_set, &
268 para_env=para_env, mos=mos)
269 nspins = SIZE(mos, 1)
270 s_spin = 1
271 l_spin = nspins
272 IF (PRESENT(myspin)) THEN
273 s_spin = myspin
274 l_spin = myspin
275 END IF
276 IF (PRESENT(loc_coeff) .AND. nspins*2 == SIZE(loc_coeff)) THEN
277 ALLOCATE (moloc_coeff(s_spin:s_spin + 2*(l_spin - s_spin) + 1))
278 ELSE
279 ALLOCATE (moloc_coeff(s_spin:l_spin))
280 END IF
281 DO ispin = s_spin, l_spin
282 NULLIFY (tmp_fm_struct, mo_coeff)
283 CALL get_mo_set(mos(ispin), mo_coeff=mo_coeff, nao=nao, nmo=nmo)
284 nmosub = localized_wfn_control%nloc_states(ispin)
285 CALL cp_fm_struct_create(tmp_fm_struct, nrow_global=nao, &
286 ncol_global=nmosub, para_env=para_env, context=mo_coeff%matrix_struct%context)
287 IF (PRESENT(loc_coeff) .AND. nspins*2 == SIZE(loc_coeff)) THEN
288 CALL cp_fm_create(moloc_coeff(2*ispin - 1), tmp_fm_struct)
289 CALL cp_fm_create(moloc_coeff(2*ispin), tmp_fm_struct)
290 ELSE
291 CALL cp_fm_create(moloc_coeff(ispin), tmp_fm_struct)
292 END IF
293
294 CALL cp_fm_get_info(moloc_coeff(ispin), nrow_global=naosub, &
295 ncol_global=nmosub)
296 cpassert(nao == naosub)
297 IF ((localized_wfn_control%do_homo) .OR. &
298 (localized_wfn_control%set_of_states == state_loc_mixed)) THEN
299 cpassert(nmo >= nmosub)
300 ELSE
301 cpassert(nao - nmo >= nmosub)
302 END IF
303 CALL cp_fm_set_all(moloc_coeff(ispin), 0.0_dp)
304 CALL cp_fm_struct_release(tmp_fm_struct)
305 END DO ! ispin
306 ! Copy the submatrix
307
308 IF (PRESENT(loc_coeff)) ALLOCATE (mat_ptr)
309
310 DO ispin = s_spin, l_spin
311 CALL get_mo_set(mos(ispin), mo_coeff=mo_coeff, &
312 occupation_numbers=occupations, nao=nao, nmo=nmo)
313 lb = localized_wfn_control%lu_bound_states(1, ispin)
314 ub = localized_wfn_control%lu_bound_states(2, ispin)
315
316 IF (PRESENT(loc_coeff)) THEN
317 mat_ptr = loc_coeff(ispin)
318 ELSE
319 mat_ptr => mo_coeff
320 END IF
321 IF ((localized_wfn_control%set_of_states == state_loc_list) .OR. &
322 (localized_wfn_control%set_of_states == state_loc_mixed)) THEN
323 ALLOCATE (vecbuffer(1, nao))
324 IF (localized_wfn_control%do_homo) THEN
325 my_occ = occupations(localized_wfn_control%loc_states(1, ispin))
326 END IF
327 nmosub = SIZE(localized_wfn_control%loc_states, 1)
328 cpassert(nmosub > 0)
329 imoloc = 0
330 DO i = lb, ub
331 ! Get the index in the subset
332 imoloc = imoloc + 1
333 ! Get the index in the full set
334 imo = localized_wfn_control%loc_states(i, ispin)
335 IF (localized_wfn_control%do_homo) THEN
336 occ_imo = occupations(imo)
337 IF (abs(occ_imo - my_occ) > localized_wfn_control%eps_occ) THEN
338 IF (localized_wfn_control%localization_method /= do_loc_none) &
339 CALL cp_abort(__location__, &
340 "States with different occupations "// &
341 "cannot be rotated together")
342 END IF
343 END IF
344 ! Take the imo vector from the full set and copy in the imoloc vector of the subset
345 CALL cp_fm_get_submatrix(mat_ptr, vecbuffer, 1, imo, &
346 nao, 1, transpose=.true.)
347 CALL cp_fm_set_submatrix(moloc_coeff(ispin), vecbuffer, 1, imoloc, &
348 nao, 1, transpose=.true.)
349 END DO
350 DEALLOCATE (vecbuffer)
351 ELSE
352 my_occ = occupations(lb)
353 occ_imo = occupations(ub)
354 IF (abs(occ_imo - my_occ) > localized_wfn_control%eps_occ) THEN
355 IF (localized_wfn_control%localization_method /= do_loc_none) &
356 CALL cp_abort(__location__, &
357 "States with different occupations "// &
358 "cannot be rotated together")
359 END IF
360 nmosub = localized_wfn_control%nloc_states(ispin)
361
362 IF (PRESENT(loc_coeff) .AND. nspins*2 == SIZE(loc_coeff)) THEN
363 CALL cp_fm_to_fm(loc_coeff(2*ispin - 1), moloc_coeff(2*ispin - 1))
364 CALL cp_fm_to_fm(loc_coeff(2*ispin), moloc_coeff(2*ispin))
365 ELSE
366 CALL cp_fm_to_fm(mat_ptr, moloc_coeff(ispin), nmosub, lb, 1)
367 END IF
368 END IF
369
370 ! we have the mo's to be localized now, see if we can rotate them according to the history
371 ! only do that if we have a history of course. The history is filled
372 IF (PRESENT(mo_loc_history)) THEN
373 IF (localized_wfn_control%use_history .AND. ASSOCIATED(mo_loc_history)) THEN
374 CALL rotate_state_to_ref(moloc_coeff(ispin), &
375 mo_loc_history(ispin), matrix_s(1)%matrix)
376 END IF
377 END IF
378
379 END DO
380
381 IF (PRESENT(loc_coeff)) DEALLOCATE (mat_ptr)
382
383 CALL set_qs_loc_env(qs_loc_env=qs_loc_env, cell=cell, local_molecules=local_molecules, &
384 moloc_coeff=moloc_coeff, particle_set=particle_set, para_env=para_env, &
385 localized_wfn_control=localized_wfn_control)
386
387 ! Prepare the operators
388 NULLIFY (tmp_fm_struct, mo_coeff)
389 nmosub = maxval(localized_wfn_control%nloc_states)
390 CALL get_mo_set(mos(1), mo_coeff=mo_coeff)
391 CALL cp_fm_struct_create(tmp_fm_struct, nrow_global=nmosub, &
392 ncol_global=nmosub, para_env=para_env, context=mo_coeff%matrix_struct%context)
393
394 IF (localized_wfn_control%operator_type == op_loc_berry) THEN
395 IF (qs_loc_env%cell%orthorhombic) THEN
396 dim_op = 3
397 ELSE
398 dim_op = 6
399 END IF
400 CALL set_qs_loc_env(qs_loc_env=qs_loc_env, dim_op=dim_op)
401 ALLOCATE (qs_loc_env%op_sm_set(2, dim_op))
402 DO i = 1, dim_op
403 DO j = 1, SIZE(qs_loc_env%op_sm_set, 1)
404 NULLIFY (qs_loc_env%op_sm_set(j, i)%matrix)
405 ALLOCATE (qs_loc_env%op_sm_set(j, i)%matrix)
406 CALL dbcsr_copy(qs_loc_env%op_sm_set(j, i)%matrix, matrix_s(1)%matrix, &
407 name="qs_loc_env%op_sm_"//trim(adjustl(cp_to_string(j)))//"-"//trim(adjustl(cp_to_string(i))))
408 CALL dbcsr_set(qs_loc_env%op_sm_set(j, i)%matrix, 0.0_dp)
409 END DO
410 END DO
411
412 ELSEIF (localized_wfn_control%operator_type == op_loc_pipek) THEN
413 natoms = SIZE(qs_loc_env%particle_set, 1)
414 ALLOCATE (qs_loc_env%op_fm_set(natoms, 1))
415 CALL set_qs_loc_env(qs_loc_env=qs_loc_env, dim_op=natoms)
416 DO ispin = 1, SIZE(qs_loc_env%op_fm_set, 2)
417 CALL get_mo_set(mos(ispin), nmo=nmo)
418 DO iatom = 1, natoms
419 CALL cp_fm_create(qs_loc_env%op_fm_set(iatom, ispin), tmp_fm_struct)
420
421 CALL cp_fm_get_info(qs_loc_env%op_fm_set(iatom, ispin), nrow_global=nmosub)
422 cpassert(nmo >= nmosub)
423 CALL cp_fm_set_all(qs_loc_env%op_fm_set(iatom, ispin), 0.0_dp)
424 END DO ! iatom
425 END DO ! ispin
426 ELSE
427 cpabort("Type of operator not implemented")
428 END IF
429 CALL cp_fm_struct_release(tmp_fm_struct)
430
431 IF (localized_wfn_control%operator_type == op_loc_berry) THEN
432
433 CALL initialize_weights(qs_loc_env%cell, qs_loc_env%weights)
434
435 CALL get_berry_operator(qs_loc_env, qs_env)
436
437 ELSEIF (localized_wfn_control%operator_type == op_loc_pipek) THEN
438
439 !! here we don't have to do anything
440 !! CALL get_pipek_mezey_operator ( qs_loc_env, qs_env )
441
442 END IF
443
444 qs_loc_env%molecular_states = .false.
445 qs_loc_env%wannier_states = .false.
446 END IF
447 CALL timestop(handle)
448
449 END SUBROUTINE qs_loc_env_init
450
451! **************************************************************************************************
452!> \brief A wrapper to compute the Berry operator for periodic systems
453!> \param qs_loc_env new environment for the localization calculations
454!> \param qs_env the qs_env in which the qs_env lives
455!> \par History
456!> 04.2005 created [MI]
457!> 04.2018 modified [RZK, ZL]
458!> \author MI
459! **************************************************************************************************
460 SUBROUTINE get_berry_operator(qs_loc_env, qs_env)
461 TYPE(qs_loc_env_type), POINTER :: qs_loc_env
462 TYPE(qs_environment_type), POINTER :: qs_env
463
464 CHARACTER(len=*), PARAMETER :: routinen = 'get_berry_operator'
465
466 INTEGER :: dim_op, handle
467 TYPE(cell_type), POINTER :: cell
468 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: op_sm_set
469
470 CALL timeset(routinen, handle)
471
472 NULLIFY (cell, op_sm_set)
473 CALL get_qs_loc_env(qs_loc_env=qs_loc_env, op_sm_set=op_sm_set, &
474 cell=cell, dim_op=dim_op)
475 CALL compute_berry_operator(qs_env, cell, op_sm_set, dim_op)
476
477 CALL timestop(handle)
478 END SUBROUTINE get_berry_operator
479
480! **************************************************************************************************
481!> \brief Computes the Berry operator for periodic systems
482!> used to define the spread of the MOS
483!> Here the matrix elements of the type <mu|cos(kr)|nu> and <mu|sin(kr)|nu>
484!> are computed, where mu and nu are the contracted basis functions.
485!> Namely the Berry operator is exp(ikr)
486!> k is defined somewhere
487!> the pair lists are exploited and sparse matrixes are constructed
488!> \param qs_env the qs_env in which the qs_env lives
489!> \param cell ...
490!> \param op_sm_set ...
491!> \param dim_op ...
492!> \par History
493!> 04.2005 created [MI]
494!> 04.2018 wrapped old code [RZK, ZL]
495!> \author MI
496!> \note
497!> The intgrals are computed analytically using the primitives GTO
498!> The contraction is performed block-wise
499! **************************************************************************************************
500 SUBROUTINE compute_berry_operator(qs_env, cell, op_sm_set, dim_op)
501 TYPE(qs_environment_type), POINTER :: qs_env
502 TYPE(cell_type), POINTER :: cell
503 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: op_sm_set
504 INTEGER :: dim_op
505
506 CHARACTER(len=*), PARAMETER :: routinen = 'compute_berry_operator'
507
508 INTEGER :: handle, i, iatom, icol, ikind, inode, irow, iset, jatom, jkind, jset, last_jatom, &
509 ldab, ldsa, ldsb, ldwork, maxl, ncoa, ncob, nkind, nrow, nseta, nsetb, sgfa, sgfb
510 INTEGER, DIMENSION(3) :: perd0
511 INTEGER, DIMENSION(:), POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
512 npgfb, nsgfa, nsgfb
513 INTEGER, DIMENSION(:, :), POINTER :: first_sgfa, first_sgfb
514 LOGICAL :: found, new_atom_b
515 REAL(kind=dp) :: dab, kvec(3), rab2, vector_k(3, 6)
516 REAL(kind=dp), DIMENSION(3) :: ra, rab, rb
517 REAL(kind=dp), DIMENSION(:), POINTER :: set_radius_a, set_radius_b
518 REAL(kind=dp), DIMENSION(:, :), POINTER :: cosab, rpgfa, rpgfb, sinab, sphi_a, &
519 sphi_b, work, zeta, zetb
520 TYPE(block_p_type), DIMENSION(:), POINTER :: op_cos, op_sin
521 TYPE(gto_basis_set_p_type), DIMENSION(:), POINTER :: basis_set_list
522 TYPE(gto_basis_set_type), POINTER :: basis_set_a, basis_set_b
524 DIMENSION(:), POINTER :: nl_iterator
525 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
526 POINTER :: sab_orb
527 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
528 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
529 TYPE(qs_kind_type), POINTER :: qs_kind
530
531 CALL timeset(routinen, handle)
532 NULLIFY (qs_kind, qs_kind_set)
533 NULLIFY (particle_set)
534 NULLIFY (sab_orb)
535 NULLIFY (cosab, sinab, work)
536 NULLIFY (la_max, la_min, lb_max, lb_min, npgfa, npgfb, nsgfa, nsgfb)
537 NULLIFY (set_radius_a, set_radius_b, rpgfa, rpgfb, sphi_a, sphi_b, zeta, zetb)
538
539 CALL get_qs_env(qs_env=qs_env, qs_kind_set=qs_kind_set, &
540 particle_set=particle_set, sab_orb=sab_orb)
541
542 nkind = SIZE(qs_kind_set)
543
544 CALL get_qs_kind_set(qs_kind_set=qs_kind_set, &
545 maxco=ldwork, maxlgto=maxl)
546 ldab = ldwork
547 ALLOCATE (cosab(ldab, ldab))
548 cosab = 0.0_dp
549 ALLOCATE (sinab(ldab, ldab))
550 sinab = 0.0_dp
551 ALLOCATE (work(ldwork, ldwork))
552 work = 0.0_dp
553
554 ALLOCATE (op_cos(dim_op))
555 ALLOCATE (op_sin(dim_op))
556 DO i = 1, dim_op
557 NULLIFY (op_cos(i)%block)
558 NULLIFY (op_sin(i)%block)
559 END DO
560
561 kvec = 0.0_dp
562 vector_k = 0.0_dp
563 vector_k(:, 1) = twopi*cell%h_inv(1, :)
564 vector_k(:, 2) = twopi*cell%h_inv(2, :)
565 vector_k(:, 3) = twopi*cell%h_inv(3, :)
566 vector_k(:, 4) = twopi*(cell%h_inv(1, :) + cell%h_inv(2, :))
567 vector_k(:, 5) = twopi*(cell%h_inv(1, :) + cell%h_inv(3, :))
568 vector_k(:, 6) = twopi*(cell%h_inv(2, :) + cell%h_inv(3, :))
569
570 ! This operator can be used only for periodic systems
571 ! If an isolated system is used the periodicity is overimposed
572 perd0(1:3) = cell%perd(1:3)
573 cell%perd(1:3) = 1
574
575 ALLOCATE (basis_set_list(nkind))
576 DO ikind = 1, nkind
577 qs_kind => qs_kind_set(ikind)
578 CALL get_qs_kind(qs_kind=qs_kind, basis_set=basis_set_a)
579 IF (ASSOCIATED(basis_set_a)) THEN
580 basis_set_list(ikind)%gto_basis_set => basis_set_a
581 ELSE
582 NULLIFY (basis_set_list(ikind)%gto_basis_set)
583 END IF
584 END DO
585 CALL neighbor_list_iterator_create(nl_iterator, sab_orb)
586 DO WHILE (neighbor_list_iterate(nl_iterator) == 0)
587 CALL get_iterator_info(nl_iterator, ikind=ikind, jkind=jkind, inode=inode, &
588 iatom=iatom, jatom=jatom, r=rab)
589 basis_set_a => basis_set_list(ikind)%gto_basis_set
590 IF (.NOT. ASSOCIATED(basis_set_a)) cycle
591 basis_set_b => basis_set_list(jkind)%gto_basis_set
592 IF (.NOT. ASSOCIATED(basis_set_b)) cycle
593 ra = pbc(particle_set(iatom)%r, cell)
594 ! basis ikind
595 first_sgfa => basis_set_a%first_sgf
596 la_max => basis_set_a%lmax
597 la_min => basis_set_a%lmin
598 npgfa => basis_set_a%npgf
599 nseta = basis_set_a%nset
600 nsgfa => basis_set_a%nsgf_set
601 rpgfa => basis_set_a%pgf_radius
602 set_radius_a => basis_set_a%set_radius
603 sphi_a => basis_set_a%sphi
604 zeta => basis_set_a%zet
605 ! basis jkind
606 first_sgfb => basis_set_b%first_sgf
607 lb_max => basis_set_b%lmax
608 lb_min => basis_set_b%lmin
609 npgfb => basis_set_b%npgf
610 nsetb = basis_set_b%nset
611 nsgfb => basis_set_b%nsgf_set
612 rpgfb => basis_set_b%pgf_radius
613 set_radius_b => basis_set_b%set_radius
614 sphi_b => basis_set_b%sphi
615 zetb => basis_set_b%zet
616
617 ldsa = SIZE(sphi_a, 1)
618 ldsb = SIZE(sphi_b, 1)
619 IF (inode == 1) last_jatom = 0
620
621 rb = rab + ra
622
623 IF (jatom /= last_jatom) THEN
624 new_atom_b = .true.
625 last_jatom = jatom
626 ELSE
627 new_atom_b = .false.
628 END IF
629
630 IF (new_atom_b) THEN
631 IF (iatom <= jatom) THEN
632 irow = iatom
633 icol = jatom
634 ELSE
635 irow = jatom
636 icol = iatom
637 END IF
638
639 DO i = 1, dim_op
640 NULLIFY (op_cos(i)%block)
641 CALL dbcsr_get_block_p(matrix=op_sm_set(1, i)%matrix, &
642 row=irow, col=icol, block=op_cos(i)%block, found=found)
643 NULLIFY (op_sin(i)%block)
644 CALL dbcsr_get_block_p(matrix=op_sm_set(2, i)%matrix, &
645 row=irow, col=icol, block=op_sin(i)%block, found=found)
646 END DO
647 END IF ! new_atom_b
648
649 rab2 = rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)
650 dab = sqrt(rab2)
651
652 nrow = 0
653 DO iset = 1, nseta
654
655 ncoa = npgfa(iset)*ncoset(la_max(iset))
656 sgfa = first_sgfa(1, iset)
657
658 DO jset = 1, nsetb
659
660 ncob = npgfb(jset)*ncoset(lb_max(jset))
661 sgfb = first_sgfb(1, jset)
662
663 IF (set_radius_a(iset) + set_radius_b(jset) >= dab) THEN
664
665! *** Calculate the primitive overlap integrals ***
666 DO i = 1, dim_op
667 kvec(1:3) = vector_k(1:3, i)
668 cosab = 0.0_dp
669 sinab = 0.0_dp
670 CALL cossin(la_max(iset), npgfa(iset), zeta(:, iset), rpgfa(:, iset), &
671 la_min(iset), lb_max(jset), npgfb(jset), zetb(:, jset), &
672 rpgfb(:, jset), lb_min(jset), &
673 ra, rb, kvec, cosab, sinab)
674 CALL contract_cossin(op_cos(i)%block, op_sin(i)%block, &
675 iatom, ncoa, nsgfa(iset), sgfa, sphi_a, ldsa, &
676 jatom, ncob, nsgfb(jset), sgfb, sphi_b, ldsb, &
677 cosab, sinab, ldab, work, ldwork)
678 END DO
679
680 END IF ! >= dab
681
682 END DO ! jset
683
684 nrow = nrow + ncoa
685
686 END DO ! iset
687
688 END DO
689 CALL neighbor_list_iterator_release(nl_iterator)
690
691 ! Set back the correct periodicity
692 cell%perd(1:3) = perd0(1:3)
693
694 DO i = 1, dim_op
695 NULLIFY (op_cos(i)%block)
696 NULLIFY (op_sin(i)%block)
697 END DO
698 DEALLOCATE (op_cos, op_sin)
699
700 DEALLOCATE (cosab, sinab, work, basis_set_list)
701
702 CALL timestop(handle)
703 END SUBROUTINE compute_berry_operator
704
705! **************************************************************************************************
706!> \brief ...
707!> \param qs_loc_env ...
708!> \param section ...
709!> \param mo_array ...
710!> \param coeff_localized ...
711!> \param do_homo ...
712!> \param evals ...
713!> \param do_mixed ...
714! **************************************************************************************************
715 SUBROUTINE loc_write_restart(qs_loc_env, section, mo_array, coeff_localized, &
716 do_homo, evals, do_mixed)
717 TYPE(qs_loc_env_type), POINTER :: qs_loc_env
718 TYPE(section_vals_type), POINTER :: section
719 TYPE(mo_set_type), DIMENSION(:), POINTER :: mo_array
720 TYPE(cp_fm_type), DIMENSION(:), INTENT(IN) :: coeff_localized
721 LOGICAL, INTENT(IN) :: do_homo
722 TYPE(cp_1d_r_p_type), DIMENSION(:), OPTIONAL, &
723 POINTER :: evals
724 LOGICAL, INTENT(IN), OPTIONAL :: do_mixed
725
726 CHARACTER(LEN=*), PARAMETER :: routinen = 'loc_write_restart'
727
728 CHARACTER(LEN=default_path_length) :: filename
729 CHARACTER(LEN=default_string_length) :: my_middle
730 INTEGER :: handle, ispin, max_block, nao, nloc, &
731 nmo, output_unit, rst_unit
732 LOGICAL :: my_do_mixed
733 TYPE(cp_logger_type), POINTER :: logger
734 TYPE(section_vals_type), POINTER :: print_key
735
736 CALL timeset(routinen, handle)
737 NULLIFY (logger)
738 logger => cp_get_default_logger()
739 output_unit = cp_logger_get_default_io_unit(logger)
740
741 IF (qs_loc_env%do_localize) THEN
742
743 print_key => section_vals_get_subs_vals(section, "LOC_RESTART")
744 IF (btest(cp_print_key_should_output(logger%iter_info, &
745 section, "LOC_RESTART"), &
746 cp_p_file)) THEN
747
748 ! Open file
749 rst_unit = -1
750
751 my_do_mixed = .false.
752 IF (PRESENT(do_mixed)) my_do_mixed = do_mixed
753 IF (do_homo) THEN
754 my_middle = "LOC_HOMO"
755 ELSEIF (my_do_mixed) THEN
756 my_middle = "LOC_MIXED"
757 ELSE
758 my_middle = "LOC_LUMO"
759 END IF
760
761 rst_unit = cp_print_key_unit_nr(logger, section, "LOC_RESTART", &
762 extension=".wfn", file_status="REPLACE", file_action="WRITE", &
763 file_form="UNFORMATTED", middle_name=trim(my_middle))
764
765 IF (rst_unit > 0) filename = cp_print_key_generate_filename(logger, print_key, &
766 middle_name=trim(my_middle), extension=".wfn", &
767 my_local=.false.)
768
769 IF (output_unit > 0) THEN
770 WRITE (unit=output_unit, fmt="(/,T2,A, A/)") &
771 "LOCALIZATION| Write restart file for the localized MOS : ", &
772 trim(filename)
773 END IF
774
775 IF (rst_unit > 0) THEN
776 WRITE (rst_unit) qs_loc_env%localized_wfn_control%set_of_states
777 WRITE (rst_unit) qs_loc_env%localized_wfn_control%lu_bound_states
778 WRITE (rst_unit) qs_loc_env%localized_wfn_control%nloc_states
779 END IF
780
781 DO ispin = 1, SIZE(coeff_localized)
782 associate(mo_coeff => coeff_localized(ispin))
783 CALL cp_fm_get_info(mo_coeff, nrow_global=nao, ncol_global=nmo, ncol_block=max_block)
784 nloc = qs_loc_env%localized_wfn_control%nloc_states(ispin)
785 IF (rst_unit > 0) THEN
786 WRITE (rst_unit) qs_loc_env%localized_wfn_control%loc_states(1:nloc, ispin)
787 IF (do_homo .OR. my_do_mixed) THEN
788 WRITE (rst_unit) nmo, &
789 mo_array(ispin)%homo, &
790 mo_array(ispin)%lfomo, &
791 mo_array(ispin)%nelectron
792 WRITE (rst_unit) mo_array(ispin)%eigenvalues(1:nmo), &
793 mo_array(ispin)%occupation_numbers(1:nmo)
794 ELSE
795 WRITE (rst_unit) nmo
796 WRITE (rst_unit) evals(ispin)%array(1:nmo)
797 END IF
798 END IF
799
800 CALL cp_fm_write_unformatted(mo_coeff, rst_unit)
801 END associate
802
803 END DO
804
805 CALL cp_print_key_finished_output(rst_unit, logger, section, &
806 "LOC_RESTART")
807 END IF
808
809 END IF
810
811 CALL timestop(handle)
812
813 END SUBROUTINE loc_write_restart
814
815! **************************************************************************************************
816!> \brief ...
817!> \param qs_loc_env ...
818!> \param mos ...
819!> \param mos_localized ...
820!> \param section ...
821!> \param section2 ...
822!> \param para_env ...
823!> \param do_homo ...
824!> \param restart_found ...
825!> \param evals ...
826!> \param do_mixed ...
827! **************************************************************************************************
828 SUBROUTINE loc_read_restart(qs_loc_env, mos, mos_localized, section, section2, para_env, &
829 do_homo, restart_found, evals, do_mixed)
830
831 TYPE(qs_loc_env_type), POINTER :: qs_loc_env
832 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
833 TYPE(cp_fm_type), DIMENSION(:), INTENT(INOUT) :: mos_localized
834 TYPE(section_vals_type), POINTER :: section, section2
835 TYPE(mp_para_env_type), POINTER :: para_env
836 LOGICAL, INTENT(IN) :: do_homo
837 LOGICAL, INTENT(INOUT) :: restart_found
838 TYPE(cp_1d_r_p_type), DIMENSION(:), OPTIONAL, &
839 POINTER :: evals
840 LOGICAL, INTENT(IN), OPTIONAL :: do_mixed
841
842 CHARACTER(len=*), PARAMETER :: routinen = 'loc_read_restart'
843
844 CHARACTER(LEN=25) :: fname_key
845 CHARACTER(LEN=default_path_length) :: filename
846 CHARACTER(LEN=default_string_length) :: my_middle
847 INTEGER :: handle, homo_read, i, ispin, lfomo_read, max_nloc, n_rep_val, nao, &
848 nelectron_read, nloc, nmo, nmo_read, nspin, output_unit, rst_unit
849 LOGICAL :: file_exists, my_do_mixed
850 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: eig_read, occ_read
851 REAL(kind=dp), DIMENSION(:, :), POINTER :: vecbuffer
852 TYPE(cp_logger_type), POINTER :: logger
853 TYPE(section_vals_type), POINTER :: print_key
854
855 CALL timeset(routinen, handle)
856
857 logger => cp_get_default_logger()
858
859 nspin = SIZE(mos_localized)
860 nao = mos(1)%nao
861 rst_unit = -1
862
863 output_unit = cp_print_key_unit_nr(logger, section2, &
864 "PROGRAM_RUN_INFO", extension=".Log")
865
866 my_do_mixed = .false.
867 IF (PRESENT(do_mixed)) my_do_mixed = do_mixed
868 IF (do_homo) THEN
869 fname_key = "LOCHOMO_RESTART_FILE_NAME"
870 ELSEIF (my_do_mixed) THEN
871 fname_key = "LOCMIXD_RESTART_FILE_NAME"
872 ELSE
873 fname_key = "LOCLUMO_RESTART_FILE_NAME"
874 IF (.NOT. PRESENT(evals)) &
875 cpabort("Missing argument to localize unoccupied states.")
876 END IF
877
878 file_exists = .false.
879 CALL section_vals_val_get(section, fname_key, n_rep_val=n_rep_val)
880 IF (n_rep_val > 0) THEN
881 CALL section_vals_val_get(section, fname_key, c_val=filename)
882 ELSE
883
884 print_key => section_vals_get_subs_vals(section2, "LOC_RESTART")
885 IF (do_homo) THEN
886 my_middle = "LOC_HOMO"
887 ELSEIF (my_do_mixed) THEN
888 my_middle = "LOC_MIXED"
889 ELSE
890 my_middle = "LOC_LUMO"
891 END IF
892 filename = cp_print_key_generate_filename(logger, print_key, &
893 middle_name=trim(my_middle), extension=".wfn", &
894 my_local=.false.)
895 END IF
896
897 IF (para_env%is_source()) INQUIRE (file=filename, exist=file_exists)
898
899 IF (file_exists) THEN
900 IF (para_env%is_source()) THEN
901 CALL open_file(file_name=filename, &
902 file_action="READ", &
903 file_form="UNFORMATTED", &
904 file_status="OLD", &
905 unit_number=rst_unit)
906
907 READ (rst_unit) qs_loc_env%localized_wfn_control%set_of_states
908 READ (rst_unit) qs_loc_env%localized_wfn_control%lu_bound_states
909 READ (rst_unit) qs_loc_env%localized_wfn_control%nloc_states
910 END IF
911 ELSE
912 IF (output_unit > 0) WRITE (output_unit, "(/,T10,A)") &
913 "Restart file not available filename=<"//trim(filename)//'>'
914 END IF
915 CALL para_env%bcast(file_exists)
916
917 IF (file_exists) THEN
918 restart_found = .true.
919
920 CALL para_env%bcast(qs_loc_env%localized_wfn_control%set_of_states)
921 CALL para_env%bcast(qs_loc_env%localized_wfn_control%lu_bound_states)
922 CALL para_env%bcast(qs_loc_env%localized_wfn_control%nloc_states)
923
924 max_nloc = maxval(qs_loc_env%localized_wfn_control%nloc_states(:))
925
926 ALLOCATE (vecbuffer(1, nao))
927 IF (ASSOCIATED(qs_loc_env%localized_wfn_control%loc_states)) THEN
928 DEALLOCATE (qs_loc_env%localized_wfn_control%loc_states)
929 END IF
930 ALLOCATE (qs_loc_env%localized_wfn_control%loc_states(max_nloc, 2))
931 qs_loc_env%localized_wfn_control%loc_states = 0
932
933 DO ispin = 1, nspin
934 IF (do_homo .OR. do_mixed) THEN
935 nmo = mos(ispin)%nmo
936 ELSE
937 nmo = SIZE(evals(ispin)%array, 1)
938 END IF
939 IF (para_env%is_source() .AND. (nmo > 0)) THEN
940 nloc = qs_loc_env%localized_wfn_control%nloc_states(ispin)
941 READ (rst_unit) qs_loc_env%localized_wfn_control%loc_states(1:nloc, ispin)
942 IF (do_homo .OR. do_mixed) THEN
943 READ (rst_unit) nmo_read, homo_read, lfomo_read, nelectron_read
944 ALLOCATE (eig_read(nmo_read), occ_read(nmo_read))
945 eig_read = 0.0_dp
946 occ_read = 0.0_dp
947 READ (rst_unit) eig_read(1:nmo_read), occ_read(1:nmo_read)
948 ELSE
949 READ (rst_unit) nmo_read
950 ALLOCATE (eig_read(nmo_read))
951 eig_read = 0.0_dp
952 READ (rst_unit) eig_read(1:nmo_read)
953 END IF
954 IF (nmo_read < nmo) &
955 CALL cp_warn(__location__, &
956 "The number of MOs on the restart unit is smaller than the number of "// &
957 "the allocated MOs. ")
958 IF (nmo_read > nmo) &
959 CALL cp_warn(__location__, &
960 "The number of MOs on the restart unit is greater than the number of "// &
961 "the allocated MOs. The read MO set will be truncated!")
962
963 nmo = min(nmo, nmo_read)
964 IF (do_homo .OR. do_mixed) THEN
965 mos(ispin)%eigenvalues(1:nmo) = eig_read(1:nmo)
966 mos(ispin)%occupation_numbers(1:nmo) = occ_read(1:nmo)
967 DEALLOCATE (eig_read, occ_read)
968 ELSE
969 evals(ispin)%array(1:nmo) = eig_read(1:nmo)
970 DEALLOCATE (eig_read)
971 END IF
972
973 END IF
974 IF (do_homo .OR. do_mixed) THEN
975 CALL para_env%bcast(mos(ispin)%eigenvalues)
976 CALL para_env%bcast(mos(ispin)%occupation_numbers)
977 ELSE
978 CALL para_env%bcast(evals(ispin)%array)
979 END IF
980
981 DO i = 1, nmo
982 IF (para_env%is_source()) THEN
983 READ (rst_unit) vecbuffer
984 ELSE
985 vecbuffer(1, :) = 0.0_dp
986 END IF
987 CALL para_env%bcast(vecbuffer)
988 CALL cp_fm_set_submatrix(mos_localized(ispin), &
989 vecbuffer, 1, i, nao, 1, transpose=.true.)
990 END DO
991 END DO
992
993 CALL para_env%bcast(qs_loc_env%localized_wfn_control%loc_states)
994
995 DEALLOCATE (vecbuffer)
996
997 END IF
998
999 ! Close restart file
1000 IF (para_env%is_source()) THEN
1001 IF (file_exists) CALL close_file(unit_number=rst_unit)
1002 END IF
1003
1004 CALL timestop(handle)
1005
1006 END SUBROUTINE loc_read_restart
1007
1008! **************************************************************************************************
1009!> \brief initializes everything needed for localization of the HOMOs
1010!> \param qs_loc_env ...
1011!> \param loc_section ...
1012!> \param do_homo ...
1013!> \param do_mixed ...
1014!> \param do_xas ...
1015!> \param nloc_xas ...
1016!> \param spin_xas ...
1017!> \par History
1018!> 2009 created
1019! **************************************************************************************************
1020 SUBROUTINE qs_loc_control_init(qs_loc_env, loc_section, do_homo, do_mixed, &
1021 do_xas, nloc_xas, spin_xas)
1022
1023 TYPE(qs_loc_env_type), POINTER :: qs_loc_env
1024 TYPE(section_vals_type), POINTER :: loc_section
1025 LOGICAL, INTENT(IN) :: do_homo
1026 LOGICAL, INTENT(IN), OPTIONAL :: do_mixed, do_xas
1027 INTEGER, INTENT(IN), OPTIONAL :: nloc_xas, spin_xas
1028
1029 LOGICAL :: my_do_mixed
1030 TYPE(localized_wfn_control_type), POINTER :: localized_wfn_control
1031
1032 NULLIFY (localized_wfn_control)
1033
1034 IF (PRESENT(do_mixed)) THEN
1035 my_do_mixed = do_mixed
1036 ELSE
1037 my_do_mixed = .false.
1038 END IF
1039 CALL localized_wfn_control_create(localized_wfn_control)
1040 CALL set_qs_loc_env(qs_loc_env, localized_wfn_control=localized_wfn_control)
1041 CALL localized_wfn_control_release(localized_wfn_control)
1042 CALL get_qs_loc_env(qs_loc_env, localized_wfn_control=localized_wfn_control)
1043 localized_wfn_control%do_homo = do_homo
1044 localized_wfn_control%do_mixed = my_do_mixed
1045 CALL read_loc_section(localized_wfn_control, loc_section, qs_loc_env%do_localize, &
1046 my_do_mixed, do_xas, nloc_xas, spin_xas)
1047
1048 END SUBROUTINE qs_loc_control_init
1049
1050! **************************************************************************************************
1051!> \brief initializes everything needed for localization of the molecular orbitals
1052!> \param qs_env ...
1053!> \param qs_loc_env ...
1054!> \param localize_section ...
1055!> \param mos_localized ...
1056!> \param do_homo ...
1057!> \param do_mo_cubes ...
1058!> \param mo_loc_history ...
1059!> \param evals ...
1060!> \param tot_zeff_corr ...
1061!> \param do_mixed ...
1062! **************************************************************************************************
1063 SUBROUTINE qs_loc_init(qs_env, qs_loc_env, localize_section, mos_localized, &
1064 do_homo, do_mo_cubes, mo_loc_history, evals, &
1065 tot_zeff_corr, do_mixed)
1066
1067 TYPE(qs_environment_type), POINTER :: qs_env
1068 TYPE(qs_loc_env_type), POINTER :: qs_loc_env
1069 TYPE(section_vals_type), POINTER :: localize_section
1070 TYPE(cp_fm_type), DIMENSION(:), INTENT(INOUT) :: mos_localized
1071 LOGICAL, OPTIONAL :: do_homo, do_mo_cubes
1072 TYPE(cp_fm_type), DIMENSION(:), OPTIONAL, POINTER :: mo_loc_history
1073 TYPE(cp_1d_r_p_type), DIMENSION(:), OPTIONAL, &
1074 POINTER :: evals
1075 REAL(kind=dp), INTENT(IN), OPTIONAL :: tot_zeff_corr
1076 LOGICAL, OPTIONAL :: do_mixed
1077
1078 CHARACTER(len=*), PARAMETER :: routinen = 'qs_loc_init'
1079
1080 INTEGER :: handle, homo, i, ilast_intocc, ilow, ispin, iup, n_mo(2), n_mos(2), nao, &
1081 nelectron, nextra, nmoloc(2), nocc, npocc, nspin, output_unit
1082 LOGICAL :: my_do_homo, my_do_mixed, my_do_mo_cubes, &
1083 restart_found
1084 REAL(kind=dp) :: maxocc, my_tot_zeff_corr
1085 REAL(kind=dp), DIMENSION(:), POINTER :: mo_eigenvalues, occupation
1086 TYPE(cp_fm_type), POINTER :: mo_coeff
1087 TYPE(cp_logger_type), POINTER :: logger
1088 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: ks_rmpv, mo_derivs
1089 TYPE(dft_control_type), POINTER :: dft_control
1090 TYPE(localized_wfn_control_type), POINTER :: localized_wfn_control
1091 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
1092 TYPE(mp_para_env_type), POINTER :: para_env
1093 TYPE(scf_control_type), POINTER :: scf_control
1094 TYPE(section_vals_type), POINTER :: loc_print_section
1095
1096 CALL timeset(routinen, handle)
1097
1098 NULLIFY (mos, mo_coeff, mo_eigenvalues, occupation, ks_rmpv, mo_derivs, scf_control, para_env)
1099 CALL get_qs_env(qs_env, &
1100 mos=mos, &
1101 matrix_ks=ks_rmpv, &
1102 mo_derivs=mo_derivs, &
1103 scf_control=scf_control, &
1104 dft_control=dft_control, &
1105 para_env=para_env)
1106
1107 loc_print_section => section_vals_get_subs_vals(localize_section, "PRINT")
1108
1109 logger => cp_get_default_logger()
1110 output_unit = cp_logger_get_default_io_unit(logger)
1111
1112 nspin = SIZE(mos)
1113 IF (PRESENT(do_homo)) THEN
1114 my_do_homo = do_homo
1115 ELSE
1116 my_do_homo = .true.
1117 END IF
1118 IF (PRESENT(do_mo_cubes)) THEN
1119 my_do_mo_cubes = do_mo_cubes
1120 ELSE
1121 my_do_mo_cubes = .false.
1122 END IF
1123 IF (PRESENT(do_mixed)) THEN
1124 my_do_mixed = do_mixed
1125 ELSE
1126 my_do_mixed = .false.
1127 END IF
1128 IF (PRESENT(tot_zeff_corr)) THEN
1129 my_tot_zeff_corr = tot_zeff_corr
1130 ELSE
1131 my_tot_zeff_corr = 0.0_dp
1132 END IF
1133 restart_found = .false.
1134
1135 IF (qs_loc_env%do_localize) THEN
1136 ! Some setup for MOs to be localized
1137 CALL get_qs_loc_env(qs_loc_env, localized_wfn_control=localized_wfn_control)
1138 IF (localized_wfn_control%loc_restart) THEN
1139 IF (localized_wfn_control%nextra > 0) THEN
1140 ! currently only the occupied guess is read
1141 my_do_homo = .false.
1142 END IF
1143 CALL loc_read_restart(qs_loc_env, mos, mos_localized, localize_section, &
1144 loc_print_section, para_env, my_do_homo, restart_found, evals=evals, &
1145 do_mixed=my_do_mixed)
1146 IF (output_unit > 0) WRITE (output_unit, "(/,T2,A,A)") "LOCALIZATION| ", &
1147 " The orbitals to be localized are read from localization restart file."
1148 nmoloc = localized_wfn_control%nloc_states
1149 localized_wfn_control%nguess = nmoloc
1150 IF (localized_wfn_control%nextra > 0) THEN
1151 ! reset different variables in localized_wfn_control:
1152 ! lu_bound_states, nloc_states, loc_states
1153 localized_wfn_control%loc_restart = restart_found
1154 localized_wfn_control%set_of_states = state_loc_mixed
1155 DO ispin = 1, nspin
1156 CALL get_mo_set(mos(ispin), homo=homo, occupation_numbers=occupation, &
1157 maxocc=maxocc)
1158 nextra = localized_wfn_control%nextra
1159 nocc = homo
1160 DO i = nocc, 1, -1
1161 IF (maxocc - occupation(i) < localized_wfn_control%eps_occ) THEN
1162 ilast_intocc = i
1163 EXIT
1164 END IF
1165 END DO
1166 nocc = ilast_intocc
1167 npocc = homo - nocc
1168 nmoloc(ispin) = nocc + nextra
1169 localized_wfn_control%lu_bound_states(1, ispin) = 1
1170 localized_wfn_control%lu_bound_states(2, ispin) = nmoloc(ispin)
1171 localized_wfn_control%nloc_states(ispin) = nmoloc(ispin)
1172 END DO
1173 my_do_homo = .false.
1174 END IF
1175 END IF
1176 IF (.NOT. restart_found) THEN
1177 nmoloc = 0
1178 DO ispin = 1, nspin
1179 CALL get_mo_set(mos(ispin), nmo=n_mo(ispin), nelectron=nelectron, homo=homo, nao=nao, &
1180 mo_coeff=mo_coeff, eigenvalues=mo_eigenvalues, occupation_numbers=occupation, &
1181 maxocc=maxocc)
1182 ! Get eigenstates (only needed if not already calculated before)
1183 IF ((.NOT. my_do_mo_cubes) &
1184 ! .OR. section_get_ival(dft_section,"PRINT%MO_CUBES%NHOMO")==0)&
1185 .AND. my_do_homo .AND. ASSOCIATED(qs_env%scf_env) &
1186 .AND. qs_env%scf_env%method == ot_method_nr .AND. (.NOT. dft_control%restricted)) THEN
1187 CALL make_mo_eig(mos, nspin, ks_rmpv, scf_control, mo_derivs)
1188 END IF
1189 IF (localized_wfn_control%set_of_states == state_loc_all .AND. my_do_homo) THEN
1190 nmoloc(ispin) = nint(nelectron/occupation(1))
1191 IF (n_mo(ispin) > homo) THEN
1192 DO i = nmoloc(ispin), 1, -1
1193 IF (occupation(1) - occupation(i) < localized_wfn_control%eps_occ) THEN
1194 ilast_intocc = i
1195 EXIT
1196 END IF
1197 END DO
1198 ELSE
1199 ilast_intocc = nmoloc(ispin)
1200 END IF
1201 nmoloc(ispin) = ilast_intocc
1202 localized_wfn_control%lu_bound_states(1, ispin) = 1
1203 localized_wfn_control%lu_bound_states(2, ispin) = ilast_intocc
1204 IF (nmoloc(ispin) /= n_mo(ispin)) THEN
1205 IF (output_unit > 0) &
1206 WRITE (output_unit, "(/,T2,A,I4,A,I6,A,/,T15,A,F12.6,A,F12.6,A)") &
1207 "LOCALIZATION| Spin ", ispin, " The first ", &
1208 ilast_intocc, " occupied orbitals are localized,", " with energies from ", &
1209 mo_eigenvalues(1), " to ", mo_eigenvalues(ilast_intocc), " [a.u.]."
1210 END IF
1211 ELSE IF (localized_wfn_control%set_of_states == energy_loc_range .AND. my_do_homo) THEN
1212 ilow = 0
1213 iup = 0
1214 DO i = 1, n_mo(ispin)
1215 IF (mo_eigenvalues(i) >= localized_wfn_control%lu_ene_bound(1)) THEN
1216 ilow = i
1217 EXIT
1218 END IF
1219 END DO
1220 DO i = n_mo(ispin), 1, -1
1221 IF (mo_eigenvalues(i) <= localized_wfn_control%lu_ene_bound(2)) THEN
1222 iup = i
1223 EXIT
1224 END IF
1225 END DO
1226 localized_wfn_control%lu_bound_states(1, ispin) = ilow
1227 localized_wfn_control%lu_bound_states(2, ispin) = iup
1228 localized_wfn_control%nloc_states(ispin) = iup - ilow + 1
1229 nmoloc(ispin) = localized_wfn_control%nloc_states(ispin)
1230 IF (occupation(ilow) - occupation(iup) > localized_wfn_control%eps_occ) THEN
1231 CALL cp_abort(__location__, &
1232 "The selected energy range includes orbitals with different occupation number. "// &
1233 "The localization procedure cannot be applied.")
1234 END IF
1235 IF (output_unit > 0) WRITE (output_unit, "(/,T2,A,I4,A,I6,A)") "LOCALIZATION| Spin ", ispin, " : ", &
1236 nmoloc(ispin), " orbitals in the selected energy range are localized."
1237 ELSE IF (localized_wfn_control%set_of_states == state_loc_all .AND. (.NOT. my_do_homo)) THEN
1238 nmoloc(ispin) = n_mo(ispin) - homo
1239 localized_wfn_control%lu_bound_states(1, ispin) = homo + 1
1240 localized_wfn_control%lu_bound_states(2, ispin) = n_mo(ispin)
1241 IF (output_unit > 0) &
1242 WRITE (output_unit, "(/,T2,A,I4,A,I6,A,/,T15,A,F12.6,A,F12.6,A)") &
1243 "LOCALIZATION| Spin ", ispin, " The first ", &
1244 nmoloc(ispin), " virtual orbitals are localized,", " with energies from ", &
1245 mo_eigenvalues(homo + 1), " to ", mo_eigenvalues(n_mo(ispin)), " [a.u.]."
1246 ELSE IF (localized_wfn_control%set_of_states == state_loc_mixed) THEN
1247 nextra = localized_wfn_control%nextra
1248 nocc = homo
1249 DO i = nocc, 1, -1
1250 IF (maxocc - occupation(i) < localized_wfn_control%eps_occ) THEN
1251 ilast_intocc = i
1252 EXIT
1253 END IF
1254 END DO
1255 nocc = ilast_intocc
1256 npocc = homo - nocc
1257 nmoloc(ispin) = nocc + nextra
1258 localized_wfn_control%lu_bound_states(1, ispin) = 1
1259 localized_wfn_control%lu_bound_states(2, ispin) = nmoloc(ispin)
1260 IF (output_unit > 0) &
1261 WRITE (output_unit, "(/,T2,A,I4,A,I6,A,/,T15,A,I6,/,T15,A,I6,/,T15,A,I6,/,T15,A,F12.6,A)") &
1262 "LOCALIZATION| Spin ", ispin, " The first ", &
1263 nmoloc(ispin), " orbitals are localized.", &
1264 "Number of fully occupied MOs: ", nocc, &
1265 "Number of partially occupied MOs: ", npocc, &
1266 "Number of extra degrees of freedom: ", nextra, &
1267 "Excess charge: ", my_tot_zeff_corr, " electrons"
1268 ELSE
1269 nmoloc(ispin) = min(localized_wfn_control%nloc_states(1), n_mo(ispin))
1270 IF (output_unit > 0 .AND. my_do_homo) WRITE (output_unit, "(/,T2,A,I4,A,I6,A)") "LOCALIZATION| Spin ", ispin, &
1271 " : ", nmoloc(ispin), " occupied orbitals are localized, as given in the input list."
1272 IF (output_unit > 0 .AND. (.NOT. my_do_homo)) WRITE (output_unit, "(/,T2,A,I4,A,I6,A)") "LOCALIZATION| Spin ", &
1273 ispin, " : ", nmoloc(ispin), " unoccupied orbitals are localized, as given in the input list."
1274 IF (n_mo(ispin) > homo .AND. my_do_homo) THEN
1275 ilow = localized_wfn_control%loc_states(1, ispin)
1276 DO i = 2, nmoloc(ispin)
1277 iup = localized_wfn_control%loc_states(i, ispin)
1278 IF (abs(occupation(ilow) - occupation(iup)) > localized_wfn_control%eps_occ) THEN
1279 ! write warning
1280 CALL cp_warn(__location__, &
1281 "User requested the calculation of localized wavefunction from a subset of MOs, "// &
1282 "including MOs with different occupations. Check the selected subset, "// &
1283 "the electronic density is not invariant with "// &
1284 "respect to rotations among orbitals with different occupation numbers!")
1285 END IF
1286 END DO
1287 END IF
1288 END IF
1289 END DO ! ispin
1290 n_mos(:) = nao - n_mo(:)
1291 IF (my_do_homo .OR. my_do_mixed) n_mos = n_mo
1292 CALL set_loc_wfn_lists(localized_wfn_control, nmoloc, n_mos, nspin)
1293 END IF
1294 CALL set_loc_centers(localized_wfn_control, nmoloc, nspin)
1295 IF (my_do_homo .OR. my_do_mixed) THEN
1296 CALL qs_loc_env_init(qs_loc_env, localized_wfn_control, qs_env, &
1297 loc_coeff=mos_localized, mo_loc_history=mo_loc_history)
1298 END IF
1299 ELSE
1300 ! Let's inform in case the section is not present in the input
1301 CALL cp_warn(__location__, &
1302 "User requested the calculation of the localized wavefunction but the section "// &
1303 "LOCALIZE was not specified. Localization will not be performed!")
1304 END IF
1305
1306 CALL timestop(handle)
1307
1308 END SUBROUTINE qs_loc_init
1309
1310! **************************************************************************************************
1311!> \brief read the controlparameter from input, using the new input scheme
1312!> \param localized_wfn_control ...
1313!> \param loc_section ...
1314!> \param localize ...
1315!> \param do_mixed ...
1316!> \param do_xas ...
1317!> \param nloc_xas ...
1318!> \param spin_channel_xas ...
1319!> \par History
1320!> 05.2005 created [MI]
1321! **************************************************************************************************
1322 SUBROUTINE read_loc_section(localized_wfn_control, loc_section, &
1323 localize, do_mixed, do_xas, nloc_xas, spin_channel_xas)
1324
1325 TYPE(localized_wfn_control_type), POINTER :: localized_wfn_control
1326 TYPE(section_vals_type), POINTER :: loc_section
1327 LOGICAL, INTENT(OUT) :: localize
1328 LOGICAL, INTENT(IN), OPTIONAL :: do_mixed, do_xas
1329 INTEGER, INTENT(IN), OPTIONAL :: nloc_xas, spin_channel_xas
1330
1331 INTEGER :: i, ind, ir, n_list, n_rep, n_state, &
1332 nextra, nline, other_spin, &
1333 output_unit, spin_xas
1334 INTEGER, DIMENSION(:), POINTER :: list, loc_list
1335 LOGICAL :: my_do_mixed, my_do_xas
1336 REAL(dp), POINTER :: ene(:)
1337 TYPE(cp_logger_type), POINTER :: logger
1338 TYPE(section_vals_type), POINTER :: loc_print_section
1339
1340 my_do_xas = .false.
1341 spin_xas = 1
1342 IF (PRESENT(do_xas)) THEN
1343 my_do_xas = do_xas
1344 cpassert(PRESENT(nloc_xas))
1345 END IF
1346 IF (PRESENT(spin_channel_xas)) spin_xas = spin_channel_xas
1347 my_do_mixed = .false.
1348 IF (PRESENT(do_mixed)) THEN
1349 my_do_mixed = do_mixed
1350 END IF
1351 cpassert(ASSOCIATED(loc_section))
1352 NULLIFY (logger)
1353 logger => cp_get_default_logger()
1354
1355 CALL section_vals_val_get(loc_section, "_SECTION_PARAMETERS_", l_val=localize)
1356 IF (localize) THEN
1357 loc_print_section => section_vals_get_subs_vals(loc_section, "PRINT")
1358 NULLIFY (list)
1359 NULLIFY (loc_list)
1360 localized_wfn_control%lu_bound_states = 0
1361 localized_wfn_control%lu_ene_bound = 0.0_dp
1362 localized_wfn_control%nloc_states = 0
1363 localized_wfn_control%set_of_states = 0
1364 localized_wfn_control%nextra = 0
1365 n_state = 0
1366
1367 CALL section_vals_val_get(loc_section, "MAX_ITER", &
1368 i_val=localized_wfn_control%max_iter)
1369 CALL section_vals_val_get(loc_section, "MAX_CRAZY_ANGLE", &
1370 r_val=localized_wfn_control%max_crazy_angle)
1371 CALL section_vals_val_get(loc_section, "CRAZY_SCALE", &
1372 r_val=localized_wfn_control%crazy_scale)
1373 CALL section_vals_val_get(loc_section, "EPS_OCCUPATION", &
1374 r_val=localized_wfn_control%eps_occ)
1375 CALL section_vals_val_get(loc_section, "CRAZY_USE_DIAG", &
1376 l_val=localized_wfn_control%crazy_use_diag)
1377 CALL section_vals_val_get(loc_section, "OUT_ITER_EACH", &
1378 i_val=localized_wfn_control%out_each)
1379 CALL section_vals_val_get(loc_section, "EPS_LOCALIZATION", &
1380 r_val=localized_wfn_control%eps_localization)
1381 CALL section_vals_val_get(loc_section, "MIN_OR_MAX", &
1382 i_val=localized_wfn_control%min_or_max)
1383 CALL section_vals_val_get(loc_section, "JACOBI_FALLBACK", &
1384 l_val=localized_wfn_control%jacobi_fallback)
1385 CALL section_vals_val_get(loc_section, "JACOBI_REFINEMENT", &
1386 l_val=localized_wfn_control%jacobi_refinement)
1387 CALL section_vals_val_get(loc_section, "METHOD", &
1388 i_val=localized_wfn_control%localization_method)
1389 CALL section_vals_val_get(loc_section, "OPERATOR", &
1390 i_val=localized_wfn_control%operator_type)
1391 CALL section_vals_val_get(loc_section, "RESTART", &
1392 l_val=localized_wfn_control%loc_restart)
1393 CALL section_vals_val_get(loc_section, "USE_HISTORY", &
1394 l_val=localized_wfn_control%use_history)
1395 CALL section_vals_val_get(loc_section, "NEXTRA", &
1396 i_val=localized_wfn_control%nextra)
1397 CALL section_vals_val_get(loc_section, "CPO_GUESS", &
1398 i_val=localized_wfn_control%coeff_po_guess)
1399 CALL section_vals_val_get(loc_section, "CPO_GUESS_SPACE", &
1400 i_val=localized_wfn_control%coeff_po_guess_mo_space)
1401 CALL section_vals_val_get(loc_section, "CG_PO", &
1402 l_val=localized_wfn_control%do_cg_po)
1403
1404 IF (localized_wfn_control%do_homo) THEN
1405 ! List of States HOMO
1406 CALL section_vals_val_get(loc_section, "LIST", n_rep_val=n_rep)
1407 IF (n_rep > 0) THEN
1408 n_list = 0
1409 DO ir = 1, n_rep
1410 NULLIFY (list)
1411 CALL section_vals_val_get(loc_section, "LIST", i_rep_val=ir, i_vals=list)
1412 IF (ASSOCIATED(list)) THEN
1413 CALL reallocate(loc_list, 1, n_list + SIZE(list))
1414 DO i = 1, SIZE(list)
1415 loc_list(n_list + i) = list(i)
1416 END DO ! i
1417 n_list = n_list + SIZE(list)
1418 END IF
1419 END DO ! ir
1420 IF (n_list /= 0) THEN
1421 localized_wfn_control%set_of_states = state_loc_list
1422 ALLOCATE (localized_wfn_control%loc_states(n_list, 2))
1423 localized_wfn_control%loc_states = 0
1424 localized_wfn_control%loc_states(:, 1) = loc_list(:)
1425 localized_wfn_control%loc_states(:, 2) = loc_list(:)
1426 localized_wfn_control%nloc_states(1) = n_list
1427 localized_wfn_control%nloc_states(2) = n_list
1428 IF (my_do_xas) THEN
1429 other_spin = 2
1430 IF (spin_xas == 2) other_spin = 1
1431 localized_wfn_control%nloc_states(other_spin) = 0
1432 localized_wfn_control%loc_states(:, other_spin) = 0
1433 END IF
1434 DEALLOCATE (loc_list)
1435 END IF
1436 END IF
1437
1438 ELSE
1439 ! List of States LUMO
1440 CALL section_vals_val_get(loc_section, "LIST_UNOCCUPIED", n_rep_val=n_rep)
1441 IF (n_rep > 0) THEN
1442 n_list = 0
1443 DO ir = 1, n_rep
1444 NULLIFY (list)
1445 CALL section_vals_val_get(loc_section, "LIST_UNOCCUPIED", i_rep_val=ir, i_vals=list)
1446 IF (ASSOCIATED(list)) THEN
1447 CALL reallocate(loc_list, 1, n_list + SIZE(list))
1448 DO i = 1, SIZE(list)
1449 loc_list(n_list + i) = list(i)
1450 END DO ! i
1451 n_list = n_list + SIZE(list)
1452 END IF
1453 END DO ! ir
1454 IF (n_list /= 0) THEN
1455 localized_wfn_control%set_of_states = state_loc_list
1456 ALLOCATE (localized_wfn_control%loc_states(n_list, 2))
1457 localized_wfn_control%loc_states = 0
1458 localized_wfn_control%loc_states(:, 1) = loc_list(:)
1459 localized_wfn_control%loc_states(:, 2) = loc_list(:)
1460 localized_wfn_control%nloc_states(1) = n_list
1461 DEALLOCATE (loc_list)
1462 END IF
1463 END IF
1464 END IF
1465
1466 IF (localized_wfn_control%set_of_states == 0) THEN
1467 CALL section_vals_val_get(loc_section, "ENERGY_RANGE", r_vals=ene)
1468 IF (ene(1) /= ene(2)) THEN
1469 localized_wfn_control%set_of_states = energy_loc_range
1470 localized_wfn_control%lu_ene_bound(1) = ene(1)
1471 localized_wfn_control%lu_ene_bound(2) = ene(2)
1472 END IF
1473 END IF
1474
1475 ! All States or XAS specific states
1476 IF (localized_wfn_control%set_of_states == 0) THEN
1477 IF (my_do_xas) THEN
1478 localized_wfn_control%set_of_states = state_loc_range
1479 localized_wfn_control%nloc_states(:) = 0
1480 localized_wfn_control%lu_bound_states(1, :) = 0
1481 localized_wfn_control%lu_bound_states(2, :) = 0
1482 localized_wfn_control%nloc_states(spin_xas) = nloc_xas
1483 localized_wfn_control%lu_bound_states(1, spin_xas) = 1
1484 localized_wfn_control%lu_bound_states(2, spin_xas) = nloc_xas
1485 ELSE IF (my_do_mixed) THEN
1486 localized_wfn_control%set_of_states = state_loc_mixed
1487 nextra = localized_wfn_control%nextra
1488 ELSE
1489 localized_wfn_control%set_of_states = state_loc_all
1490 END IF
1491 END IF
1492
1493 localized_wfn_control%print_centers = &
1494 btest(cp_print_key_should_output(logger%iter_info, loc_print_section, &
1495 "WANNIER_CENTERS"), cp_p_file)
1496 localized_wfn_control%print_spreads = &
1497 btest(cp_print_key_should_output(logger%iter_info, loc_print_section, &
1498 "WANNIER_SPREADS"), cp_p_file)
1499 localized_wfn_control%print_cubes = &
1500 btest(cp_print_key_should_output(logger%iter_info, loc_print_section, &
1501 "WANNIER_CUBES"), cp_p_file)
1502
1503 output_unit = cp_print_key_unit_nr(logger, loc_print_section, "PROGRAM_RUN_INFO", &
1504 extension=".Log")
1505
1506 IF (output_unit > 0) THEN
1507 WRITE (unit=output_unit, fmt="(/,T2,A)") &
1508 "LOCALIZE| The spread relative to a set of orbitals is computed"
1509
1510 SELECT CASE (localized_wfn_control%set_of_states)
1511 CASE (state_loc_all)
1512 WRITE (unit=output_unit, fmt="(T2,A)") &
1513 "LOCALIZE| Orbitals to be localized: All orbitals"
1514 WRITE (unit=output_unit, fmt="(T2,A,/,T12,A,F16.8)") &
1515 "LOCALIZE| If fractional occupation, fully occupied MOs are those ", &
1516 "within occupation tolerance of ", localized_wfn_control%eps_occ
1517 CASE (state_loc_range)
1518 WRITE (unit=output_unit, fmt="(T2,A,T65,I8,A,I8)") &
1519 "LOCALIZE| Orbitals to be localized: Those with index between ", &
1520 localized_wfn_control%lu_bound_states(1, spin_xas), " and ", &
1521 localized_wfn_control%lu_bound_states(2, spin_xas)
1522 CASE (state_loc_list)
1523 WRITE (unit=output_unit, fmt="(T2,A)") &
1524 "LOCALIZE| Orbitals to be localized: Those with index in the following list"
1525 nline = localized_wfn_control%nloc_states(1)/10 + 1
1526 ind = 0
1527 DO i = 1, nline
1528 IF (ind + 10 < localized_wfn_control%nloc_states(1)) THEN
1529 WRITE (unit=output_unit, fmt="(T8,10I7)") localized_wfn_control%loc_states(ind + 1:ind + 10, 1)
1530 ind = ind + 10
1531 ELSE
1532 WRITE (unit=output_unit, fmt="(T8,10I7)") &
1533 localized_wfn_control%loc_states(ind + 1:localized_wfn_control%nloc_states(1), 1)
1534 ind = localized_wfn_control%nloc_states(1)
1535 END IF
1536 END DO
1537 CASE (energy_loc_range)
1538 WRITE (unit=output_unit, fmt="(T2,A,T65,/,f16.6,A,f16.6,A)") &
1539 "LOCALIZE| Orbitals to be localized: Those with energy in the range between ", &
1540 localized_wfn_control%lu_ene_bound(1), " and ", localized_wfn_control%lu_ene_bound(2), " a.u."
1541 CASE (state_loc_mixed)
1542 WRITE (unit=output_unit, fmt="(T2,A,I4,A)") &
1543 "LOCALIZE| Orbitals to be localized: Occupied orbitals + ", nextra, " orbitals"
1544 CASE DEFAULT
1545 WRITE (unit=output_unit, fmt="(T2,A)") &
1546 "LOCALIZE| Orbitals to be localized: None "
1547 END SELECT
1548
1549 SELECT CASE (localized_wfn_control%operator_type)
1550 CASE (op_loc_berry)
1551 WRITE (unit=output_unit, fmt="(T2,A)") &
1552 "LOCALIZE| Spread defined by the Berry phase operator "
1553 CASE (op_loc_boys)
1554 WRITE (unit=output_unit, fmt="(T2,A)") &
1555 "LOCALIZE| Spread defined by the Boys phase operator "
1556 CASE DEFAULT
1557 WRITE (unit=output_unit, fmt="(T2,A)") &
1558 "LOCALIZE| Spread defined by the Pipek phase operator "
1559 END SELECT
1560
1561 SELECT CASE (localized_wfn_control%localization_method)
1562 CASE (do_loc_jacobi)
1563 WRITE (unit=output_unit, fmt="(T2,A)") &
1564 "LOCALIZE| Optimal unitary transformation generated by Jacobi algorithm"
1565 CASE (do_loc_crazy)
1566 WRITE (unit=output_unit, fmt="(T2,A)") &
1567 "LOCALIZE| Optimal unitary transformation generated by Crazy angle algorithm"
1568 WRITE (unit=output_unit, fmt="(T2,A,F16.8)") &
1569 "LOCALIZE| maximum angle: ", localized_wfn_control%max_crazy_angle
1570 WRITE (unit=output_unit, fmt="(T2,A,F16.8)") &
1571 "LOCALIZE| scaling: ", localized_wfn_control%crazy_scale
1572 WRITE (unit=output_unit, fmt="(T2,A,L1)") &
1573 "LOCALIZE| use diag:", localized_wfn_control%crazy_use_diag
1574 CASE (do_loc_gapo)
1575 WRITE (unit=output_unit, fmt="(T2,A)") &
1576 "LOCALIZE| Optimal unitary transformation generated by gradient ascent algorithm "
1577 WRITE (unit=output_unit, fmt="(T2,A)") &
1578 "LOCALIZE| for partially occupied wannier functions"
1579 CASE (do_loc_direct)
1580 WRITE (unit=output_unit, fmt="(T2,A)") &
1581 "LOCALIZE| Optimal unitary transformation generated by direct algorithm"
1582 CASE (do_loc_l1_norm_sd)
1583 WRITE (unit=output_unit, fmt="(T2,A)") &
1584 "LOCALIZE| Optimal unitary transformation generated by "
1585 WRITE (unit=output_unit, fmt="(T2,A)") &
1586 "LOCALIZE| steepest descent algorithm applied on an approximate l1 norm"
1587 CASE (do_loc_none)
1588 WRITE (unit=output_unit, fmt="(T2,A)") &
1589 "LOCALIZE| No unitary transformation is applied"
1590 CASE (do_loc_scdm)
1591 WRITE (unit=output_unit, fmt="(T2,A)") &
1592 "LOCALIZE| Pivoted QR decomposition is used to transform coefficients"
1593 END SELECT
1594
1595 END IF ! process has output_unit
1596
1597 CALL cp_print_key_finished_output(output_unit, logger, loc_print_section, "PROGRAM_RUN_INFO")
1598
1599 ELSE
1600 localized_wfn_control%localization_method = do_loc_none
1601 localized_wfn_control%localization_method = state_loc_none
1602 localized_wfn_control%print_centers = .false.
1603 localized_wfn_control%print_spreads = .false.
1604 localized_wfn_control%print_cubes = .false.
1605 END IF
1606
1607 END SUBROUTINE read_loc_section
1608
1609! **************************************************************************************************
1610!> \brief create the center and spread array and the file names for the output
1611!> \param localized_wfn_control ...
1612!> \param nmoloc ...
1613!> \param nspins ...
1614!> \par History
1615!> 04.2005 created [MI]
1616! **************************************************************************************************
1617 SUBROUTINE set_loc_centers(localized_wfn_control, nmoloc, nspins)
1618
1619 TYPE(localized_wfn_control_type) :: localized_wfn_control
1620 INTEGER, DIMENSION(2), INTENT(IN) :: nmoloc
1621 INTEGER, INTENT(IN) :: nspins
1622
1623 INTEGER :: ispin
1624
1625 DO ispin = 1, nspins
1626 ALLOCATE (localized_wfn_control%centers_set(ispin)%array(6, nmoloc(ispin)))
1627 localized_wfn_control%centers_set(ispin)%array = 0.0_dp
1628 END DO
1629
1630 END SUBROUTINE set_loc_centers
1631
1632! **************************************************************************************************
1633!> \brief create the lists of mos that are taken into account
1634!> \param localized_wfn_control ...
1635!> \param nmoloc ...
1636!> \param nmo ...
1637!> \param nspins ...
1638!> \param my_spin ...
1639!> \par History
1640!> 04.2005 created [MI]
1641! **************************************************************************************************
1642 SUBROUTINE set_loc_wfn_lists(localized_wfn_control, nmoloc, nmo, nspins, my_spin)
1643
1644 TYPE(localized_wfn_control_type) :: localized_wfn_control
1645 INTEGER, DIMENSION(2), INTENT(IN) :: nmoloc, nmo
1646 INTEGER, INTENT(IN) :: nspins
1647 INTEGER, INTENT(IN), OPTIONAL :: my_spin
1648
1649 CHARACTER(len=*), PARAMETER :: routinen = 'set_loc_wfn_lists'
1650
1651 INTEGER :: i, ispin, max_iloc, max_nmoloc, state
1652
1653 CALL timeset(routinen, state)
1654
1655 localized_wfn_control%nloc_states(1:2) = nmoloc(1:2)
1656 max_nmoloc = max(nmoloc(1), nmoloc(2))
1657
1658 SELECT CASE (localized_wfn_control%set_of_states)
1659 CASE (state_loc_list)
1660 ! List
1661 cpassert(ASSOCIATED(localized_wfn_control%loc_states))
1662 DO ispin = 1, nspins
1663 localized_wfn_control%lu_bound_states(1, ispin) = 1
1664 localized_wfn_control%lu_bound_states(2, ispin) = nmoloc(ispin)
1665 IF (nmoloc(ispin) < 1) THEN
1666 localized_wfn_control%lu_bound_states(1, ispin) = 0
1667 localized_wfn_control%loc_states(:, ispin) = 0
1668 END IF
1669 END DO
1670 CASE (state_loc_range)
1671 ! Range
1672 ALLOCATE (localized_wfn_control%loc_states(max_nmoloc, 2))
1673 localized_wfn_control%loc_states = 0
1674 DO ispin = 1, nspins
1675 localized_wfn_control%lu_bound_states(1, ispin) = &
1676 localized_wfn_control%lu_bound_states(1, my_spin)
1677 localized_wfn_control%lu_bound_states(2, ispin) = &
1678 localized_wfn_control%lu_bound_states(1, my_spin) + nmoloc(ispin) - 1
1679 max_iloc = localized_wfn_control%lu_bound_states(2, ispin)
1680 DO i = 1, nmoloc(ispin)
1681 localized_wfn_control%loc_states(i, ispin) = localized_wfn_control%lu_bound_states(1, ispin) + i - 1
1682 END DO
1683 cpassert(max_iloc <= nmo(ispin))
1684 mark_used(nmo)
1685 END DO
1686 CASE (energy_loc_range)
1687 ! Energy
1688 ALLOCATE (localized_wfn_control%loc_states(max_nmoloc, 2))
1689 localized_wfn_control%loc_states = 0
1690 DO ispin = 1, nspins
1691 DO i = 1, nmoloc(ispin)
1692 localized_wfn_control%loc_states(i, ispin) = localized_wfn_control%lu_bound_states(1, ispin) + i - 1
1693 END DO
1694 END DO
1695 CASE (state_loc_all)
1696 ! All
1697 ALLOCATE (localized_wfn_control%loc_states(max_nmoloc, 2))
1698 localized_wfn_control%loc_states = 0
1699
1700 IF (localized_wfn_control%lu_bound_states(1, 1) == 1) THEN
1701 DO ispin = 1, nspins
1702 localized_wfn_control%lu_bound_states(1, ispin) = 1
1703 localized_wfn_control%lu_bound_states(2, ispin) = nmoloc(ispin)
1704 IF (nmoloc(ispin) < 1) localized_wfn_control%lu_bound_states(1, ispin) = 0
1705 DO i = 1, nmoloc(ispin)
1706 localized_wfn_control%loc_states(i, ispin) = i
1707 END DO
1708 END DO
1709 ELSE
1710 DO ispin = 1, nspins
1711 IF (nmoloc(ispin) < 1) localized_wfn_control%lu_bound_states(1, ispin) = 0
1712 DO i = 1, nmoloc(ispin)
1713 localized_wfn_control%loc_states(i, ispin) = &
1714 localized_wfn_control%lu_bound_states(1, ispin) + i - 1
1715 END DO
1716 END DO
1717 END IF
1718 CASE (state_loc_mixed)
1719 ! Mixed
1720 ALLOCATE (localized_wfn_control%loc_states(max_nmoloc, 2))
1721 localized_wfn_control%loc_states = 0
1722 DO ispin = 1, nspins
1723 DO i = 1, nmoloc(ispin)
1724 localized_wfn_control%loc_states(i, ispin) = i
1725 END DO
1726 END DO
1727 END SELECT
1728
1729 CALL timestop(state)
1730
1731 END SUBROUTINE set_loc_wfn_lists
1732
1733END MODULE qs_loc_utils
1734
Calculation of the moment integrals over Cartesian Gaussian-type functions.
Definition ai_moments.F:17
subroutine, public contract_cossin(cos_block, sin_block, iatom, ncoa, nsgfa, sgfa, sphi_a, ldsa, jatom, ncob, nsgfb, sgfb, sphi_b, ldsb, cosab, sinab, ldab, work, ldwork)
...
Definition ai_moments.F:261
subroutine, public cossin(la_max_set, npgfa, zeta, rpgfa, la_min_set, lb_max, npgfb, zetb, rpgfb, lb_min, rac, rbc, kvec, cosab, sinab, dcosab, dsinab)
...
Definition ai_moments.F:339
collect pointers to a block of reals
Handles all functions related to the CELL.
Definition cell_types.F:15
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...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_set(matrix, alpha)
...
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
Utility routines to open and close files. Tracking of preconnections.
Definition cp_files.F:16
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
Definition cp_files.F:311
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
Definition cp_files.F:122
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_column_scale(matrixa, scaling)
scales column i of matrix a with scaling(i)
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
Definition cp_fm_diag.F:17
subroutine, public choose_eigv_solver(matrix, eigenvectors, eigenvalues, info)
Choose the Eigensolver depending on which library is available ELPA seems to be unstable for small sy...
Definition cp_fm_diag.F:245
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
Definition cp_fm_types.F:15
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_write_unformatted(fm, unit)
...
subroutine, public cp_fm_set_submatrix(fm, new_values, start_row, start_col, n_rows, n_cols, alpha, beta, transpose)
sets a submatrix of a full matrix fm(start_row:start_row+n_rows,start_col:start_col+n_cols) = alpha*o...
subroutine, public cp_fm_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
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,...
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)
...
character(len=default_path_length) function, public cp_print_key_generate_filename(logger, print_key, middle_name, extension, my_local)
Utility function that returns a unit number to write the print key. Might open a file with a unique f...
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,...
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...
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public op_loc_pipek
integer, parameter, public do_loc_jacobi
integer, parameter, public do_loc_l1_norm_sd
integer, parameter, public state_loc_all
integer, parameter, public do_loc_none
integer, parameter, public do_loc_scdm
integer, parameter, public energy_loc_range
integer, parameter, public op_loc_berry
integer, parameter, public do_loc_crazy
integer, parameter, public state_loc_mixed
integer, parameter, public do_loc_gapo
integer, parameter, public op_loc_boys
integer, parameter, public state_loc_none
integer, parameter, public state_loc_list
integer, parameter, public state_loc_range
integer, parameter, public do_mixed
integer, parameter, public do_loc_direct
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
integer, parameter, public default_path_length
Definition kinds.F:58
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
Definition list.F:24
Definition of mathematical constants and functions.
real(kind=dp), parameter, public twopi
Utility routines for the memory handling.
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public ncoset
basic linear algebra operations for full matrixes
Define the data structure for the particle information.
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, 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.
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, cneo_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, monovalent, 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, cneo_potential_present, nkind_q, natom_q)
Get attributes of an atomic kind set.
New version of the module for the localization of the molecular orbitals This should be able to use d...
subroutine, public localized_wfn_control_create(localized_wfn_control)
create the localized_wfn_control_type
subroutine, public localized_wfn_control_release(localized_wfn_control)
release the localized_wfn_control_type
subroutine, public get_qs_loc_env(qs_loc_env, cell, local_molecules, localized_wfn_control, moloc_coeff, op_sm_set, op_fm_set, para_env, particle_set, weights, dim_op)
...
subroutine, public set_qs_loc_env(qs_loc_env, cell, local_molecules, localized_wfn_control, moloc_coeff, op_sm_set, op_fm_set, para_env, particle_set, weights, dim_op)
...
Some utilities for the construction of the localization environment.
subroutine, public compute_berry_operator(qs_env, cell, op_sm_set, dim_op)
Computes the Berry operator for periodic systems used to define the spread of the MOS Here the matrix...
subroutine, public set_loc_wfn_lists(localized_wfn_control, nmoloc, nmo, nspins, my_spin)
create the lists of mos that are taken into account
subroutine, public loc_write_restart(qs_loc_env, section, mo_array, coeff_localized, do_homo, evals, do_mixed)
...
subroutine, public qs_loc_env_init(qs_loc_env, localized_wfn_control, qs_env, myspin, do_localize, loc_coeff, mo_loc_history)
allocates the data, and initializes the operators
subroutine, public set_loc_centers(localized_wfn_control, nmoloc, nspins)
create the center and spread array and the file names for the output
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
Localization methods such as 2x2 Jacobi rotations Steepest Decents Conjugate Gradient.
subroutine, public initialize_weights(cell, weights)
...
collects routines that perform operations directly related to MOs
subroutine, public make_mo_eig(mos, nspins, ks_rmpv, scf_control, mo_derivs, admm_env, hairy_probes, probe)
Calculate KS eigenvalues starting from OF MOS.
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
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.
subroutine, public neighbor_list_iterator_create(iterator_set, nl, search, nthread)
Neighbor list iterator functions.
subroutine, public neighbor_list_iterator_release(iterator_set)
...
integer function, public neighbor_list_iterate(iterator_set, mepos)
...
subroutine, public get_iterator_info(iterator_set, mepos, ikind, jkind, nkind, ilist, nlist, inode, nnode, iatom, jatom, r, cell)
...
module that contains the definitions of the scf types
integer, parameter, public ot_method_nr
parameters that control an scf iteration
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
represent a pointer to a 1d array
keeps the information about the structure of a full matrix
represent a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
structure to store local (to a processor) ordered lists of integers.
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
A type that holds controlling information for the calculation of the spread of wfn and the optimizati...
contains all the info needed by quickstep to calculate the spread of a selected set of orbitals and i...