(git:21ef868)
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 LOGICAL :: loc_coeff_spin_resolved
248 REAL(kind=dp) :: my_occ, occ_imo
249 REAL(kind=dp), DIMENSION(:), POINTER :: occupations
250 REAL(kind=dp), DIMENSION(:, :), POINTER :: vecbuffer
251 TYPE(cell_type), POINTER :: cell
252 TYPE(cp_fm_struct_type), POINTER :: tmp_fm_struct
253 TYPE(cp_fm_type), DIMENSION(:), POINTER :: moloc_coeff
254 TYPE(cp_fm_type), POINTER :: mat_ptr, mo_coeff
255 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
256 TYPE(distribution_1d_type), POINTER :: local_molecules
257 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
258 TYPE(mp_para_env_type), POINTER :: para_env
259 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
260
261 CALL timeset(routinen, handle)
262
263 NULLIFY (mos, matrix_s, moloc_coeff, particle_set, para_env, cell, &
264 local_molecules, occupations, mat_ptr)
265 IF (PRESENT(do_localize)) qs_loc_env%do_localize = do_localize
266 IF (qs_loc_env%do_localize) THEN
267 CALL get_qs_env(qs_env=qs_env, matrix_s=matrix_s, cell=cell, &
268 local_molecules=local_molecules, particle_set=particle_set, &
269 para_env=para_env, mos=mos)
270 nspins = SIZE(mos, 1)
271 loc_coeff_spin_resolved = .false.
272 IF (PRESENT(loc_coeff)) THEN
273 loc_coeff_spin_resolved = nspins*2 == SIZE(loc_coeff)
274 END IF
275 s_spin = 1
276 l_spin = nspins
277 IF (PRESENT(myspin)) THEN
278 s_spin = myspin
279 l_spin = myspin
280 END IF
281 IF (loc_coeff_spin_resolved) THEN
282 ALLOCATE (moloc_coeff(s_spin:s_spin + 2*(l_spin - s_spin) + 1))
283 ELSE
284 ALLOCATE (moloc_coeff(s_spin:l_spin))
285 END IF
286 DO ispin = s_spin, l_spin
287 NULLIFY (tmp_fm_struct, mo_coeff)
288 CALL get_mo_set(mos(ispin), mo_coeff=mo_coeff, nao=nao, nmo=nmo)
289 nmosub = localized_wfn_control%nloc_states(ispin)
290 CALL cp_fm_struct_create(tmp_fm_struct, nrow_global=nao, &
291 ncol_global=nmosub, para_env=para_env, context=mo_coeff%matrix_struct%context)
292 IF (loc_coeff_spin_resolved) THEN
293 CALL cp_fm_create(moloc_coeff(2*ispin - 1), tmp_fm_struct)
294 CALL cp_fm_create(moloc_coeff(2*ispin), tmp_fm_struct)
295 ELSE
296 CALL cp_fm_create(moloc_coeff(ispin), tmp_fm_struct)
297 END IF
298
299 CALL cp_fm_get_info(moloc_coeff(ispin), nrow_global=naosub, &
300 ncol_global=nmosub)
301 cpassert(nao == naosub)
302 IF ((localized_wfn_control%do_homo) .OR. &
303 (localized_wfn_control%set_of_states == state_loc_mixed)) THEN
304 cpassert(nmo >= nmosub)
305 ELSE
306 cpassert(nao - nmo >= nmosub)
307 END IF
308 CALL cp_fm_set_all(moloc_coeff(ispin), 0.0_dp)
309 CALL cp_fm_struct_release(tmp_fm_struct)
310 END DO ! ispin
311 ! Copy the submatrix
312
313 IF (PRESENT(loc_coeff)) ALLOCATE (mat_ptr)
314
315 DO ispin = s_spin, l_spin
316 CALL get_mo_set(mos(ispin), mo_coeff=mo_coeff, &
317 occupation_numbers=occupations, nao=nao, nmo=nmo)
318 lb = localized_wfn_control%lu_bound_states(1, ispin)
319 ub = localized_wfn_control%lu_bound_states(2, ispin)
320
321 IF (PRESENT(loc_coeff)) THEN
322 mat_ptr = loc_coeff(ispin)
323 ELSE
324 mat_ptr => mo_coeff
325 END IF
326 IF ((localized_wfn_control%set_of_states == state_loc_list) .OR. &
327 (localized_wfn_control%set_of_states == state_loc_mixed)) THEN
328 ALLOCATE (vecbuffer(1, nao))
329 IF (localized_wfn_control%do_homo) THEN
330 my_occ = occupations(localized_wfn_control%loc_states(1, ispin))
331 END IF
332 nmosub = SIZE(localized_wfn_control%loc_states, 1)
333 cpassert(nmosub > 0)
334 imoloc = 0
335 DO i = lb, ub
336 ! Get the index in the subset
337 imoloc = imoloc + 1
338 ! Get the index in the full set
339 imo = localized_wfn_control%loc_states(i, ispin)
340 IF (localized_wfn_control%do_homo) THEN
341 occ_imo = occupations(imo)
342 IF (abs(occ_imo - my_occ) > localized_wfn_control%eps_occ) THEN
343 IF (localized_wfn_control%localization_method /= do_loc_none) THEN
344 CALL cp_abort(__location__, &
345 "States with different occupations "// &
346 "cannot be rotated together")
347 END IF
348 END IF
349 END IF
350 ! Take the imo vector from the full set and copy in the imoloc vector of the subset
351 CALL cp_fm_get_submatrix(mat_ptr, vecbuffer, 1, imo, &
352 nao, 1, transpose=.true.)
353 CALL cp_fm_set_submatrix(moloc_coeff(ispin), vecbuffer, 1, imoloc, &
354 nao, 1, transpose=.true.)
355 END DO
356 DEALLOCATE (vecbuffer)
357 ELSE
358 my_occ = occupations(lb)
359 occ_imo = occupations(ub)
360 IF (abs(occ_imo - my_occ) > localized_wfn_control%eps_occ) THEN
361 IF (localized_wfn_control%localization_method /= do_loc_none) THEN
362 CALL cp_abort(__location__, &
363 "States with different occupations "// &
364 "cannot be rotated together")
365 END IF
366 END IF
367 nmosub = localized_wfn_control%nloc_states(ispin)
368
369 IF (loc_coeff_spin_resolved) THEN
370 CALL cp_fm_to_fm(loc_coeff(2*ispin - 1), moloc_coeff(2*ispin - 1))
371 CALL cp_fm_to_fm(loc_coeff(2*ispin), moloc_coeff(2*ispin))
372 ELSE
373 CALL cp_fm_to_fm(mat_ptr, moloc_coeff(ispin), nmosub, lb, 1)
374 END IF
375 END IF
376
377 ! we have the mo's to be localized now, see if we can rotate them according to the history
378 ! only do that if we have a history of course. The history is filled
379 IF (PRESENT(mo_loc_history)) THEN
380 IF (localized_wfn_control%use_history .AND. ASSOCIATED(mo_loc_history)) THEN
381 CALL rotate_state_to_ref(moloc_coeff(ispin), &
382 mo_loc_history(ispin), matrix_s(1)%matrix)
383 END IF
384 END IF
385
386 END DO
387
388 IF (PRESENT(loc_coeff)) DEALLOCATE (mat_ptr)
389
390 CALL set_qs_loc_env(qs_loc_env=qs_loc_env, cell=cell, local_molecules=local_molecules, &
391 moloc_coeff=moloc_coeff, particle_set=particle_set, para_env=para_env, &
392 localized_wfn_control=localized_wfn_control)
393
394 ! Prepare the operators
395 NULLIFY (tmp_fm_struct, mo_coeff)
396 nmosub = maxval(localized_wfn_control%nloc_states)
397 CALL get_mo_set(mos(1), mo_coeff=mo_coeff)
398 CALL cp_fm_struct_create(tmp_fm_struct, nrow_global=nmosub, &
399 ncol_global=nmosub, para_env=para_env, context=mo_coeff%matrix_struct%context)
400
401 IF (localized_wfn_control%operator_type == op_loc_berry) THEN
402 IF (qs_loc_env%cell%orthorhombic) THEN
403 dim_op = 3
404 ELSE
405 dim_op = 6
406 END IF
407 CALL set_qs_loc_env(qs_loc_env=qs_loc_env, dim_op=dim_op)
408 ALLOCATE (qs_loc_env%op_sm_set(2, dim_op))
409 DO i = 1, dim_op
410 DO j = 1, SIZE(qs_loc_env%op_sm_set, 1)
411 NULLIFY (qs_loc_env%op_sm_set(j, i)%matrix)
412 ALLOCATE (qs_loc_env%op_sm_set(j, i)%matrix)
413 CALL dbcsr_copy(qs_loc_env%op_sm_set(j, i)%matrix, matrix_s(1)%matrix, &
414 name="qs_loc_env%op_sm_"//trim(adjustl(cp_to_string(j)))//"-"//trim(adjustl(cp_to_string(i))))
415 CALL dbcsr_set(qs_loc_env%op_sm_set(j, i)%matrix, 0.0_dp)
416 END DO
417 END DO
418
419 ELSE IF (localized_wfn_control%operator_type == op_loc_pipek) THEN
420 natoms = SIZE(qs_loc_env%particle_set, 1)
421 ALLOCATE (qs_loc_env%op_fm_set(natoms, 1))
422 CALL set_qs_loc_env(qs_loc_env=qs_loc_env, dim_op=natoms)
423 DO ispin = 1, SIZE(qs_loc_env%op_fm_set, 2)
424 CALL get_mo_set(mos(ispin), nmo=nmo)
425 DO iatom = 1, natoms
426 CALL cp_fm_create(qs_loc_env%op_fm_set(iatom, ispin), tmp_fm_struct)
427
428 CALL cp_fm_get_info(qs_loc_env%op_fm_set(iatom, ispin), nrow_global=nmosub)
429 cpassert(nmo >= nmosub)
430 CALL cp_fm_set_all(qs_loc_env%op_fm_set(iatom, ispin), 0.0_dp)
431 END DO ! iatom
432 END DO ! ispin
433 ELSE
434 cpabort("Type of operator not implemented")
435 END IF
436 CALL cp_fm_struct_release(tmp_fm_struct)
437
438 IF (localized_wfn_control%operator_type == op_loc_berry) THEN
439
440 CALL initialize_weights(qs_loc_env%cell, qs_loc_env%weights)
441
442 CALL get_berry_operator(qs_loc_env, qs_env)
443
444 ELSE IF (localized_wfn_control%operator_type == op_loc_pipek) THEN
445
446 !! here we don't have to do anything
447 !! CALL get_pipek_mezey_operator ( qs_loc_env, qs_env )
448
449 END IF
450
451 qs_loc_env%molecular_states = .false.
452 qs_loc_env%wannier_states = .false.
453 END IF
454 CALL timestop(handle)
455
456 END SUBROUTINE qs_loc_env_init
457
458! **************************************************************************************************
459!> \brief A wrapper to compute the Berry operator for periodic systems
460!> \param qs_loc_env new environment for the localization calculations
461!> \param qs_env the qs_env in which the qs_env lives
462!> \par History
463!> 04.2005 created [MI]
464!> 04.2018 modified [RZK, ZL]
465!> \author MI
466! **************************************************************************************************
467 SUBROUTINE get_berry_operator(qs_loc_env, qs_env)
468 TYPE(qs_loc_env_type), POINTER :: qs_loc_env
469 TYPE(qs_environment_type), POINTER :: qs_env
470
471 CHARACTER(len=*), PARAMETER :: routinen = 'get_berry_operator'
472
473 INTEGER :: dim_op, handle
474 TYPE(cell_type), POINTER :: cell
475 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: op_sm_set
476
477 CALL timeset(routinen, handle)
478
479 NULLIFY (cell, op_sm_set)
480 CALL get_qs_loc_env(qs_loc_env=qs_loc_env, op_sm_set=op_sm_set, &
481 cell=cell, dim_op=dim_op)
482 CALL compute_berry_operator(qs_env, cell, op_sm_set, dim_op)
483
484 CALL timestop(handle)
485 END SUBROUTINE get_berry_operator
486
487! **************************************************************************************************
488!> \brief Computes the Berry operator for periodic systems
489!> used to define the spread of the MOS
490!> Here the matrix elements of the type <mu|cos(kr)|nu> and <mu|sin(kr)|nu>
491!> are computed, where mu and nu are the contracted basis functions.
492!> Namely the Berry operator is exp(ikr)
493!> k is defined somewhere
494!> the pair lists are exploited and sparse matrixes are constructed
495!> \param qs_env the qs_env in which the qs_env lives
496!> \param cell ...
497!> \param op_sm_set ...
498!> \param dim_op ...
499!> \par History
500!> 04.2005 created [MI]
501!> 04.2018 wrapped old code [RZK, ZL]
502!> \author MI
503!> \note
504!> The intgrals are computed analytically using the primitives GTO
505!> The contraction is performed block-wise
506! **************************************************************************************************
507 SUBROUTINE compute_berry_operator(qs_env, cell, op_sm_set, dim_op)
508 TYPE(qs_environment_type), POINTER :: qs_env
509 TYPE(cell_type), POINTER :: cell
510 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: op_sm_set
511 INTEGER :: dim_op
512
513 CHARACTER(len=*), PARAMETER :: routinen = 'compute_berry_operator'
514
515 INTEGER :: handle, i, iatom, icol, ikind, inode, irow, iset, jatom, jkind, jset, last_jatom, &
516 ldab, ldsa, ldsb, ldwork, maxl, ncoa, ncob, nkind, nrow, nseta, nsetb, sgfa, sgfb
517 INTEGER, DIMENSION(3) :: perd0
518 INTEGER, DIMENSION(:), POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
519 npgfb, nsgfa, nsgfb
520 INTEGER, DIMENSION(:, :), POINTER :: first_sgfa, first_sgfb
521 LOGICAL :: found, new_atom_b
522 REAL(kind=dp) :: dab, kvec(3), rab2, vector_k(3, 6)
523 REAL(kind=dp), DIMENSION(3) :: ra, rab, rb
524 REAL(kind=dp), DIMENSION(:), POINTER :: set_radius_a, set_radius_b
525 REAL(kind=dp), DIMENSION(:, :), POINTER :: cosab, rpgfa, rpgfb, sinab, sphi_a, &
526 sphi_b, work, zeta, zetb
527 TYPE(block_p_type), DIMENSION(:), POINTER :: op_cos, op_sin
528 TYPE(gto_basis_set_p_type), DIMENSION(:), POINTER :: basis_set_list
529 TYPE(gto_basis_set_type), POINTER :: basis_set_a, basis_set_b
531 DIMENSION(:), POINTER :: nl_iterator
532 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
533 POINTER :: sab_orb
534 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
535 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
536 TYPE(qs_kind_type), POINTER :: qs_kind
537
538 CALL timeset(routinen, handle)
539 NULLIFY (qs_kind, qs_kind_set)
540 NULLIFY (particle_set)
541 NULLIFY (sab_orb)
542 NULLIFY (cosab, sinab, work)
543 NULLIFY (la_max, la_min, lb_max, lb_min, npgfa, npgfb, nsgfa, nsgfb)
544 NULLIFY (set_radius_a, set_radius_b, rpgfa, rpgfb, sphi_a, sphi_b, zeta, zetb)
545
546 CALL get_qs_env(qs_env=qs_env, qs_kind_set=qs_kind_set, &
547 particle_set=particle_set, sab_orb=sab_orb)
548
549 nkind = SIZE(qs_kind_set)
550
551 CALL get_qs_kind_set(qs_kind_set=qs_kind_set, &
552 maxco=ldwork, maxlgto=maxl)
553 ldab = ldwork
554 ALLOCATE (cosab(ldab, ldab))
555 cosab = 0.0_dp
556 ALLOCATE (sinab(ldab, ldab))
557 sinab = 0.0_dp
558 ALLOCATE (work(ldwork, ldwork))
559 work = 0.0_dp
560
561 ALLOCATE (op_cos(dim_op))
562 ALLOCATE (op_sin(dim_op))
563 DO i = 1, dim_op
564 NULLIFY (op_cos(i)%block)
565 NULLIFY (op_sin(i)%block)
566 END DO
567
568 kvec = 0.0_dp
569 vector_k = 0.0_dp
570 vector_k(:, 1) = twopi*cell%h_inv(1, :)
571 vector_k(:, 2) = twopi*cell%h_inv(2, :)
572 vector_k(:, 3) = twopi*cell%h_inv(3, :)
573 vector_k(:, 4) = twopi*(cell%h_inv(1, :) + cell%h_inv(2, :))
574 vector_k(:, 5) = twopi*(cell%h_inv(1, :) + cell%h_inv(3, :))
575 vector_k(:, 6) = twopi*(cell%h_inv(2, :) + cell%h_inv(3, :))
576
577 ! This operator can be used only for periodic systems
578 ! If an isolated system is used the periodicity is overimposed
579 perd0(1:3) = cell%perd(1:3)
580 cell%perd(1:3) = 1
581
582 ALLOCATE (basis_set_list(nkind))
583 DO ikind = 1, nkind
584 qs_kind => qs_kind_set(ikind)
585 CALL get_qs_kind(qs_kind=qs_kind, basis_set=basis_set_a)
586 IF (ASSOCIATED(basis_set_a)) THEN
587 basis_set_list(ikind)%gto_basis_set => basis_set_a
588 ELSE
589 NULLIFY (basis_set_list(ikind)%gto_basis_set)
590 END IF
591 END DO
592 CALL neighbor_list_iterator_create(nl_iterator, sab_orb)
593 DO WHILE (neighbor_list_iterate(nl_iterator) == 0)
594 CALL get_iterator_info(nl_iterator, ikind=ikind, jkind=jkind, inode=inode, &
595 iatom=iatom, jatom=jatom, r=rab)
596 basis_set_a => basis_set_list(ikind)%gto_basis_set
597 IF (.NOT. ASSOCIATED(basis_set_a)) cycle
598 basis_set_b => basis_set_list(jkind)%gto_basis_set
599 IF (.NOT. ASSOCIATED(basis_set_b)) cycle
600 ra = pbc(particle_set(iatom)%r, cell)
601 ! basis ikind
602 first_sgfa => basis_set_a%first_sgf
603 la_max => basis_set_a%lmax
604 la_min => basis_set_a%lmin
605 npgfa => basis_set_a%npgf
606 nseta = basis_set_a%nset
607 nsgfa => basis_set_a%nsgf_set
608 rpgfa => basis_set_a%pgf_radius
609 set_radius_a => basis_set_a%set_radius
610 sphi_a => basis_set_a%sphi
611 zeta => basis_set_a%zet
612 ! basis jkind
613 first_sgfb => basis_set_b%first_sgf
614 lb_max => basis_set_b%lmax
615 lb_min => basis_set_b%lmin
616 npgfb => basis_set_b%npgf
617 nsetb = basis_set_b%nset
618 nsgfb => basis_set_b%nsgf_set
619 rpgfb => basis_set_b%pgf_radius
620 set_radius_b => basis_set_b%set_radius
621 sphi_b => basis_set_b%sphi
622 zetb => basis_set_b%zet
623
624 ldsa = SIZE(sphi_a, 1)
625 ldsb = SIZE(sphi_b, 1)
626 IF (inode == 1) last_jatom = 0
627
628 rb = rab + ra
629
630 IF (jatom /= last_jatom) THEN
631 new_atom_b = .true.
632 last_jatom = jatom
633 ELSE
634 new_atom_b = .false.
635 END IF
636
637 IF (new_atom_b) THEN
638 IF (iatom <= jatom) THEN
639 irow = iatom
640 icol = jatom
641 ELSE
642 irow = jatom
643 icol = iatom
644 END IF
645
646 DO i = 1, dim_op
647 NULLIFY (op_cos(i)%block)
648 CALL dbcsr_get_block_p(matrix=op_sm_set(1, i)%matrix, &
649 row=irow, col=icol, block=op_cos(i)%block, found=found)
650 NULLIFY (op_sin(i)%block)
651 CALL dbcsr_get_block_p(matrix=op_sm_set(2, i)%matrix, &
652 row=irow, col=icol, block=op_sin(i)%block, found=found)
653 END DO
654 END IF ! new_atom_b
655
656 rab2 = rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)
657 dab = sqrt(rab2)
658
659 nrow = 0
660 DO iset = 1, nseta
661
662 ncoa = npgfa(iset)*ncoset(la_max(iset))
663 sgfa = first_sgfa(1, iset)
664
665 DO jset = 1, nsetb
666
667 ncob = npgfb(jset)*ncoset(lb_max(jset))
668 sgfb = first_sgfb(1, jset)
669
670 IF (set_radius_a(iset) + set_radius_b(jset) >= dab) THEN
671
672! *** Calculate the primitive overlap integrals ***
673 DO i = 1, dim_op
674 kvec(1:3) = vector_k(1:3, i)
675 cosab = 0.0_dp
676 sinab = 0.0_dp
677 CALL cossin(la_max(iset), npgfa(iset), zeta(:, iset), rpgfa(:, iset), &
678 la_min(iset), lb_max(jset), npgfb(jset), zetb(:, jset), &
679 rpgfb(:, jset), lb_min(jset), &
680 ra, rb, kvec, cosab, sinab)
681 CALL contract_cossin(op_cos(i)%block, op_sin(i)%block, &
682 iatom, ncoa, nsgfa(iset), sgfa, sphi_a, ldsa, &
683 jatom, ncob, nsgfb(jset), sgfb, sphi_b, ldsb, &
684 cosab, sinab, ldab, work, ldwork)
685 END DO
686
687 END IF ! >= dab
688
689 END DO ! jset
690
691 nrow = nrow + ncoa
692
693 END DO ! iset
694
695 END DO
696 CALL neighbor_list_iterator_release(nl_iterator)
697
698 ! Set back the correct periodicity
699 cell%perd(1:3) = perd0(1:3)
700
701 DO i = 1, dim_op
702 NULLIFY (op_cos(i)%block)
703 NULLIFY (op_sin(i)%block)
704 END DO
705 DEALLOCATE (op_cos, op_sin)
706
707 DEALLOCATE (cosab, sinab, work, basis_set_list)
708
709 CALL timestop(handle)
710 END SUBROUTINE compute_berry_operator
711
712! **************************************************************************************************
713!> \brief ...
714!> \param qs_loc_env ...
715!> \param section ...
716!> \param mo_array ...
717!> \param coeff_localized ...
718!> \param do_homo ...
719!> \param evals ...
720!> \param do_mixed ...
721! **************************************************************************************************
722 SUBROUTINE loc_write_restart(qs_loc_env, section, mo_array, coeff_localized, &
723 do_homo, evals, do_mixed)
724 TYPE(qs_loc_env_type), POINTER :: qs_loc_env
725 TYPE(section_vals_type), POINTER :: section
726 TYPE(mo_set_type), DIMENSION(:), POINTER :: mo_array
727 TYPE(cp_fm_type), DIMENSION(:), INTENT(IN) :: coeff_localized
728 LOGICAL, INTENT(IN) :: do_homo
729 TYPE(cp_1d_r_p_type), DIMENSION(:), OPTIONAL, &
730 POINTER :: evals
731 LOGICAL, INTENT(IN), OPTIONAL :: do_mixed
732
733 CHARACTER(LEN=*), PARAMETER :: routinen = 'loc_write_restart'
734
735 CHARACTER(LEN=default_path_length) :: filename
736 CHARACTER(LEN=default_string_length) :: my_middle
737 INTEGER :: handle, ispin, max_block, nao, nloc, &
738 nmo, output_unit, rst_unit
739 LOGICAL :: my_do_mixed
740 TYPE(cp_logger_type), POINTER :: logger
741 TYPE(section_vals_type), POINTER :: print_key
742
743 CALL timeset(routinen, handle)
744 NULLIFY (logger)
745 logger => cp_get_default_logger()
746 output_unit = cp_logger_get_default_io_unit(logger)
747
748 IF (qs_loc_env%do_localize) THEN
749
750 print_key => section_vals_get_subs_vals(section, "LOC_RESTART")
751 IF (btest(cp_print_key_should_output(logger%iter_info, &
752 section, "LOC_RESTART"), &
753 cp_p_file)) THEN
754
755 ! Open file
756 rst_unit = -1
757
758 my_do_mixed = .false.
759 IF (PRESENT(do_mixed)) my_do_mixed = do_mixed
760 IF (do_homo) THEN
761 my_middle = "LOC_HOMO"
762 ELSE IF (my_do_mixed) THEN
763 my_middle = "LOC_MIXED"
764 ELSE
765 my_middle = "LOC_LUMO"
766 END IF
767
768 rst_unit = cp_print_key_unit_nr(logger, section, "LOC_RESTART", &
769 extension=".wfn", file_status="REPLACE", file_action="WRITE", &
770 file_form="UNFORMATTED", middle_name=trim(my_middle))
771
772 IF (rst_unit > 0) filename = cp_print_key_generate_filename(logger, print_key, &
773 middle_name=trim(my_middle), extension=".wfn", &
774 my_local=.false.)
775
776 IF (output_unit > 0) THEN
777 WRITE (unit=output_unit, fmt="(/,T2,A, A/)") &
778 "LOCALIZATION| Write restart file for the localized MOS : ", &
779 trim(filename)
780 END IF
781
782 IF (rst_unit > 0) THEN
783 WRITE (rst_unit) qs_loc_env%localized_wfn_control%set_of_states
784 WRITE (rst_unit) qs_loc_env%localized_wfn_control%lu_bound_states
785 WRITE (rst_unit) qs_loc_env%localized_wfn_control%nloc_states
786 END IF
787
788 DO ispin = 1, SIZE(coeff_localized)
789 associate(mo_coeff => coeff_localized(ispin))
790 CALL cp_fm_get_info(mo_coeff, nrow_global=nao, ncol_global=nmo, ncol_block=max_block)
791 nloc = qs_loc_env%localized_wfn_control%nloc_states(ispin)
792 IF (rst_unit > 0) THEN
793 WRITE (rst_unit) qs_loc_env%localized_wfn_control%loc_states(1:nloc, ispin)
794 IF (do_homo .OR. my_do_mixed) THEN
795 WRITE (rst_unit) nmo, &
796 mo_array(ispin)%homo, &
797 mo_array(ispin)%lfomo, &
798 mo_array(ispin)%nelectron
799 WRITE (rst_unit) mo_array(ispin)%eigenvalues(1:nmo), &
800 mo_array(ispin)%occupation_numbers(1:nmo)
801 ELSE
802 WRITE (rst_unit) nmo
803 WRITE (rst_unit) evals(ispin)%array(1:nmo)
804 END IF
805 END IF
806
807 CALL cp_fm_write_unformatted(mo_coeff, rst_unit)
808 END associate
809
810 END DO
811
812 CALL cp_print_key_finished_output(rst_unit, logger, section, &
813 "LOC_RESTART")
814 END IF
815
816 END IF
817
818 CALL timestop(handle)
819
820 END SUBROUTINE loc_write_restart
821
822! **************************************************************************************************
823!> \brief ...
824!> \param qs_loc_env ...
825!> \param mos ...
826!> \param mos_localized ...
827!> \param section ...
828!> \param section2 ...
829!> \param para_env ...
830!> \param do_homo ...
831!> \param restart_found ...
832!> \param evals ...
833!> \param do_mixed ...
834! **************************************************************************************************
835 SUBROUTINE loc_read_restart(qs_loc_env, mos, mos_localized, section, section2, para_env, &
836 do_homo, restart_found, evals, do_mixed)
837
838 TYPE(qs_loc_env_type), POINTER :: qs_loc_env
839 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
840 TYPE(cp_fm_type), DIMENSION(:), INTENT(INOUT) :: mos_localized
841 TYPE(section_vals_type), POINTER :: section, section2
842 TYPE(mp_para_env_type), POINTER :: para_env
843 LOGICAL, INTENT(IN) :: do_homo
844 LOGICAL, INTENT(INOUT) :: restart_found
845 TYPE(cp_1d_r_p_type), DIMENSION(:), OPTIONAL, &
846 POINTER :: evals
847 LOGICAL, INTENT(IN), OPTIONAL :: do_mixed
848
849 CHARACTER(len=*), PARAMETER :: routinen = 'loc_read_restart'
850
851 CHARACTER(LEN=25) :: fname_key
852 CHARACTER(LEN=default_path_length) :: filename
853 CHARACTER(LEN=default_string_length) :: my_middle
854 INTEGER :: handle, homo_read, i, ispin, lfomo_read, max_nloc, n_rep_val, nao, &
855 nelectron_read, nloc, nmo, nmo_read, nspin, output_unit, rst_unit
856 LOGICAL :: file_exists, my_do_mixed
857 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: eig_read, occ_read
858 REAL(kind=dp), DIMENSION(:, :), POINTER :: vecbuffer
859 TYPE(cp_logger_type), POINTER :: logger
860 TYPE(section_vals_type), POINTER :: print_key
861
862 CALL timeset(routinen, handle)
863
864 logger => cp_get_default_logger()
865
866 nspin = SIZE(mos_localized)
867 nao = mos(1)%nao
868 rst_unit = -1
869
870 output_unit = cp_print_key_unit_nr(logger, section2, &
871 "PROGRAM_RUN_INFO", extension=".Log")
872
873 my_do_mixed = .false.
874 IF (PRESENT(do_mixed)) my_do_mixed = do_mixed
875 IF (do_homo) THEN
876 fname_key = "LOCHOMO_RESTART_FILE_NAME"
877 ELSE IF (my_do_mixed) THEN
878 fname_key = "LOCMIXD_RESTART_FILE_NAME"
879 ELSE
880 fname_key = "LOCLUMO_RESTART_FILE_NAME"
881 IF (.NOT. PRESENT(evals)) THEN
882 cpabort("Missing argument to localize unoccupied states.")
883 END IF
884 END IF
885
886 file_exists = .false.
887 CALL section_vals_val_get(section, fname_key, n_rep_val=n_rep_val)
888 IF (n_rep_val > 0) THEN
889 CALL section_vals_val_get(section, fname_key, c_val=filename)
890 ELSE
891
892 print_key => section_vals_get_subs_vals(section2, "LOC_RESTART")
893 IF (do_homo) THEN
894 my_middle = "LOC_HOMO"
895 ELSE IF (my_do_mixed) THEN
896 my_middle = "LOC_MIXED"
897 ELSE
898 my_middle = "LOC_LUMO"
899 END IF
900 filename = cp_print_key_generate_filename(logger, print_key, &
901 middle_name=trim(my_middle), extension=".wfn", &
902 my_local=.false.)
903 END IF
904
905 IF (para_env%is_source()) INQUIRE (file=filename, exist=file_exists)
906
907 IF (file_exists) THEN
908 IF (para_env%is_source()) THEN
909 CALL open_file(file_name=filename, &
910 file_action="READ", &
911 file_form="UNFORMATTED", &
912 file_status="OLD", &
913 unit_number=rst_unit)
914
915 READ (rst_unit) qs_loc_env%localized_wfn_control%set_of_states
916 READ (rst_unit) qs_loc_env%localized_wfn_control%lu_bound_states
917 READ (rst_unit) qs_loc_env%localized_wfn_control%nloc_states
918 END IF
919 ELSE
920 IF (output_unit > 0) THEN
921 WRITE (output_unit, "(/,T10,A)") &
922 "Restart file not available filename=<"//trim(filename)//'>'
923 END IF
924 END IF
925 CALL para_env%bcast(file_exists)
926
927 IF (file_exists) THEN
928 restart_found = .true.
929
930 CALL para_env%bcast(qs_loc_env%localized_wfn_control%set_of_states)
931 CALL para_env%bcast(qs_loc_env%localized_wfn_control%lu_bound_states)
932 CALL para_env%bcast(qs_loc_env%localized_wfn_control%nloc_states)
933
934 max_nloc = maxval(qs_loc_env%localized_wfn_control%nloc_states(:))
935
936 ALLOCATE (vecbuffer(1, nao))
937 IF (ASSOCIATED(qs_loc_env%localized_wfn_control%loc_states)) THEN
938 DEALLOCATE (qs_loc_env%localized_wfn_control%loc_states)
939 END IF
940 ALLOCATE (qs_loc_env%localized_wfn_control%loc_states(max_nloc, 2))
941 qs_loc_env%localized_wfn_control%loc_states = 0
942
943 DO ispin = 1, nspin
944 IF (do_homo .OR. do_mixed) THEN
945 nmo = mos(ispin)%nmo
946 ELSE
947 nmo = SIZE(evals(ispin)%array, 1)
948 END IF
949 IF (para_env%is_source() .AND. (nmo > 0)) THEN
950 nloc = qs_loc_env%localized_wfn_control%nloc_states(ispin)
951 READ (rst_unit) qs_loc_env%localized_wfn_control%loc_states(1:nloc, ispin)
952 IF (do_homo .OR. do_mixed) THEN
953 READ (rst_unit) nmo_read, homo_read, lfomo_read, nelectron_read
954 ALLOCATE (eig_read(nmo_read), occ_read(nmo_read))
955 eig_read = 0.0_dp
956 occ_read = 0.0_dp
957 READ (rst_unit) eig_read(1:nmo_read), occ_read(1:nmo_read)
958 ELSE
959 READ (rst_unit) nmo_read
960 ALLOCATE (eig_read(nmo_read))
961 eig_read = 0.0_dp
962 READ (rst_unit) eig_read(1:nmo_read)
963 END IF
964 IF (nmo_read < nmo) THEN
965 CALL cp_warn(__location__, &
966 "The number of MOs on the restart unit is smaller than the number of "// &
967 "the allocated MOs. ")
968 END IF
969 IF (nmo_read > nmo) THEN
970 CALL cp_warn(__location__, &
971 "The number of MOs on the restart unit is greater than the number of "// &
972 "the allocated MOs. The read MO set will be truncated!")
973 END IF
974
975 nmo = min(nmo, nmo_read)
976 IF (do_homo .OR. do_mixed) THEN
977 mos(ispin)%eigenvalues(1:nmo) = eig_read(1:nmo)
978 mos(ispin)%occupation_numbers(1:nmo) = occ_read(1:nmo)
979 DEALLOCATE (eig_read, occ_read)
980 ELSE
981 evals(ispin)%array(1:nmo) = eig_read(1:nmo)
982 DEALLOCATE (eig_read)
983 END IF
984
985 END IF
986 IF (do_homo .OR. do_mixed) THEN
987 CALL para_env%bcast(mos(ispin)%eigenvalues)
988 CALL para_env%bcast(mos(ispin)%occupation_numbers)
989 ELSE
990 CALL para_env%bcast(evals(ispin)%array)
991 END IF
992
993 DO i = 1, nmo
994 IF (para_env%is_source()) THEN
995 READ (rst_unit) vecbuffer
996 ELSE
997 vecbuffer(1, :) = 0.0_dp
998 END IF
999 CALL para_env%bcast(vecbuffer)
1000 CALL cp_fm_set_submatrix(mos_localized(ispin), &
1001 vecbuffer, 1, i, nao, 1, transpose=.true.)
1002 END DO
1003 END DO
1004
1005 CALL para_env%bcast(qs_loc_env%localized_wfn_control%loc_states)
1006
1007 DEALLOCATE (vecbuffer)
1008
1009 END IF
1010
1011 ! Close restart file
1012 IF (para_env%is_source()) THEN
1013 IF (file_exists) CALL close_file(unit_number=rst_unit)
1014 END IF
1015
1016 CALL timestop(handle)
1017
1018 END SUBROUTINE loc_read_restart
1019
1020! **************************************************************************************************
1021!> \brief initializes everything needed for localization of the HOMOs
1022!> \param qs_loc_env ...
1023!> \param loc_section ...
1024!> \param do_homo ...
1025!> \param do_mixed ...
1026!> \param do_xas ...
1027!> \param nloc_xas ...
1028!> \param spin_xas ...
1029!> \par History
1030!> 2009 created
1031! **************************************************************************************************
1032 SUBROUTINE qs_loc_control_init(qs_loc_env, loc_section, do_homo, do_mixed, &
1033 do_xas, nloc_xas, spin_xas)
1034
1035 TYPE(qs_loc_env_type), POINTER :: qs_loc_env
1036 TYPE(section_vals_type), POINTER :: loc_section
1037 LOGICAL, INTENT(IN) :: do_homo
1038 LOGICAL, INTENT(IN), OPTIONAL :: do_mixed, do_xas
1039 INTEGER, INTENT(IN), OPTIONAL :: nloc_xas, spin_xas
1040
1041 LOGICAL :: my_do_mixed
1042 TYPE(localized_wfn_control_type), POINTER :: localized_wfn_control
1043
1044 NULLIFY (localized_wfn_control)
1045
1046 IF (PRESENT(do_mixed)) THEN
1047 my_do_mixed = do_mixed
1048 ELSE
1049 my_do_mixed = .false.
1050 END IF
1051 CALL localized_wfn_control_create(localized_wfn_control)
1052 CALL set_qs_loc_env(qs_loc_env, localized_wfn_control=localized_wfn_control)
1053 CALL localized_wfn_control_release(localized_wfn_control)
1054 CALL get_qs_loc_env(qs_loc_env, localized_wfn_control=localized_wfn_control)
1055 localized_wfn_control%do_homo = do_homo
1056 localized_wfn_control%do_mixed = my_do_mixed
1057 CALL read_loc_section(localized_wfn_control, loc_section, qs_loc_env%do_localize, &
1058 my_do_mixed, do_xas, nloc_xas, spin_xas)
1059
1060 END SUBROUTINE qs_loc_control_init
1061
1062! **************************************************************************************************
1063!> \brief initializes everything needed for localization of the molecular orbitals
1064!> \param qs_env ...
1065!> \param qs_loc_env ...
1066!> \param localize_section ...
1067!> \param mos_localized ...
1068!> \param do_homo ...
1069!> \param do_mo_cubes ...
1070!> \param mo_loc_history ...
1071!> \param evals ...
1072!> \param tot_zeff_corr ...
1073!> \param do_mixed ...
1074! **************************************************************************************************
1075 SUBROUTINE qs_loc_init(qs_env, qs_loc_env, localize_section, mos_localized, &
1076 do_homo, do_mo_cubes, mo_loc_history, evals, &
1077 tot_zeff_corr, do_mixed)
1078
1079 TYPE(qs_environment_type), POINTER :: qs_env
1080 TYPE(qs_loc_env_type), POINTER :: qs_loc_env
1081 TYPE(section_vals_type), POINTER :: localize_section
1082 TYPE(cp_fm_type), DIMENSION(:), INTENT(INOUT) :: mos_localized
1083 LOGICAL, OPTIONAL :: do_homo, do_mo_cubes
1084 TYPE(cp_fm_type), DIMENSION(:), OPTIONAL, POINTER :: mo_loc_history
1085 TYPE(cp_1d_r_p_type), DIMENSION(:), OPTIONAL, &
1086 POINTER :: evals
1087 REAL(kind=dp), INTENT(IN), OPTIONAL :: tot_zeff_corr
1088 LOGICAL, OPTIONAL :: do_mixed
1089
1090 CHARACTER(len=*), PARAMETER :: routinen = 'qs_loc_init'
1091
1092 INTEGER :: handle, homo, i, ilast_intocc, ilow, ispin, iup, n_mo(2), n_mos(2), nao, &
1093 nelectron, nextra, nmoloc(2), nocc, npocc, nspin, output_unit
1094 LOGICAL :: my_do_homo, my_do_mixed, my_do_mo_cubes, &
1095 restart_found
1096 REAL(kind=dp) :: maxocc, my_tot_zeff_corr
1097 REAL(kind=dp), DIMENSION(:), POINTER :: mo_eigenvalues, occupation
1098 TYPE(cp_fm_type), POINTER :: mo_coeff
1099 TYPE(cp_logger_type), POINTER :: logger
1100 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: ks_rmpv, mo_derivs
1101 TYPE(dft_control_type), POINTER :: dft_control
1102 TYPE(localized_wfn_control_type), POINTER :: localized_wfn_control
1103 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
1104 TYPE(mp_para_env_type), POINTER :: para_env
1105 TYPE(scf_control_type), POINTER :: scf_control
1106 TYPE(section_vals_type), POINTER :: loc_print_section
1107
1108 CALL timeset(routinen, handle)
1109
1110 NULLIFY (mos, mo_coeff, mo_eigenvalues, occupation, ks_rmpv, mo_derivs, scf_control, para_env)
1111 CALL get_qs_env(qs_env, &
1112 mos=mos, &
1113 matrix_ks=ks_rmpv, &
1114 mo_derivs=mo_derivs, &
1115 scf_control=scf_control, &
1116 dft_control=dft_control, &
1117 para_env=para_env)
1118
1119 loc_print_section => section_vals_get_subs_vals(localize_section, "PRINT")
1120
1121 logger => cp_get_default_logger()
1122 output_unit = cp_logger_get_default_io_unit(logger)
1123
1124 nspin = SIZE(mos)
1125 IF (PRESENT(do_homo)) THEN
1126 my_do_homo = do_homo
1127 ELSE
1128 my_do_homo = .true.
1129 END IF
1130 IF (PRESENT(do_mo_cubes)) THEN
1131 my_do_mo_cubes = do_mo_cubes
1132 ELSE
1133 my_do_mo_cubes = .false.
1134 END IF
1135 IF (PRESENT(do_mixed)) THEN
1136 my_do_mixed = do_mixed
1137 ELSE
1138 my_do_mixed = .false.
1139 END IF
1140 IF (PRESENT(tot_zeff_corr)) THEN
1141 my_tot_zeff_corr = tot_zeff_corr
1142 ELSE
1143 my_tot_zeff_corr = 0.0_dp
1144 END IF
1145 restart_found = .false.
1146
1147 IF (qs_loc_env%do_localize) THEN
1148 ! Some setup for MOs to be localized
1149 CALL get_qs_loc_env(qs_loc_env, localized_wfn_control=localized_wfn_control)
1150 IF (localized_wfn_control%loc_restart) THEN
1151 IF (localized_wfn_control%nextra > 0) THEN
1152 ! currently only the occupied guess is read
1153 my_do_homo = .false.
1154 END IF
1155 CALL loc_read_restart(qs_loc_env, mos, mos_localized, localize_section, &
1156 loc_print_section, para_env, my_do_homo, restart_found, evals=evals, &
1157 do_mixed=my_do_mixed)
1158 IF (output_unit > 0) WRITE (output_unit, "(/,T2,A,A)") "LOCALIZATION| ", &
1159 " The orbitals to be localized are read from localization restart file."
1160 nmoloc = localized_wfn_control%nloc_states
1161 localized_wfn_control%nguess = nmoloc
1162 IF (localized_wfn_control%nextra > 0) THEN
1163 ! reset different variables in localized_wfn_control:
1164 ! lu_bound_states, nloc_states, loc_states
1165 localized_wfn_control%loc_restart = restart_found
1166 localized_wfn_control%set_of_states = state_loc_mixed
1167 DO ispin = 1, nspin
1168 CALL get_mo_set(mos(ispin), homo=homo, occupation_numbers=occupation, &
1169 maxocc=maxocc)
1170 nextra = localized_wfn_control%nextra
1171 nocc = homo
1172 DO i = nocc, 1, -1
1173 IF (maxocc - occupation(i) < localized_wfn_control%eps_occ) THEN
1174 ilast_intocc = i
1175 EXIT
1176 END IF
1177 END DO
1178 nocc = ilast_intocc
1179 npocc = homo - nocc
1180 nmoloc(ispin) = nocc + nextra
1181 localized_wfn_control%lu_bound_states(1, ispin) = 1
1182 localized_wfn_control%lu_bound_states(2, ispin) = nmoloc(ispin)
1183 localized_wfn_control%nloc_states(ispin) = nmoloc(ispin)
1184 END DO
1185 my_do_homo = .false.
1186 END IF
1187 END IF
1188 IF (.NOT. restart_found) THEN
1189 nmoloc = 0
1190 DO ispin = 1, nspin
1191 CALL get_mo_set(mos(ispin), nmo=n_mo(ispin), nelectron=nelectron, homo=homo, nao=nao, &
1192 mo_coeff=mo_coeff, eigenvalues=mo_eigenvalues, occupation_numbers=occupation, &
1193 maxocc=maxocc)
1194 ! Get eigenstates (only needed if not already calculated before)
1195 IF ((.NOT. my_do_mo_cubes) &
1196 .AND. my_do_homo .AND. ASSOCIATED(qs_env%scf_env) &
1197 .AND. qs_env%scf_env%method == ot_method_nr .AND. (.NOT. dft_control%restricted)) THEN
1198 CALL make_mo_eig(mos, nspin, ks_rmpv, scf_control, mo_derivs)
1199 END IF
1200 IF (localized_wfn_control%set_of_states == state_loc_all .AND. my_do_homo) THEN
1201 nmoloc(ispin) = nint(nelectron/occupation(1))
1202 IF (n_mo(ispin) > homo) THEN
1203 DO i = nmoloc(ispin), 1, -1
1204 IF (occupation(1) - occupation(i) < localized_wfn_control%eps_occ) THEN
1205 ilast_intocc = i
1206 EXIT
1207 END IF
1208 END DO
1209 ELSE
1210 ilast_intocc = nmoloc(ispin)
1211 END IF
1212 nmoloc(ispin) = ilast_intocc
1213 localized_wfn_control%lu_bound_states(1, ispin) = 1
1214 localized_wfn_control%lu_bound_states(2, ispin) = ilast_intocc
1215 IF (nmoloc(ispin) /= n_mo(ispin)) THEN
1216 IF (output_unit > 0) THEN
1217 WRITE (output_unit, "(/,T2,A,I4,A,I6,A,/,T15,A,F12.6,A,F12.6,A)") &
1218 "LOCALIZATION| Spin ", ispin, " The first ", &
1219 ilast_intocc, " occupied orbitals are localized,", " with energies from ", &
1220 mo_eigenvalues(1), " to ", mo_eigenvalues(ilast_intocc), " [a.u.]."
1221 END IF
1222 END IF
1223 ELSE IF (localized_wfn_control%set_of_states == energy_loc_range .AND. my_do_homo) THEN
1224 ilow = 0
1225 iup = 0
1226 DO i = 1, n_mo(ispin)
1227 IF (mo_eigenvalues(i) >= localized_wfn_control%lu_ene_bound(1)) THEN
1228 ilow = i
1229 EXIT
1230 END IF
1231 END DO
1232 DO i = n_mo(ispin), 1, -1
1233 IF (mo_eigenvalues(i) <= localized_wfn_control%lu_ene_bound(2)) THEN
1234 iup = i
1235 EXIT
1236 END IF
1237 END DO
1238 localized_wfn_control%lu_bound_states(1, ispin) = ilow
1239 localized_wfn_control%lu_bound_states(2, ispin) = iup
1240 localized_wfn_control%nloc_states(ispin) = iup - ilow + 1
1241 nmoloc(ispin) = localized_wfn_control%nloc_states(ispin)
1242 IF (occupation(ilow) - occupation(iup) > localized_wfn_control%eps_occ) THEN
1243 CALL cp_abort(__location__, &
1244 "The selected energy range includes orbitals with different occupation number. "// &
1245 "The localization procedure cannot be applied.")
1246 END IF
1247 IF (output_unit > 0) WRITE (output_unit, "(/,T2,A,I4,A,I6,A)") "LOCALIZATION| Spin ", ispin, " : ", &
1248 nmoloc(ispin), " orbitals in the selected energy range are localized."
1249 ELSE IF (localized_wfn_control%set_of_states == state_loc_all .AND. (.NOT. my_do_homo)) THEN
1250 nmoloc(ispin) = n_mo(ispin) - homo
1251 localized_wfn_control%lu_bound_states(1, ispin) = homo + 1
1252 localized_wfn_control%lu_bound_states(2, ispin) = n_mo(ispin)
1253 IF (output_unit > 0) THEN
1254 WRITE (output_unit, "(/,T2,A,I4,A,I6,A,/,T15,A,F12.6,A,F12.6,A)") &
1255 "LOCALIZATION| Spin ", ispin, " The first ", &
1256 nmoloc(ispin), " virtual orbitals are localized,", " with energies from ", &
1257 mo_eigenvalues(homo + 1), " to ", mo_eigenvalues(n_mo(ispin)), " [a.u.]."
1258 END IF
1259 ELSE IF (localized_wfn_control%set_of_states == state_loc_mixed) THEN
1260 nextra = localized_wfn_control%nextra
1261 nocc = homo
1262 DO i = nocc, 1, -1
1263 IF (maxocc - occupation(i) < localized_wfn_control%eps_occ) THEN
1264 ilast_intocc = i
1265 EXIT
1266 END IF
1267 END DO
1268 nocc = ilast_intocc
1269 npocc = homo - nocc
1270 nmoloc(ispin) = nocc + nextra
1271 localized_wfn_control%lu_bound_states(1, ispin) = 1
1272 localized_wfn_control%lu_bound_states(2, ispin) = nmoloc(ispin)
1273 IF (output_unit > 0) THEN
1274 WRITE (output_unit, "(/,T2,A,I4,A,I6,A,/,T15,A,I6,/,T15,A,I6,/,T15,A,I6,/,T15,A,F12.6,A)") &
1275 "LOCALIZATION| Spin ", ispin, " The first ", &
1276 nmoloc(ispin), " orbitals are localized.", &
1277 "Number of fully occupied MOs: ", nocc, &
1278 "Number of partially occupied MOs: ", npocc, &
1279 "Number of extra degrees of freedom: ", nextra, &
1280 "Excess charge: ", my_tot_zeff_corr, " electrons"
1281 END IF
1282 ELSE
1283 nmoloc(ispin) = min(localized_wfn_control%nloc_states(1), n_mo(ispin))
1284 IF (output_unit > 0 .AND. my_do_homo) WRITE (output_unit, "(/,T2,A,I4,A,I6,A)") "LOCALIZATION| Spin ", ispin, &
1285 " : ", nmoloc(ispin), " occupied orbitals are localized, as given in the input list."
1286 IF (output_unit > 0 .AND. (.NOT. my_do_homo)) WRITE (output_unit, "(/,T2,A,I4,A,I6,A)") "LOCALIZATION| Spin ", &
1287 ispin, " : ", nmoloc(ispin), " unoccupied orbitals are localized, as given in the input list."
1288 IF (n_mo(ispin) > homo .AND. my_do_homo) THEN
1289 ilow = localized_wfn_control%loc_states(1, ispin)
1290 DO i = 2, nmoloc(ispin)
1291 iup = localized_wfn_control%loc_states(i, ispin)
1292 IF (abs(occupation(ilow) - occupation(iup)) > localized_wfn_control%eps_occ) THEN
1293 ! write warning
1294 CALL cp_warn(__location__, &
1295 "User requested the calculation of localized wavefunction from a subset of MOs, "// &
1296 "including MOs with different occupations. Check the selected subset, "// &
1297 "the electronic density is not invariant with "// &
1298 "respect to rotations among orbitals with different occupation numbers!")
1299 END IF
1300 END DO
1301 END IF
1302 END IF
1303 END DO ! ispin
1304 n_mos(:) = nao - n_mo(:)
1305 IF (my_do_homo .OR. my_do_mixed) n_mos = n_mo
1306 CALL set_loc_wfn_lists(localized_wfn_control, nmoloc, n_mos, nspin)
1307 END IF
1308 CALL set_loc_centers(localized_wfn_control, nmoloc, nspin)
1309 IF (my_do_homo .OR. my_do_mixed) THEN
1310 CALL qs_loc_env_init(qs_loc_env, localized_wfn_control, qs_env, &
1311 loc_coeff=mos_localized, mo_loc_history=mo_loc_history)
1312 END IF
1313 ELSE
1314 ! Let's inform in case the section is not present in the input
1315 CALL cp_warn(__location__, &
1316 "User requested the calculation of the localized wavefunction but the section "// &
1317 "LOCALIZE was not specified. Localization will not be performed!")
1318 END IF
1319
1320 CALL timestop(handle)
1321
1322 END SUBROUTINE qs_loc_init
1323
1324! **************************************************************************************************
1325!> \brief read the controlparameter from input, using the new input scheme
1326!> \param localized_wfn_control ...
1327!> \param loc_section ...
1328!> \param localize ...
1329!> \param do_mixed ...
1330!> \param do_xas ...
1331!> \param nloc_xas ...
1332!> \param spin_channel_xas ...
1333!> \par History
1334!> 05.2005 created [MI]
1335! **************************************************************************************************
1336 SUBROUTINE read_loc_section(localized_wfn_control, loc_section, &
1337 localize, do_mixed, do_xas, nloc_xas, spin_channel_xas)
1338
1339 TYPE(localized_wfn_control_type), POINTER :: localized_wfn_control
1340 TYPE(section_vals_type), POINTER :: loc_section
1341 LOGICAL, INTENT(OUT) :: localize
1342 LOGICAL, INTENT(IN), OPTIONAL :: do_mixed, do_xas
1343 INTEGER, INTENT(IN), OPTIONAL :: nloc_xas, spin_channel_xas
1344
1345 INTEGER :: i, ind, ir, n_list, n_rep, n_state, &
1346 nextra, nline, other_spin, &
1347 output_unit, spin_xas
1348 INTEGER, DIMENSION(:), POINTER :: list, loc_list
1349 LOGICAL :: my_do_mixed, my_do_xas
1350 REAL(dp), POINTER :: ene(:)
1351 TYPE(cp_logger_type), POINTER :: logger
1352 TYPE(section_vals_type), POINTER :: loc_print_section
1353
1354 my_do_xas = .false.
1355 spin_xas = 1
1356 IF (PRESENT(do_xas)) THEN
1357 my_do_xas = do_xas
1358 cpassert(PRESENT(nloc_xas))
1359 END IF
1360 IF (PRESENT(spin_channel_xas)) spin_xas = spin_channel_xas
1361 my_do_mixed = .false.
1362 IF (PRESENT(do_mixed)) THEN
1363 my_do_mixed = do_mixed
1364 END IF
1365 cpassert(ASSOCIATED(loc_section))
1366 NULLIFY (logger)
1367 logger => cp_get_default_logger()
1368
1369 CALL section_vals_val_get(loc_section, "_SECTION_PARAMETERS_", l_val=localize)
1370 IF (localize) THEN
1371 loc_print_section => section_vals_get_subs_vals(loc_section, "PRINT")
1372 NULLIFY (list)
1373 NULLIFY (loc_list)
1374 localized_wfn_control%lu_bound_states = 0
1375 localized_wfn_control%lu_ene_bound = 0.0_dp
1376 localized_wfn_control%nloc_states = 0
1377 localized_wfn_control%set_of_states = 0
1378 localized_wfn_control%nextra = 0
1379 n_state = 0
1380
1381 CALL section_vals_val_get(loc_section, "MAX_ITER", &
1382 i_val=localized_wfn_control%max_iter)
1383 CALL section_vals_val_get(loc_section, "MAX_CRAZY_ANGLE", &
1384 r_val=localized_wfn_control%max_crazy_angle)
1385 CALL section_vals_val_get(loc_section, "CRAZY_SCALE", &
1386 r_val=localized_wfn_control%crazy_scale)
1387 CALL section_vals_val_get(loc_section, "EPS_OCCUPATION", &
1388 r_val=localized_wfn_control%eps_occ)
1389 CALL section_vals_val_get(loc_section, "CRAZY_USE_DIAG", &
1390 l_val=localized_wfn_control%crazy_use_diag)
1391 CALL section_vals_val_get(loc_section, "OUT_ITER_EACH", &
1392 i_val=localized_wfn_control%out_each)
1393 CALL section_vals_val_get(loc_section, "EPS_LOCALIZATION", &
1394 r_val=localized_wfn_control%eps_localization)
1395 CALL section_vals_val_get(loc_section, "MIN_OR_MAX", &
1396 i_val=localized_wfn_control%min_or_max)
1397 CALL section_vals_val_get(loc_section, "JACOBI_FALLBACK", &
1398 l_val=localized_wfn_control%jacobi_fallback)
1399 CALL section_vals_val_get(loc_section, "JACOBI_REFINEMENT", &
1400 l_val=localized_wfn_control%jacobi_refinement)
1401 CALL section_vals_val_get(loc_section, "METHOD", &
1402 i_val=localized_wfn_control%localization_method)
1403 CALL section_vals_val_get(loc_section, "OPERATOR", &
1404 i_val=localized_wfn_control%operator_type)
1405 CALL section_vals_val_get(loc_section, "RESTART", &
1406 l_val=localized_wfn_control%loc_restart)
1407 CALL section_vals_val_get(loc_section, "USE_HISTORY", &
1408 l_val=localized_wfn_control%use_history)
1409 CALL section_vals_val_get(loc_section, "NEXTRA", &
1410 i_val=localized_wfn_control%nextra)
1411 CALL section_vals_val_get(loc_section, "CPO_GUESS", &
1412 i_val=localized_wfn_control%coeff_po_guess)
1413 CALL section_vals_val_get(loc_section, "CPO_GUESS_SPACE", &
1414 i_val=localized_wfn_control%coeff_po_guess_mo_space)
1415 CALL section_vals_val_get(loc_section, "CG_PO", &
1416 l_val=localized_wfn_control%do_cg_po)
1417
1418 IF (localized_wfn_control%do_homo) THEN
1419 ! List of States HOMO
1420 CALL section_vals_val_get(loc_section, "LIST", n_rep_val=n_rep)
1421 IF (n_rep > 0) THEN
1422 n_list = 0
1423 DO ir = 1, n_rep
1424 NULLIFY (list)
1425 CALL section_vals_val_get(loc_section, "LIST", i_rep_val=ir, i_vals=list)
1426 IF (ASSOCIATED(list)) THEN
1427 CALL reallocate(loc_list, 1, n_list + SIZE(list))
1428 DO i = 1, SIZE(list)
1429 loc_list(n_list + i) = list(i)
1430 END DO ! i
1431 n_list = n_list + SIZE(list)
1432 END IF
1433 END DO ! ir
1434 IF (n_list /= 0) THEN
1435 localized_wfn_control%set_of_states = state_loc_list
1436 ALLOCATE (localized_wfn_control%loc_states(n_list, 2))
1437 localized_wfn_control%loc_states = 0
1438 localized_wfn_control%loc_states(:, 1) = loc_list(:)
1439 localized_wfn_control%loc_states(:, 2) = loc_list(:)
1440 localized_wfn_control%nloc_states(1) = n_list
1441 localized_wfn_control%nloc_states(2) = n_list
1442 IF (my_do_xas) THEN
1443 other_spin = 2
1444 IF (spin_xas == 2) other_spin = 1
1445 localized_wfn_control%nloc_states(other_spin) = 0
1446 localized_wfn_control%loc_states(:, other_spin) = 0
1447 END IF
1448 DEALLOCATE (loc_list)
1449 END IF
1450 END IF
1451
1452 ELSE
1453 ! List of States LUMO
1454 CALL section_vals_val_get(loc_section, "LIST_UNOCCUPIED", n_rep_val=n_rep)
1455 IF (n_rep > 0) THEN
1456 n_list = 0
1457 DO ir = 1, n_rep
1458 NULLIFY (list)
1459 CALL section_vals_val_get(loc_section, "LIST_UNOCCUPIED", i_rep_val=ir, i_vals=list)
1460 IF (ASSOCIATED(list)) THEN
1461 CALL reallocate(loc_list, 1, n_list + SIZE(list))
1462 DO i = 1, SIZE(list)
1463 loc_list(n_list + i) = list(i)
1464 END DO ! i
1465 n_list = n_list + SIZE(list)
1466 END IF
1467 END DO ! ir
1468 IF (n_list /= 0) THEN
1469 localized_wfn_control%set_of_states = state_loc_list
1470 ALLOCATE (localized_wfn_control%loc_states(n_list, 2))
1471 localized_wfn_control%loc_states = 0
1472 localized_wfn_control%loc_states(:, 1) = loc_list(:)
1473 localized_wfn_control%loc_states(:, 2) = loc_list(:)
1474 localized_wfn_control%nloc_states(1) = n_list
1475 DEALLOCATE (loc_list)
1476 END IF
1477 END IF
1478 END IF
1479
1480 IF (localized_wfn_control%set_of_states == 0) THEN
1481 CALL section_vals_val_get(loc_section, "ENERGY_RANGE", r_vals=ene)
1482 IF (ene(1) /= ene(2)) THEN
1483 localized_wfn_control%set_of_states = energy_loc_range
1484 localized_wfn_control%lu_ene_bound(1) = ene(1)
1485 localized_wfn_control%lu_ene_bound(2) = ene(2)
1486 END IF
1487 END IF
1488
1489 ! All States or XAS specific states
1490 IF (localized_wfn_control%set_of_states == 0) THEN
1491 IF (my_do_xas) THEN
1492 localized_wfn_control%set_of_states = state_loc_range
1493 localized_wfn_control%nloc_states(:) = 0
1494 localized_wfn_control%lu_bound_states(1, :) = 0
1495 localized_wfn_control%lu_bound_states(2, :) = 0
1496 localized_wfn_control%nloc_states(spin_xas) = nloc_xas
1497 localized_wfn_control%lu_bound_states(1, spin_xas) = 1
1498 localized_wfn_control%lu_bound_states(2, spin_xas) = nloc_xas
1499 ELSE IF (my_do_mixed) THEN
1500 localized_wfn_control%set_of_states = state_loc_mixed
1501 nextra = localized_wfn_control%nextra
1502 ELSE
1503 localized_wfn_control%set_of_states = state_loc_all
1504 END IF
1505 END IF
1506
1507 localized_wfn_control%print_centers = &
1508 btest(cp_print_key_should_output(logger%iter_info, loc_print_section, &
1509 "WANNIER_CENTERS"), cp_p_file)
1510 localized_wfn_control%print_spreads = &
1511 btest(cp_print_key_should_output(logger%iter_info, loc_print_section, &
1512 "WANNIER_SPREADS"), cp_p_file)
1513 localized_wfn_control%print_cubes = &
1514 btest(cp_print_key_should_output(logger%iter_info, loc_print_section, &
1515 "WANNIER_CUBES"), cp_p_file)
1516
1517 output_unit = cp_print_key_unit_nr(logger, loc_print_section, "PROGRAM_RUN_INFO", &
1518 extension=".Log")
1519
1520 IF (output_unit > 0) THEN
1521 WRITE (unit=output_unit, fmt="(/,T2,A)") &
1522 "LOCALIZE| The spread relative to a set of orbitals is computed"
1523
1524 SELECT CASE (localized_wfn_control%set_of_states)
1525 CASE (state_loc_all)
1526 WRITE (unit=output_unit, fmt="(T2,A)") &
1527 "LOCALIZE| Orbitals to be localized: All orbitals"
1528 WRITE (unit=output_unit, fmt="(T2,A,/,T12,A,F16.8)") &
1529 "LOCALIZE| If fractional occupation, fully occupied MOs are those ", &
1530 "within occupation tolerance of ", localized_wfn_control%eps_occ
1531 CASE (state_loc_range)
1532 WRITE (unit=output_unit, fmt="(T2,A,T65,I8,A,I8)") &
1533 "LOCALIZE| Orbitals to be localized: Those with index between ", &
1534 localized_wfn_control%lu_bound_states(1, spin_xas), " and ", &
1535 localized_wfn_control%lu_bound_states(2, spin_xas)
1536 CASE (state_loc_list)
1537 WRITE (unit=output_unit, fmt="(T2,A)") &
1538 "LOCALIZE| Orbitals to be localized: Those with index in the following list"
1539 nline = localized_wfn_control%nloc_states(1)/10 + 1
1540 ind = 0
1541 DO i = 1, nline
1542 IF (ind + 10 < localized_wfn_control%nloc_states(1)) THEN
1543 WRITE (unit=output_unit, fmt="(T8,10I7)") localized_wfn_control%loc_states(ind + 1:ind + 10, 1)
1544 ind = ind + 10
1545 ELSE
1546 WRITE (unit=output_unit, fmt="(T8,10I7)") &
1547 localized_wfn_control%loc_states(ind + 1:localized_wfn_control%nloc_states(1), 1)
1548 ind = localized_wfn_control%nloc_states(1)
1549 END IF
1550 END DO
1551 CASE (energy_loc_range)
1552 WRITE (unit=output_unit, fmt="(T2,A,T65,/,f16.6,A,f16.6,A)") &
1553 "LOCALIZE| Orbitals to be localized: Those with energy in the range between ", &
1554 localized_wfn_control%lu_ene_bound(1), " and ", localized_wfn_control%lu_ene_bound(2), " a.u."
1555 CASE (state_loc_mixed)
1556 WRITE (unit=output_unit, fmt="(T2,A,I4,A)") &
1557 "LOCALIZE| Orbitals to be localized: Occupied orbitals + ", nextra, " orbitals"
1558 CASE DEFAULT
1559 WRITE (unit=output_unit, fmt="(T2,A)") &
1560 "LOCALIZE| Orbitals to be localized: None "
1561 END SELECT
1562
1563 SELECT CASE (localized_wfn_control%operator_type)
1564 CASE (op_loc_berry)
1565 WRITE (unit=output_unit, fmt="(T2,A)") &
1566 "LOCALIZE| Spread defined by the Berry phase operator "
1567 CASE (op_loc_boys)
1568 WRITE (unit=output_unit, fmt="(T2,A)") &
1569 "LOCALIZE| Spread defined by the Boys phase operator "
1570 CASE DEFAULT
1571 WRITE (unit=output_unit, fmt="(T2,A)") &
1572 "LOCALIZE| Spread defined by the Pipek phase operator "
1573 END SELECT
1574
1575 SELECT CASE (localized_wfn_control%localization_method)
1576 CASE (do_loc_jacobi)
1577 WRITE (unit=output_unit, fmt="(T2,A)") &
1578 "LOCALIZE| Optimal unitary transformation generated by Jacobi algorithm"
1579 CASE (do_loc_crazy)
1580 WRITE (unit=output_unit, fmt="(T2,A)") &
1581 "LOCALIZE| Optimal unitary transformation generated by Crazy angle algorithm"
1582 WRITE (unit=output_unit, fmt="(T2,A,F16.8)") &
1583 "LOCALIZE| maximum angle: ", localized_wfn_control%max_crazy_angle
1584 WRITE (unit=output_unit, fmt="(T2,A,F16.8)") &
1585 "LOCALIZE| scaling: ", localized_wfn_control%crazy_scale
1586 WRITE (unit=output_unit, fmt="(T2,A,L1)") &
1587 "LOCALIZE| use diag:", localized_wfn_control%crazy_use_diag
1588 CASE (do_loc_gapo)
1589 WRITE (unit=output_unit, fmt="(T2,A)") &
1590 "LOCALIZE| Optimal unitary transformation generated by gradient ascent algorithm "
1591 WRITE (unit=output_unit, fmt="(T2,A)") &
1592 "LOCALIZE| for partially occupied wannier functions"
1593 CASE (do_loc_direct)
1594 WRITE (unit=output_unit, fmt="(T2,A)") &
1595 "LOCALIZE| Optimal unitary transformation generated by direct algorithm"
1596 CASE (do_loc_l1_norm_sd)
1597 WRITE (unit=output_unit, fmt="(T2,A)") &
1598 "LOCALIZE| Optimal unitary transformation generated by "
1599 WRITE (unit=output_unit, fmt="(T2,A)") &
1600 "LOCALIZE| steepest descent algorithm applied on an approximate l1 norm"
1601 CASE (do_loc_none)
1602 WRITE (unit=output_unit, fmt="(T2,A)") &
1603 "LOCALIZE| No unitary transformation is applied"
1604 CASE (do_loc_scdm)
1605 WRITE (unit=output_unit, fmt="(T2,A)") &
1606 "LOCALIZE| Pivoted QR decomposition is used to transform coefficients"
1607 END SELECT
1608
1609 END IF ! process has output_unit
1610
1611 CALL cp_print_key_finished_output(output_unit, logger, loc_print_section, "PROGRAM_RUN_INFO")
1612
1613 ELSE
1614 localized_wfn_control%localization_method = do_loc_none
1615 localized_wfn_control%localization_method = state_loc_none
1616 localized_wfn_control%print_centers = .false.
1617 localized_wfn_control%print_spreads = .false.
1618 localized_wfn_control%print_cubes = .false.
1619 END IF
1620
1621 END SUBROUTINE read_loc_section
1622
1623! **************************************************************************************************
1624!> \brief create the center and spread array and the file names for the output
1625!> \param localized_wfn_control ...
1626!> \param nmoloc ...
1627!> \param nspins ...
1628!> \par History
1629!> 04.2005 created [MI]
1630! **************************************************************************************************
1631 SUBROUTINE set_loc_centers(localized_wfn_control, nmoloc, nspins)
1632
1633 TYPE(localized_wfn_control_type) :: localized_wfn_control
1634 INTEGER, DIMENSION(2), INTENT(IN) :: nmoloc
1635 INTEGER, INTENT(IN) :: nspins
1636
1637 INTEGER :: ispin
1638
1639 DO ispin = 1, nspins
1640 ALLOCATE (localized_wfn_control%centers_set(ispin)%array(6, nmoloc(ispin)))
1641 localized_wfn_control%centers_set(ispin)%array = 0.0_dp
1642 END DO
1643
1644 END SUBROUTINE set_loc_centers
1645
1646! **************************************************************************************************
1647!> \brief create the lists of mos that are taken into account
1648!> \param localized_wfn_control ...
1649!> \param nmoloc ...
1650!> \param nmo ...
1651!> \param nspins ...
1652!> \param my_spin ...
1653!> \par History
1654!> 04.2005 created [MI]
1655! **************************************************************************************************
1656 SUBROUTINE set_loc_wfn_lists(localized_wfn_control, nmoloc, nmo, nspins, my_spin)
1657
1658 TYPE(localized_wfn_control_type) :: localized_wfn_control
1659 INTEGER, DIMENSION(2), INTENT(IN) :: nmoloc, nmo
1660 INTEGER, INTENT(IN) :: nspins
1661 INTEGER, INTENT(IN), OPTIONAL :: my_spin
1662
1663 CHARACTER(len=*), PARAMETER :: routinen = 'set_loc_wfn_lists'
1664
1665 INTEGER :: i, ispin, max_iloc, max_nmoloc, state
1666
1667 CALL timeset(routinen, state)
1668
1669 localized_wfn_control%nloc_states(1:2) = nmoloc(1:2)
1670 max_nmoloc = max(nmoloc(1), nmoloc(2))
1671
1672 SELECT CASE (localized_wfn_control%set_of_states)
1673 CASE (state_loc_list)
1674 ! List
1675 cpassert(ASSOCIATED(localized_wfn_control%loc_states))
1676 DO ispin = 1, nspins
1677 localized_wfn_control%lu_bound_states(1, ispin) = 1
1678 localized_wfn_control%lu_bound_states(2, ispin) = nmoloc(ispin)
1679 IF (nmoloc(ispin) < 1) THEN
1680 localized_wfn_control%lu_bound_states(1, ispin) = 0
1681 localized_wfn_control%loc_states(:, ispin) = 0
1682 END IF
1683 END DO
1684 CASE (state_loc_range)
1685 ! Range
1686 ALLOCATE (localized_wfn_control%loc_states(max_nmoloc, 2))
1687 localized_wfn_control%loc_states = 0
1688 DO ispin = 1, nspins
1689 localized_wfn_control%lu_bound_states(1, ispin) = &
1690 localized_wfn_control%lu_bound_states(1, my_spin)
1691 localized_wfn_control%lu_bound_states(2, ispin) = &
1692 localized_wfn_control%lu_bound_states(1, my_spin) + nmoloc(ispin) - 1
1693 max_iloc = localized_wfn_control%lu_bound_states(2, ispin)
1694 DO i = 1, nmoloc(ispin)
1695 localized_wfn_control%loc_states(i, ispin) = localized_wfn_control%lu_bound_states(1, ispin) + i - 1
1696 END DO
1697 cpassert(max_iloc <= nmo(ispin))
1698 mark_used(nmo)
1699 END DO
1700 CASE (energy_loc_range)
1701 ! Energy
1702 ALLOCATE (localized_wfn_control%loc_states(max_nmoloc, 2))
1703 localized_wfn_control%loc_states = 0
1704 DO ispin = 1, nspins
1705 DO i = 1, nmoloc(ispin)
1706 localized_wfn_control%loc_states(i, ispin) = localized_wfn_control%lu_bound_states(1, ispin) + i - 1
1707 END DO
1708 END DO
1709 CASE (state_loc_all)
1710 ! All
1711 ALLOCATE (localized_wfn_control%loc_states(max_nmoloc, 2))
1712 localized_wfn_control%loc_states = 0
1713
1714 IF (localized_wfn_control%lu_bound_states(1, 1) == 1) THEN
1715 DO ispin = 1, nspins
1716 localized_wfn_control%lu_bound_states(1, ispin) = 1
1717 localized_wfn_control%lu_bound_states(2, ispin) = nmoloc(ispin)
1718 IF (nmoloc(ispin) < 1) localized_wfn_control%lu_bound_states(1, ispin) = 0
1719 DO i = 1, nmoloc(ispin)
1720 localized_wfn_control%loc_states(i, ispin) = i
1721 END DO
1722 END DO
1723 ELSE
1724 DO ispin = 1, nspins
1725 IF (nmoloc(ispin) < 1) localized_wfn_control%lu_bound_states(1, ispin) = 0
1726 DO i = 1, nmoloc(ispin)
1727 localized_wfn_control%loc_states(i, ispin) = &
1728 localized_wfn_control%lu_bound_states(1, ispin) + i - 1
1729 END DO
1730 END DO
1731 END IF
1732 CASE (state_loc_mixed)
1733 ! Mixed
1734 ALLOCATE (localized_wfn_control%loc_states(max_nmoloc, 2))
1735 localized_wfn_control%loc_states = 0
1736 DO ispin = 1, nspins
1737 DO i = 1, nmoloc(ispin)
1738 localized_wfn_control%loc_states(i, ispin) = i
1739 END DO
1740 END DO
1741 END SELECT
1742
1743 CALL timestop(state)
1744
1745 END SUBROUTINE set_loc_wfn_lists
1746
1747END MODULE qs_loc_utils
1748
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, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
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, hund_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, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, 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, do_mtlr_present, 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...