-
Notifications
You must be signed in to change notification settings - Fork 1
/
input_cp2k_scf.F
2000 lines (1739 loc) · 118 KB
/
input_cp2k_scf.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!--------------------------------------------------------------------------------------------------!
! CP2K: A general program to perform molecular dynamics simulations !
! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
! !
! SPDX-License-Identifier: GPL-2.0-or-later !
!--------------------------------------------------------------------------------------------------!
! **************************************************************************************************
!> \brief function that build the scf section of the input
!> \par History
!> 10.2005 moved out of input_cp2k [fawzi]
!> 07.2024 moved out of input_cp2k_dft [JGH]
!> \author fawzi
! **************************************************************************************************
MODULE input_cp2k_scf
USE bibliography, ONLY: Becke1988b,&
Holmberg2017,&
Holmberg2018,&
Schiffmann2015,&
Stewart1982,&
VandeVondele2003,&
VandeVondele2005a,&
Weber2008
USE cp_output_handling, ONLY: add_last_numeric,&
cp_print_key_section_create,&
high_print_level,&
low_print_level
USE cp_units, ONLY: cp_unit_to_cp2k
USE input_constants, ONLY: &
atomic_guess, becke_cutoff_element, becke_cutoff_global, broyden_type_1, &
broyden_type_1_explicit, broyden_type_1_explicit_ls, broyden_type_1_ls, broyden_type_2, &
broyden_type_2_explicit, broyden_type_2_explicit_ls, broyden_type_2_ls, &
cdft_alpha_constraint, cdft_beta_constraint, cdft_charge_constraint, &
cdft_magnetization_constraint, cholesky_dbcsr, cholesky_inverse, cholesky_off, &
cholesky_reduce, cholesky_restore, core_guess, diag_block_davidson, diag_block_krylov, &
diag_filter_matrix, diag_ot, diag_standard, eht_guess, gaussian, general_roks, &
high_spin_roks, history_guess, jacobian_fd1, jacobian_fd1_backward, jacobian_fd1_central, &
jacobian_fd2, jacobian_fd2_backward, ls_2pnt, ls_3pnt, ls_gold, ls_none, mopac_guess, &
no_guess, numerical, ot_algo_irac, ot_algo_taylor_or_diag, ot_chol_irac, ot_lwdn_irac, &
ot_mini_broyden, ot_mini_cg, ot_mini_diis, ot_mini_sd, ot_poly_irac, ot_precond_full_all, &
ot_precond_full_kinetic, ot_precond_full_single, ot_precond_full_single_inverse, &
ot_precond_none, ot_precond_s_inverse, ot_precond_solver_default, &
ot_precond_solver_direct, ot_precond_solver_inv_chol, ot_precond_solver_update, &
outer_scf_basis_center_opt, outer_scf_becke_constraint, outer_scf_cdft_constraint, &
outer_scf_ddapc_constraint, outer_scf_hirshfeld_constraint, outer_scf_none, &
outer_scf_optimizer_bisect, outer_scf_optimizer_broyden, outer_scf_optimizer_diis, &
outer_scf_optimizer_newton, outer_scf_optimizer_newton_ls, outer_scf_optimizer_none, &
outer_scf_optimizer_sd, outer_scf_optimizer_secant, outer_scf_s2_constraint, &
radius_covalent, radius_default, radius_single, radius_user, radius_vdw, random_guess, &
restart_guess, shape_function_density, shape_function_gaussian, smear_energy_window, &
smear_fermi_dirac, smear_list, sparse_guess
USE input_keyword_types, ONLY: keyword_create,&
keyword_release,&
keyword_type
USE input_section_types, ONLY: section_add_keyword,&
section_add_subsection,&
section_create,&
section_release,&
section_type
USE input_val_types, ONLY: integer_t,&
real_t
USE kinds, ONLY: dp
USE qs_density_mixing_types, ONLY: create_mixing_section
USE qs_fb_input, ONLY: create_filtermatrix_section
USE qs_mom_types, ONLY: create_mom_section
USE string_utilities, ONLY: newline,&
s2a
#include "./base/base_uses.f90"
IMPLICIT NONE
PRIVATE
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_scf'
PUBLIC :: create_scf_section, create_cdft_control_section
CONTAINS
! **************************************************************************************************
!> \brief creates the structure of the section with the DFT SCF parameters
!> \param section will contain the SCF section
!> \author fawzi
! **************************************************************************************************
SUBROUTINE create_scf_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
TYPE(section_type), POINTER :: print_key, subsection
NULLIFY (print_key)
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="scf", &
description="Parameters needed to perform an SCF run.", &
n_keywords=18, n_subsections=7, repeats=.FALSE.)
NULLIFY (subsection)
CALL create_ot_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_diagonalization_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_outer_scf_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_smear_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_mixing_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL create_mom_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER_LUMO", &
variants=(/"MAX_ITER_LUMOS"/), &
description="Maximum number of iterations for the calculation of the LUMO energies "// &
"with the OT eigensolver.", &
usage="MAX_ITER_LUMO 100", default_i_val=299)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_LUMO", &
variants=(/"EPS_LUMOS"/), &
description="Target accuracy for the calculation of the LUMO energies with the OT eigensolver.", &
usage="EPS_LUMO 1.0E-6", default_r_val=1.0E-5_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_SCF", &
description="Maximum number of SCF iteration to be performed for one optimization", &
usage="MAX_SCF 200", default_i_val=50)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_SCF_HISTORY", variants=(/"MAX_SCF_HIST"/), &
description="Maximum number of SCF iterations after the history pipeline is filled", &
usage="MAX_SCF_HISTORY 1", default_i_val=0, lone_keyword_i_val=1)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_DIIS", &
variants=(/"MAX_DIIS_BUFFER_SIZE"/), &
description="Maximum number of DIIS vectors to be used", &
usage="MAX_DIIS 3", default_i_val=4)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="LEVEL_SHIFT", &
variants=(/"LSHIFT"/), &
description="Use level shifting to improve convergence", &
unit_str="au_e", &
usage="LEVEL_SHIFT 0.1", &
default_r_val=0.0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_SCF", &
description="Target accuracy for the SCF convergence.", &
usage="EPS_SCF 1.e-6", default_r_val=1.e-5_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_SCF_HISTORY", variants=(/"EPS_SCF_HIST"/), &
description="Target accuracy for the SCF convergence after the history pipeline is filled.", &
usage="EPS_SCF_HISTORY 1.e-5", default_r_val=0.0_dp, lone_keyword_r_val=1.0e-5_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="CHOLESKY", &
description="If the cholesky method should be used for computing "// &
"the inverse of S, and in this case calling which Lapack routines", &
usage="CHOLESKY REDUCE", default_i_val=cholesky_restore, &
enum_c_vals=s2a("OFF", "REDUCE", "RESTORE", "INVERSE", "INVERSE_DBCSR"), &
enum_desc=s2a("The cholesky algorithm is not used", "Reduce is called", &
"Reduce is replaced by two restore", &
"Restore uses operator multiply by inverse of the triangular matrix", &
"Like inverse, but matrix stored as dbcsr, sparce matrix algebra used when possible"), &
enum_i_vals=(/cholesky_off, cholesky_reduce, cholesky_restore, cholesky_inverse, cholesky_dbcsr/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_EIGVAL", &
description="Throw away linear combinations of basis functions with a small eigenvalue in S", &
usage="EPS_EIGVAL 1.0", default_r_val=1.0e-5_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_DIIS", &
description="Threshold on the convergence to start using DIAG/DIIS", &
usage="EPS_DIIS 5.0e-2", default_r_val=0.1_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="SCF_GUESS", &
description="Change the initial guess for the wavefunction.", &
usage="SCF_GUESS RESTART", default_i_val=atomic_guess, &
enum_c_vals=s2a("ATOMIC", "RESTART", "RANDOM", "CORE", &
"HISTORY_RESTART", "MOPAC", "EHT", "SPARSE", "NONE"), &
enum_desc=s2a("Generate an atomic density using the atomic code", &
"Use the RESTART file as an initial guess (and ATOMIC if not present).", &
"Use random wavefunction coefficients.", &
"Diagonalize the core hamiltonian for an initial guess.", &
"Extrapolated from previous RESTART files.", &
"Use same guess as MOPAC for semi-empirical methods or a simple diagonal density matrix for other methods", &
"Use the EHT (gfn0-xTB) code to generate an initial wavefunction.", &
"Generate a sparse wavefunction using the atomic code (for OT based methods)", &
"Skip initial guess (only for non-self consistent methods)."), &
enum_i_vals=(/atomic_guess, restart_guess, random_guess, core_guess, &
history_guess, mopac_guess, eht_guess, sparse_guess, no_guess/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="NROW_BLOCK", &
description="sets the number of rows in a scalapack block", &
usage="NROW_BLOCK 31", default_i_val=32)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="NCOL_BLOCK", &
description="Sets the number of columns in a scalapack block", &
usage="NCOL_BLOCK 31", default_i_val=32)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ADDED_MOS", &
description="Number of additional MOS added for each spin. Use -1 to add all available. "// &
"alpha/beta spin can be specified independently (if spin-polarized calculation requested).", &
usage="ADDED_MOS", default_i_val=0, n_var=-1)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, &
name="ROKS_SCHEME", &
description="Selects the ROKS scheme when ROKS is applied.", &
usage="ROKS_SCHEME HIGH-SPIN", &
repeats=.FALSE., &
n_var=1, &
enum_c_vals=s2a("GENERAL", "HIGH-SPIN"), &
enum_i_vals=(/general_roks, high_spin_roks/), &
default_i_val=high_spin_roks)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, &
name="ROKS_F", &
variants=(/"F_ROKS"/), &
description="Allows to define the parameter f for the "// &
"general ROKS scheme.", &
usage="ROKS_PARAMETER 1/2", &
repeats=.FALSE., &
n_var=1, &
type_of_var=real_t, &
default_r_val=0.5_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, &
name="ROKS_PARAMETERS", &
variants=(/"ROKS_PARAMETER"/), &
description="Allows to define all parameters for the high-spin "// &
"ROKS scheme explicitly. "// &
"The full set of 6 parameters has to be specified "// &
"in the order acc, bcc, aoo, boo, avv, bvv", &
usage="ROKS_PARAMETERS 1/2 1/2 1/2 1/2 1/2 1/2", &
repeats=.FALSE., &
n_var=6, &
type_of_var=real_t, &
default_r_vals=(/-0.5_dp, 1.5_dp, 0.5_dp, 0.5_dp, 1.5_dp, -0.5_dp/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="IGNORE_CONVERGENCE_FAILURE", &
description="If true, only a warning is issued if an SCF "// &
"iteration has not converged. By default, a run is aborted "// &
"if the required convergence criteria have not been achieved.", &
usage="IGNORE_CONVERGENCE_FAILURE logical_value", &
default_l_val=.FALSE., &
lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="FORCE_SCF_CALCULATION", &
description="Request a SCF type solution even for nonSCF methods. ", &
usage="FORCE_SCF_CALCULATION logical_value", &
default_l_val=.FALSE., &
lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL section_create(subsection, __LOCATION__, name="PRINT", &
description="Printing of information during the SCF.", repeats=.FALSE.)
CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
description="Controls the dumping of the MO restart file during SCF. "// &
"By default keeps a short history of three restarts. "// &
"See also RESTART_HISTORY", &
print_level=low_print_level, common_iter_levels=3, &
each_iter_names=s2a("QS_SCF"), each_iter_values=(/20/), &
add_last=add_last_numeric, filename="RESTART")
CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
description="Specifies the maximum number of backup copies.", &
usage="BACKUP_COPIES {int}", &
default_i_val=1)
CALL section_add_keyword(print_key, keyword)
CALL keyword_release(keyword)
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create( &
print_key, __LOCATION__, "RESTART_HISTORY", &
description="Dumps unique MO restart files during the run keeping all of them.", &
print_level=low_print_level, common_iter_levels=0, &
each_iter_names=s2a("__ROOT__", "MD", "GEO_OPT", "ROT_OPT", "NEB", "METADYNAMICS", "QS_SCF"), &
each_iter_values=(/500, 500, 500, 500, 500, 500, 500/), &
filename="RESTART")
CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
description="Specifies the maximum number of backup copies.", &
usage="BACKUP_COPIES {int}", &
default_i_val=1)
CALL section_add_keyword(print_key, keyword)
CALL keyword_release(keyword)
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "iteration_info", &
description="Controls the printing of basic iteration information during the SCF.", &
print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL keyword_create(keyword, __LOCATION__, name="time_cumul", &
description="If the printkey is activated switches the printing of timings"// &
" to cumulative (over the SCF).", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(print_key, keyword)
CALL keyword_release(keyword)
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
description="Controls the printing of basic information during the SCF.", &
print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "MO_ORTHONORMALITY", &
description="Controls the printing relative to the orthonormality of MOs (CT S C).", &
print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "MO_MAGNITUDE", &
description="Prints the min/max eigenvalues of the overlap of the MOs without S (CT C).", &
print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "detailed_energy", &
description="Controls the printing of detailed energy information.", &
print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "diis_info", &
description="Controls the printing of DIIS information.", &
print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "total_densities", &
description="Controls the printing of total densities.", &
print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "Lanczos", &
description="Controls the printing of information on Lanczos refinement iterations.", &
print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create( &
print_key, __LOCATION__, "DIAG_SUB_SCF", &
description="Controls the printing of information on subspace diagonalization internal loop. ", &
print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "Davidson", &
description="Controls the printing of information on Davidson iterations.", &
print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL cp_print_key_section_create(print_key, __LOCATION__, "FILTER_MATRIX", &
description="Controls the printing of information on Filter Matrix method.", &
print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)
CALL keyword_create(keyword, __LOCATION__, name="DM_RESTART_WRITE", &
description="Write the density matrix into a binary file at the end of the SCF.", &
usage="DM_RESTART_WRITE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(subsection, keyword)
CALL keyword_release(keyword)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
END SUBROUTINE create_scf_section
! **************************************************************************************************
!> \brief creates the structure of the section with SCF parameters
!> controlling an other loop
!> \param section will contain the SCF section
!> \author Joost VandeVondele [2006.03]
! **************************************************************************************************
SUBROUTINE create_outer_scf_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
TYPE(section_type), POINTER :: subsection
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="OUTER_SCF", &
description="parameters controlling the outer SCF loop", &
n_keywords=13, n_subsections=1, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
description="controls the activation of the outer SCF loop", &
usage="&OUTER_SCF ON", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
! add CDFT_OPT section
NULLIFY (subsection)
CALL create_cdft_opt_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)
CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
description="Specifies which kind of outer SCF should be employed", &
usage="TYPE DDAPC_CONSTRAINT ", &
default_i_val=outer_scf_none, &
enum_c_vals=s2a("DDAPC_CONSTRAINT", "S2_CONSTRAINT", &
"BASIS_CENTER_OPT", "CDFT_CONSTRAINT", "NONE"), &
enum_desc=s2a("Enforce a constraint on the DDAPC, requires the corresponding section", &
"Enforce a constraint on the S2, requires the corresponding section", &
"Optimize positions of basis functions, if atom types FLOATING_BASIS_CENTER "// &
"are defined", &
"Enforce a constraint on a generic CDFT weight population. "// &
"Requires the corresponding section QS&CDFT"// &
" which determines the type of weight used.", &
"Do nothing in the outer loop, useful for resetting the inner loop,"), &
enum_i_vals=(/outer_scf_ddapc_constraint, outer_scf_s2_constraint, &
outer_scf_basis_center_opt, outer_scf_cdft_constraint, outer_scf_none/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="OPTIMIZER", &
description="Method used to bring the outer loop to a stationary point", &
usage="OPTIMIZER SD", &
default_i_val=outer_scf_optimizer_none, &
enum_c_vals=s2a("SD", "DIIS", "NONE", "BISECT", "BROYDEN", "NEWTON", "SECANT", "NEWTON_LS"), &
enum_desc=s2a("Takes steps in the direction of the gradient, multiplied by step_size", &
"Uses a Direct Inversion in the Iterative Subspace method", &
"Do nothing, useful only with the none type", &
"Bisection of the gradient, useful for difficult one dimensional cases", &
"Broyden's method. Variant defined in BROYDEN_TYPE.", &
"Newton's method. Only compatible with CDFT constraints.", &
"Secant method. Only for one dimensional cases. See Broyden for "// &
"multidimensional cases.", &
"Newton's method with backtracking line search to find the optimal step size. "// &
"Only compatible with CDFT constraints. Starts from the regular Newton solution "// &
"and successively reduces the step size until the L2 norm of the CDFT gradient "// &
"decreases or MAX_LS steps is reached. Potentially very expensive because "// &
"each iteration performs a full SCF calculation."), &
enum_i_vals=(/outer_scf_optimizer_sd, outer_scf_optimizer_diis, outer_scf_optimizer_none, &
outer_scf_optimizer_bisect, outer_scf_optimizer_broyden, &
outer_scf_optimizer_newton, outer_scf_optimizer_secant, &
outer_scf_optimizer_newton_ls/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BISECT_TRUST_COUNT", &
description="Maximum number of times the same point will be used in bisection,"// &
" a small number guards against the effect of wrongly converged states.", &
usage="BISECT_TRUST_COUNT 5", default_i_val=10)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_SCF", &
description="The target gradient of the outer SCF variables. "// &
"Notice that the EPS_SCF of the inner loop also determines "// &
"the value that can be reached in the outer loop, "// &
"typically EPS_SCF of the outer loop must be smaller "// &
"than or equal to EPS_SCF of the inner loop.", &
usage="EPS_SCF 1.0E-6 ", default_r_val=1.0E-5_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="DIIS_BUFFER_LENGTH", &
description="Maximum number of DIIS vectors used ", &
usage="DIIS_BUFFER_LENGTH 5", default_i_val=3)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EXTRAPOLATION_ORDER", &
description="Number of past states used in the extrapolation of the variables during e.g. MD", &
usage="EXTRAPOLATION_ORDER 5", default_i_val=3)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_SCF", &
description="The maximum number of outer loops ", &
usage="MAX_SCF 20", default_i_val=50)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="STEP_SIZE", &
description="The initial step_size used in the optimizer (currently steepest descent). "// &
"Note that in cases where a sadle point is sought for (constrained DFT),"// &
" this can be negative. For Newton and Broyden optimizers, use a value less/higher than "// &
"the default 1.0 (in absolute value, the sign is not significant) to active an under/overrelaxed "// &
"optimizer.", &
usage="STEP_SIZE -1.0", default_r_val=0.5_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_outer_scf_section
! **************************************************************************************************
!> \brief makes the orbital transformation section
!> \param section ...
!> \par History
!> 11.2004 created [Joost VandeVondele]
! **************************************************************************************************
SUBROUTINE create_ot_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="OT", &
description="Sets the various options for the orbital transformation (OT) method. "// &
"Default settings already provide an efficient, yet robust method. "// &
"Most systems benefit from using the FULL_ALL preconditioner "// &
"combined with a small value (0.001) of ENERGY_GAP. "// &
"Well-behaved systems might benefit from using a DIIS minimizer. "//newline//newline// &
"**Advantages:** "// &
"It's fast, because no expensive diagonalisation is performed. "// &
"If preconditioned correctly, method guaranteed to find minimum. "//newline//newline// &
"**Disadvantages:** "// &
"Sensitive to preconditioning. A good preconditioner can be expensive. "// &
"No smearing, or advanced SCF mixing possible: POOR convergence for metallic systems.", &
n_keywords=27, n_subsections=0, repeats=.FALSE., &
citations=(/VandeVondele2003, Weber2008/))
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
description="controls the activation of the ot method", &
usage="&OT T", &
default_l_val=.FALSE., &
lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ALGORITHM", &
description="Algorithm to be used for OT", &
usage="ALGORITHM STRICT", &
default_i_val=ot_algo_taylor_or_diag, &
enum_c_vals=s2a("STRICT", "IRAC"), &
enum_desc=s2a("Strict orthogonality: Taylor or diagonalization based algorithm.", &
"Orbital Transformation based Iterative Refinement "// &
"of the Approximative Congruence transformation (OT/IR)."), &
enum_i_vals=(/ot_algo_taylor_or_diag, ot_algo_irac/), &
citations=(/VandeVondele2003, VandeVondele2005a, Weber2008/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="IRAC_DEGREE", &
description="The refinement polynomial degree (2, 3 or 4).", &
usage="IRAC_DEGREE 4", &
default_i_val=4)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_IRAC", &
description="Maximum allowed refinement iteration.", &
usage="MAX_IRAC 5", &
default_i_val=50)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ORTHO_IRAC", &
description="The orthogonality method.", &
usage="ORTHO_IRAC POLY", &
default_i_val=ot_chol_irac, &
enum_c_vals=s2a("CHOL", "POLY", "LWDN"), &
enum_desc=s2a("Cholesky.", "Polynomial.", "Loewdin."), &
enum_i_vals=(/ot_chol_irac, ot_poly_irac, ot_lwdn_irac/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_IRAC_FILTER_MATRIX", &
description="Sets the threshold for filtering the matrices.", &
usage="EPS_IRAC_FILTER_MATRIX 1.0E-5", &
default_r_val=0.0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_IRAC", &
description="Targeted accuracy during the refinement iteration.", &
usage="EPS_IRAC 1.0E-5", &
default_r_val=1.0E-10_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_IRAC_QUICK_EXIT", &
description="Only one extra refinement iteration is "// &
"done when the norm is below this value.", &
usage="EPS_IRAC_QUICK_EXIT 1.0E-2", &
default_r_val=1.0E-5_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_IRAC_SWITCH", &
description="The algorithm switches to the polynomial "// &
"refinement when the norm is below this value.", &
usage="EPS_IRAC_SWITCH 1.0E-3", &
default_r_val=1.0E-2_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ON_THE_FLY_LOC", &
description="On the fly localization of the molecular orbitals. "// &
"Can only be used with OT/IRAC.", &
usage="ON_THE_FLY_LOC T", &
default_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="MINIMIZER", &
description="Minimizer to be used with the OT method", &
usage="MINIMIZER DIIS", &
default_i_val=ot_mini_cg, &
enum_c_vals=s2a("SD", "CG", "DIIS", "BROYDEN"), &
enum_desc=s2a("Steepest descent: not recommended", "Conjugate Gradients: most reliable, use for difficult systems."// &
" The total energy should decrease at every OT CG step if the line search is appropriate.", &
"Direct inversion in the iterative subspace: less reliable than CG, but sometimes about 50% faster", &
"Broyden mixing approximating the inverse Hessian"), &
enum_i_vals=(/ot_mini_sd, ot_mini_cg, ot_mini_diis, ot_mini_broyden/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="SAFE_DIIS", &
variants=(/"SAFER_DIIS"/), &
description="Reject DIIS steps if they point away from the"// &
" minimum, do SD in that case.", &
usage="SAFE_DIIS ON", default_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="N_HISTORY_VEC", &
variants=s2a("NDIIS", "N_DIIS", "N_BROYDEN"), &
description="Number of history vectors to be used with DIIS or BROYDEN", &
usage="N_DIIS 4", &
default_i_val=7)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_BETA", &
description="Underrelaxation for the broyden mixer", &
usage="BROYDEN_BETA 0.9", &
default_r_val=0.9_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_GAMMA", &
description="Backtracking parameter", &
usage="BROYDEN_GAMMA 0.5", &
default_r_val=0.5_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_SIGMA", &
description="Curvature of energy functional.", &
usage="BROYDEN_SIGMA 0.25", &
default_r_val=0.25_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_ETA", &
description="Dampening of estimated energy curvature.", &
usage="BROYDEN_ETA 0.7", &
default_r_val=0.7_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_OMEGA", &
description="Growth limit of curvature.", &
usage="BROYDEN_OMEGA 1.1", &
default_r_val=1.1_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_SIGMA_DECREASE", &
description="Reduction of curvature on bad approximation.", &
usage="BROYDEN_SIGMA_DECREASE 0.7", &
default_r_val=0.7_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_SIGMA_MIN", &
description="Minimum adaptive curvature.", &
usage="BROYDEN_SIGMA_MIN 0.05", &
default_r_val=0.05_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_FORGET_HISTORY", &
description="Forget history on bad approximation", &
usage="BROYDEN_FORGET_HISTORY OFF", default_l_val=.FALSE., &
lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_ADAPTIVE_SIGMA", &
description="Enable adaptive curvature estimation", &
usage="BROYDEN_ADAPTIVE_SIGMA ON", default_l_val=.TRUE., &
lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_ENABLE_FLIP", &
description="Ensure positive definite update", &
usage="BROYDEN_ENABLE_FLIP ON", default_l_val=.TRUE., &
lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="LINESEARCH", &
variants=(/"LINE_SEARCH"/), &
description="1D line search algorithm to be used with the OT minimizer,"// &
" in increasing order of robustness and cost. MINIMIZER CG combined with"// &
" LINESEARCH GOLD should always find an electronic minimum."// &
" Whereas the 2PNT minimizer is almost always OK, 3PNT might be needed for systems"// &
" in which successive OT CG steps do not decrease the total energy.", &
usage="LINESEARCH GOLD", &
default_i_val=ls_2pnt, &
enum_c_vals=s2a("NONE", "2PNT", "3PNT", "GOLD"), &
enum_desc=s2a("take fixed length steps", "extrapolate based on 2 points", &
"... or on 3 points", "perform 1D golden section search of the minimum (very expensive)"), &
enum_i_vals=(/ls_none, ls_2pnt, ls_3pnt, ls_gold/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="STEPSIZE", &
description="Initial stepsize used for the line search, sometimes this parameter can be reduced to stabilize DIIS"// &
" or to improve the CG behavior in the first few steps."// &
" The optimal value depends on the quality of the preconditioner."// &
" A negative values leaves the choice to CP2K depending on the preconditioner.", &
usage="STEPSIZE 0.4", &
default_r_val=-1.0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="GOLD_TARGET", &
description="Target relative uncertainty in the location of the minimum for LINESEARCH GOLD", &
usage="GOLD_TARGET 0.1", &
default_r_val=0.01_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="PRECONDITIONER", &
description="Type of preconditioner to be used with all minimization schemes. "// &
"They differ in effectiveness, cost of construction, cost of application. "// &
"Properly preconditioned minimization can be orders of magnitude faster than doing nothing.", &
usage="PRECONDITIONER FULL_ALL", &
default_i_val=ot_precond_full_kinetic, &
enum_c_vals=s2a("FULL_ALL", "FULL_SINGLE_INVERSE", "FULL_SINGLE", "FULL_KINETIC", "FULL_S_INVERSE", &
"NONE"), &
enum_desc=s2a("Most effective state selective preconditioner based on diagonalization, "// &
"requires the ENERGY_GAP parameter to be an underestimate of the HOMO-LUMO gap. "// &
"This preconditioner is recommended for almost all systems, except very large systems where "// &
"make_preconditioner would dominate the total computational cost.", &
"Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "// &
"but cheaper to construct, "// &
"might be somewhat less robust. Recommended for large systems.", &
"Based on H-eS diagonalisation, not as good as FULL_ALL, but somewhat cheaper to apply. ", &
"Cholesky inversion of S and T, fast construction, robust, and relatively good, "// &
"use for very large systems.", &
"Cholesky inversion of S, not as good as FULL_KINETIC, yet equally expensive.", &
"skip preconditioning"), &
enum_i_vals=(/ot_precond_full_all, ot_precond_full_single_inverse, ot_precond_full_single, &
ot_precond_full_kinetic, ot_precond_s_inverse, ot_precond_none/), &
citations=(/VandeVondele2003, Weber2008, Schiffmann2015/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="CHOLESKY", &
description="If FULL_ALL the cholesky decomposition of the S matrix is used. "// &
"Options on the algorithm to be used.", &
usage="CHOLESKY REDUCE", default_i_val=cholesky_reduce, &
enum_c_vals=s2a("OFF", "REDUCE", "RESTORE", "INVERSE", "INVERSE_DBCSR"), &
enum_desc=s2a("The cholesky algorithm is not used", "Reduce is called", &
"Reduce is replaced by two restore", &
"Restore uses operator multiply by inverse of the triangular matrix", &
"Like inverse, but matrix stored as dbcsr, sparce matrix algebra used when possible"), &
enum_i_vals=(/cholesky_off, cholesky_reduce, cholesky_restore, cholesky_inverse, cholesky_dbcsr/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="PRECOND_SOLVER", &
description="How the preconditioner is applied to the residual.", &
usage="PRECOND_SOLVER DIRECT", &
default_i_val=ot_precond_solver_default, &
enum_c_vals=s2a("DEFAULT", "DIRECT", "INVERSE_CHOLESKY", "INVERSE_UPDATE"), &
enum_desc=s2a("the default", "Cholesky decomposition followed by triangular solve "// &
"(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
"Cholesky decomposition followed by explicit inversion "// &
"(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
"Performs a Hotelling update of the inverse if a previous preconditioner is present. "// &
"Mainly useful for GPU accelerated systems (works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)"), &
enum_i_vals=(/ot_precond_solver_default, &
ot_precond_solver_direct, &
ot_precond_solver_inv_chol, &
ot_precond_solver_update/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="ENERGY_GAP", &
description="Should be an estimate for the energy gap [a.u.] (HOMO-LUMO) and is used in preconditioning, "// &
"especially effective with the FULL_ALL preconditioner, in which case it should be an underestimate "// &
"of the gap (can be a small number, e.g. 0.002)."// &
" FULL_SINGLE_INVERSE takes it as lower bound (values below 0.05 can cause stability issues)."// &
" In general, higher values will tame the preconditioner in case of poor initial guesses."// &
" A negative value will leave the choice to CP2K depending on type of preconditioner.", &
usage="ENERGY_GAP 0.001", &
default_r_val=-1.0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="EPS_TAYLOR", &
variants=(/"EPSTAYLOR"/), &
description="Target accuracy of the taylor expansion for the matrix functions, should normally be kept as is.", &
usage="EPS_TAYLOR 1.0E-15", &
default_r_val=1.0E-16_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create( &
keyword, __LOCATION__, name="MAX_TAYLOR", &
description="Maximum order of the Taylor expansion before diagonalisation is preferred, for large parallel runs"// &
" a slightly higher order could sometimes result in a small speedup.", &
usage="MAX_TAYLOR 5", &
default_i_val=4)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ROTATION", &
description="Introduce additional variables so that rotations of the occupied"// &
" subspace are allowed as well, only needed for cases where the energy is not invariant under"// &
" a rotation of the occupied subspace such as non-singlet restricted calculations"// &
" or fractional occupations.", &
usage="ROTATION", lone_keyword_l_val=.TRUE., &
default_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ENERGIES", &
description="Optimize orbital energies for use in Fermi-Dirac smearing "// &
"(requires ROTATION and FD smearing to be active).", &
usage="ENERGIES", lone_keyword_l_val=.TRUE., &
default_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="OCCUPATION_PRECONDITIONER", &
description="Preconditioner with the occupation numbers (FD smearing)", &
usage="OCCUPATION_PRECONDITIONER", lone_keyword_l_val=.TRUE., &
default_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="NONDIAG_ENERGY", &
description="Add a non-diagonal energy penalty (FD smearing)", &
usage="NONDIAG_ENERGY", lone_keyword_l_val=.TRUE., &
default_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="NONDIAG_ENERGY_STRENGTH", &
description="The prefactor for the non-diagonal energy penalty (FD smearing)", &
usage="NONDIAG_ENERGY_STRENGTH", default_r_val=1.0_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_ot_section
! **************************************************************************************************
!> \brief creates the diagonalization section
!> \param section ...
!> \par History
!> 10.2008 created [JGH]
! **************************************************************************************************
SUBROUTINE create_diagonalization_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
TYPE(section_type), POINTER :: subsection
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="DIAGONALIZATION", &
description="Set up type and parameters for Kohn-Sham matrix diagonalization.", &
n_keywords=0, n_subsections=1, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
description="controls the activation of the diagonalization method", &
usage="&DIAGONALIZATION T", &
default_l_val=.FALSE., &
lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="ALGORITHM", &
description="Algorithm to be used for diagonalization", &
usage="ALGORITHM STANDARD", &
default_i_val=diag_standard, &
enum_c_vals=s2a("STANDARD", "OT", "LANCZOS", "DAVIDSON", "FILTER_MATRIX"), &
enum_desc=s2a("Standard diagonalization: LAPACK methods or Jacobi.", &
"Iterative diagonalization using OT method", &
"Block Krylov-space approach to self-consistent diagonalisation", &
"Preconditioned blocked Davidson", &
"Filter matrix diagonalization"), &
enum_i_vals=(/diag_standard, diag_ot, diag_block_krylov, diag_block_davidson, &
diag_filter_matrix/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="JACOBI_THRESHOLD", &
description="Controls the accuracy of the pseudo-diagonalization method using Jacobi rotations", &
usage="JACOBI_THRESHOLD 1.0E-6", &
default_r_val=1.0E-7_dp, &
citations=(/Stewart1982/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_JACOBI", &
description="Below this threshold value for the SCF convergence the pseudo-diagonalization "// &
"method using Jacobi rotations is activated. This method is much faster than a "// &
"real diagonalization and it is even speeding up while achieving full convergence. "// &
"However, it needs a pre-converged wavefunction obtained by at least one real "// &
"diagonalization which is further optimized while keeping the original eigenvalue "// &
"spectrum. The MO eigenvalues are NOT updated. The method might be useful to speed "// &
"up calculations for large systems e.g. using a semi-empirical method.", &
usage="EPS_JACOBI 1.0E-5", &
default_r_val=0.0_dp, &
citations=(/Stewart1982/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_ADAPT", &
description="Required accuracy in iterative diagonalization as compared to current SCF convergence", &
usage="EPS_ADAPT 0.01", &
default_r_val=0._dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
description="Maximum number of iterations in iterative diagonalization", &
usage="MAX_ITER 20", &
default_i_val=2)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
description="Required accuracy in iterative diagonalization", &
usage="EPS_ITER 1.e-8", &
default_r_val=1.e-8_dp)