-
Notifications
You must be signed in to change notification settings - Fork 1
/
qs_kind_types.F
3566 lines (3274 loc) · 164 KB
/
qs_kind_types.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 Define the quickstep kind type and their sub types
!> \author Ole Schuett
!>
!> <b>Modification history:</b>
!> - 01.2002 creation [MK]
!> - 04.2002 added pao [fawzi]
!> - 09.2002 adapted for POL/KG use [GT]
!> - 02.2004 flexible normalization of basis sets [jgh]
!> - 03.2004 attach/detach routines [jgh]
!> - 10.2004 removed pao [fawzi]
!> - 08.2014 separated qs-related stuff from atomic_kind_types.F [Ole Schuett]
!> - 07.2015 new container for basis sets [jgh]
!> - 04.2021 init dft_plus_u_type [MK]
! **************************************************************************************************
MODULE qs_kind_types
USE atom_sgp, ONLY: atom_sgp_potential_type,&
atom_sgp_release,&
sgp_construction
USE atom_types, ONLY: atom_ecppot_type,&
lmat,&
read_ecp_potential
USE atom_upf, ONLY: atom_read_upf,&
atom_release_upf,&
atom_upfpot_type
USE atomic_kind_types, ONLY: atomic_kind_type,&
get_atomic_kind
USE basis_set_container_types, ONLY: add_basis_set_to_container,&
basis_set_container_type,&
get_basis_from_container,&
remove_basis_from_container,&
remove_basis_set_container
USE basis_set_types, ONLY: &
allocate_gto_basis_set, allocate_sto_basis_set, combine_basis_sets, &
create_gto_from_sto_basis, deallocate_sto_basis_set, get_gto_basis_set, &
gto_basis_set_type, init_aux_basis_set, init_orb_basis_set, read_gto_basis_set, &
read_sto_basis_set, sto_basis_set_type, write_gto_basis_set, write_orb_basis_set
USE cp_control_types, ONLY: dft_control_type,&
qs_control_type,&
xtb_control_type
USE cp_log_handling, ONLY: cp_get_default_logger,&
cp_logger_get_default_io_unit,&
cp_logger_type
USE cp_output_handling, ONLY: cp_p_file,&
cp_print_key_finished_output,&
cp_print_key_should_output,&
cp_print_key_unit_nr
USE external_potential_types, ONLY: &
all_potential_type, allocate_potential, deallocate_potential, get_potential, &
gth_potential_type, init_potential, local_potential_type, read_potential, &
set_default_all_potential, set_potential, sgp_potential_type, write_potential
USE gapw_1c_basis_set, ONLY: create_1c_basis
USE input_constants, ONLY: &
do_method_am1, do_method_dftb, do_method_mndo, do_method_mndod, do_method_pdg, &
do_method_pm3, do_method_pm6, do_method_pm6fm, do_method_pnnl, do_method_pw, &
do_method_rm1, do_method_xtb, do_qs, do_sirius, gapw_1c_large, gapw_1c_medium, &
gapw_1c_orb, gapw_1c_small, gapw_1c_very_large
USE input_section_types, ONLY: section_vals_get,&
section_vals_get_subs_vals,&
section_vals_type,&
section_vals_val_get
USE kinds, ONLY: default_path_length,&
default_string_length,&
dp
USE mathconstants, ONLY: pi
USE message_passing, ONLY: mp_para_env_type
USE orbital_pointers, ONLY: init_orbital_pointers,&
nco,&
ncoset
USE paw_proj_set_types, ONLY: allocate_paw_proj_set,&
deallocate_paw_proj_set,&
get_paw_proj_set,&
paw_proj_set_type,&
projectors
USE periodic_table, ONLY: get_ptable_info,&
ptable
USE physcon, ONLY: angstrom,&
bohr,&
evolt
USE qs_dftb_types, ONLY: qs_dftb_atom_type
USE qs_dftb_utils, ONLY: deallocate_dftb_atom_param,&
get_dftb_atom_param,&
write_dftb_atom_param
USE qs_dispersion_types, ONLY: qs_atom_dispersion_type
USE qs_grid_atom, ONLY: allocate_grid_atom,&
deallocate_grid_atom,&
grid_atom_type
USE qs_harmonics_atom, ONLY: allocate_harmonics_atom,&
deallocate_harmonics_atom,&
harmonics_atom_type
USE semi_empirical_types, ONLY: get_se_param,&
semi_empirical_create,&
semi_empirical_release,&
semi_empirical_type,&
write_se_param
USE semi_empirical_utils, ONLY: init_se_param,&
se_param_set_default
USE soft_basis_set, ONLY: create_soft_basis
USE string_utilities, ONLY: uppercase
USE xtb_parameters, ONLY: xtb_set_kab
USE xtb_types, ONLY: deallocate_xtb_atom_param,&
get_xtb_atom_param,&
write_xtb_atom_param,&
xtb_atom_type
#include "./base/base_uses.f90"
IMPLICIT NONE
PRIVATE
! Global parameters (only in this module)
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_kind_types'
! **************************************************************************************************
!> \brief Input parameters for the DFT+U method
! **************************************************************************************************
TYPE dft_plus_u_type
INTEGER :: l = -1
INTEGER :: n = -1
INTEGER :: max_scf = -1
REAL(KIND=dp) :: eps_u_ramping = 0.0_dp
REAL(KIND=dp) :: eps_scf = HUGE(0.0_dp)
REAL(KIND=dp) :: u_minus_j_target = 0.0_dp
REAL(KIND=dp) :: u_minus_j = 0.0_dp
REAL(KIND=dp) :: u_ramping = 0.0_dp
REAL(KIND=dp) :: U = 0.0_dp
REAL(KIND=dp) :: J = 0.0_dp
REAL(KIND=dp) :: alpha = 0.0_dp
REAL(KIND=dp) :: beta = 0.0_dp
REAL(KIND=dp) :: J0 = 0.0_dp
REAL(KIND=dp) :: occupation = -1.0_dp
INTEGER, DIMENSION(:), POINTER :: orbitals => Null()
LOGICAL :: init_u_ramping_each_scf = .FALSE.
LOGICAL :: smear = .FALSE.
REAL(KIND=dp), DIMENSION(:), POINTER :: nelec => Null()
END TYPE dft_plus_u_type
! **************************************************************************************************
!> \brief Holds information about a PAO potential
! **************************************************************************************************
TYPE pao_potential_type
INTEGER :: maxl = -1
REAL(KIND=dp) :: beta = 0.0_dp
REAL(KIND=dp) :: weight = 0.0_dp
INTEGER :: max_projector = -1
REAL(KIND=dp) :: beta_radius = HUGE(dp)
END TYPE pao_potential_type
! **************************************************************************************************
!> \brief Holds information about a PAO descriptor
! **************************************************************************************************
TYPE pao_descriptor_type
REAL(KIND=dp) :: beta = 0.0_dp
REAL(KIND=dp) :: beta_radius = HUGE(dp)
REAL(KIND=dp) :: weight = 0.0_dp
REAL(KIND=dp) :: screening = 0.0_dp
REAL(KIND=dp) :: screening_radius = HUGE(dp)
END TYPE pao_descriptor_type
! **************************************************************************************************
!> \brief Provides all information about a quickstep kind
! **************************************************************************************************
TYPE qs_kind_type
CHARACTER(LEN=default_string_length) :: name = ""
CHARACTER(LEN=2) :: element_symbol = ""
INTEGER :: natom = -1
TYPE(all_potential_type), POINTER :: all_potential => Null()
TYPE(local_potential_type), POINTER :: tnadd_potential => Null()
TYPE(gth_potential_type), POINTER :: gth_potential => Null()
TYPE(sgp_potential_type), POINTER :: sgp_potential => Null()
TYPE(semi_empirical_type), POINTER :: se_parameter => Null()
TYPE(qs_dftb_atom_type), POINTER :: dftb_parameter => Null()
TYPE(xtb_atom_type), POINTER :: xtb_parameter => Null()
!
TYPE(atom_upfpot_type), POINTER :: upf_potential => Null()
!
TYPE(basis_set_container_type), &
DIMENSION(20) :: basis_sets = basis_set_container_type()
! Atomic radii
REAL(KIND=dp) :: covalent_radius = 0.0_dp
REAL(KIND=dp) :: vdw_radius = 0.0_dp
! GAPW specific data
TYPE(paw_proj_set_type), POINTER :: paw_proj_set => Null()
REAL(KIND=dp) :: hard_radius = 0.8_dp*bohr ! for hard and soft exp
REAL(KIND=dp) :: hard0_radius = 0.8_dp*bohr ! for hard exp of rho0
REAL(KIND=dp) :: max_rad_local = 13.2_dp*bohr ! max GTO radius used in GAPW
LOGICAL :: paw_atom = .FALSE. ! needs atomic rho1
LOGICAL :: gpw_type_forced = .FALSE. ! gpw atom even if with hard exponents
!
LOGICAL :: ghost = .FALSE.
LOGICAL :: floating = .FALSE.
INTEGER :: lmax_dftb = -1
REAL(KIND=dp) :: dudq_dftb3 = 0.0_dp
REAL(KIND=dp) :: magnetization = 0.0_dp
INTEGER, DIMENSION(:, :), POINTER :: addel => Null()
INTEGER, DIMENSION(:, :), POINTER :: laddel => Null()
INTEGER, DIMENSION(:, :), POINTER :: naddel => Null()
TYPE(harmonics_atom_type), POINTER :: harmonics => Null()
TYPE(grid_atom_type), POINTER :: grid_atom => Null()
INTEGER :: ngrid_rad = 50
INTEGER :: ngrid_ang = 50
INTEGER :: lmax_rho0 = 0
INTEGER :: mao = -1
INTEGER, DIMENSION(:), POINTER :: elec_conf => Null() ! used to set up the initial atomic guess
LOGICAL :: bs_occupation = .FALSE.
TYPE(dft_plus_u_type), POINTER :: dft_plus_u => Null()
LOGICAL :: no_optimize = .TRUE.
!
REAL(KIND=dp), DIMENSION(:, :), POINTER :: nlcc_pot => Null()
!
TYPE(qs_atom_dispersion_type), POINTER :: dispersion => Null()
REAL(KIND=dp), DIMENSION(:, :), POINTER :: reltmat => Null()
INTEGER :: pao_basis_size = -1
CHARACTER(LEN=default_path_length) :: pao_model_file = ""
TYPE(pao_potential_type), DIMENSION(:), POINTER :: pao_potentials => Null()
TYPE(pao_descriptor_type), DIMENSION(:), POINTER :: pao_descriptors => Null()
END TYPE qs_kind_type
! **************************************************************************************************
!> \brief Provides a vector of pointers of type qs_kind_type
! **************************************************************************************************
TYPE qs_kind_p_type
TYPE(qs_kind_type), DIMENSION(:), &
POINTER :: qs_kind_set => NULL()
END TYPE qs_kind_p_type
! Public subroutines
PUBLIC :: check_qs_kind_set, &
deallocate_qs_kind_set, &
get_qs_kind, &
get_qs_kind_set, &
has_nlcc, &
init_qs_kind_set, &
init_gapw_basis_set, &
init_gapw_nlcc, &
create_qs_kind_set, &
set_qs_kind, &
write_qs_kind_set, &
write_gto_basis_sets, &
init_atom_electronic_state, set_pseudo_state
! Public data types
PUBLIC :: qs_kind_type, pao_potential_type, pao_descriptor_type
CONTAINS
! **************************************************************************************************
!> \brief Destructor routine for a set of qs kinds
!> \param qs_kind_set ...
!> \date 02.01.2002
!> \author Matthias Krack (MK)
!> \version 2.0
! **************************************************************************************************
SUBROUTINE deallocate_qs_kind_set(qs_kind_set)
TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
INTEGER :: ikind, nkind
IF (ASSOCIATED(qs_kind_set)) THEN
nkind = SIZE(qs_kind_set)
DO ikind = 1, nkind
IF (ASSOCIATED(qs_kind_set(ikind)%all_potential)) THEN
CALL deallocate_potential(qs_kind_set(ikind)%all_potential)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%tnadd_potential)) THEN
CALL deallocate_potential(qs_kind_set(ikind)%tnadd_potential)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%gth_potential)) THEN
CALL deallocate_potential(qs_kind_set(ikind)%gth_potential)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%sgp_potential)) THEN
CALL deallocate_potential(qs_kind_set(ikind)%sgp_potential)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%upf_potential)) THEN
CALL atom_release_upf(qs_kind_set(ikind)%upf_potential)
DEALLOCATE (qs_kind_set(ikind)%upf_potential)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%se_parameter)) THEN
CALL semi_empirical_release(qs_kind_set(ikind)%se_parameter)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%dftb_parameter)) THEN
CALL deallocate_dftb_atom_param(qs_kind_set(ikind)%dftb_parameter)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%xtb_parameter)) THEN
CALL deallocate_xtb_atom_param(qs_kind_set(ikind)%xtb_parameter)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%paw_proj_set)) THEN
CALL deallocate_paw_proj_set(qs_kind_set(ikind)%paw_proj_set)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%harmonics)) THEN
CALL deallocate_harmonics_atom(qs_kind_set(ikind)%harmonics)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%grid_atom)) THEN
CALL deallocate_grid_atom(qs_kind_set(ikind)%grid_atom)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%elec_conf)) THEN
DEALLOCATE (qs_kind_set(ikind)%elec_conf)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%dft_plus_u)) THEN
IF (ASSOCIATED(qs_kind_set(ikind)%dft_plus_u%orbitals)) THEN
DEALLOCATE (qs_kind_set(ikind)%dft_plus_u%orbitals)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%dft_plus_u%nelec)) THEN
DEALLOCATE (qs_kind_set(ikind)%dft_plus_u%nelec)
END IF
DEALLOCATE (qs_kind_set(ikind)%dft_plus_u)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%nlcc_pot)) THEN
DEALLOCATE (qs_kind_set(ikind)%nlcc_pot)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%dispersion)) THEN
DEALLOCATE (qs_kind_set(ikind)%dispersion)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%addel)) THEN
DEALLOCATE (qs_kind_set(ikind)%addel)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%naddel)) THEN
DEALLOCATE (qs_kind_set(ikind)%naddel)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%laddel)) THEN
DEALLOCATE (qs_kind_set(ikind)%laddel)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%reltmat)) THEN
DEALLOCATE (qs_kind_set(ikind)%reltmat)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%pao_potentials)) THEN
DEALLOCATE (qs_kind_set(ikind)%pao_potentials)
END IF
IF (ASSOCIATED(qs_kind_set(ikind)%pao_descriptors)) THEN
DEALLOCATE (qs_kind_set(ikind)%pao_descriptors)
END IF
CALL remove_basis_set_container(qs_kind_set(ikind)%basis_sets)
END DO
DEALLOCATE (qs_kind_set)
ELSE
CALL cp_abort(__LOCATION__, &
"The pointer qs_kind_set is not associated and "// &
"cannot be deallocated")
END IF
END SUBROUTINE deallocate_qs_kind_set
! **************************************************************************************************
!> \brief Get attributes of an atomic kind.
!> \param qs_kind ...
!> \param basis_set ...
!> \param basis_type ...
!> \param ncgf ...
!> \param nsgf ...
!> \param all_potential ...
!> \param tnadd_potential ...
!> \param gth_potential ...
!> \param sgp_potential ...
!> \param upf_potential ...
!> \param se_parameter ...
!> \param dftb_parameter ...
!> \param xtb_parameter ...
!> \param dftb3_param ...
!> \param zatom ...
!> \param zeff ...
!> \param elec_conf ...
!> \param mao ...
!> \param lmax_dftb ...
!> \param alpha_core_charge ...
!> \param ccore_charge ...
!> \param core_charge ...
!> \param core_charge_radius ...
!> \param paw_proj_set ...
!> \param paw_atom ...
!> \param hard_radius ...
!> \param hard0_radius ...
!> \param max_rad_local ...
!> \param covalent_radius ...
!> \param vdw_radius ...
!> \param gpw_type_forced ...
!> \param harmonics ...
!> \param max_iso_not0 ...
!> \param max_s_harm ...
!> \param grid_atom ...
!> \param ngrid_ang ...
!> \param ngrid_rad ...
!> \param lmax_rho0 ...
!> \param dft_plus_u_atom ...
!> \param l_of_dft_plus_u ...
!> \param n_of_dft_plus_u ...
!> \param u_minus_j ...
!> \param U_of_dft_plus_u ...
!> \param J_of_dft_plus_u ...
!> \param alpha_of_dft_plus_u ...
!> \param beta_of_dft_plus_u ...
!> \param J0_of_dft_plus_u ...
!> \param occupation_of_dft_plus_u ...
!> \param dispersion ...
!> \param bs_occupation ...
!> \param magnetization ...
!> \param no_optimize ...
!> \param addel ...
!> \param laddel ...
!> \param naddel ...
!> \param orbitals ...
!> \param max_scf ...
!> \param eps_scf ...
!> \param smear ...
!> \param u_ramping ...
!> \param u_minus_j_target ...
!> \param eps_u_ramping ...
!> \param init_u_ramping_each_scf ...
!> \param reltmat ...
!> \param ghost ...
!> \param floating ...
!> \param name ...
!> \param element_symbol ...
!> \param pao_basis_size ...
!> \param pao_model_file ...
!> \param pao_potentials ...
!> \param pao_descriptors ...
!> \param nelec ...
! **************************************************************************************************
SUBROUTINE get_qs_kind(qs_kind, &
basis_set, basis_type, ncgf, nsgf, &
all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, &
se_parameter, dftb_parameter, xtb_parameter, &
dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, &
alpha_core_charge, ccore_charge, core_charge, core_charge_radius, &
paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, &
covalent_radius, vdw_radius, &
gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, &
ngrid_ang, ngrid_rad, lmax_rho0, &
dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, &
u_minus_j, U_of_dft_plus_u, J_of_dft_plus_u, &
alpha_of_dft_plus_u, beta_of_dft_plus_u, J0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, &
bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, &
max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, &
init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, &
pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
TYPE(qs_kind_type) :: qs_kind
TYPE(gto_basis_set_type), OPTIONAL, POINTER :: basis_set
CHARACTER(len=*), OPTIONAL :: basis_type
INTEGER, INTENT(OUT), OPTIONAL :: ncgf, nsgf
TYPE(all_potential_type), OPTIONAL, POINTER :: all_potential
TYPE(local_potential_type), OPTIONAL, POINTER :: tnadd_potential
TYPE(gth_potential_type), OPTIONAL, POINTER :: gth_potential
TYPE(sgp_potential_type), OPTIONAL, POINTER :: sgp_potential
TYPE(atom_upfpot_type), OPTIONAL, POINTER :: upf_potential
TYPE(semi_empirical_type), OPTIONAL, POINTER :: se_parameter
TYPE(qs_dftb_atom_type), OPTIONAL, POINTER :: dftb_parameter
TYPE(xtb_atom_type), OPTIONAL, POINTER :: xtb_parameter
REAL(KIND=dp), INTENT(OUT), OPTIONAL :: dftb3_param
INTEGER, INTENT(OUT), OPTIONAL :: zatom
REAL(KIND=dp), INTENT(OUT), OPTIONAL :: zeff
INTEGER, DIMENSION(:), OPTIONAL, POINTER :: elec_conf
INTEGER, INTENT(OUT), OPTIONAL :: mao, lmax_dftb
REAL(KIND=dp), INTENT(OUT), OPTIONAL :: alpha_core_charge, ccore_charge, &
core_charge, core_charge_radius
TYPE(paw_proj_set_type), OPTIONAL, POINTER :: paw_proj_set
LOGICAL, INTENT(OUT), OPTIONAL :: paw_atom
REAL(KIND=dp), INTENT(OUT), OPTIONAL :: hard_radius, hard0_radius, &
max_rad_local, covalent_radius, &
vdw_radius
LOGICAL, INTENT(OUT), OPTIONAL :: gpw_type_forced
TYPE(harmonics_atom_type), OPTIONAL, POINTER :: harmonics
INTEGER, INTENT(OUT), OPTIONAL :: max_iso_not0, max_s_harm
TYPE(grid_atom_type), OPTIONAL, POINTER :: grid_atom
INTEGER, INTENT(OUT), OPTIONAL :: ngrid_ang, ngrid_rad, lmax_rho0
LOGICAL, INTENT(OUT), OPTIONAL :: dft_plus_u_atom
INTEGER, INTENT(OUT), OPTIONAL :: l_of_dft_plus_u, n_of_dft_plus_u
REAL(KIND=dp), INTENT(OUT), OPTIONAL :: u_minus_j, U_of_dft_plus_u, J_of_dft_plus_u, &
alpha_of_dft_plus_u, beta_of_dft_plus_u, J0_of_dft_plus_u, occupation_of_dft_plus_u
TYPE(qs_atom_dispersion_type), OPTIONAL, POINTER :: dispersion
LOGICAL, INTENT(OUT), OPTIONAL :: bs_occupation
REAL(KIND=dp), INTENT(OUT), OPTIONAL :: magnetization
LOGICAL, INTENT(OUT), OPTIONAL :: no_optimize
INTEGER, DIMENSION(:, :), OPTIONAL, POINTER :: addel, laddel, naddel
INTEGER, DIMENSION(:), OPTIONAL, POINTER :: orbitals
INTEGER, OPTIONAL :: max_scf
REAL(KIND=dp), OPTIONAL :: eps_scf
LOGICAL, OPTIONAL :: smear
REAL(KIND=dp), INTENT(OUT), OPTIONAL :: u_ramping, u_minus_j_target, &
eps_u_ramping
LOGICAL, OPTIONAL :: init_u_ramping_each_scf
REAL(KIND=dp), DIMENSION(:, :), OPTIONAL, POINTER :: reltmat
LOGICAL, OPTIONAL :: ghost, floating
CHARACTER(LEN=default_string_length), &
INTENT(OUT), OPTIONAL :: name
CHARACTER(LEN=2), INTENT(OUT), OPTIONAL :: element_symbol
INTEGER, INTENT(OUT), OPTIONAL :: pao_basis_size
CHARACTER(LEN=default_path_length), INTENT(OUT), &
OPTIONAL :: pao_model_file
TYPE(pao_potential_type), DIMENSION(:), OPTIONAL, &
POINTER :: pao_potentials
TYPE(pao_descriptor_type), DIMENSION(:), &
OPTIONAL, POINTER :: pao_descriptors
REAL(KIND=dp), DIMENSION(:), OPTIONAL, POINTER :: nelec
CHARACTER(LEN=default_string_length) :: my_basis_type
INTEGER :: l
LOGICAL :: found
TYPE(gto_basis_set_type), POINTER :: tmp_basis_set
! Retrieve basis set from the kind container
IF (PRESENT(basis_type)) THEN
my_basis_type = basis_type
ELSE
my_basis_type = "ORB"
END IF
IF (PRESENT(basis_set)) THEN
CALL get_basis_from_container(qs_kind%basis_sets, basis_set=basis_set, &
basis_type=my_basis_type)
END IF
IF (PRESENT(ncgf)) THEN
CALL get_basis_from_container(qs_kind%basis_sets, basis_set=tmp_basis_set, &
basis_type=my_basis_type)
IF (ASSOCIATED(tmp_basis_set)) THEN
CALL get_gto_basis_set(gto_basis_set=tmp_basis_set, ncgf=ncgf)
ELSE IF (ASSOCIATED(qs_kind%dftb_parameter)) THEN
l = qs_kind%dftb_parameter%lmax
ncgf = ((l + 1)*(l + 2)*(l + 3))/6
ELSE
ncgf = 0
END IF
END IF
IF (PRESENT(nsgf)) THEN
CALL get_basis_from_container(qs_kind%basis_sets, basis_set=tmp_basis_set, &
basis_type=my_basis_type)
IF (ASSOCIATED(tmp_basis_set)) THEN
CALL get_gto_basis_set(gto_basis_set=tmp_basis_set, nsgf=nsgf)
ELSE IF (ASSOCIATED(qs_kind%dftb_parameter)) THEN
nsgf = qs_kind%dftb_parameter%natorb
ELSE
nsgf = 0
END IF
END IF
IF (PRESENT(all_potential)) all_potential => qs_kind%all_potential
IF (PRESENT(tnadd_potential)) tnadd_potential => qs_kind%tnadd_potential
IF (PRESENT(gth_potential)) gth_potential => qs_kind%gth_potential
IF (PRESENT(sgp_potential)) sgp_potential => qs_kind%sgp_potential
IF (PRESENT(upf_potential)) upf_potential => qs_kind%upf_potential
IF (PRESENT(se_parameter)) se_parameter => qs_kind%se_parameter
IF (PRESENT(dftb_parameter)) dftb_parameter => qs_kind%dftb_parameter
IF (PRESENT(xtb_parameter)) xtb_parameter => qs_kind%xtb_parameter
IF (PRESENT(element_symbol)) element_symbol = qs_kind%element_symbol
IF (PRESENT(name)) name = qs_kind%name
IF (PRESENT(dftb3_param)) dftb3_param = qs_kind%dudq_dftb3
IF (PRESENT(elec_conf)) elec_conf => qs_kind%elec_conf
IF (PRESENT(alpha_core_charge)) THEN
IF (ASSOCIATED(qs_kind%all_potential)) THEN
CALL get_potential(potential=qs_kind%all_potential, &
alpha_core_charge=alpha_core_charge)
ELSE IF (ASSOCIATED(qs_kind%gth_potential)) THEN
CALL get_potential(potential=qs_kind%gth_potential, &
alpha_core_charge=alpha_core_charge)
ELSE IF (ASSOCIATED(qs_kind%sgp_potential)) THEN
CALL get_potential(potential=qs_kind%sgp_potential, &
alpha_core_charge=alpha_core_charge)
ELSE
alpha_core_charge = 1.0_dp
END IF
END IF
IF (PRESENT(ccore_charge)) THEN
IF (ASSOCIATED(qs_kind%all_potential)) THEN
CALL get_potential(potential=qs_kind%all_potential, &
ccore_charge=ccore_charge)
ELSE IF (ASSOCIATED(qs_kind%gth_potential)) THEN
CALL get_potential(potential=qs_kind%gth_potential, &
ccore_charge=ccore_charge)
ELSE IF (ASSOCIATED(qs_kind%sgp_potential)) THEN
CALL get_potential(potential=qs_kind%sgp_potential, &
ccore_charge=ccore_charge)
ELSE IF (ASSOCIATED(qs_kind%upf_potential)) THEN
CPABORT("UPF CCORE CHARGE RADIUS NOT AVAILABLE")
ELSE
ccore_charge = 0.0_dp
END IF
END IF
IF (PRESENT(core_charge_radius)) THEN
IF (ASSOCIATED(qs_kind%all_potential)) THEN
CALL get_potential(potential=qs_kind%all_potential, &
core_charge_radius=core_charge_radius)
ELSE IF (ASSOCIATED(qs_kind%gth_potential)) THEN
CALL get_potential(potential=qs_kind%gth_potential, &
core_charge_radius=core_charge_radius)
ELSE IF (ASSOCIATED(qs_kind%sgp_potential)) THEN
CALL get_potential(potential=qs_kind%sgp_potential, &
core_charge_radius=core_charge_radius)
ELSE IF (ASSOCIATED(qs_kind%upf_potential)) THEN
CPABORT("UPF CORE CHARGE RADIUS NOT AVAILABLE")
ELSE
core_charge_radius = 0.0_dp
END IF
END IF
IF (PRESENT(core_charge)) THEN
IF (ASSOCIATED(qs_kind%all_potential)) THEN
CALL get_potential(potential=qs_kind%all_potential, &
zeff=core_charge)
ELSE IF (ASSOCIATED(qs_kind%gth_potential)) THEN
CALL get_potential(potential=qs_kind%gth_potential, &
zeff=core_charge)
ELSE IF (ASSOCIATED(qs_kind%sgp_potential)) THEN
CALL get_potential(potential=qs_kind%sgp_potential, &
zeff=core_charge)
ELSE IF (ASSOCIATED(qs_kind%upf_potential)) THEN
CPABORT("UPF CORE CHARGE NOT AVAILABLE")
ELSE
core_charge = 0.0_dp
END IF
END IF
IF (PRESENT(zatom)) THEN
! Retrieve information on element
CALL get_ptable_info(qs_kind%element_symbol, ielement=zatom, found=found)
CPASSERT(found)
END IF
IF (PRESENT(zeff)) THEN
IF (ASSOCIATED(qs_kind%all_potential)) THEN
CALL get_potential(potential=qs_kind%all_potential, zeff=zeff)
ELSE IF (ASSOCIATED(qs_kind%gth_potential)) THEN
CALL get_potential(potential=qs_kind%gth_potential, zeff=zeff)
ELSE IF (ASSOCIATED(qs_kind%sgp_potential)) THEN
CALL get_potential(potential=qs_kind%sgp_potential, zeff=zeff)
ELSE IF (ASSOCIATED(qs_kind%upf_potential)) THEN
zeff = qs_kind%upf_potential%zion
ELSE
zeff = 0.0_dp
END IF
END IF
IF (PRESENT(covalent_radius)) covalent_radius = qs_kind%covalent_radius
IF (PRESENT(vdw_radius)) vdw_radius = qs_kind%vdw_radius
IF (PRESENT(paw_proj_set)) paw_proj_set => qs_kind%paw_proj_set
IF (PRESENT(paw_atom)) paw_atom = qs_kind%paw_atom
IF (PRESENT(gpw_type_forced)) gpw_type_forced = qs_kind%gpw_type_forced
IF (PRESENT(hard_radius)) hard_radius = qs_kind%hard_radius
IF (PRESENT(hard0_radius)) hard0_radius = qs_kind%hard0_radius
IF (PRESENT(max_rad_local)) max_rad_local = qs_kind%max_rad_local
IF (PRESENT(harmonics)) harmonics => qs_kind%harmonics
IF (PRESENT(max_s_harm)) THEN
IF (ASSOCIATED(qs_kind%harmonics)) THEN
max_s_harm = qs_kind%harmonics%max_s_harm
ELSE
max_s_harm = 0
END IF
END IF
IF (PRESENT(max_iso_not0)) THEN
IF (ASSOCIATED(qs_kind%harmonics)) THEN
max_iso_not0 = qs_kind%harmonics%max_iso_not0
ELSE
max_iso_not0 = 0
END IF
END IF
IF (PRESENT(grid_atom)) grid_atom => qs_kind%grid_atom
IF (PRESENT(ngrid_ang)) ngrid_ang = qs_kind%ngrid_ang
IF (PRESENT(ngrid_rad)) ngrid_rad = qs_kind%ngrid_rad
IF (PRESENT(lmax_rho0)) lmax_rho0 = qs_kind%lmax_rho0
IF (PRESENT(ghost)) ghost = qs_kind%ghost
IF (PRESENT(floating)) floating = qs_kind%floating
IF (PRESENT(dft_plus_u_atom)) dft_plus_u_atom = ASSOCIATED(qs_kind%dft_plus_u)
IF (PRESENT(l_of_dft_plus_u)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
l_of_dft_plus_u = qs_kind%dft_plus_u%l
ELSE
l_of_dft_plus_u = -1
END IF
END IF
IF (PRESENT(n_of_dft_plus_u)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
n_of_dft_plus_u = qs_kind%dft_plus_u%n
ELSE
n_of_dft_plus_u = -1
END IF
END IF
IF (PRESENT(u_minus_j)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
u_minus_j = qs_kind%dft_plus_u%u_minus_j
ELSE
u_minus_j = 0.0_dp
END IF
END IF
IF (PRESENT(u_minus_j_target)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
u_minus_j_target = qs_kind%dft_plus_u%u_minus_j_target
ELSE
u_minus_j_target = 0.0_dp
END IF
END IF
IF (PRESENT(U_of_dft_plus_u)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
U_of_dft_plus_u = qs_kind%dft_plus_u%U
ELSE
U_of_dft_plus_u = 0.0_dp
END IF
END IF
IF (PRESENT(J_of_dft_plus_u)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
J_of_dft_plus_u = qs_kind%dft_plus_u%J
ELSE
J_of_dft_plus_u = 0.0_dp
END IF
END IF
IF (PRESENT(alpha_of_dft_plus_u)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
alpha_of_dft_plus_u = qs_kind%dft_plus_u%alpha
ELSE
alpha_of_dft_plus_u = 0.0_dp
END IF
END IF
IF (PRESENT(beta_of_dft_plus_u)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
beta_of_dft_plus_u = qs_kind%dft_plus_u%beta
ELSE
beta_of_dft_plus_u = 0.0_dp
END IF
END IF
IF (PRESENT(J0_of_dft_plus_u)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
J0_of_dft_plus_u = qs_kind%dft_plus_u%J0
ELSE
J0_of_dft_plus_u = 0.0_dp
END IF
END IF
IF (PRESENT(occupation_of_dft_plus_u)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
occupation_of_dft_plus_u = qs_kind%dft_plus_u%occupation
ELSE
occupation_of_dft_plus_u = -1.0_dp
END IF
END IF
IF (PRESENT(init_u_ramping_each_scf)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
init_u_ramping_each_scf = qs_kind%dft_plus_u%init_u_ramping_each_scf
ELSE
init_u_ramping_each_scf = .FALSE.
END IF
END IF
IF (PRESENT(u_ramping)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
u_ramping = qs_kind%dft_plus_u%u_ramping
ELSE
u_ramping = 0.0_dp
END IF
END IF
IF (PRESENT(eps_u_ramping)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
eps_u_ramping = qs_kind%dft_plus_u%eps_u_ramping
ELSE
eps_u_ramping = 1.0E-5_dp
END IF
END IF
IF (PRESENT(nelec)) THEN
NULLIFY (nelec)
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u%nelec)) THEN
nelec => qs_kind%dft_plus_u%nelec
END IF
END IF
END IF
IF (PRESENT(orbitals)) THEN
NULLIFY (orbitals)
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u%orbitals)) THEN
orbitals => qs_kind%dft_plus_u%orbitals
END IF
END IF
END IF
IF (PRESENT(eps_scf)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
eps_scf = qs_kind%dft_plus_u%eps_scf
ELSE
eps_scf = 1.0E30_dp
END IF
END IF
IF (PRESENT(max_scf)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
max_scf = qs_kind%dft_plus_u%max_scf
ELSE
max_scf = -1
END IF
END IF
IF (PRESENT(smear)) THEN
IF (ASSOCIATED(qs_kind%dft_plus_u)) THEN
smear = qs_kind%dft_plus_u%smear
ELSE
smear = .FALSE.
END IF
END IF
IF (PRESENT(dispersion)) dispersion => qs_kind%dispersion
IF (PRESENT(bs_occupation)) bs_occupation = qs_kind%bs_occupation
IF (PRESENT(addel)) addel => qs_kind%addel
IF (PRESENT(laddel)) laddel => qs_kind%laddel
IF (PRESENT(naddel)) naddel => qs_kind%naddel
IF (PRESENT(magnetization)) magnetization = qs_kind%magnetization
IF (PRESENT(no_optimize)) no_optimize = qs_kind%no_optimize
IF (PRESENT(reltmat)) reltmat => qs_kind%reltmat
IF (PRESENT(mao)) mao = qs_kind%mao
IF (PRESENT(lmax_dftb)) lmax_dftb = qs_kind%lmax_dftb
IF (PRESENT(pao_basis_size)) pao_basis_size = qs_kind%pao_basis_size
IF (PRESENT(pao_model_file)) pao_model_file = qs_kind%pao_model_file
IF (PRESENT(pao_potentials)) pao_potentials => qs_kind%pao_potentials
IF (PRESENT(pao_descriptors)) pao_descriptors => qs_kind%pao_descriptors
END SUBROUTINE get_qs_kind
! **************************************************************************************************
!> \brief Get attributes of an atomic kind set.
!> \param qs_kind_set ...
!> \param all_potential_present ...
!> \param tnadd_potential_present ...
!> \param gth_potential_present ...
!> \param sgp_potential_present ...
!> \param paw_atom_present ...
!> \param dft_plus_u_atom_present ...
!> \param maxcgf ...
!> \param maxsgf ...
!> \param maxco ...
!> \param maxco_proj ...
!> \param maxgtops ...
!> \param maxlgto ...
!> \param maxlprj ...
!> \param maxnset ...
!> \param maxsgf_set ...
!> \param ncgf ...
!> \param npgf ...
!> \param nset ...
!> \param nsgf ...
!> \param nshell ...
!> \param maxpol ...
!> \param maxlppl ...
!> \param maxlppnl ...
!> \param maxppnl ...
!> \param nelectron ...
!> \param maxder ...
!> \param max_ngrid_rad ...
!> \param max_sph_harm ...
!> \param maxg_iso_not0 ...
!> \param lmax_rho0 ...
!> \param basis_rcut ...
!> \param basis_type ...
!> \param total_zeff_corr ... [SGh]
!> \param npgf_seg total number of primitive GTOs in "segmented contraction format"
! **************************************************************************************************
SUBROUTINE get_qs_kind_set(qs_kind_set, &
all_potential_present, tnadd_potential_present, gth_potential_present, &
sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, &
maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, &
ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, &
nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, &
basis_rcut, &
basis_type, total_zeff_corr, npgf_seg)
TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
LOGICAL, INTENT(OUT), OPTIONAL :: all_potential_present, tnadd_potential_present, &
gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present
INTEGER, INTENT(OUT), OPTIONAL :: maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, &
maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, &
maxppnl, nelectron
INTEGER, INTENT(IN), OPTIONAL :: maxder
INTEGER, INTENT(OUT), OPTIONAL :: max_ngrid_rad, max_sph_harm, &
maxg_iso_not0, lmax_rho0
REAL(KIND=dp), INTENT(OUT), OPTIONAL :: basis_rcut
CHARACTER(len=*), OPTIONAL :: basis_type
REAL(KIND=dp), INTENT(OUT), OPTIONAL :: total_zeff_corr
INTEGER, INTENT(OUT), OPTIONAL :: npgf_seg
CHARACTER(len=default_string_length) :: my_basis_type
INTEGER :: ikind, imax, lmax_rho0_kind, &
max_iso_not0, max_s_harm, n, &
ngrid_rad, nkind, nrloc(10), &
nrpot(1:15, 0:10)
LOGICAL :: dft_plus_u_atom, ecp_semi_local, paw_atom
REAL(KIND=dp) :: brcut, zeff, zeff_correction
TYPE(all_potential_type), POINTER :: all_potential
TYPE(gth_potential_type), POINTER :: gth_potential
TYPE(gto_basis_set_type), POINTER :: tmp_basis_set
TYPE(local_potential_type), POINTER :: tnadd_potential
TYPE(paw_proj_set_type), POINTER :: paw_proj_set
TYPE(qs_dftb_atom_type), POINTER :: dftb_parameter
TYPE(qs_kind_type), POINTER :: qs_kind
TYPE(sgp_potential_type), POINTER :: sgp_potential
IF (PRESENT(basis_type)) THEN
my_basis_type = basis_type
ELSE
my_basis_type = "ORB"
END IF
IF (ASSOCIATED(qs_kind_set)) THEN
IF (PRESENT(maxcgf)) maxcgf = 0
IF (PRESENT(maxco)) maxco = 0
IF (PRESENT(maxco_proj)) maxco_proj = 0
IF (PRESENT(maxg_iso_not0)) maxg_iso_not0 = 0
IF (PRESENT(maxgtops)) maxgtops = 0
IF (PRESENT(maxlgto)) maxlgto = -1
IF (PRESENT(maxlppl)) maxlppl = -1
IF (PRESENT(maxlppnl)) maxlppnl = -1
IF (PRESENT(maxpol)) maxpol = -1
IF (PRESENT(maxlprj)) maxlprj = -1
IF (PRESENT(maxnset)) maxnset = 0
IF (PRESENT(maxppnl)) maxppnl = 0
IF (PRESENT(maxsgf)) maxsgf = 0
IF (PRESENT(maxsgf_set)) maxsgf_set = 0
IF (PRESENT(ncgf)) ncgf = 0
IF (PRESENT(nelectron)) nelectron = 0
IF (PRESENT(npgf)) npgf = 0
IF (PRESENT(nset)) nset = 0
IF (PRESENT(nsgf)) nsgf = 0
IF (PRESENT(nshell)) nshell = 0
IF (PRESENT(all_potential_present)) all_potential_present = .FALSE.
IF (PRESENT(tnadd_potential_present)) tnadd_potential_present = .FALSE.
IF (PRESENT(gth_potential_present)) gth_potential_present = .FALSE.
IF (PRESENT(sgp_potential_present)) sgp_potential_present = .FALSE.
IF (PRESENT(paw_atom_present)) paw_atom_present = .FALSE.
IF (PRESENT(max_ngrid_rad)) max_ngrid_rad = 0
IF (PRESENT(max_sph_harm)) max_sph_harm = 0
IF (PRESENT(lmax_rho0)) lmax_rho0 = 0
IF (PRESENT(basis_rcut)) basis_rcut = 0.0_dp
IF (PRESENT(total_zeff_corr)) total_zeff_corr = 0.0_dp
IF (PRESENT(npgf_seg)) npgf_seg = 0
nkind = SIZE(qs_kind_set)
DO ikind = 1, nkind
qs_kind => qs_kind_set(ikind)
CALL get_qs_kind(qs_kind=qs_kind, &
all_potential=all_potential, &
tnadd_potential=tnadd_potential, &
gth_potential=gth_potential, &
sgp_potential=sgp_potential, &
paw_proj_set=paw_proj_set, &
dftb_parameter=dftb_parameter, &
ngrid_rad=ngrid_rad, &
max_s_harm=max_s_harm, &
max_iso_not0=max_iso_not0, &
paw_atom=paw_atom, &
dft_plus_u_atom=dft_plus_u_atom, &
lmax_rho0=lmax_rho0_kind)
IF (PRESENT(maxlppl) .AND. ASSOCIATED(gth_potential)) THEN
CALL get_potential(potential=gth_potential, nexp_ppl=n)
maxlppl = MAX(maxlppl, 2*(n - 1))
ELSEIF (PRESENT(maxlppl) .AND. ASSOCIATED(sgp_potential)) THEN
CALL get_potential(potential=sgp_potential, nrloc=nrloc, ecp_semi_local=ecp_semi_local)
n = MAXVAL(nrloc) - 2
maxlppl = MAX(maxlppl, 2*(n - 1))
IF (ecp_semi_local) THEN
CALL get_potential(potential=sgp_potential, sl_lmax=imax, nrpot=nrpot)
n = MAXVAL(nrpot) - 2
n = 2*(n - 1) + imax
maxlppl = MAX(maxlppl, n)
END IF
END IF
IF (PRESENT(maxlppnl) .AND. ASSOCIATED(gth_potential)) THEN
CALL get_potential(potential=gth_potential, lprj_ppnl_max=imax)
maxlppnl = MAX(maxlppnl, imax)
ELSEIF (PRESENT(maxlppnl) .AND. ASSOCIATED(sgp_potential)) THEN
CALL get_potential(potential=sgp_potential, lmax=imax)
maxlppnl = MAX(maxlppnl, imax)
END IF
IF (PRESENT(maxpol) .AND. ASSOCIATED(tnadd_potential)) THEN
CALL get_potential(potential=tnadd_potential, npol=n)
maxpol = MAX(maxpol, 2*(n - 1))
END IF
IF (PRESENT(maxco_proj) .AND. ASSOCIATED(paw_proj_set)) THEN
CALL get_paw_proj_set(paw_proj_set=paw_proj_set, ncgauprj=imax)
maxco_proj = MAX(maxco_proj, imax)
END IF