(git:e7e05ae)
dm_ls_scf_create.F
Go to the documentation of this file.
1 !--------------------------------------------------------------------------------------------------!
2 ! CP2K: A general program to perform molecular dynamics simulations !
3 ! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4 ! !
5 ! SPDX-License-Identifier: GPL-2.0-or-later !
6 !--------------------------------------------------------------------------------------------------!
7 
8 ! **************************************************************************************************
9 !> \brief Routines for a linear scaling quickstep SCF run based on the density
10 !> matrix
11 !> \par History
12 !> 2010.10 created [Joost VandeVondele]
13 !> 2016.11 created from dm_ls_scf to avoid circular dependencies
14 !> \author Joost VandeVondele
15 ! **************************************************************************************************
17  USE bibliography, ONLY: lin2009,&
18  lin2013,&
21  shao2003,&
23  cite_reference
24  USE cp_control_types, ONLY: dft_control_type
27  cp_logger_type
28  USE dbcsr_api, ONLY: dbcsr_p_type
29  USE dm_ls_scf_types, ONLY: ls_scf_env_type
30  USE input_constants, ONLY: &
38  enumeration_type
39  USE input_keyword_types, ONLY: keyword_get,&
40  keyword_type
43  section_type,&
47  section_vals_type,&
49  USE kinds, ONLY: dp
50  USE machine, ONLY: m_flush
51  USE molecule_types, ONLY: molecule_of_atom,&
52  molecule_type
53  USE pao_main, ONLY: pao_init
54  USE particle_types, ONLY: particle_type
56  USE pexsi_types, ONLY: lib_pexsi_init
59  USE qs_environment_types, ONLY: get_qs_env,&
60  qs_environment_type,&
62 #include "./base/base_uses.f90"
63 
64  IMPLICIT NONE
65 
66  PRIVATE
67 
68  CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'dm_ls_scf_create'
69 
70  PUBLIC :: ls_scf_create
71 
72 CONTAINS
73 
74 ! **************************************************************************************************
75 !> \brief Creation and basic initialization of the LS type.
76 !> \param qs_env ...
77 !> \par History
78 !> 2012.11 created [Joost VandeVondele]
79 !> \author Joost VandeVondele
80 ! **************************************************************************************************
81  SUBROUTINE ls_scf_create(qs_env)
82  TYPE(qs_environment_type), POINTER :: qs_env
83 
84  CHARACTER(len=*), PARAMETER :: routinen = 'ls_scf_create'
85 
86  INTEGER :: handle, unit_nr
87  TYPE(cp_logger_type), POINTER :: logger
88  TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
89  TYPE(dft_control_type), POINTER :: dft_control
90  TYPE(ls_scf_env_type), POINTER :: ls_scf_env
91  TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
92  TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
93  TYPE(section_vals_type), POINTER :: input, mixing_section
94 
95  CALL timeset(routinen, handle)
96 
97  CALL cite_reference(vandevondele2012)
98 
99  ! get a useful output_unit
100  logger => cp_get_default_logger()
101  IF (logger%para_env%is_source()) THEN
102  unit_nr = cp_logger_get_default_unit_nr(logger, local=.true.)
103  ELSE
104  unit_nr = -1
105  END IF
106 
107  ALLOCATE (ls_scf_env)
108 
109  ! get basic quantities from the qs_env
110  CALL get_qs_env(qs_env, nelectron_total=ls_scf_env%nelectron_total, &
111  matrix_s=matrix_s, &
112  dft_control=dft_control, &
113  particle_set=particle_set, &
114  molecule_set=molecule_set, &
115  input=input, &
116  has_unit_metric=ls_scf_env%has_unit_metric, &
117  para_env=ls_scf_env%para_env, &
118  do_transport=ls_scf_env%do_transport, &
119  nelectron_spin=ls_scf_env%nelectron_spin)
120 
121  ! copy some basic stuff
122  ls_scf_env%nspins = dft_control%nspins
123  ls_scf_env%natoms = SIZE(particle_set, 1)
124  CALL ls_scf_env%para_env%retain()
125 
126  ! initialize block to group to defined molecules
127  ALLOCATE (ls_scf_env%ls_mstruct%atom_to_molecule(ls_scf_env%natoms))
128 
129  CALL molecule_of_atom(molecule_set, atom_to_mol=ls_scf_env%ls_mstruct%atom_to_molecule)
130 
131  ! parse the ls_scf section and set derived quantities
132  CALL ls_scf_init_read_write_input(input, ls_scf_env, unit_nr)
133  dft_control%qs_control%pao = ls_scf_env%do_pao
134 
135  ! set up the buffer for the history of matrices
136  ls_scf_env%scf_history%nstore = ls_scf_env%extrapolation_order
137  ls_scf_env%scf_history%istore = 0
138  ALLOCATE (ls_scf_env%scf_history%matrix(ls_scf_env%nspins, ls_scf_env%scf_history%nstore))
139 
140  NULLIFY (ls_scf_env%mixing_store)
141  mixing_section => section_vals_get_subs_vals(input, "DFT%LS_SCF%RHO_MIXING")
142  ALLOCATE (ls_scf_env%mixing_store)
143  CALL mixing_storage_create(ls_scf_env%mixing_store, mixing_section, &
144  ls_scf_env%density_mixing_method, &
145  dft_control%qs_control%cutoff)
146 
147  ! initialize PEXSI
148  IF (ls_scf_env%do_pexsi) THEN
149  IF (dft_control%qs_control%eps_filter_matrix .NE. 0.0_dp) &
150  cpabort("EPS_FILTER_MATRIX must be set to 0 for PEXSI.")
151  CALL lib_pexsi_init(ls_scf_env%pexsi, ls_scf_env%para_env, ls_scf_env%nspins)
152  END IF
153 
154  ! initialize PAO
155  CALL pao_init(qs_env, ls_scf_env)
156 
157  ! put the ls_scf_env in qs_env
158  CALL set_qs_env(qs_env, ls_scf_env=ls_scf_env)
159 
160  CALL timestop(handle)
161 
162  END SUBROUTINE ls_scf_create
163 
164 ! **************************************************************************************************
165 !> \brief parse the input section, no need to pass it around
166 !> \param input ...
167 !> \param ls_scf_env ...
168 !> \param unit_nr ...
169 !> \par History
170 !> 2010.10 created [Joost VandeVondele]
171 !> \author Joost VandeVondele
172 ! **************************************************************************************************
173  SUBROUTINE ls_scf_init_read_write_input(input, ls_scf_env, unit_nr)
174  TYPE(section_vals_type), POINTER :: input
175  TYPE(ls_scf_env_type), INTENT(INOUT) :: ls_scf_env
176  INTEGER, INTENT(IN) :: unit_nr
177 
178  CHARACTER(len=*), PARAMETER :: routinen = 'ls_scf_init_read_write_input'
179 
180  INTEGER :: handle
181  REAL(kind=dp) :: mu
182  TYPE(enumeration_type), POINTER :: enum
183  TYPE(keyword_type), POINTER :: keyword
184  TYPE(section_type), POINTER :: section
185  TYPE(section_vals_type), POINTER :: chebyshev_section, curvy_section, &
186  ls_scf_section, mixing_section, &
187  pao_section, pexsi_section
188 
189  CALL timeset(routinen, handle)
190  CALL cite_reference(vandevondele2012)
191  ls_scf_section => section_vals_get_subs_vals(input, "DFT%LS_SCF")
192  curvy_section => section_vals_get_subs_vals(ls_scf_section, "CURVY_STEPS")
193 
194  ! should come from input
195  CALL section_vals_val_get(ls_scf_section, "LS_DIIS", l_val=ls_scf_env%ls_diis)
196  CALL section_vals_val_get(ls_scf_section, "INI_DIIS", i_val=ls_scf_env%iter_ini_diis)
197  CALL section_vals_val_get(ls_scf_section, "MAX_DIIS", i_val=ls_scf_env%max_diis)
198  CALL section_vals_val_get(ls_scf_section, "NMIXING", i_val=ls_scf_env%nmixing)
199  CALL section_vals_val_get(ls_scf_section, "EPS_DIIS", r_val=ls_scf_env%eps_diis)
200  CALL section_vals_val_get(ls_scf_section, "EPS_SCF", r_val=ls_scf_env%eps_scf)
201  CALL section_vals_val_get(ls_scf_section, "EPS_FILTER", r_val=ls_scf_env%eps_filter)
202  CALL section_vals_val_get(ls_scf_section, "MU", r_val=mu)
203  CALL section_vals_val_get(ls_scf_section, "FIXED_MU", l_val=ls_scf_env%fixed_mu)
204  ls_scf_env%mu_spin = mu
205  CALL section_vals_val_get(ls_scf_section, "MIXING_FRACTION", r_val=ls_scf_env%mixing_fraction)
206  CALL section_vals_val_get(ls_scf_section, "MAX_SCF", i_val=ls_scf_env%max_scf)
207  CALL section_vals_val_get(ls_scf_section, "S_PRECONDITIONER", i_val=ls_scf_env%s_preconditioner_type)
208  CALL section_vals_val_get(ls_scf_section, "MATRIX_CLUSTER_TYPE", i_val=ls_scf_env%ls_mstruct%cluster_type)
209  CALL section_vals_val_get(ls_scf_section, "S_INVERSION", i_val=ls_scf_env%s_inversion_type)
210  CALL section_vals_val_get(ls_scf_section, "CHECK_S_INV", l_val=ls_scf_env%check_s_inv)
211  CALL section_vals_val_get(ls_scf_section, "REPORT_ALL_SPARSITIES", l_val=ls_scf_env%report_all_sparsities)
212  CALL section_vals_val_get(ls_scf_section, "PERFORM_MU_SCAN", l_val=ls_scf_env%perform_mu_scan)
213  CALL section_vals_val_get(ls_scf_section, "PURIFICATION_METHOD", i_val=ls_scf_env%purification_method)
214  CALL section_vals_val_get(ls_scf_section, "SIGN_METHOD", i_val=ls_scf_env%sign_method)
215  CALL section_vals_val_get(ls_scf_section, "SUBMATRIX_SIGN_METHOD", i_val=ls_scf_env%submatrix_sign_method)
216  CALL section_vals_val_get(ls_scf_section, "SIGN_ORDER", i_val=ls_scf_env%sign_order)
217  CALL section_vals_val_get(ls_scf_section, "SIGN_SYMMETRIC", l_val=ls_scf_env%sign_symmetric)
218  CALL section_vals_val_get(ls_scf_section, "DYNAMIC_THRESHOLD", l_val=ls_scf_env%dynamic_threshold)
219  CALL section_vals_val_get(ls_scf_section, "NON_MONOTONIC", l_val=ls_scf_env%non_monotonic)
220  CALL section_vals_val_get(ls_scf_section, "S_SQRT_METHOD", i_val=ls_scf_env%s_sqrt_method)
221  CALL section_vals_val_get(ls_scf_section, "S_SQRT_ORDER", i_val=ls_scf_env%s_sqrt_order)
222  CALL section_vals_val_get(ls_scf_section, "EXTRAPOLATION_ORDER", i_val=ls_scf_env%extrapolation_order)
223  CALL section_vals_val_get(ls_scf_section, "RESTART_READ", l_val=ls_scf_env%restart_read)
224  CALL section_vals_val_get(ls_scf_section, "RESTART_WRITE", l_val=ls_scf_env%restart_write)
225  CALL section_vals_val_get(ls_scf_section, "EPS_LANCZOS", r_val=ls_scf_env%eps_lanczos)
226  CALL section_vals_val_get(ls_scf_section, "MAX_ITER_LANCZOS", i_val=ls_scf_env%max_iter_lanczos)
227 
228  CALL section_vals_get(curvy_section, explicit=ls_scf_env%curvy_steps)
229  CALL section_vals_val_get(curvy_section, "LINE_SEARCH", i_val=ls_scf_env%curvy_data%line_search_type)
230  CALL section_vals_val_get(curvy_section, "N_BCH_HISTORY", i_val=ls_scf_env%curvy_data%n_bch_hist)
231  CALL section_vals_val_get(curvy_section, "MIN_HESSIAN_SHIFT", r_val=ls_scf_env%curvy_data%min_shift)
232  CALL section_vals_val_get(curvy_section, "FILTER_FACTOR", r_val=ls_scf_env%curvy_data%filter_factor)
233  CALL section_vals_val_get(curvy_section, "FILTER_FACTOR_SCALE", r_val=ls_scf_env%curvy_data%scale_filter)
234  CALL section_vals_val_get(curvy_section, "MIN_FILTER", r_val=ls_scf_env%curvy_data%min_filter)
235 
236  ls_scf_env%extrapolation_order = max(0, ls_scf_env%extrapolation_order)
237 
238  chebyshev_section => section_vals_get_subs_vals(input, "DFT%LS_SCF%CHEBYSHEV")
239  CALL section_vals_get(chebyshev_section, explicit=ls_scf_env%chebyshev%compute_chebyshev)
240  IF (ls_scf_env%chebyshev%compute_chebyshev) THEN
241  CALL section_vals_val_get(chebyshev_section, "N_CHEBYSHEV", i_val=ls_scf_env%chebyshev%n_chebyshev)
242  CALL section_vals_val_get(chebyshev_section, "DOS%N_GRIDPOINTS", i_val=ls_scf_env%chebyshev%n_gridpoint_dos)
243 
244  ls_scf_env%chebyshev%print_key_dos => &
245  section_vals_get_subs_vals(chebyshev_section, "DOS")
246  CALL section_vals_retain(ls_scf_env%chebyshev%print_key_dos)
247 
248  ls_scf_env%chebyshev%print_key_cube => &
249  section_vals_get_subs_vals(chebyshev_section, "PRINT_SPECIFIC_E_DENSITY_CUBE")
250  CALL section_vals_retain(ls_scf_env%chebyshev%print_key_cube)
251  END IF
252 
253  mixing_section => section_vals_get_subs_vals(input, "DFT%LS_SCF%RHO_MIXING")
254  CALL section_vals_get(mixing_section, explicit=ls_scf_env%do_rho_mixing)
255 
256  CALL section_vals_val_get(mixing_section, "METHOD", i_val=ls_scf_env%density_mixing_method)
257  IF (ls_scf_env%ls_diis .AND. ls_scf_env%do_rho_mixing) &
258  cpabort("LS_DIIS and RHO_MIXING are not compatible.")
259 
260  pexsi_section => section_vals_get_subs_vals(input, "DFT%LS_SCF%PEXSI")
261  CALL section_vals_get(pexsi_section)
262 
263  ls_scf_env%do_pexsi = ls_scf_env%purification_method .EQ. ls_scf_pexsi &
264  .AND. .NOT. ls_scf_env%do_transport
265  IF (ls_scf_env%do_pexsi) THEN
266  CALL pexsi_init_read_input(pexsi_section, ls_scf_env%pexsi)
267  ! Turn off S inversion (not used for PEXSI).
268  ! Methods such as purification must thus be avoided... which is OK, as the density matrix computed in pexsi is
269  ! a finite temperature one, and thus not idempotent
270  ls_scf_env%s_inversion_type = ls_s_inversion_none
271  ! PEXSI needs the sparsity pattern of S to be fixed by the upper bound ~ Int[|phi_a||phi_b|],
272  ! they can not be filtered based on magnitude, as small elements in S (e.g. symmetry) do not necessarily
273  ! correspond to small elements in the density matrix, with non-zero contributions to the total density.
274  ! the easiest way to make sure S is untouched is to set eps_filter to zero (which should be inconsequential,
275  ! as a run based on pexsi should execute exactly zero multiplications)
276  ls_scf_env%eps_filter = 0.0_dp
277  END IF
278 
279  ! Turn off S inversion and set eps_filter to zero for transport
280  IF (ls_scf_env%do_transport) THEN
281  ls_scf_env%s_inversion_type = ls_s_inversion_none
282  ls_scf_env%eps_filter = 0.0_dp
283  END IF
284 
285  SELECT CASE (ls_scf_env%s_inversion_type)
287  ls_scf_env%needs_s_inv = .true.
288  ls_scf_env%use_s_sqrt = .true.
290  ls_scf_env%needs_s_inv = .true.
291  ls_scf_env%use_s_sqrt = .false.
292  CASE (ls_s_inversion_none)
293  ls_scf_env%needs_s_inv = .false.
294  ls_scf_env%use_s_sqrt = .false.
295  CASE DEFAULT
296  cpabort("")
297  END SELECT
298 
299  SELECT CASE (ls_scf_env%s_preconditioner_type)
301  ls_scf_env%has_s_preconditioner = .false.
302  CASE DEFAULT
303  ls_scf_env%has_s_preconditioner = .true.
304  END SELECT
305 
306  ! verify some requirements for the curvy steps
307  IF (ls_scf_env%curvy_steps .AND. ls_scf_env%do_pexsi) &
308  cpabort("CURVY_STEPS cannot be used together with PEXSI.")
309  IF (ls_scf_env%curvy_steps .AND. ls_scf_env%do_transport) &
310  cpabort("CURVY_STEPS cannot be used together with TRANSPORT.")
311  IF (ls_scf_env%curvy_steps .AND. ls_scf_env%has_s_preconditioner) &
312  cpabort("S Preconditioning not implemented in combination with CURVY_STEPS.")
313  IF (ls_scf_env%curvy_steps .AND. .NOT. ls_scf_env%use_s_sqrt) &
314  cpabort("CURVY_STEPS requires the use of the sqrt inversion.")
315 
316  ! verify requirements for direct submatrix sign methods
317  IF (ls_scf_env%sign_method .EQ. ls_scf_sign_submatrix &
318  .AND. ( &
319  ls_scf_env%submatrix_sign_method .EQ. ls_scf_submatrix_sign_direct &
320  .OR. ls_scf_env%submatrix_sign_method .EQ. ls_scf_submatrix_sign_direct_muadj &
321  .OR. ls_scf_env%submatrix_sign_method .EQ. ls_scf_submatrix_sign_direct_muadj_lowmem &
322  ) .AND. .NOT. ls_scf_env%sign_symmetric) &
323  cpabort("DIRECT submatrix sign methods require SIGN_SYMMETRIC being set.")
324  IF (ls_scf_env%fixed_mu .AND. ( &
325  ls_scf_env%submatrix_sign_method .EQ. ls_scf_submatrix_sign_direct_muadj &
326  .OR. ls_scf_env%submatrix_sign_method .EQ. ls_scf_submatrix_sign_direct_muadj_lowmem &
327  )) cpabort("Invalid submatrix sign method for FIXED_MU.")
328 
329  ! sign_symmetric requires computation of s_sqrt
330  IF (ls_scf_env%sign_symmetric) ls_scf_env%use_s_sqrt = .true.
331 
332  ! an undocumented feature ... allows for just doing the initial guess, no expensive stuff
333  IF (ls_scf_env%max_scf < 0) THEN
334  ls_scf_env%needs_s_inv = .false.
335  ls_scf_env%use_s_sqrt = .false.
336  ls_scf_env%has_s_preconditioner = .false.
337  END IF
338 
339  pao_section => section_vals_get_subs_vals(input, "DFT%LS_SCF%PAO")
340  CALL section_vals_get(pao_section, explicit=ls_scf_env%do_pao)
341  ls_scf_env%ls_mstruct%do_pao = ls_scf_env%do_pao
342 
343  IF (unit_nr > 0) THEN
344  WRITE (unit_nr, '()')
345  WRITE (unit_nr, '(T2,A,A,A)') repeat("-", 30), " Linear scaling SCF ", repeat("-", 29)
346  WRITE (unit_nr, '(T2,A,T61,E20.3)') "eps_scf:", ls_scf_env%eps_scf
347  WRITE (unit_nr, '(T2,A,T61,E20.3)') "eps_filter:", ls_scf_env%eps_filter
348  IF (ls_scf_env%do_rho_mixing) THEN
349  IF (ls_scf_env%density_mixing_method > 0) THEN
350  NULLIFY (section)
351  CALL create_mixing_section(section, ls_scf=.true.)
352  keyword => section_get_keyword(section, "METHOD")
353  CALL keyword_get(keyword, enum=enum)
354  WRITE (unit_nr, "(T2,A,T61,A20)") &
355  "Density mixing in g-space:", adjustr(trim(enum_i2c(enum, &
356  ls_scf_env%density_mixing_method)))
357  CALL section_release(section)
358  END IF
359  ELSE
360  WRITE (unit_nr, '(T2,A,T61,E20.3)') "mixing_fraction:", ls_scf_env%mixing_fraction
361  END IF
362  WRITE (unit_nr, '(T2,A,T61,I20)') "max_scf:", ls_scf_env%max_scf
363  IF (ls_scf_env%ls_diis) THEN
364  WRITE (unit_nr, '(T2,A,T61,I20)') "DIIS: max_diis:", ls_scf_env%max_diis
365  WRITE (unit_nr, '(T2,A,T61,E20.3)') "DIIS: eps_diis:", ls_scf_env%eps_diis
366  WRITE (unit_nr, '(T2,A,T61,I20)') "DIIS: ini_diis:", ls_scf_env%iter_ini_diis
367  WRITE (unit_nr, '(T2,A,T61,I20)') "DIIS: nmixing:", ls_scf_env%nmixing
368  END IF
369  WRITE (unit_nr, '(T2,A,T61,L20)') "fixed chemical potential (mu)", ls_scf_env%fixed_mu
370  WRITE (unit_nr, '(T2,A,T61,L20)') "has unit metric:", ls_scf_env%has_unit_metric
371  WRITE (unit_nr, '(T2,A,T61,L20)') "Computing inv(S):", ls_scf_env%needs_s_inv
372  WRITE (unit_nr, '(T2,A,T61,L20)') "Computing sqrt(S):", ls_scf_env%use_s_sqrt
373  WRITE (unit_nr, '(T2,A,T61,L20)') "Computing S preconditioner ", ls_scf_env%has_s_preconditioner
374 
375  SELECT CASE (ls_scf_env%s_sqrt_method)
376  CASE (ls_s_sqrt_ns)
377  WRITE (unit_nr, '(T2,A,T61,A20)') "S sqrt method:", "NEWTONSCHULZ"
378  CASE (ls_s_sqrt_proot)
379  WRITE (unit_nr, '(T2,A,T61,A20)') "S sqrt method:", "PROOT"
380  CASE DEFAULT
381  cpabort("Unknown sqrt method.")
382  END SELECT
383 
384  WRITE (unit_nr, '(T2,A,T61,I20)') "S sqrt order:", ls_scf_env%s_sqrt_order
385  WRITE (unit_nr, '(T2,A,T61,I20)') "Extrapolation order:", ls_scf_env%extrapolation_order
386 
387  SELECT CASE (ls_scf_env%s_preconditioner_type)
389  WRITE (unit_nr, '(T2,A,T61,A20)') "S preconditioner type ", "NONE"
391  WRITE (unit_nr, '(T2,A,T61,A20)') "S preconditioner type ", "ATOMIC"
393  WRITE (unit_nr, '(T2,A,T61,A20)') "S preconditioner type ", "MOLECULAR"
394  END SELECT
395 
396  WRITE (unit_nr, '(T2,A,T61,L20)') "Polarized Atomic Orbitals (PAO) ", ls_scf_env%do_pao
397 
398  IF (ls_scf_env%curvy_steps) THEN
399  WRITE (unit_nr, '(T2,A,T61,A30)') "Using curvy steps to optimize the density matrix"
400  CALL cite_reference(shao2003)
401  END IF
402 
403  SELECT CASE (ls_scf_env%purification_method)
404  CASE (ls_scf_sign)
405  WRITE (unit_nr, '(T2,A,T51,A30)') "Purification method", adjustr("sign iteration")
406  SELECT CASE (ls_scf_env%sign_method)
407  CASE (ls_scf_sign_ns)
408  WRITE (unit_nr, '(T2,A,T61,A20)') "Sign method:", adjustr("newton schulz")
409  CASE (ls_scf_sign_proot)
410  WRITE (unit_nr, '(T2,A,T61,A20)') "Sign method:", adjustr("p-th root method")
411  CASE (ls_scf_sign_submatrix)
412  WRITE (unit_nr, '(T2,A,T61,A20)') "Sign method:", adjustr("submatrix method")
413  SELECT CASE (ls_scf_env%submatrix_sign_method)
415  WRITE (unit_nr, '(T2,A,T61,A20)') "Submatrix sign method:", adjustr("newton schulz")
417  WRITE (unit_nr, '(T2,A,T61,A20)') "Submatrix sign method:", adjustr("direct")
419  WRITE (unit_nr, '(T2,A,T61,A20)') "Submatrix sign method:", adjustr("direct mu-adj")
421  WRITE (unit_nr, '(T2,A,T61,A20)') "Submatrix sign method:", adjustr("direct mu-adj lowmem")
422  CASE DEFAULT
423  cpabort("Unkown submatrix sign method.")
424  END SELECT
425  CASE DEFAULT
426  cpabort("Unknown sign method.")
427  END SELECT
428  WRITE (unit_nr, '(T2,A,T61,I20)') "Sign order:", ls_scf_env%sign_order
429  WRITE (unit_nr, '(T2,A,T61,L20)') "Symmetric sign calculation:", ls_scf_env%sign_symmetric
430  CASE (ls_scf_tc2)
431  CALL cite_reference(niklasson2014)
432  WRITE (unit_nr, '(T2,A,T51,A30)') "Purification method", adjustr("Trace conserving 2nd order")
433  CASE (ls_scf_trs4)
434  CALL cite_reference(niklasson2003)
435  WRITE (unit_nr, '(T2,A,T51,A30)') "Purification method", adjustr("Trace resetting 4th order")
436  CASE (ls_scf_pexsi)
437  CALL cite_reference(lin2009)
438  CALL cite_reference(lin2013)
439  WRITE (unit_nr, '(T2,A,T51,A20)') "Purification method", adjustr("PEXSI")
440  CASE DEFAULT
441  cpabort("")
442  END SELECT
443 
444  SELECT CASE (ls_scf_env%ls_mstruct%cluster_type)
445  CASE (ls_cluster_atomic)
446  WRITE (unit_nr, '(T2,A,T61,A20)') "Cluster type", adjustr("ATOMIC")
447  CASE (ls_cluster_molecular)
448  WRITE (unit_nr, '(T2,A,T61,A20)') "Cluster type", adjustr("MOLECULAR")
449  CASE DEFAULT
450  cpabort("Unknown cluster type")
451  END SELECT
452 
453  IF (ls_scf_env%chebyshev%compute_chebyshev) THEN
454  WRITE (unit_nr, '(T2,A,T61,A20)') "Computing Chebyshev", adjustr("TRUE")
455  WRITE (unit_nr, '(T2,A,T61,I20)') "N_CHEBYSHEV:", ls_scf_env%chebyshev%n_chebyshev
456  WRITE (unit_nr, '(T2,A,T61,I20)') "N_GRIDPOINT_DOS:", ls_scf_env%chebyshev%n_gridpoint_dos
457  ELSE
458  WRITE (unit_nr, '(T2,A,T61,A20)') "Computing Chebyshev", adjustr("FALSE")
459  END IF
460 
461  WRITE (unit_nr, '(T2,A,T61,L20)') "Using PAO", ls_scf_env%do_pao
462 
463  WRITE (unit_nr, '(T2,A)') repeat("-", 79)
464  WRITE (unit_nr, '()')
465  CALL m_flush(unit_nr)
466  END IF
467 
468  CALL timestop(handle)
469 
470  END SUBROUTINE ls_scf_init_read_write_input
471 
472 END MODULE dm_ls_scf_create
collects all references to literature in CP2K as new algorithms / method are included from literature...
Definition: bibliography.F:28
integer, save, public lin2009
Definition: bibliography.F:43
integer, save, public vandevondele2012
Definition: bibliography.F:43
integer, save, public lin2013
Definition: bibliography.F:43
integer, save, public shao2003
Definition: bibliography.F:43
integer, save, public niklasson2014
Definition: bibliography.F:43
integer, save, public niklasson2003
Definition: bibliography.F:43
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
various routines to log and control the output. The idea is that decisions about where to log should ...
recursive integer function, public cp_logger_get_default_unit_nr(logger, local, skip_not_ionode)
asks the default unit number of the given logger. try to use cp_logger_get_unit_nr
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
Routines for a linear scaling quickstep SCF run based on the density matrix.
subroutine, public ls_scf_create(qs_env)
Creation and basic initialization of the LS type.
Types needed for a linear scaling quickstep SCF run based on the density matrix.
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public ls_scf_submatrix_sign_direct_muadj
integer, parameter, public ls_s_preconditioner_molecular
integer, parameter, public ls_s_inversion_hotelling
integer, parameter, public ls_cluster_molecular
integer, parameter, public ls_scf_pexsi
integer, parameter, public ls_s_preconditioner_atomic
integer, parameter, public ls_scf_sign_submatrix
integer, parameter, public ls_s_inversion_none
integer, parameter, public ls_s_sqrt_proot
integer, parameter, public ls_s_sqrt_ns
integer, parameter, public ls_s_preconditioner_none
integer, parameter, public ls_scf_sign_proot
integer, parameter, public ls_scf_trs4
integer, parameter, public ls_scf_sign
integer, parameter, public ls_scf_tc2
integer, parameter, public ls_scf_submatrix_sign_ns
integer, parameter, public ls_scf_sign_ns
integer, parameter, public ls_s_inversion_sign_sqrt
integer, parameter, public ls_scf_submatrix_sign_direct_muadj_lowmem
integer, parameter, public ls_scf_submatrix_sign_direct
integer, parameter, public ls_cluster_atomic
represents an enumeration, i.e. a mapping between integers and strings
character(len=default_string_length) function, public enum_i2c(enum, i)
maps an integer to a string
represents keywords in an input
subroutine, public keyword_get(keyword, names, usage, description, type_of_var, n_var, default_value, lone_keyword_value, repeats, enum, citations)
...
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_retain(section_vals)
retains the given section values (see doc/ReferenceCounting.html)
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
recursive subroutine, public section_release(section)
releases the given keyword list (see doc/ReferenceCounting.html)
recursive type(keyword_type) function, pointer, public section_get_keyword(section, keyword_name)
returns the requested keyword
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
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
Machine interface based on Fortran 2003 and POSIX.
Definition: machine.F:17
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition: machine.F:106
Define the data structure for the molecule information.
subroutine, public molecule_of_atom(molecule_set, atom_to_mol)
finds for each atom the molecule it belongs to
Main module for the PAO method.
Definition: pao_main.F:12
subroutine, public pao_init(qs_env, ls_scf_env)
Initialize the PAO environment.
Definition: pao_main.F:74
Define the data structure for the particle information.
Methods using the PEXSI library to calculate the density matrix and related quantities using the Kohn...
Definition: pexsi_methods.F:17
subroutine, public pexsi_init_read_input(pexsi_section, pexsi_env)
Read CP2K input section PEXSI and pass it to the PEXSI environment.
Definition: pexsi_methods.F:81
Environment storing all data that is needed in order to call the DFT driver of the PEXSI library with...
Definition: pexsi_types.F:18
subroutine, public lib_pexsi_init(pexsi_env, mp_group, nspin)
Initialize PEXSI.
Definition: pexsi_types.F:121
module that contains the definitions of the scf types
subroutine, public create_mixing_section(section, ls_scf)
Create CP2K input section for the mixing of the density matrix to be used only with diagonalization m...
subroutine, public mixing_storage_create(mixing_store, mixing_section, mixing_method, ecut)
creates a mixing_storage
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_RI_aux_kp, matrix_s, matrix_s_RI_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, WannierCentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Get the QUICKSTEP environment.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, WannierCentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Set the QUICKSTEP environment.