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 : MODULE input_cp2k_loc
8 : USE bibliography, ONLY: Hunt2003,&
9 : Schreder2021,&
10 : Schreder2024_1,&
11 : Schreder2024_2
12 : USE cp_output_handling, ONLY: add_last_numeric,&
13 : cp_print_key_section_create,&
14 : debug_print_level,&
15 : high_print_level,&
16 : low_print_level
17 : USE input_constants, ONLY: &
18 : do_loc_both, do_loc_cpo_atomic, do_loc_cpo_random, do_loc_cpo_restart, &
19 : do_loc_cpo_space_nmo, do_loc_cpo_space_wan, do_loc_crazy, do_loc_cs, do_loc_direct, &
20 : do_loc_gapo, do_loc_homo, do_loc_jacobi, do_loc_l1_norm_sd, do_loc_lumo, do_loc_max, &
21 : do_loc_min, do_loc_mixed, do_loc_none, do_loc_scdm, op_loc_berry, op_loc_boys, op_loc_pipek
22 : USE input_cp2k_mm, ONLY: create_dipoles_section
23 : USE input_cp2k_motion_print, ONLY: add_format_keyword
24 : USE input_keyword_types, ONLY: keyword_create,&
25 : keyword_release,&
26 : keyword_type
27 : USE input_section_types, ONLY: section_add_keyword,&
28 : section_add_subsection,&
29 : section_create,&
30 : section_release,&
31 : section_type
32 : USE input_val_types, ONLY: integer_t,&
33 : lchar_t,&
34 : real_t
35 : USE kinds, ONLY: dp
36 : USE string_utilities, ONLY: s2a
37 : #include "./base/base_uses.f90"
38 :
39 : IMPLICIT NONE
40 : PRIVATE
41 :
42 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_loc'
43 :
44 : PUBLIC :: create_localize_section, print_wanniers
45 :
46 : CONTAINS
47 :
48 : ! **************************************************************************************************
49 : !> \brief parameters fo the localization of wavefunctions
50 : !> \param section ...
51 : !> \par History
52 : !> 03.2005 created [MI]
53 : ! **************************************************************************************************
54 :
55 6043 : SUBROUTINE create_localize_section(section)
56 :
57 : TYPE(section_type), POINTER :: section
58 :
59 : TYPE(keyword_type), POINTER :: keyword
60 : TYPE(section_type), POINTER :: print_key, print_section, subsection
61 :
62 6043 : CPASSERT(.NOT. ASSOCIATED(section))
63 :
64 6043 : NULLIFY (keyword, print_key)
65 : CALL section_create(section, __LOCATION__, name="LOCALIZE", &
66 : description="Use one of the available methods to define the localization"// &
67 : " and possibly to optimize it to a minimum or a maximum.", &
68 : n_keywords=8, n_subsections=0, repeats=.FALSE., &
69 12086 : citations=[Schreder2021])
70 :
71 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
72 : description="controls the activation of the MOS localization procedure", &
73 6043 : usage="&LOCALIZE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
74 6043 : CALL section_add_keyword(section, keyword)
75 6043 : CALL keyword_release(keyword)
76 :
77 : CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
78 : description="Maximum number of iterations used for localization methods", &
79 6043 : usage="MAX_ITER 2000", default_i_val=10000)
80 6043 : CALL section_add_keyword(section, keyword)
81 6043 : CALL keyword_release(keyword)
82 :
83 : CALL keyword_create( &
84 : keyword, __LOCATION__, name="MAX_CRAZY_ANGLE", &
85 : description="Largest allowed angle for the crazy rotations algorithm (smaller is slower but more stable).", &
86 6043 : usage="MAX_CRAZY_ANGLE 0.1", unit_str="rad", default_r_val=0.2_dp)
87 6043 : CALL section_add_keyword(section, keyword)
88 6043 : CALL keyword_release(keyword)
89 :
90 : CALL keyword_create(keyword, __LOCATION__, name="CRAZY_SCALE", &
91 : description="scale angles", &
92 6043 : usage="CRAZY_SCALE 0.9", default_r_val=1.0_dp)
93 6043 : CALL section_add_keyword(section, keyword)
94 6043 : CALL keyword_release(keyword)
95 :
96 : CALL keyword_create(keyword, __LOCATION__, name="CRAZY_USE_DIAG", &
97 : description="Use diagonalization (slow) or pade based calculation of matrix exponentials.", &
98 6043 : usage="CRAZY_USE_DIAG ", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
99 6043 : CALL section_add_keyword(section, keyword)
100 6043 : CALL keyword_release(keyword)
101 :
102 : CALL keyword_create( &
103 : keyword, __LOCATION__, name="USE_HISTORY", &
104 : description="Generate an improved initial guess based on a history of results, which is useful during MD. "// &
105 : "Will only work if the number of states to be localized remains constant.", &
106 6043 : usage="USE_HISTORY ", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
107 6043 : CALL section_add_keyword(section, keyword)
108 6043 : CALL keyword_release(keyword)
109 :
110 : CALL keyword_create(keyword, __LOCATION__, name="EACH", &
111 : description="localize each n steps", &
112 6043 : default_i_val=1)
113 6043 : CALL section_add_keyword(section, keyword)
114 6043 : CALL keyword_release(keyword)
115 :
116 : CALL keyword_create( &
117 : keyword, __LOCATION__, name="EPS_OCCUPATION", &
118 : description="Tolerance in the occupation number to select only fully occupied orbitals for the rotation", &
119 6043 : usage="EPS_OCCUPATION 1.E-5", default_r_val=1.0E-8_dp)
120 6043 : CALL section_add_keyword(section, keyword)
121 6043 : CALL keyword_release(keyword)
122 :
123 : CALL keyword_create(keyword, __LOCATION__, name="OUT_ITER_EACH", &
124 : description="Every how many iterations of the localization algorithm "// &
125 : "(Jacobi) the tolerance value is printed out", &
126 6043 : usage="OUT_ITER_EACH 100", default_i_val=100)
127 6043 : CALL section_add_keyword(section, keyword)
128 6043 : CALL keyword_release(keyword)
129 :
130 : CALL keyword_create(keyword, __LOCATION__, name="EPS_LOCALIZATION", &
131 : description="Tolerance used in the convergence criterion of the localization methods.", &
132 6043 : usage="EPS_LOCALIZATION 1.0E-2", default_r_val=1.0E-4_dp)
133 6043 : CALL section_add_keyword(section, keyword)
134 6043 : CALL keyword_release(keyword)
135 :
136 : CALL keyword_create(keyword, __LOCATION__, name="MIN_OR_MAX", &
137 : description="Requires the maximization of the spread of the wfn", &
138 : usage="MIN_OR_MAX (SPREADMIN|SPREADMAX)", &
139 : enum_c_vals=["SPREADMIN", "SPREADMAX"], &
140 : enum_i_vals=[do_loc_min, do_loc_max], &
141 18129 : default_i_val=do_loc_min)
142 6043 : CALL section_add_keyword(section, keyword)
143 6043 : CALL keyword_release(keyword)
144 :
145 : CALL keyword_create( &
146 : keyword, __LOCATION__, name="METHOD", &
147 : description="Method of optimization if any", &
148 : usage="METHOD (JACOBI|CRAZY|DIRECT|GAPO|L1SD|SCDM|CS|NONE)", &
149 : enum_c_vals=s2a("NONE", "JACOBI", "CRAZY", "GAPO", "L1SD", "DIRECT", "SCDM", "CS"), &
150 : enum_i_vals=[do_loc_none, &
151 : do_loc_jacobi, &
152 : do_loc_crazy, &
153 : do_loc_gapo, &
154 : do_loc_l1_norm_sd, &
155 : do_loc_direct, &
156 : do_loc_scdm, &
157 : do_loc_cs], &
158 : enum_desc=s2a("No localization is applied", &
159 : "Using 2 x 2 rotations of the orbitals, slow but robust", &
160 : "A new fast method is applied, might be slightly less robust than jacobi, but usually much faster", &
161 : "Gradient ascent for partially occupied wannier functions", &
162 : "Steepest descent minimization of an approximate l1 norm", &
163 : "Using a direct minimisation approacha", &
164 : "Use QR factorization", &
165 : "Using the Cardoso-Souloumiac algorithm for complex matrices"), &
166 : default_i_val=do_loc_jacobi, &
167 18129 : citations=[Schreder2021, Schreder2024_2])
168 6043 : CALL section_add_keyword(section, keyword)
169 6043 : CALL keyword_release(keyword)
170 :
171 : CALL keyword_create(keyword, __LOCATION__, name="CPO_GUESS", &
172 : description="Initial guess for coefficients if METHOD GAPO is used", &
173 : usage="CPO_GUESS (ATOMIC|RESTART|RANDOM)", &
174 : enum_c_vals=s2a("ATOMIC", "RESTART", "RANDOM"), &
175 : enum_i_vals=[do_loc_cpo_atomic, do_loc_cpo_restart, do_loc_cpo_random], &
176 6043 : default_i_val=do_loc_cpo_atomic)
177 6043 : CALL section_add_keyword(section, keyword)
178 6043 : CALL keyword_release(keyword)
179 :
180 : CALL keyword_create(keyword, __LOCATION__, name="CPO_GUESS_SPACE", &
181 : description="Orbital space from which initial guess for coefficients is determined "// &
182 : "if METHOD GAPO and CPO_GUESS ATOMIC are employed", &
183 : usage="CPO_GUESS_SPACE (WAN|ALL)", &
184 : enum_c_vals=s2a("WAN", "ALL"), &
185 : enum_i_vals=[do_loc_cpo_space_wan, do_loc_cpo_space_nmo], &
186 6043 : default_i_val=do_loc_cpo_space_wan)
187 6043 : CALL section_add_keyword(section, keyword)
188 6043 : CALL keyword_release(keyword)
189 :
190 : CALL keyword_create(keyword, __LOCATION__, name="CG_PO", &
191 : description="Use conjugate gradient in conjunction with METHOD GAPO. If FALSE, "// &
192 : "steepest descent is used instead.", &
193 : usage="CG_PO", default_l_val=.TRUE., &
194 6043 : lone_keyword_l_val=.TRUE.)
195 6043 : CALL section_add_keyword(section, keyword)
196 6043 : CALL keyword_release(keyword)
197 :
198 : CALL keyword_create(keyword, __LOCATION__, name="JACOBI_FALLBACK", &
199 : description="Use Jacobi method in case no convergence was achieved"// &
200 : " by using the crazy rotations method.", &
201 : usage="JACOBI_FALLBACK", default_l_val=.TRUE., &
202 6043 : lone_keyword_l_val=.TRUE.)
203 6043 : CALL section_add_keyword(section, keyword)
204 6043 : CALL keyword_release(keyword)
205 :
206 : CALL keyword_create(keyword, __LOCATION__, name="JACOBI_REFINEMENT", &
207 : description="Use Jacobi method to refine the localisation obtained by SCDM", &
208 : usage="JACOBI_REFINEMENT", default_l_val=.FALSE., &
209 6043 : lone_keyword_l_val=.TRUE.)
210 6043 : CALL section_add_keyword(section, keyword)
211 6043 : CALL keyword_release(keyword)
212 :
213 : CALL keyword_create(keyword, __LOCATION__, name="RESTART", &
214 : description="Restart the localization from a set of orbitals"// &
215 : " read from a localization restart file written by PRINT%LOC_RESTART."// &
216 : " The wavefunction file written by PRINT%WFN_RESTART cannot be used here.", &
217 : usage="RESTART", default_l_val=.FALSE., &
218 6043 : lone_keyword_l_val=.TRUE.)
219 6043 : CALL section_add_keyword(section, keyword)
220 6043 : CALL keyword_release(keyword)
221 :
222 : CALL keyword_create(keyword, __LOCATION__, name="LOCHOMO_RESTART_FILE_NAME", &
223 : description="File name where to read the MOS from "// &
224 : "which to restart the localization procedure for occupied states "// &
225 : "(a file written by PRINT%LOC_RESTART)", &
226 : usage="LOCHOMO_RESTART_FILE_NAME <FILENAME>", &
227 6043 : type_of_var=lchar_t)
228 6043 : CALL section_add_keyword(section, keyword)
229 6043 : CALL keyword_release(keyword)
230 :
231 : CALL keyword_create(keyword, __LOCATION__, name="LOCMIXD_RESTART_FILE_NAME", &
232 : description="File name where to read the MOS from "// &
233 : "which to restart the localization procedure for MIXED states "// &
234 : "(a file written by PRINT%LOC_RESTART)", &
235 : usage="LOCMIXD_RESTART_FILE_NAME <FILENAME>", &
236 6043 : type_of_var=lchar_t)
237 6043 : CALL section_add_keyword(section, keyword)
238 6043 : CALL keyword_release(keyword)
239 :
240 : CALL keyword_create(keyword, __LOCATION__, name="LOCLUMO_RESTART_FILE_NAME", &
241 : description="File name where to read the MOS from "// &
242 : "which to restart the localization procedure for unoccupied states "// &
243 : "(a file written by PRINT%LOC_RESTART)", &
244 : usage="LOCLUMO_RESTART_FILE_NAME <FILENAME>", &
245 6043 : type_of_var=lchar_t)
246 6043 : CALL section_add_keyword(section, keyword)
247 6043 : CALL keyword_release(keyword)
248 :
249 : CALL keyword_create(keyword, __LOCATION__, name="OPERATOR", &
250 : description="Type of opertator which defines the spread functional", &
251 : usage="OPERATOR (BERRY|BOYS|PIPEK)", &
252 : enum_c_vals=s2a("BERRY", "BOYS", "PIPEK"), &
253 : enum_i_vals=[op_loc_berry, op_loc_boys, op_loc_pipek], &
254 : default_i_val=op_loc_berry, &
255 12086 : citations=[Schreder2024_2])
256 6043 : CALL section_add_keyword(section, keyword)
257 6043 : CALL keyword_release(keyword)
258 :
259 : CALL keyword_create(keyword, __LOCATION__, name="LIST", &
260 : description="Indexes of the occupied wfn to be localized "// &
261 : "This keyword can be repeated several times "// &
262 : "(useful if you have to specify many indexes).", &
263 : usage="LIST 1 2", &
264 6043 : n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
265 6043 : CALL section_add_keyword(section, keyword)
266 6043 : CALL keyword_release(keyword)
267 :
268 : CALL keyword_create(keyword, __LOCATION__, name="LIST_UNOCCUPIED", &
269 : description="Indexes of the unoccupied states to be localized, "// &
270 : "up to now only valid in combination with GPW. "// &
271 : "This keyword has to be present if unoccupied states should be localized. "// &
272 : "This keyword can be repeated several times "// &
273 : "(useful if you have to specify many indexes).", &
274 : usage="LIST_UNOCCUPIED 1 2", &
275 6043 : n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
276 6043 : CALL section_add_keyword(section, keyword)
277 6043 : CALL keyword_release(keyword)
278 :
279 : CALL keyword_create(keyword, __LOCATION__, name="NEXTRA", &
280 : description="Number of orbitals above fully occupied MOs to be localized, "// &
281 : "up to now only valid in combination with GPW. "// &
282 : "This keyword has to be present for STATES MIXED option. "// &
283 : "Otherwise, only the fully occupied MOs are localized.", &
284 6043 : usage="NEXTRA 5", default_i_val=0)
285 6043 : CALL section_add_keyword(section, keyword)
286 6043 : CALL keyword_release(keyword)
287 :
288 : CALL keyword_create(keyword, __LOCATION__, name="STATES", &
289 : description="Which states to localize, LUMO up to now only available in GPW", &
290 : usage="STATES (HOMO|LUMO|MIXED|ALL)", &
291 : enum_c_vals=s2a("OCCUPIED", "UNOCCUPIED", "MIXED", "ALL"), &
292 : enum_i_vals=[do_loc_homo, do_loc_lumo, do_loc_mixed, do_loc_both], &
293 6043 : default_i_val=do_loc_homo)
294 6043 : CALL section_add_keyword(section, keyword)
295 6043 : CALL keyword_release(keyword)
296 :
297 : CALL keyword_create( &
298 : keyword, __LOCATION__, &
299 : name="ENERGY_RANGE", &
300 : description="Select the orbitals to be localized within the given energy range."// &
301 : " This type of selection cannot be added on top of the selection through a LIST. It reads to reals that are"// &
302 : " lower and higher boundaries of the energy range.", &
303 : usage="ENERGY_RANGE lower_bound {real}, higher_bound {real}", &
304 : repeats=.FALSE., &
305 : n_var=2, default_r_vals=[0._dp, 0._dp], unit_str='eV', &
306 6043 : type_of_var=real_t)
307 6043 : CALL section_add_keyword(section, keyword)
308 6043 : CALL keyword_release(keyword)
309 :
310 6043 : NULLIFY (print_section)
311 : CALL section_create(print_section, __LOCATION__, name="PRINT", &
312 : description="Collects all printing options related to the Wannier centers and "// &
313 : "properties computed with Wannier centers.", &
314 6043 : n_keywords=0, n_subsections=1, repeats=.FALSE.)
315 6043 : NULLIFY (print_key)
316 : CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
317 : description="Controls the printing basic info about the method", &
318 6043 : print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
319 6043 : CALL section_add_subsection(print_section, print_key)
320 6043 : CALL section_release(print_key)
321 : ! Add printing of wannier infos
322 6043 : CALL print_wanniers(print_section)
323 6043 : NULLIFY (subsection)
324 : ! Total Dipoles with wannier
325 6043 : CALL create_dipoles_section(subsection, "TOTAL_DIPOLE", debug_print_level + 1)
326 6043 : CALL section_add_subsection(print_section, subsection)
327 6043 : CALL section_release(subsection)
328 : ! Molecular Dipoles with wannier
329 6043 : CALL create_dipoles_section(subsection, "MOLECULAR_DIPOLES", debug_print_level + 1)
330 6043 : CALL section_add_subsection(print_section, subsection)
331 6043 : CALL section_release(subsection)
332 : ! Molecular Mulipole Moments with wannier
333 : CALL cp_print_key_section_create(subsection, __LOCATION__, name="MOLECULAR_MOMENTS", &
334 : description="Section controlling the calculation of molecular multipole moments.", &
335 6043 : print_level=debug_print_level + 1, filename="__STD_OUT__")
336 : CALL keyword_create(keyword, __LOCATION__, name="ORDER", &
337 : description="Maximum order of mulitpoles to be calculated.", &
338 6043 : usage="ORDER {integer}", default_i_val=2, type_of_var=integer_t)
339 6043 : CALL section_add_keyword(subsection, keyword)
340 6043 : CALL keyword_release(keyword)
341 : !
342 6043 : CALL section_add_subsection(print_section, subsection)
343 6043 : CALL section_release(subsection)
344 : !
345 : CALL cp_print_key_section_create(subsection, __LOCATION__, name="LOCALIZED_MOMENTS", &
346 : description="Section controlling the calculation of "// &
347 : "localized moments", &
348 : print_level=debug_print_level + 1, filename="__STD_OUT__", &
349 18129 : citations=[Schreder2021, Schreder2024_1])
350 : !
351 : CALL keyword_create(keyword, __LOCATION__, &
352 : name="MAX_MOMENT", &
353 : description="Maximum moment to be calculated.", &
354 : usage="MAX_MOMENT {integer}", &
355 : repeats=.FALSE., &
356 : n_var=1, &
357 : type_of_var=integer_t, &
358 6043 : default_i_val=1)
359 6043 : CALL section_add_keyword(subsection, keyword)
360 6043 : CALL keyword_release(keyword)
361 : !
362 : CALL keyword_create(keyword, __LOCATION__, &
363 : name="MAGNETIC", &
364 : description="Calculate also magnetic moments.", &
365 : usage="MAGNETIC .TRUE.", &
366 : repeats=.FALSE., &
367 : n_var=1, &
368 : default_l_val=.FALSE., &
369 6043 : lone_keyword_l_val=.TRUE.)
370 6043 : CALL section_add_keyword(subsection, keyword)
371 6043 : CALL keyword_release(keyword)
372 : !
373 : CALL keyword_create(keyword, __LOCATION__, &
374 : name="VEL_REPRS", &
375 : description="Calculate expectation values of the el. multipole "// &
376 : "moments in their velocity representation during RTP. Implemented up "// &
377 : "to el. quadrupole moment.", &
378 : usage="VEL_REPRS .TRUE.", &
379 : repeats=.FALSE., &
380 : n_var=1, &
381 : default_l_val=.FALSE., &
382 6043 : lone_keyword_l_val=.TRUE.)
383 6043 : CALL section_add_keyword(subsection, keyword)
384 6043 : CALL keyword_release(keyword)
385 : !
386 : CALL keyword_create(keyword, __LOCATION__, &
387 : name="COM_NL", &
388 : description="Include non local commutator for velocity "// &
389 : "representations. Necessary for origin independent results.", &
390 : usage="COM_NL .TRUE.", &
391 : repeats=.FALSE., &
392 : n_var=1, &
393 : default_l_val=.FALSE., &
394 6043 : lone_keyword_l_val=.TRUE.)
395 6043 : CALL section_add_keyword(subsection, keyword)
396 6043 : CALL keyword_release(keyword)
397 : !
398 6043 : CALL section_add_subsection(print_section, subsection)
399 6043 : CALL section_release(subsection)
400 : ! Molecular States with wannier
401 6043 : CALL create_molecular_states_section(subsection)
402 6043 : CALL section_add_subsection(print_section, subsection)
403 6043 : CALL section_release(subsection)
404 : ! Wannier States with wannier
405 6043 : CALL create_wannier_states_section(subsection)
406 6043 : CALL section_add_subsection(print_section, subsection)
407 6043 : CALL section_release(subsection)
408 : !
409 6043 : CALL section_add_subsection(section, print_section)
410 6043 : CALL section_release(print_section)
411 :
412 6043 : END SUBROUTINE create_localize_section
413 :
414 : ! **************************************************************************************************
415 : !> \brief Controls the printing of the basic info coming from the LOCALIZE
416 : !> section
417 : !> \param section ...
418 : !> \author teo
419 : ! **************************************************************************************************
420 7542 : SUBROUTINE print_wanniers(section)
421 : TYPE(section_type), POINTER :: section
422 :
423 : TYPE(keyword_type), POINTER :: keyword
424 : TYPE(section_type), POINTER :: print_key
425 :
426 7542 : CPASSERT(ASSOCIATED(section))
427 7542 : NULLIFY (print_key, keyword)
428 : CALL cp_print_key_section_create(print_key, __LOCATION__, "WANNIER_CUBES", &
429 : description="Controls the printing of the wannier functions ", &
430 7542 : print_level=high_print_level, add_last=add_last_numeric, filename="")
431 : CALL keyword_create(keyword, __LOCATION__, name="stride", &
432 : description="The stride (X,Y,Z) used to write the cube file "// &
433 : "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
434 : " 1 number valid for all components.", &
435 7542 : usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
436 7542 : CALL section_add_keyword(print_key, keyword)
437 7542 : CALL keyword_release(keyword)
438 :
439 : CALL keyword_create(keyword, __LOCATION__, name="DENSITY", &
440 : description="Controls the printing of the Wannier function "// &
441 : "electronic densities", &
442 7542 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
443 7542 : CALL section_add_keyword(print_key, keyword)
444 7542 : CALL keyword_release(keyword)
445 :
446 : CALL keyword_create(keyword, __LOCATION__, name="CUBES_LU_BOUNDS", &
447 : variants=["CUBES_LU"], &
448 : description="The lower and upper index of the states to be printed as cube", &
449 : usage="CUBES_LU_BOUNDS integer integer", &
450 15084 : n_var=2, default_i_vals=[0, -2], type_of_var=integer_t)
451 7542 : CALL section_add_keyword(print_key, keyword)
452 7542 : CALL keyword_release(keyword)
453 :
454 : CALL keyword_create(keyword, __LOCATION__, name="CUBES_LIST", &
455 : description="Indexes of the states to be printed as cube files"// &
456 : " This keyword can be repeated several times"// &
457 : " (useful if you have to specify many indexes).", &
458 : usage="CUBES_LIST 1 2", &
459 7542 : n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
460 7542 : CALL section_add_keyword(print_key, keyword)
461 7542 : CALL keyword_release(keyword)
462 : CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
463 : description="append the cube files when they already exist", &
464 7542 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
465 7542 : CALL section_add_keyword(print_key, keyword)
466 7542 : CALL keyword_release(keyword)
467 :
468 7542 : CALL section_add_subsection(section, print_key)
469 7542 : CALL section_release(print_key)
470 :
471 7542 : NULLIFY (print_key)
472 : CALL cp_print_key_section_create(print_key, __LOCATION__, "WANNIER_CENTERS", &
473 : description="Controls the printing of the wannier functions", &
474 : print_level=high_print_level, add_last=add_last_numeric, filename="", &
475 7542 : unit_str="angstrom")
476 :
477 : CALL keyword_create(keyword, __LOCATION__, name="IONS+CENTERS", &
478 : description="prints out the wannier centers together with the particles", &
479 : usage="IONS+CENTERS", default_l_val=.FALSE., &
480 7542 : lone_keyword_l_val=.TRUE.)
481 7542 : CALL section_add_keyword(print_key, keyword)
482 7542 : CALL keyword_release(keyword)
483 :
484 : CALL add_format_keyword(keyword, print_key, pos=.TRUE., &
485 7542 : description="Specifies the format of the output file when IONS+CENTERS is enabled.")
486 7542 : CALL section_add_subsection(section, print_key)
487 7542 : CALL section_release(print_key)
488 :
489 7542 : NULLIFY (print_key)
490 : CALL cp_print_key_section_create(print_key, __LOCATION__, "WANNIER_SPREADS", &
491 : description="Controls the printing of the wannier functions", &
492 7542 : print_level=high_print_level, add_last=add_last_numeric, filename="")
493 :
494 : CALL keyword_create(keyword, __LOCATION__, name="SECOND_MOMENTS", &
495 : description="Prints out the upper triangular part of the position covariance matrix. "// &
496 : "Default is to use a non-periodic position operator. ", &
497 : usage="SECOND_MOMENTS", default_l_val=.FALSE., &
498 7542 : lone_keyword_l_val=.TRUE.)
499 7542 : CALL section_add_keyword(print_key, keyword)
500 7542 : CALL keyword_release(keyword)
501 :
502 : CALL keyword_create(keyword, __LOCATION__, name="PERIODIC", &
503 : description="For the covariance matrix, use the periodic position operator."// &
504 : " Requires setting LMAXN1 in QS section to 6 or higher.", &
505 : usage="PERIODIC", default_l_val=.FALSE., &
506 7542 : lone_keyword_l_val=.TRUE.)
507 7542 : CALL section_add_keyword(print_key, keyword)
508 7542 : CALL keyword_release(keyword)
509 :
510 7542 : CALL section_add_subsection(section, print_key)
511 7542 : CALL section_release(print_key)
512 :
513 7542 : NULLIFY (print_key)
514 : CALL cp_print_key_section_create(print_key, __LOCATION__, "LOC_RESTART", &
515 : description="Controls the printing of the restart file of the localization procedure "// &
516 : "(PROJECT-LOC_HOMO-*.wfn, PROJECT-LOC_LUMO-*.wfn, PROJECT-LOC_MIXED-*.wfn). "// &
517 : "It is read only by LOCALIZE%RESTART to continue the localization, and it is "// &
518 : "not a wavefunction restart file for SCF, RTP or EMD (see WFN_RESTART).", &
519 7542 : print_level=high_print_level, add_last=add_last_numeric, filename="")
520 7542 : CALL section_add_subsection(section, print_key)
521 7542 : CALL section_release(print_key)
522 :
523 7542 : NULLIFY (print_key)
524 : CALL cp_print_key_section_create(print_key, __LOCATION__, "WFN_RESTART", &
525 : description="Controls the printing of a standard wavefunction restart "// &
526 : "file (PROJECT-LOCALIZED-RESTART.wfn) in which the occupied orbitals are replaced by the "// &
527 : "localized ones. It is read through DFT%WFN_RESTART_FILE_NAME, e.g. by "// &
528 : "SCF_GUESS RESTART or by REAL_TIME_PROPAGATION%INITIAL_WFN RESTART_WFN. "// &
529 : "It is a different file from LOC_RESTART: it restarts SCF, RTP or EMD, "// &
530 : "not the localization procedure, and it cannot be read by LOCALIZE%RESTART. "// &
531 : "The stored eigenvalues are those of the canonical orbitals.", &
532 : print_level=high_print_level, add_last=add_last_numeric, &
533 7542 : common_iter_levels=3, filename="LOCALIZED-RESTART")
534 7542 : CALL section_add_subsection(section, print_key)
535 7542 : CALL section_release(print_key)
536 :
537 7542 : END SUBROUTINE print_wanniers
538 :
539 : ! **************************************************************************************************
540 : !> \brief creates the input section for the molecular states
541 : !> \param print_key ...
542 : !> \author teo
543 : ! **************************************************************************************************
544 6043 : SUBROUTINE create_molecular_states_section(print_key)
545 : TYPE(section_type), POINTER :: print_key
546 :
547 : TYPE(keyword_type), POINTER :: keyword
548 : TYPE(section_type), POINTER :: print_key2
549 :
550 6043 : CPASSERT(.NOT. ASSOCIATED(print_key))
551 6043 : NULLIFY (print_key2, keyword)
552 : CALL cp_print_key_section_create(print_key, __LOCATION__, "MOLECULAR_STATES", &
553 : description="Controls printing of molecular states ", &
554 12086 : print_level=high_print_level, filename=" ", citations=[Hunt2003])
555 :
556 : CALL keyword_create( &
557 : keyword, __LOCATION__, name="CUBE_EVAL_RANGE", &
558 : description="only write cubes if the energies of the corresponding molecular states lie in the given interval. "// &
559 : "Default is all states.", &
560 6043 : usage="CUBE_EVAL_RANGE -1.0 1.0", unit_str="hartree", n_var=2, type_of_var=real_t)
561 6043 : CALL section_add_keyword(print_key, keyword)
562 6043 : CALL keyword_release(keyword)
563 :
564 : CALL keyword_create(keyword, __LOCATION__, name="MARK_STATES", &
565 : description="Can be used to mark given molecular states."// &
566 : " Sets a mark to both, occupied and unoccupied states. "// &
567 : "Occupied states are counted beginning with HOMO=1, "// &
568 : "unoccupied states are counted beginning with LUMO=1, "// &
569 : "This is only meaningful in combination with WFN_MIX. "// &
570 : "First integer specifies the molecule, second integer specifies the state.", &
571 : usage="MARK_STATES integer integer", &
572 6043 : n_var=2, default_i_vals=[-1, -1], type_of_var=integer_t, repeats=.TRUE.)
573 6043 : CALL section_add_keyword(print_key, keyword)
574 6043 : CALL keyword_release(keyword)
575 :
576 : CALL cp_print_key_section_create(print_key2, __LOCATION__, "cubes", &
577 : description="Controls the printing of cube files", &
578 6043 : print_level=high_print_level, filename="")
579 : CALL keyword_create(keyword, __LOCATION__, name="stride", &
580 : description="The stride (X,Y,Z) used to write the cube file "// &
581 : "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
582 : " 1 number valid for all components.", &
583 6043 : usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
584 6043 : CALL section_add_keyword(print_key2, keyword)
585 6043 : CALL keyword_release(keyword)
586 6043 : CALL section_add_subsection(print_key, print_key2)
587 6043 : CALL section_release(print_key2)
588 6043 : END SUBROUTINE create_molecular_states_section
589 :
590 : ! **************************************************************************************************
591 : !> \brief ...
592 : !> \param print_key ...
593 : ! **************************************************************************************************
594 6043 : SUBROUTINE create_wannier_states_section(print_key)
595 : TYPE(section_type), POINTER :: print_key
596 :
597 : TYPE(keyword_type), POINTER :: keyword
598 : TYPE(section_type), POINTER :: print_key2
599 :
600 6043 : CPASSERT(.NOT. ASSOCIATED(print_key))
601 6043 : NULLIFY (print_key2, keyword)
602 : CALL cp_print_key_section_create(print_key, __LOCATION__, "WANNIER_STATES", &
603 : description="Controls printing of Wannier states ", &
604 6043 : print_level=high_print_level, filename=" ")
605 :
606 : CALL keyword_create( &
607 : keyword, __LOCATION__, name="CUBE_EVAL_RANGE", &
608 : description="only write cubes if the energies of the corresponding molecular states lie in the given interval. "// &
609 : "Default is all states.", &
610 6043 : usage="CUBE_EVAL_RANGE -1.0 1.0", unit_str="hartree", n_var=2, type_of_var=real_t)
611 6043 : CALL section_add_keyword(print_key, keyword)
612 6043 : CALL keyword_release(keyword)
613 :
614 : CALL keyword_create(keyword, __LOCATION__, name="MARK_STATES", &
615 : description="Can be used to mark given molecular states."// &
616 : " Sets a mark to both, occupied and unoccupied states. "// &
617 : "Occupied states are counted beginning with HOMO=1, "// &
618 : "unoccupied states are counted beginning with LUMO=1, "// &
619 : "This is only meaningful in combination with WFN_MIX. "// &
620 : "First integer specifies the molecule, second integer specifies the state.", &
621 : usage="MARK_STATES integer integer", &
622 6043 : n_var=2, default_i_vals=[-1, -1], type_of_var=integer_t, repeats=.TRUE.)
623 6043 : CALL section_add_keyword(print_key, keyword)
624 6043 : CALL keyword_release(keyword)
625 :
626 : CALL keyword_create(keyword, __LOCATION__, name="CARTESIAN", &
627 : description="Print the Wannier states in the Cartesian basis instead of the default spherical basis.", &
628 6043 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
629 6043 : CALL section_add_keyword(print_key, keyword)
630 6043 : CALL keyword_release(keyword)
631 :
632 : CALL cp_print_key_section_create(print_key2, __LOCATION__, "cubes", &
633 : description="Controls the printing of cube files", &
634 6043 : print_level=high_print_level, filename="")
635 : CALL keyword_create(keyword, __LOCATION__, name="stride", &
636 : description="The stride (X,Y,Z) used to write the cube file "// &
637 : "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
638 : " 1 number valid for all components.", &
639 6043 : usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
640 6043 : CALL section_add_keyword(print_key2, keyword)
641 6043 : CALL keyword_release(keyword)
642 6043 : CALL section_add_subsection(print_key, print_key2)
643 6043 : CALL section_release(print_key2)
644 6043 : END SUBROUTINE create_wannier_states_section
645 :
646 : END MODULE input_cp2k_loc
|