Line data Source code
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 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 : ! **************************************************************************************************
16 : MODULE dm_ls_scf_create
17 : USE bibliography, ONLY: Lin2009,&
18 : Lin2013,&
19 : Niklasson2003,&
20 : Niklasson2014,&
21 : Shao2003,&
22 : VandeVondele2012,&
23 : cite_reference
24 : USE cp_control_types, ONLY: dft_control_type
25 : USE cp_dbcsr_api, ONLY: dbcsr_p_type
26 : USE cp_log_handling, ONLY: cp_get_default_logger,&
27 : cp_logger_get_default_unit_nr,&
28 : cp_logger_type
29 : USE dm_ls_scf_types, ONLY: ls_scf_env_type
30 : USE input_constants, ONLY: &
31 : ls_cluster_atomic, ls_cluster_molecular, ls_s_inversion_hotelling, ls_s_inversion_none, &
32 : ls_s_inversion_sign_sqrt, ls_s_preconditioner_atomic, ls_s_preconditioner_molecular, &
33 : ls_s_preconditioner_none, ls_s_sqrt_ns, ls_s_sqrt_proot, ls_scf_pexsi, ls_scf_sign, &
34 : ls_scf_sign_ns, ls_scf_sign_proot, ls_scf_sign_submatrix, ls_scf_submatrix_sign_direct, &
35 : ls_scf_submatrix_sign_direct_muadj, ls_scf_submatrix_sign_direct_muadj_lowmem, &
36 : ls_scf_submatrix_sign_ns, ls_scf_tc2, ls_scf_trs4
37 : USE input_enumeration_types, ONLY: enum_i2c,&
38 : enumeration_type
39 : USE input_keyword_types, ONLY: keyword_get,&
40 : keyword_type
41 : USE input_section_types, ONLY: section_get_keyword,&
42 : section_release,&
43 : section_type,&
44 : section_vals_get,&
45 : section_vals_get_subs_vals,&
46 : section_vals_retain,&
47 : section_vals_type,&
48 : section_vals_val_get
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
55 : USE pexsi_methods, ONLY: pexsi_init_read_input
56 : USE pexsi_types, ONLY: lib_pexsi_init
57 : USE qs_density_mixing_types, ONLY: create_mixing_section,&
58 : mixing_storage_create
59 : USE qs_environment_types, ONLY: get_qs_env,&
60 : qs_environment_type,&
61 : set_qs_env
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 764 : 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 764 : 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 764 : TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
92 764 : TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
93 : TYPE(section_vals_type), POINTER :: input, mixing_section
94 :
95 764 : NULLIFY (ls_scf_env)
96 764 : CALL get_qs_env(qs_env, ls_scf_env=ls_scf_env)
97 : ! we cannot rebuild ls_scf_env for each new optimization. It seems it holds some values
98 : ! that need to be save between calls?
99 764 : IF (ASSOCIATED(ls_scf_env)) RETURN
100 : ! IF(ASSOCIATED(ls_scf_env)) THEN
101 : ! CALL ls_scf_release(ls_scf_env)
102 : ! END IF
103 :
104 386 : CALL timeset(routineN, handle)
105 :
106 386 : CALL cite_reference(VandeVondele2012)
107 :
108 : ! get a useful output_unit
109 386 : logger => cp_get_default_logger()
110 386 : IF (logger%para_env%is_source()) THEN
111 193 : unit_nr = cp_logger_get_default_unit_nr(logger, local=.TRUE.)
112 : ELSE
113 193 : unit_nr = -1
114 : END IF
115 :
116 11194 : ALLOCATE (ls_scf_env)
117 :
118 : ! get basic quantities from the qs_env
119 : CALL get_qs_env(qs_env, nelectron_total=ls_scf_env%nelectron_total, &
120 : matrix_s=matrix_s, &
121 : dft_control=dft_control, &
122 : particle_set=particle_set, &
123 : molecule_set=molecule_set, &
124 : input=input, &
125 : has_unit_metric=ls_scf_env%has_unit_metric, &
126 : para_env=ls_scf_env%para_env, &
127 : do_transport=ls_scf_env%do_transport, &
128 386 : nelectron_spin=ls_scf_env%nelectron_spin)
129 :
130 : ! copy some basic stuff
131 386 : ls_scf_env%nspins = dft_control%nspins
132 386 : ls_scf_env%natoms = SIZE(particle_set, 1)
133 386 : CALL ls_scf_env%para_env%retain()
134 :
135 : ! initialize block to group to defined molecules
136 1158 : ALLOCATE (ls_scf_env%ls_mstruct%atom_to_molecule(ls_scf_env%natoms))
137 :
138 386 : CALL molecule_of_atom(molecule_set, atom_to_mol=ls_scf_env%ls_mstruct%atom_to_molecule)
139 :
140 : ! parse the ls_scf section and set derived quantities
141 386 : CALL ls_scf_init_read_write_input(input, ls_scf_env, unit_nr)
142 386 : dft_control%qs_control%pao = ls_scf_env%do_pao
143 :
144 : ! set up the buffer for the history of matrices
145 386 : ls_scf_env%scf_history%nstore = ls_scf_env%extrapolation_order
146 386 : ls_scf_env%scf_history%istore = 0
147 4110 : ALLOCATE (ls_scf_env%scf_history%matrix(ls_scf_env%nspins, ls_scf_env%scf_history%nstore))
148 :
149 386 : NULLIFY (ls_scf_env%mixing_store)
150 386 : mixing_section => section_vals_get_subs_vals(input, "DFT%LS_SCF%RHO_MIXING")
151 1158 : ALLOCATE (ls_scf_env%mixing_store)
152 : CALL mixing_storage_create(ls_scf_env%mixing_store, mixing_section, &
153 : ls_scf_env%density_mixing_method, &
154 386 : dft_control%qs_control%cutoff)
155 :
156 : ! initialize PEXSI
157 386 : IF (ls_scf_env%do_pexsi) THEN
158 0 : IF (dft_control%qs_control%eps_filter_matrix /= 0.0_dp) THEN
159 0 : CPABORT("EPS_FILTER_MATRIX must be set to 0 for PEXSI.")
160 : END IF
161 0 : CALL lib_pexsi_init(ls_scf_env%pexsi, ls_scf_env%para_env, ls_scf_env%nspins)
162 : END IF
163 :
164 : ! initialize PAO
165 386 : CALL pao_init(qs_env, ls_scf_env)
166 :
167 : ! put the ls_scf_env in qs_env
168 386 : CALL set_qs_env(qs_env, ls_scf_env=ls_scf_env)
169 :
170 386 : CALL timestop(handle)
171 :
172 1150 : END SUBROUTINE ls_scf_create
173 :
174 : ! **************************************************************************************************
175 : !> \brief parse the input section, no need to pass it around
176 : !> \param input ...
177 : !> \param ls_scf_env ...
178 : !> \param unit_nr ...
179 : !> \par History
180 : !> 2010.10 created [Joost VandeVondele]
181 : !> \author Joost VandeVondele
182 : ! **************************************************************************************************
183 772 : SUBROUTINE ls_scf_init_read_write_input(input, ls_scf_env, unit_nr)
184 : TYPE(section_vals_type), POINTER :: input
185 : TYPE(ls_scf_env_type), INTENT(INOUT) :: ls_scf_env
186 : INTEGER, INTENT(IN) :: unit_nr
187 :
188 : CHARACTER(len=*), PARAMETER :: routineN = 'ls_scf_init_read_write_input'
189 :
190 : INTEGER :: handle
191 : REAL(KIND=dp) :: mu
192 : TYPE(enumeration_type), POINTER :: enum
193 : TYPE(keyword_type), POINTER :: keyword
194 : TYPE(section_type), POINTER :: section
195 : TYPE(section_vals_type), POINTER :: chebyshev_section, curvy_section, &
196 : ls_scf_section, mixing_section, &
197 : pao_section, pexsi_section
198 :
199 386 : CALL timeset(routineN, handle)
200 386 : CALL cite_reference(VandeVondele2012)
201 386 : ls_scf_section => section_vals_get_subs_vals(input, "DFT%LS_SCF")
202 386 : curvy_section => section_vals_get_subs_vals(ls_scf_section, "CURVY_STEPS")
203 :
204 : ! should come from input
205 386 : CALL section_vals_val_get(ls_scf_section, "LS_DIIS", l_val=ls_scf_env%ls_diis)
206 386 : CALL section_vals_val_get(ls_scf_section, "INI_DIIS", i_val=ls_scf_env%iter_ini_diis)
207 386 : CALL section_vals_val_get(ls_scf_section, "MAX_DIIS", i_val=ls_scf_env%max_diis)
208 386 : CALL section_vals_val_get(ls_scf_section, "NMIXING", i_val=ls_scf_env%nmixing)
209 386 : CALL section_vals_val_get(ls_scf_section, "EPS_DIIS", r_val=ls_scf_env%eps_diis)
210 386 : CALL section_vals_val_get(ls_scf_section, "EPS_SCF", r_val=ls_scf_env%eps_scf)
211 386 : CALL section_vals_val_get(ls_scf_section, "EPS_FILTER", r_val=ls_scf_env%eps_filter)
212 386 : CALL section_vals_val_get(ls_scf_section, "MU", r_val=mu)
213 386 : CALL section_vals_val_get(ls_scf_section, "FIXED_MU", l_val=ls_scf_env%fixed_mu)
214 1158 : ls_scf_env%mu_spin = mu
215 386 : CALL section_vals_val_get(ls_scf_section, "MIXING_FRACTION", r_val=ls_scf_env%mixing_fraction)
216 386 : CALL section_vals_val_get(ls_scf_section, "MAX_SCF", i_val=ls_scf_env%max_scf)
217 386 : CALL section_vals_val_get(ls_scf_section, "S_PRECONDITIONER", i_val=ls_scf_env%s_preconditioner_type)
218 386 : CALL section_vals_val_get(ls_scf_section, "MATRIX_CLUSTER_TYPE", i_val=ls_scf_env%ls_mstruct%cluster_type)
219 386 : CALL section_vals_val_get(ls_scf_section, "S_INVERSION", i_val=ls_scf_env%s_inversion_type)
220 386 : CALL section_vals_val_get(ls_scf_section, "CHECK_S_INV", l_val=ls_scf_env%check_s_inv)
221 386 : CALL section_vals_val_get(ls_scf_section, "REPORT_ALL_SPARSITIES", l_val=ls_scf_env%report_all_sparsities)
222 386 : CALL section_vals_val_get(ls_scf_section, "PERFORM_MU_SCAN", l_val=ls_scf_env%perform_mu_scan)
223 386 : CALL section_vals_val_get(ls_scf_section, "PURIFICATION_METHOD", i_val=ls_scf_env%purification_method)
224 386 : CALL section_vals_val_get(ls_scf_section, "SIGN_METHOD", i_val=ls_scf_env%sign_method)
225 386 : CALL section_vals_val_get(ls_scf_section, "SUBMATRIX_SIGN_METHOD", i_val=ls_scf_env%submatrix_sign_method)
226 386 : CALL section_vals_val_get(ls_scf_section, "SIGN_ORDER", i_val=ls_scf_env%sign_order)
227 386 : CALL section_vals_val_get(ls_scf_section, "SIGN_SYMMETRIC", l_val=ls_scf_env%sign_symmetric)
228 386 : CALL section_vals_val_get(ls_scf_section, "DYNAMIC_THRESHOLD", l_val=ls_scf_env%dynamic_threshold)
229 386 : CALL section_vals_val_get(ls_scf_section, "NON_MONOTONIC", l_val=ls_scf_env%non_monotonic)
230 386 : CALL section_vals_val_get(ls_scf_section, "S_SQRT_METHOD", i_val=ls_scf_env%s_sqrt_method)
231 386 : CALL section_vals_val_get(ls_scf_section, "S_SQRT_ORDER", i_val=ls_scf_env%s_sqrt_order)
232 386 : CALL section_vals_val_get(ls_scf_section, "EXTRAPOLATION_ORDER", i_val=ls_scf_env%extrapolation_order)
233 386 : CALL section_vals_val_get(ls_scf_section, "RESTART_READ", l_val=ls_scf_env%restart_read)
234 386 : CALL section_vals_val_get(ls_scf_section, "RESTART_WRITE", l_val=ls_scf_env%restart_write)
235 386 : CALL section_vals_val_get(ls_scf_section, "EPS_LANCZOS", r_val=ls_scf_env%eps_lanczos)
236 386 : CALL section_vals_val_get(ls_scf_section, "MAX_ITER_LANCZOS", i_val=ls_scf_env%max_iter_lanczos)
237 :
238 386 : CALL section_vals_get(curvy_section, explicit=ls_scf_env%curvy_steps)
239 386 : CALL section_vals_val_get(curvy_section, "LINE_SEARCH", i_val=ls_scf_env%curvy_data%line_search_type)
240 386 : CALL section_vals_val_get(curvy_section, "N_BCH_HISTORY", i_val=ls_scf_env%curvy_data%n_bch_hist)
241 386 : CALL section_vals_val_get(curvy_section, "MIN_HESSIAN_SHIFT", r_val=ls_scf_env%curvy_data%min_shift)
242 386 : CALL section_vals_val_get(curvy_section, "FILTER_FACTOR", r_val=ls_scf_env%curvy_data%filter_factor)
243 386 : CALL section_vals_val_get(curvy_section, "FILTER_FACTOR_SCALE", r_val=ls_scf_env%curvy_data%scale_filter)
244 386 : CALL section_vals_val_get(curvy_section, "MIN_FILTER", r_val=ls_scf_env%curvy_data%min_filter)
245 :
246 386 : ls_scf_env%extrapolation_order = MAX(0, ls_scf_env%extrapolation_order)
247 :
248 386 : chebyshev_section => section_vals_get_subs_vals(input, "DFT%LS_SCF%CHEBYSHEV")
249 386 : CALL section_vals_get(chebyshev_section, explicit=ls_scf_env%chebyshev%compute_chebyshev)
250 386 : IF (ls_scf_env%chebyshev%compute_chebyshev) THEN
251 6 : CALL section_vals_val_get(chebyshev_section, "N_CHEBYSHEV", i_val=ls_scf_env%chebyshev%n_chebyshev)
252 6 : CALL section_vals_val_get(chebyshev_section, "DOS%N_GRIDPOINTS", i_val=ls_scf_env%chebyshev%n_gridpoint_dos)
253 :
254 : ls_scf_env%chebyshev%print_key_dos => &
255 6 : section_vals_get_subs_vals(chebyshev_section, "DOS")
256 6 : CALL section_vals_retain(ls_scf_env%chebyshev%print_key_dos)
257 :
258 : ls_scf_env%chebyshev%print_key_cube => &
259 6 : section_vals_get_subs_vals(chebyshev_section, "PRINT_SPECIFIC_E_DENSITY_CUBE")
260 6 : CALL section_vals_retain(ls_scf_env%chebyshev%print_key_cube)
261 : END IF
262 :
263 386 : mixing_section => section_vals_get_subs_vals(input, "DFT%LS_SCF%RHO_MIXING")
264 386 : CALL section_vals_get(mixing_section, explicit=ls_scf_env%do_rho_mixing)
265 :
266 386 : CALL section_vals_val_get(mixing_section, "METHOD", i_val=ls_scf_env%density_mixing_method)
267 386 : IF (ls_scf_env%ls_diis .AND. ls_scf_env%do_rho_mixing) THEN
268 0 : CPABORT("LS_DIIS and RHO_MIXING are not compatible.")
269 : END IF
270 :
271 386 : pexsi_section => section_vals_get_subs_vals(input, "DFT%LS_SCF%PEXSI")
272 386 : CALL section_vals_get(pexsi_section)
273 :
274 : ls_scf_env%do_pexsi = ls_scf_env%purification_method == ls_scf_pexsi &
275 386 : .AND. .NOT. ls_scf_env%do_transport
276 386 : IF (ls_scf_env%do_pexsi) THEN
277 0 : CALL pexsi_init_read_input(pexsi_section, ls_scf_env%pexsi)
278 : ! Turn off S inversion (not used for PEXSI).
279 : ! Methods such as purification must thus be avoided... which is OK, as the density matrix computed in pexsi is
280 : ! a finite temperature one, and thus not idempotent
281 0 : ls_scf_env%s_inversion_type = ls_s_inversion_none
282 : ! PEXSI needs the sparsity pattern of S to be fixed by the upper bound ~ Int[|phi_a||phi_b|],
283 : ! they can not be filtered based on magnitude, as small elements in S (e.g. symmetry) do not necessarily
284 : ! correspond to small elements in the density matrix, with non-zero contributions to the total density.
285 : ! the easiest way to make sure S is untouched is to set eps_filter to zero (which should be inconsequential,
286 : ! as a run based on pexsi should execute exactly zero multiplications)
287 0 : ls_scf_env%eps_filter = 0.0_dp
288 : END IF
289 :
290 : ! Turn off S inversion and set eps_filter to zero for transport
291 386 : IF (ls_scf_env%do_transport) THEN
292 0 : ls_scf_env%s_inversion_type = ls_s_inversion_none
293 0 : ls_scf_env%eps_filter = 0.0_dp
294 : END IF
295 :
296 770 : SELECT CASE (ls_scf_env%s_inversion_type)
297 : CASE (ls_s_inversion_sign_sqrt)
298 384 : ls_scf_env%needs_s_inv = .TRUE.
299 384 : ls_scf_env%use_s_sqrt = .TRUE.
300 : CASE (ls_s_inversion_hotelling)
301 2 : ls_scf_env%needs_s_inv = .TRUE.
302 2 : ls_scf_env%use_s_sqrt = .FALSE.
303 : CASE (ls_s_inversion_none)
304 0 : ls_scf_env%needs_s_inv = .FALSE.
305 0 : ls_scf_env%use_s_sqrt = .FALSE.
306 : CASE DEFAULT
307 386 : CPABORT("Unknown S_INVERSION type for LS_SCF")
308 : END SELECT
309 :
310 520 : SELECT CASE (ls_scf_env%s_preconditioner_type)
311 : CASE (ls_s_preconditioner_none)
312 134 : ls_scf_env%has_s_preconditioner = .FALSE.
313 : CASE DEFAULT
314 386 : ls_scf_env%has_s_preconditioner = .TRUE.
315 : END SELECT
316 :
317 : ! verify some requirements for the curvy steps
318 386 : IF (ls_scf_env%curvy_steps .AND. ls_scf_env%do_pexsi) THEN
319 0 : CPABORT("CURVY_STEPS cannot be used together with PEXSI.")
320 : END IF
321 386 : IF (ls_scf_env%curvy_steps .AND. ls_scf_env%do_transport) THEN
322 0 : CPABORT("CURVY_STEPS cannot be used together with TRANSPORT.")
323 : END IF
324 386 : IF (ls_scf_env%curvy_steps .AND. ls_scf_env%has_s_preconditioner) THEN
325 0 : CPABORT("S Preconditioning not implemented in combination with CURVY_STEPS.")
326 : END IF
327 386 : IF (ls_scf_env%curvy_steps .AND. .NOT. ls_scf_env%use_s_sqrt) THEN
328 0 : CPABORT("CURVY_STEPS requires the use of the sqrt inversion.")
329 : END IF
330 :
331 : ! verify requirements for direct submatrix sign methods
332 : IF (ls_scf_env%sign_method == ls_scf_sign_submatrix &
333 : .AND. ( &
334 : ls_scf_env%submatrix_sign_method == ls_scf_submatrix_sign_direct &
335 : .OR. ls_scf_env%submatrix_sign_method == ls_scf_submatrix_sign_direct_muadj &
336 : .OR. ls_scf_env%submatrix_sign_method == ls_scf_submatrix_sign_direct_muadj_lowmem &
337 386 : ) .AND. .NOT. ls_scf_env%sign_symmetric) THEN
338 0 : CPABORT("DIRECT submatrix sign methods require SIGN_SYMMETRIC being set.")
339 : END IF
340 386 : IF (ls_scf_env%fixed_mu .AND. ( &
341 : ls_scf_env%submatrix_sign_method == ls_scf_submatrix_sign_direct_muadj &
342 : .OR. ls_scf_env%submatrix_sign_method == ls_scf_submatrix_sign_direct_muadj_lowmem &
343 0 : )) CPABORT("Invalid submatrix sign method for FIXED_MU.")
344 :
345 : ! sign_symmetric requires computation of s_sqrt
346 386 : IF (ls_scf_env%sign_symmetric) ls_scf_env%use_s_sqrt = .TRUE.
347 :
348 : ! an undocumented feature ... allows for just doing the initial guess, no expensive stuff
349 386 : IF (ls_scf_env%max_scf < 0) THEN
350 2 : ls_scf_env%needs_s_inv = .FALSE.
351 2 : ls_scf_env%use_s_sqrt = .FALSE.
352 2 : ls_scf_env%has_s_preconditioner = .FALSE.
353 : END IF
354 :
355 386 : pao_section => section_vals_get_subs_vals(input, "DFT%LS_SCF%PAO")
356 386 : CALL section_vals_get(pao_section, explicit=ls_scf_env%do_pao)
357 386 : ls_scf_env%ls_mstruct%do_pao = ls_scf_env%do_pao
358 :
359 386 : IF (unit_nr > 0) THEN
360 193 : WRITE (unit_nr, '()')
361 193 : WRITE (unit_nr, '(T2,A,A,A)') REPEAT("-", 30), " Linear scaling SCF ", REPEAT("-", 29)
362 193 : WRITE (unit_nr, '(T2,A,T61,E20.3)') "eps_scf:", ls_scf_env%eps_scf
363 193 : WRITE (unit_nr, '(T2,A,T61,E20.3)') "eps_filter:", ls_scf_env%eps_filter
364 193 : IF (ls_scf_env%do_rho_mixing) THEN
365 0 : IF (ls_scf_env%density_mixing_method > 0) THEN
366 0 : NULLIFY (section)
367 0 : CALL create_mixing_section(section, ls_scf=.TRUE.)
368 0 : keyword => section_get_keyword(section, "METHOD")
369 0 : CALL keyword_get(keyword, enum=enum)
370 : WRITE (unit_nr, "(T2,A,T61,A20)") &
371 0 : "Density mixing in g-space:", ADJUSTR(TRIM(enum_i2c(enum, &
372 0 : ls_scf_env%density_mixing_method)))
373 0 : CALL section_release(section)
374 : END IF
375 : ELSE
376 193 : WRITE (unit_nr, '(T2,A,T61,E20.3)') "mixing_fraction:", ls_scf_env%mixing_fraction
377 : END IF
378 193 : WRITE (unit_nr, '(T2,A,T61,I20)') "max_scf:", ls_scf_env%max_scf
379 193 : IF (ls_scf_env%ls_diis) THEN
380 2 : WRITE (unit_nr, '(T2,A,T61,I20)') "DIIS: max_diis:", ls_scf_env%max_diis
381 2 : WRITE (unit_nr, '(T2,A,T61,E20.3)') "DIIS: eps_diis:", ls_scf_env%eps_diis
382 2 : WRITE (unit_nr, '(T2,A,T61,I20)') "DIIS: ini_diis:", ls_scf_env%iter_ini_diis
383 2 : WRITE (unit_nr, '(T2,A,T61,I20)') "DIIS: nmixing:", ls_scf_env%nmixing
384 : END IF
385 193 : WRITE (unit_nr, '(T2,A,T61,L20)') "fixed chemical potential (mu)", ls_scf_env%fixed_mu
386 193 : WRITE (unit_nr, '(T2,A,T61,L20)') "has unit metric:", ls_scf_env%has_unit_metric
387 193 : WRITE (unit_nr, '(T2,A,T61,L20)') "Computing inv(S):", ls_scf_env%needs_s_inv
388 193 : WRITE (unit_nr, '(T2,A,T61,L20)') "Computing sqrt(S):", ls_scf_env%use_s_sqrt
389 193 : WRITE (unit_nr, '(T2,A,T61,L20)') "Computing S preconditioner ", ls_scf_env%has_s_preconditioner
390 :
391 383 : SELECT CASE (ls_scf_env%s_sqrt_method)
392 : CASE (ls_s_sqrt_ns)
393 190 : WRITE (unit_nr, '(T2,A,T61,A20)') "S sqrt method:", "NEWTONSCHULZ"
394 : CASE (ls_s_sqrt_proot)
395 3 : WRITE (unit_nr, '(T2,A,T61,A20)') "S sqrt method:", "PROOT"
396 : CASE DEFAULT
397 193 : CPABORT("Unknown sqrt method.")
398 : END SELECT
399 :
400 193 : WRITE (unit_nr, '(T2,A,T61,I20)') "S sqrt order:", ls_scf_env%s_sqrt_order
401 193 : WRITE (unit_nr, '(T2,A,T61,I20)') "Extrapolation order:", ls_scf_env%extrapolation_order
402 :
403 260 : SELECT CASE (ls_scf_env%s_preconditioner_type)
404 : CASE (ls_s_preconditioner_none)
405 67 : WRITE (unit_nr, '(T2,A,T61,A20)') "S preconditioner type ", "NONE"
406 : CASE (ls_s_preconditioner_atomic)
407 67 : WRITE (unit_nr, '(T2,A,T61,A20)') "S preconditioner type ", "ATOMIC"
408 : CASE (ls_s_preconditioner_molecular)
409 193 : WRITE (unit_nr, '(T2,A,T61,A20)') "S preconditioner type ", "MOLECULAR"
410 : END SELECT
411 :
412 193 : WRITE (unit_nr, '(T2,A,T61,L20)') "Polarized Atomic Orbitals (PAO) ", ls_scf_env%do_pao
413 :
414 193 : IF (ls_scf_env%curvy_steps) THEN
415 6 : WRITE (unit_nr, '(T2,A,T61,A30)') "Using curvy steps to optimize the density matrix"
416 6 : CALL cite_reference(Shao2003)
417 : END IF
418 :
419 269 : SELECT CASE (ls_scf_env%purification_method)
420 : CASE (ls_scf_sign)
421 76 : WRITE (unit_nr, '(T2,A,T51,A30)') "Purification method", ADJUSTR("sign iteration")
422 144 : SELECT CASE (ls_scf_env%sign_method)
423 : CASE (ls_scf_sign_ns)
424 68 : WRITE (unit_nr, '(T2,A,T61,A20)') "Sign method:", ADJUSTR("newton schulz")
425 : CASE (ls_scf_sign_proot)
426 3 : WRITE (unit_nr, '(T2,A,T61,A20)') "Sign method:", ADJUSTR("p-th root method")
427 : CASE (ls_scf_sign_submatrix)
428 5 : WRITE (unit_nr, '(T2,A,T61,A20)') "Sign method:", ADJUSTR("submatrix method")
429 7 : SELECT CASE (ls_scf_env%submatrix_sign_method)
430 : CASE (ls_scf_submatrix_sign_ns)
431 2 : WRITE (unit_nr, '(T2,A,T61,A20)') "Submatrix sign method:", ADJUSTR("newton schulz")
432 : CASE (ls_scf_submatrix_sign_direct)
433 1 : WRITE (unit_nr, '(T2,A,T61,A20)') "Submatrix sign method:", ADJUSTR("direct")
434 : CASE (ls_scf_submatrix_sign_direct_muadj)
435 1 : WRITE (unit_nr, '(T2,A,T61,A20)') "Submatrix sign method:", ADJUSTR("direct mu-adj")
436 : CASE (ls_scf_submatrix_sign_direct_muadj_lowmem)
437 1 : WRITE (unit_nr, '(T2,A,T61,A20)') "Submatrix sign method:", ADJUSTR("direct mu-adj lowmem")
438 : CASE DEFAULT
439 5 : CPABORT("Unkown submatrix sign method.")
440 : END SELECT
441 : CASE DEFAULT
442 76 : CPABORT("Unknown sign method.")
443 : END SELECT
444 76 : WRITE (unit_nr, '(T2,A,T61,I20)') "Sign order:", ls_scf_env%sign_order
445 76 : WRITE (unit_nr, '(T2,A,T61,L20)') "Symmetric sign calculation:", ls_scf_env%sign_symmetric
446 : CASE (ls_scf_tc2)
447 16 : CALL cite_reference(Niklasson2014)
448 16 : WRITE (unit_nr, '(T2,A,T51,A30)') "Purification method", ADJUSTR("Trace conserving 2nd order")
449 : CASE (ls_scf_trs4)
450 101 : CALL cite_reference(Niklasson2003)
451 101 : WRITE (unit_nr, '(T2,A,T51,A30)') "Purification method", ADJUSTR("Trace resetting 4th order")
452 : CASE (ls_scf_pexsi)
453 0 : CALL cite_reference(Lin2009)
454 0 : CALL cite_reference(Lin2013)
455 0 : WRITE (unit_nr, '(T2,A,T51,A20)') "Purification method", ADJUSTR("PEXSI")
456 : CASE DEFAULT
457 193 : CPABORT("Unknown purification method for LS_SCF")
458 : END SELECT
459 :
460 363 : SELECT CASE (ls_scf_env%ls_mstruct%cluster_type)
461 : CASE (ls_cluster_atomic)
462 170 : WRITE (unit_nr, '(T2,A,T61,A20)') "Cluster type", ADJUSTR("ATOMIC")
463 : CASE (ls_cluster_molecular)
464 23 : WRITE (unit_nr, '(T2,A,T61,A20)') "Cluster type", ADJUSTR("MOLECULAR")
465 : CASE DEFAULT
466 193 : CPABORT("Unknown cluster type")
467 : END SELECT
468 :
469 193 : WRITE (unit_nr, '(T2,A,T61,L20)') "Computing Chebyshev", ls_scf_env%chebyshev%compute_chebyshev
470 193 : IF (ls_scf_env%chebyshev%compute_chebyshev) THEN
471 3 : WRITE (unit_nr, '(T2,A,T61,I20)') "N_CHEBYSHEV:", ls_scf_env%chebyshev%n_chebyshev
472 3 : WRITE (unit_nr, '(T2,A,T61,I20)') "N_GRIDPOINT_DOS:", ls_scf_env%chebyshev%n_gridpoint_dos
473 : END IF
474 :
475 193 : WRITE (unit_nr, '(T2,A)') REPEAT("-", 79)
476 193 : WRITE (unit_nr, '()')
477 193 : CALL m_flush(unit_nr)
478 : END IF
479 :
480 386 : CALL timestop(handle)
481 :
482 386 : END SUBROUTINE ls_scf_init_read_write_input
483 :
484 : END MODULE dm_ls_scf_create
|