-
Notifications
You must be signed in to change notification settings - Fork 1
/
atom_types.F
3045 lines (2854 loc) · 119 KB
/
atom_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 atom type and its sub types
!> \author jgh
!> \date 03.03.2008
!> \version 1.0
!>
! **************************************************************************************************
MODULE atom_types
USE atom_upf, ONLY: atom_read_upf,&
atom_release_upf,&
atom_upfpot_type
USE bessel_lib, ONLY: bessel0
USE bibliography, ONLY: Limpanuparb2011,&
cite_reference
USE cp_linked_list_input, ONLY: cp_sll_val_next,&
cp_sll_val_type
USE cp_parser_methods, ONLY: parser_get_next_line,&
parser_get_object,&
parser_read_line,&
parser_search_string,&
parser_test_next_token
USE cp_parser_types, ONLY: cp_parser_type,&
parser_create,&
parser_release
USE input_constants, ONLY: &
barrier_conf, contracted_gto, do_analytic, do_gapw_log, do_nonrel_atom, do_numeric, &
do_potential_coulomb, do_potential_long, do_potential_mix_cl, do_potential_short, &
do_rks_atom, do_semi_analytic, ecp_pseudo, gaussian, geometrical_gto, gth_pseudo, no_conf, &
no_pseudo, numerical, poly_conf, sgp_pseudo, slater, upf_pseudo
USE input_section_types, ONLY: section_vals_get,&
section_vals_get_subs_vals,&
section_vals_list_get,&
section_vals_type,&
section_vals_val_get
USE input_val_types, ONLY: val_get,&
val_type
USE kinds, ONLY: default_string_length,&
dp
USE mathconstants, ONLY: dfac,&
fac,&
pi,&
rootpi
USE periodic_table, ONLY: get_ptable_info,&
ptable
USE qs_grid_atom, ONLY: allocate_grid_atom,&
create_grid_atom,&
deallocate_grid_atom,&
grid_atom_type
USE string_utilities, ONLY: remove_word,&
uppercase
#include "./base/base_uses.f90"
IMPLICIT NONE
PRIVATE
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'atom_types'
! maximum l-quantum number considered in atomic code/basis
INTEGER, PARAMETER :: lmat = 5
INTEGER, PARAMETER :: GTO_BASIS = 100, &
CGTO_BASIS = 101, &
STO_BASIS = 102, &
NUM_BASIS = 103
INTEGER, PARAMETER :: nmax = 25
!> \brief Provides all information about a basis set
! **************************************************************************************************
TYPE atom_basis_type
INTEGER :: basis_type = GTO_BASIS
INTEGER, DIMENSION(0:lmat) :: nbas = 0
INTEGER, DIMENSION(0:lmat) :: nprim = 0
REAL(KIND=dp), DIMENSION(:, :), POINTER :: am => NULL() !GTO exponents
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: cm => NULL() !Contraction coeffs
REAL(KIND=dp), DIMENSION(:, :), POINTER :: as => NULL() !STO exponents
INTEGER, DIMENSION(:, :), POINTER :: ns => NULL() !STO n-quantum numbers
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: bf => NULL() !num. bsf
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: dbf => NULL() !derivatives (num)
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: ddbf => NULL() !2nd derivatives (num)
REAL(KIND=dp) :: eps_eig = 0.0_dp
TYPE(grid_atom_type), POINTER :: grid => NULL()
LOGICAL :: geometrical = .FALSE.
REAL(KIND=dp) :: aval = 0.0_dp, cval = 0.0_dp
INTEGER, DIMENSION(0:lmat) :: start = 0
END TYPE atom_basis_type
!> \brief Provides all information about a pseudopotential
! **************************************************************************************************
TYPE atom_gthpot_type
CHARACTER(LEN=2) :: symbol = ""
CHARACTER(LEN=default_string_length) :: pname = ""
INTEGER, DIMENSION(0:lmat) :: econf = 0
REAL(dp) :: zion = 0.0_dp
REAL(dp) :: rc = 0.0_dp
INTEGER :: ncl = 0
REAL(dp), DIMENSION(5) :: cl = 0.0_dp
INTEGER, DIMENSION(0:lmat) :: nl = 0
REAL(dp), DIMENSION(0:lmat) :: rcnl = 0.0_dp
REAL(dp), DIMENSION(4, 4, 0:lmat) :: hnl = 0.0_dp
! type extensions
! NLCC
LOGICAL :: nlcc = .FALSE.
INTEGER :: nexp_nlcc = 0
REAL(KIND=dp), DIMENSION(10) :: alpha_nlcc = 0.0_dp
INTEGER, DIMENSION(10) :: nct_nlcc = 0
REAL(KIND=dp), DIMENSION(4, 10) :: cval_nlcc = 0.0_dp
! LSD potential
LOGICAL :: lsdpot = .FALSE.
INTEGER :: nexp_lsd = 0
REAL(KIND=dp), DIMENSION(10) :: alpha_lsd = 0.0_dp
INTEGER, DIMENSION(10) :: nct_lsd = 0
REAL(KIND=dp), DIMENSION(4, 10) :: cval_lsd = 0.0_dp
! extended local potential
LOGICAL :: lpotextended = .FALSE.
INTEGER :: nexp_lpot = 0
REAL(KIND=dp), DIMENSION(10) :: alpha_lpot = 0.0_dp
INTEGER, DIMENSION(10) :: nct_lpot = 0
REAL(KIND=dp), DIMENSION(4, 10) :: cval_lpot = 0.0_dp
END TYPE atom_gthpot_type
TYPE atom_ecppot_type
CHARACTER(LEN=2) :: symbol = ""
CHARACTER(LEN=default_string_length) :: pname = ""
INTEGER, DIMENSION(0:lmat) :: econf = 0
REAL(dp) :: zion = 0.0_dp
INTEGER :: lmax = 0
INTEGER :: nloc = 0 ! # terms
INTEGER, DIMENSION(1:15) :: nrloc = 0 ! r**(n-2)
REAL(dp), DIMENSION(1:15) :: aloc = 0.0_dp ! coefficient
REAL(dp), DIMENSION(1:15) :: bloc = 0.0_dp ! exponent
INTEGER, DIMENSION(0:10) :: npot = 0 ! # terms
INTEGER, DIMENSION(1:15, 0:10) :: nrpot = 0 ! r**(n-2)
REAL(dp), DIMENSION(1:15, 0:10) :: apot = 0.0_dp ! coefficient
REAL(dp), DIMENSION(1:15, 0:10) :: bpot = 0.0_dp ! exponent
END TYPE atom_ecppot_type
TYPE atom_sgppot_type
CHARACTER(LEN=2) :: symbol = ""
CHARACTER(LEN=default_string_length) :: pname = ""
INTEGER, DIMENSION(0:lmat) :: econf = 0
REAL(dp) :: zion = 0.0_dp
INTEGER :: lmax = 0
LOGICAL :: has_nonlocal = .FALSE.
INTEGER :: n_nonlocal = 0
LOGICAL, DIMENSION(0:5) :: is_nonlocal = .FALSE.
REAL(KIND=dp), DIMENSION(nmax) :: a_nonlocal = 0.0_dp
REAL(KIND=dp), DIMENSION(nmax, 0:lmat) :: h_nonlocal = 0.0_dp
REAL(KIND=dp), DIMENSION(nmax, nmax, 0:lmat) :: c_nonlocal = 0.0_dp
INTEGER :: n_local = 0
REAL(KIND=dp) :: ac_local = 0.0_dp
REAL(KIND=dp), DIMENSION(nmax) :: a_local = 0.0_dp
REAL(KIND=dp), DIMENSION(nmax) :: c_local = 0.0_dp
LOGICAL :: has_nlcc = .FALSE.
INTEGER :: n_nlcc = 0
REAL(KIND=dp), DIMENSION(nmax) :: a_nlcc = 0.0_dp
REAL(KIND=dp), DIMENSION(nmax) :: c_nlcc = 0.0_dp
END TYPE atom_sgppot_type
TYPE atom_potential_type
INTEGER :: ppot_type = 0
LOGICAL :: confinement = .FALSE.
INTEGER :: conf_type = 0
REAL(dp) :: acon = 0.0_dp
REAL(dp) :: rcon = 0.0_dp
REAL(dp) :: scon = 0.0_dp
TYPE(atom_gthpot_type) :: gth_pot = atom_gthpot_type()
TYPE(atom_ecppot_type) :: ecp_pot = atom_ecppot_type()
TYPE(atom_upfpot_type) :: upf_pot = atom_upfpot_type()
TYPE(atom_sgppot_type) :: sgp_pot = atom_sgppot_type()
END TYPE atom_potential_type
!> \brief Provides info about hartree-fock exchange (For now, we only support potentials that can be represented
!> with Coulomb and longrange-coulomb potential)
! **************************************************************************************************
TYPE atom_hfx_type
REAL(KIND=dp) :: scale_coulomb = 0.0_dp
REAL(KIND=dp) :: scale_longrange = 0.0_dp
REAL(KIND=dp) :: omega = 0.0_dp
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :, :) :: kernel
LOGICAL :: do_gh = .FALSE.
INTEGER :: nr_gh = 0
END TYPE atom_hfx_type
!> \brief Provides all information on states and occupation
! **************************************************************************************************
TYPE atom_state
REAL(KIND=dp), DIMENSION(0:lmat, 10) :: occ = 0.0_dp
REAL(KIND=dp), DIMENSION(0:lmat, 10) :: core = 0.0_dp
REAL(KIND=dp), DIMENSION(0:lmat, 10) :: occupation = 0.0_dp
INTEGER :: maxl_occ = 0
INTEGER, DIMENSION(0:lmat) :: maxn_occ = 0
INTEGER :: maxl_calc = 0
INTEGER, DIMENSION(0:lmat) :: maxn_calc = 0
INTEGER :: multiplicity = 0
REAL(KIND=dp), DIMENSION(0:lmat, 10) :: occa = 0.0_dp, occb = 0.0_dp
END TYPE atom_state
!> \brief Holds atomic integrals
! **************************************************************************************************
TYPE eri
REAL(KIND=dp), DIMENSION(:, :), POINTER :: int => NULL()
END TYPE eri
TYPE atom_integrals
INTEGER :: status = 0
INTEGER :: ppstat = 0
LOGICAL :: eri_coulomb = .FALSE.
LOGICAL :: eri_exchange = .FALSE.
LOGICAL :: all_nu = .FALSE.
INTEGER, DIMENSION(0:lmat) :: n = 0, nne = 0
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: ovlp => NULL(), kin => NULL(), core => NULL(), clsd => NULL()
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: utrans => NULL(), uptrans => NULL()
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: hnl => NULL()
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: conf => NULL()
TYPE(eri), DIMENSION(100) :: ceri = eri()
TYPE(eri), DIMENSION(100) :: eeri = eri()
INTEGER :: dkhstat = 0
INTEGER :: zorastat = 0
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: tzora => NULL()
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: hdkh => NULL()
END TYPE atom_integrals
!> \brief Holds atomic orbitals and energies
! **************************************************************************************************
TYPE atom_orbitals
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: wfn => NULL(), wfna => NULL(), wfnb => NULL()
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: pmat => NULL(), pmata => NULL(), pmatb => NULL()
REAL(KIND=dp), DIMENSION(:, :), POINTER :: ener => NULL(), enera => NULL(), enerb => NULL()
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: refene => NULL(), refchg => NULL(), refnod => NULL()
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: wrefene => NULL(), wrefchg => NULL(), wrefnod => NULL()
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: crefene => NULL(), crefchg => NULL(), crefnod => NULL()
REAL(KIND=dp), DIMENSION(:, :), POINTER :: wpsir0 => NULL(), tpsir0 => NULL()
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: rcmax => NULL()
CHARACTER(LEN=2), DIMENSION(:, :, :), POINTER :: reftype => NULL()
END TYPE atom_orbitals
!> \brief Operator matrices
! **************************************************************************************************
TYPE opmat_type
INTEGER, DIMENSION(0:lmat) :: n = 0
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: op => NULL()
END TYPE opmat_type
!> \brief Operator grids
! **************************************************************************************************
TYPE opgrid_type
REAL(KIND=dp), DIMENSION(:), POINTER :: op => NULL()
TYPE(grid_atom_type), POINTER :: grid => NULL()
END TYPE opgrid_type
!> \brief All energies
! **************************************************************************************************
TYPE atom_energy_type
REAL(KIND=dp) :: etot = 0.0_dp
REAL(KIND=dp) :: eband = 0.0_dp
REAL(KIND=dp) :: ekin = 0.0_dp
REAL(KIND=dp) :: epot = 0.0_dp
REAL(KIND=dp) :: ecore = 0.0_dp
REAL(KIND=dp) :: elsd = 0.0_dp
REAL(KIND=dp) :: epseudo = 0.0_dp
REAL(KIND=dp) :: eploc = 0.0_dp
REAL(KIND=dp) :: epnl = 0.0_dp
REAL(KIND=dp) :: exc = 0.0_dp
REAL(KIND=dp) :: ecoulomb = 0.0_dp
REAL(KIND=dp) :: eexchange = 0.0_dp
REAL(KIND=dp) :: econfinement = 0.0_dp
END TYPE atom_energy_type
!> \brief Information on optimization procedure
! **************************************************************************************************
TYPE atom_optimization_type
REAL(KIND=dp) :: damping = 0.0_dp
REAL(KIND=dp) :: eps_scf = 0.0_dp
REAL(KIND=dp) :: eps_diis = 0.0_dp
INTEGER :: max_iter = 0
INTEGER :: n_diis = 0
END TYPE atom_optimization_type
!> \brief Provides all information about an atomic kind
! **************************************************************************************************
TYPE atom_type
INTEGER :: z = 0
INTEGER :: zcore = 0
LOGICAL :: pp_calc = .FALSE.
! ZMP adding in type some variables
LOGICAL :: do_zmp = .FALSE., doread = .FALSE., read_vxc = .FALSE., dm = .FALSE.
CHARACTER(LEN=default_string_length) :: ext_file = "", ext_vxc_file = "", &
zmp_restart_file = ""
!
INTEGER :: method_type = do_rks_atom
INTEGER :: relativistic = do_nonrel_atom
INTEGER :: coulomb_integral_type = do_analytic
INTEGER :: exchange_integral_type = do_analytic
! ZMP
REAL(KIND=dp) :: lambda = 0.0_dp
REAL(KIND=dp) :: rho_diff_integral = 0.0_dp
REAL(KIND=dp) :: weight = 0.0_dp, zmpgrid_tol = 0.0_dp, zmpvxcgrid_tol = 0.0_dp
!
TYPE(atom_basis_type), POINTER :: basis => NULL()
TYPE(atom_potential_type), POINTER :: potential => NULL()
TYPE(atom_state), POINTER :: state => NULL()
TYPE(atom_integrals), POINTER :: integrals => NULL()
TYPE(atom_orbitals), POINTER :: orbitals => NULL()
TYPE(atom_energy_type) :: energy = atom_energy_type()
TYPE(atom_optimization_type) :: optimization = atom_optimization_type()
TYPE(section_vals_type), POINTER :: xc_section => NULL(), zmp_section => NULL()
TYPE(opmat_type), POINTER :: fmat => NULL()
TYPE(atom_hfx_type) :: hfx_pot = atom_hfx_type()
END TYPE atom_type
! **************************************************************************************************
TYPE atom_p_type
TYPE(atom_type), POINTER :: atom => NULL()
END TYPE atom_p_type
PUBLIC :: lmat
PUBLIC :: atom_p_type, atom_type, atom_basis_type, atom_state, atom_integrals
PUBLIC :: atom_orbitals, eri, atom_potential_type, atom_hfx_type
PUBLIC :: atom_gthpot_type, atom_ecppot_type, atom_sgppot_type
PUBLIC :: atom_optimization_type
PUBLIC :: atom_compare_grids
PUBLIC :: create_atom_type, release_atom_type, set_atom
PUBLIC :: create_atom_orbs, release_atom_orbs
PUBLIC :: init_atom_basis, init_atom_basis_default_pp, atom_basis_gridrep, release_atom_basis
PUBLIC :: init_atom_potential, release_atom_potential
PUBLIC :: read_atom_opt_section, read_ecp_potential
PUBLIC :: Clementi_geobas
PUBLIC :: GTO_BASIS, CGTO_BASIS, STO_BASIS, NUM_BASIS
PUBLIC :: opmat_type, create_opmat, release_opmat
PUBLIC :: opgrid_type, create_opgrid, release_opgrid
PUBLIC :: no_pseudo, gth_pseudo, sgp_pseudo, upf_pseudo, ecp_pseudo
PUBLIC :: setup_hf_section
! **************************************************************************************************
CONTAINS
! **************************************************************************************************
!> \brief Initialize the basis for the atomic code
!> \param basis ...
!> \param basis_section ...
!> \param zval ...
!> \param btyp ...
!> \note Highly accurate relativistic universal Gaussian basis set: Dirac-Fock-Coulomb calculations
!> for atomic systems up to nobelium
!> J. Chem. Phys. 101, 6829 (1994); DOI:10.1063/1.468311
!> G. L. Malli and A. B. F. Da Silva
!> Department of Chemistry, Simon Fraser University, Burnaby, B.C., Canada
!> Yasuyuki Ishikawa
!> Department of Chemistry, University of Puerto Rico, San Juan, Puerto Rico
!>
!> A universal Gaussian basis set is developed that leads to relativistic Dirac-Fock SCF energies
!> of comparable accuracy as that obtained by the accurate numerical finite-difference method
!> (GRASP2 package) [J. Phys. B 25, 1 (1992)]. The Gaussian-type functions of our universal basis
!> set satisfy the relativistic boundary conditions associated with the finite nuclear model for a
!> finite speed of light and conform to the so-called kinetic balance at the nonrelativistic limit.
!> We attribute the exceptionally high accuracy obtained in our calculations to the fact that the
!> representation of the relativistic dynamics of an electron in a spherical ball finite nucleus
!> near the origin in terms of our universal Gaussian basis set is as accurate as that provided by
!> the numerical finite-difference method. Results of the Dirac-Fock-Coulomb energies for a number
!> of atoms up to No (Z=102) and some negative ions are presented and compared with the recent
!> results obtained with the numerical finite-difference method and geometrical Gaussian basis sets
!> by Parpia, Mohanty, and Clementi [J. Phys. B 25, 1 (1992)]. The accuracy of our calculations is
!> estimated to be within a few parts in 109 for all the atomic systems studied.
! **************************************************************************************************
SUBROUTINE init_atom_basis(basis, basis_section, zval, btyp)
TYPE(atom_basis_type), INTENT(INOUT) :: basis
TYPE(section_vals_type), POINTER :: basis_section
INTEGER, INTENT(IN) :: zval
CHARACTER(LEN=2) :: btyp
INTEGER, PARAMETER :: nua = 40, nup = 16
REAL(KIND=dp), DIMENSION(nua), PARAMETER :: ugbs = (/0.007299_dp, 0.013705_dp, 0.025733_dp, &
0.048316_dp, 0.090718_dp, 0.170333_dp, 0.319819_dp, 0.600496_dp, 1.127497_dp, 2.117000_dp,&
3.974902_dp, 7.463317_dp, 14.013204_dp, 26.311339_dp, 49.402449_dp, 92.758561_dp, &
174.164456_dp, 327.013024_dp, 614.003114_dp, 1152.858743_dp, 2164.619772_dp, &
4064.312984_dp, 7631.197056_dp, 14328.416324_dp, 26903.186074_dp, 50513.706789_dp, &
94845.070265_dp, 178082.107320_dp, 334368.848683_dp, 627814.487663_dp, 1178791.123851_dp, &
2213310.684886_dp, 4155735.557141_dp, 7802853.046713_dp, 14650719.428954_dp, &
27508345.793637_dp, 51649961.080194_dp, 96978513.342764_dp, 182087882.613702_dp, &
341890134.751331_dp/)
CHARACTER(LEN=default_string_length) :: basis_fn, basis_name
INTEGER :: basistype, i, j, k, l, ll, m, ngp, nl, &
nr, nu, quadtype
INTEGER, DIMENSION(0:lmat) :: starti
INTEGER, DIMENSION(:), POINTER :: nqm, num_gto, num_slater, sindex
REAL(KIND=dp) :: al, amax, aval, cval, ear, pf, rk
REAL(KIND=dp), DIMENSION(:), POINTER :: expo
TYPE(section_vals_type), POINTER :: gto_basis_section
! btyp = AE : standard all-electron basis
! btyp = PP : standard pseudopotential basis
! btyp = AA : high accuracy all-electron basis
! btyp = AP : high accuracy pseudopotential basis
NULLIFY (basis%am, basis%cm, basis%as, basis%ns, basis%bf, basis%dbf, basis%ddbf)
! get information on quadrature type and number of grid points
! allocate and initialize the atomic grid
CALL allocate_grid_atom(basis%grid)
CALL section_vals_val_get(basis_section, "QUADRATURE", i_val=quadtype)
CALL section_vals_val_get(basis_section, "GRID_POINTS", i_val=ngp)
IF (ngp <= 0) &
CPABORT("# point radial grid < 0")
CALL create_grid_atom(basis%grid, ngp, 1, 1, 0, quadtype)
basis%grid%nr = ngp
basis%geometrical = .FALSE.
basis%aval = 0._dp
basis%cval = 0._dp
basis%start = 0
CALL section_vals_val_get(basis_section, "BASIS_TYPE", i_val=basistype)
CALL section_vals_val_get(basis_section, "EPS_EIGENVALUE", r_val=basis%eps_eig)
SELECT CASE (basistype)
CASE DEFAULT
CPABORT("")
CASE (gaussian)
basis%basis_type = GTO_BASIS
NULLIFY (num_gto)
CALL section_vals_val_get(basis_section, "NUM_GTO", i_vals=num_gto)
IF (num_gto(1) < 1) THEN
! use default basis
IF (btyp == "AE") THEN
nu = nua
ELSEIF (btyp == "PP") THEN
nu = nup
ELSE
nu = nua
END IF
basis%nbas = nu
basis%nprim = nu
ALLOCATE (basis%am(nu, 0:lmat))
DO i = 0, lmat
basis%am(1:nu, i) = ugbs(1:nu)
END DO
ELSE
basis%nbas = 0
DO i = 1, SIZE(num_gto)
basis%nbas(i - 1) = num_gto(i)
END DO
basis%nprim = basis%nbas
m = MAXVAL(basis%nbas)
ALLOCATE (basis%am(m, 0:lmat))
basis%am = 0._dp
DO l = 0, lmat
IF (basis%nbas(l) > 0) THEN
NULLIFY (expo)
SELECT CASE (l)
CASE DEFAULT
CPABORT("Atom Basis")
CASE (0)
CALL section_vals_val_get(basis_section, "S_EXPONENTS", r_vals=expo)
CASE (1)
CALL section_vals_val_get(basis_section, "P_EXPONENTS", r_vals=expo)
CASE (2)
CALL section_vals_val_get(basis_section, "D_EXPONENTS", r_vals=expo)
CASE (3)
CALL section_vals_val_get(basis_section, "F_EXPONENTS", r_vals=expo)
END SELECT
CPASSERT(SIZE(expo) >= basis%nbas(l))
DO i = 1, basis%nbas(l)
basis%am(i, l) = expo(i)
END DO
END IF
END DO
END IF
! initialize basis function on a radial grid
nr = basis%grid%nr
m = MAXVAL(basis%nbas)
ALLOCATE (basis%bf(nr, m, 0:lmat))
ALLOCATE (basis%dbf(nr, m, 0:lmat))
ALLOCATE (basis%ddbf(nr, m, 0:lmat))
basis%bf = 0._dp
basis%dbf = 0._dp
basis%ddbf = 0._dp
DO l = 0, lmat
DO i = 1, basis%nbas(l)
al = basis%am(i, l)
DO k = 1, nr
rk = basis%grid%rad(k)
ear = EXP(-al*basis%grid%rad(k)**2)
basis%bf(k, i, l) = rk**l*ear
basis%dbf(k, i, l) = (REAL(l, dp)*rk**(l - 1) - 2._dp*al*rk**(l + 1))*ear
basis%ddbf(k, i, l) = (REAL(l*(l - 1), dp)*rk**(l - 2) - &
2._dp*al*REAL(2*l + 1, dp)*rk**(l) + 4._dp*al*rk**(l + 2))*ear
END DO
END DO
END DO
CASE (geometrical_gto)
basis%basis_type = GTO_BASIS
NULLIFY (num_gto)
CALL section_vals_val_get(basis_section, "NUM_GTO", i_vals=num_gto)
IF (num_gto(1) < 1) THEN
IF (btyp == "AE") THEN
! use the Clementi extra large basis
CALL Clementi_geobas(zval, cval, aval, basis%nbas, starti)
ELSEIF (btyp == "PP") THEN
! use the Clementi extra large basis
CALL Clementi_geobas(zval, cval, aval, basis%nbas, starti)
ELSEIF (btyp == "AA") THEN
CALL Clementi_geobas(zval, cval, aval, basis%nbas, starti)
amax = cval**(basis%nbas(0) - 1)
basis%nbas(0) = NINT((LOG(amax)/LOG(1.6_dp)))
cval = 1.6_dp
starti = 0
basis%nbas(1) = basis%nbas(0) - 4
basis%nbas(2) = basis%nbas(0) - 8
basis%nbas(3) = basis%nbas(0) - 12
IF (lmat > 3) basis%nbas(4:lmat) = 0
ELSEIF (btyp == "AP") THEN
CALL Clementi_geobas(zval, cval, aval, basis%nbas, starti)
amax = 500._dp/aval
basis%nbas = NINT((LOG(amax)/LOG(1.6_dp)))
cval = 1.6_dp
starti = 0
ELSE
! use the Clementi extra large basis
CALL Clementi_geobas(zval, cval, aval, basis%nbas, starti)
END IF
basis%nprim = basis%nbas
ELSE
basis%nbas = 0
DO i = 1, SIZE(num_gto)
basis%nbas(i - 1) = num_gto(i)
END DO
basis%nprim = basis%nbas
NULLIFY (sindex)
CALL section_vals_val_get(basis_section, "START_INDEX", i_vals=sindex)
starti = 0
DO i = 1, SIZE(sindex)
starti(i - 1) = sindex(i)
CPASSERT(sindex(i) >= 0)
END DO
CALL section_vals_val_get(basis_section, "GEOMETRICAL_FACTOR", r_val=cval)
CALL section_vals_val_get(basis_section, "GEO_START_VALUE", r_val=aval)
END IF
m = MAXVAL(basis%nbas)
ALLOCATE (basis%am(m, 0:lmat))
basis%am = 0._dp
DO l = 0, lmat
DO i = 1, basis%nbas(l)
ll = i - 1 + starti(l)
basis%am(i, l) = aval*cval**(ll)
END DO
END DO
basis%geometrical = .TRUE.
basis%aval = aval
basis%cval = cval
basis%start = starti
! initialize basis function on a radial grid
nr = basis%grid%nr
m = MAXVAL(basis%nbas)
ALLOCATE (basis%bf(nr, m, 0:lmat))
ALLOCATE (basis%dbf(nr, m, 0:lmat))
ALLOCATE (basis%ddbf(nr, m, 0:lmat))
basis%bf = 0._dp
basis%dbf = 0._dp
basis%ddbf = 0._dp
DO l = 0, lmat
DO i = 1, basis%nbas(l)
al = basis%am(i, l)
DO k = 1, nr
rk = basis%grid%rad(k)
ear = EXP(-al*basis%grid%rad(k)**2)
basis%bf(k, i, l) = rk**l*ear
basis%dbf(k, i, l) = (REAL(l, dp)*rk**(l - 1) - 2._dp*al*rk**(l + 1))*ear
basis%ddbf(k, i, l) = (REAL(l*(l - 1), dp)*rk**(l - 2) - &
2._dp*al*REAL(2*l + 1, dp)*rk**(l) + 4._dp*al*rk**(l + 2))*ear
END DO
END DO
END DO
CASE (contracted_gto)
basis%basis_type = CGTO_BASIS
CALL section_vals_val_get(basis_section, "BASIS_SET_FILE_NAME", c_val=basis_fn)
CALL section_vals_val_get(basis_section, "BASIS_SET", c_val=basis_name)
gto_basis_section => section_vals_get_subs_vals(basis_section, "BASIS")
CALL read_basis_set(ptable(zval)%symbol, basis, basis_name, basis_fn, &
gto_basis_section)
! initialize basis function on a radial grid
nr = basis%grid%nr
m = MAXVAL(basis%nbas)
ALLOCATE (basis%bf(nr, m, 0:lmat))
ALLOCATE (basis%dbf(nr, m, 0:lmat))
ALLOCATE (basis%ddbf(nr, m, 0:lmat))
basis%bf = 0._dp
basis%dbf = 0._dp
basis%ddbf = 0._dp
DO l = 0, lmat
DO i = 1, basis%nprim(l)
al = basis%am(i, l)
DO k = 1, nr
rk = basis%grid%rad(k)
ear = EXP(-al*basis%grid%rad(k)**2)
DO j = 1, basis%nbas(l)
basis%bf(k, j, l) = basis%bf(k, j, l) + rk**l*ear*basis%cm(i, j, l)
basis%dbf(k, j, l) = basis%dbf(k, j, l) &
+ (REAL(l, dp)*rk**(l - 1) - 2._dp*al*rk**(l + 1))*ear*basis%cm(i, j, l)
basis%ddbf(k, j, l) = basis%ddbf(k, j, l) + &
(REAL(l*(l - 1), dp)*rk**(l - 2) - 2._dp*al*REAL(2*l + 1, dp)*rk**(l) + 4._dp*al*rk**(l + 2))* &
ear*basis%cm(i, j, l)
END DO
END DO
END DO
END DO
CASE (slater)
basis%basis_type = STO_BASIS
NULLIFY (num_slater)
CALL section_vals_val_get(basis_section, "NUM_SLATER", i_vals=num_slater)
IF (num_slater(1) < 1) THEN
CPABORT("")
ELSE
basis%nbas = 0
DO i = 1, SIZE(num_slater)
basis%nbas(i - 1) = num_slater(i)
END DO
basis%nprim = basis%nbas
m = MAXVAL(basis%nbas)
ALLOCATE (basis%as(m, 0:lmat), basis%ns(m, 0:lmat))
basis%as = 0._dp
basis%ns = 0
DO l = 0, lmat
IF (basis%nbas(l) > 0) THEN
NULLIFY (expo)
SELECT CASE (l)
CASE DEFAULT
CPABORT("Atom Basis")
CASE (0)
CALL section_vals_val_get(basis_section, "S_EXPONENTS", r_vals=expo)
CASE (1)
CALL section_vals_val_get(basis_section, "P_EXPONENTS", r_vals=expo)
CASE (2)
CALL section_vals_val_get(basis_section, "D_EXPONENTS", r_vals=expo)
CASE (3)
CALL section_vals_val_get(basis_section, "F_EXPONENTS", r_vals=expo)
END SELECT
CPASSERT(SIZE(expo) >= basis%nbas(l))
DO i = 1, basis%nbas(l)
basis%as(i, l) = expo(i)
END DO
NULLIFY (nqm)
SELECT CASE (l)
CASE DEFAULT
CPABORT("Atom Basis")
CASE (0)
CALL section_vals_val_get(basis_section, "S_QUANTUM_NUMBERS", i_vals=nqm)
CASE (1)
CALL section_vals_val_get(basis_section, "P_QUANTUM_NUMBERS", i_vals=nqm)
CASE (2)
CALL section_vals_val_get(basis_section, "D_QUANTUM_NUMBERS", i_vals=nqm)
CASE (3)
CALL section_vals_val_get(basis_section, "F_QUANTUM_NUMBERS", i_vals=nqm)
END SELECT
CPASSERT(SIZE(nqm) >= basis%nbas(l))
DO i = 1, basis%nbas(l)
basis%ns(i, l) = nqm(i)
END DO
END IF
END DO
END IF
! initialize basis function on a radial grid
nr = basis%grid%nr
m = MAXVAL(basis%nbas)
ALLOCATE (basis%bf(nr, m, 0:lmat))
ALLOCATE (basis%dbf(nr, m, 0:lmat))
ALLOCATE (basis%ddbf(nr, m, 0:lmat))
basis%bf = 0._dp
basis%dbf = 0._dp
basis%ddbf = 0._dp
DO l = 0, lmat
DO i = 1, basis%nbas(l)
al = basis%as(i, l)
nl = basis%ns(i, l)
pf = (2._dp*al)**nl*SQRT(2._dp*al/fac(2*nl))
DO k = 1, nr
rk = basis%grid%rad(k)
ear = rk**(nl - 1)*EXP(-al*rk)
basis%bf(k, i, l) = pf*ear
basis%dbf(k, i, l) = pf*(REAL(nl - 1, dp)/rk - al)*ear
basis%ddbf(k, i, l) = pf*(REAL((nl - 2)*(nl - 1), dp)/rk/rk &
- al*REAL(2*(nl - 1), dp)/rk + al*al)*ear
END DO
END DO
END DO
CASE (numerical)
basis%basis_type = NUM_BASIS
CPABORT("")
END SELECT
END SUBROUTINE init_atom_basis
! **************************************************************************************************
!> \brief ...
!> \param basis ...
! **************************************************************************************************
SUBROUTINE init_atom_basis_default_pp(basis)
TYPE(atom_basis_type), INTENT(INOUT) :: basis
INTEGER, PARAMETER :: nua = 40, nup = 20
REAL(KIND=dp), DIMENSION(nua), PARAMETER :: ugbs = (/0.007299_dp, 0.013705_dp, 0.025733_dp, &
0.048316_dp, 0.090718_dp, 0.170333_dp, 0.319819_dp, 0.600496_dp, 1.127497_dp, 2.117000_dp,&
3.974902_dp, 7.463317_dp, 14.013204_dp, 26.311339_dp, 49.402449_dp, 92.758561_dp, &
174.164456_dp, 327.013024_dp, 614.003114_dp, 1152.858743_dp, 2164.619772_dp, &
4064.312984_dp, 7631.197056_dp, 14328.416324_dp, 26903.186074_dp, 50513.706789_dp, &
94845.070265_dp, 178082.107320_dp, 334368.848683_dp, 627814.487663_dp, 1178791.123851_dp, &
2213310.684886_dp, 4155735.557141_dp, 7802853.046713_dp, 14650719.428954_dp, &
27508345.793637_dp, 51649961.080194_dp, 96978513.342764_dp, 182087882.613702_dp, &
341890134.751331_dp/)
INTEGER :: i, k, l, m, ngp, nr, nu, quadtype
REAL(KIND=dp) :: al, ear, rk
NULLIFY (basis%am, basis%cm, basis%as, basis%ns, basis%bf, basis%dbf, basis%ddbf)
! allocate and initialize the atomic grid
NULLIFY (basis%grid)
CALL allocate_grid_atom(basis%grid)
quadtype = do_gapw_log
ngp = 500
CALL create_grid_atom(basis%grid, ngp, 1, 1, 0, quadtype)
basis%grid%nr = ngp
basis%geometrical = .FALSE.
basis%aval = 0._dp
basis%cval = 0._dp
basis%start = 0
basis%eps_eig = 1.e-12_dp
basis%basis_type = GTO_BASIS
nu = nup
basis%nbas = nu
basis%nprim = nu
ALLOCATE (basis%am(nu, 0:lmat))
DO i = 0, lmat
basis%am(1:nu, i) = ugbs(1:nu)
END DO
! initialize basis function on a radial grid
nr = basis%grid%nr
m = MAXVAL(basis%nbas)
ALLOCATE (basis%bf(nr, m, 0:lmat))
ALLOCATE (basis%dbf(nr, m, 0:lmat))
ALLOCATE (basis%ddbf(nr, m, 0:lmat))
basis%bf = 0._dp
basis%dbf = 0._dp
basis%ddbf = 0._dp
DO l = 0, lmat
DO i = 1, basis%nbas(l)
al = basis%am(i, l)
DO k = 1, nr
rk = basis%grid%rad(k)
ear = EXP(-al*basis%grid%rad(k)**2)
basis%bf(k, i, l) = rk**l*ear
basis%dbf(k, i, l) = (REAL(l, dp)*rk**(l - 1) - 2._dp*al*rk**(l + 1))*ear
basis%ddbf(k, i, l) = (REAL(l*(l - 1), dp)*rk**(l - 2) - &
2._dp*al*REAL(2*l + 1, dp)*rk**(l) + 4._dp*al*rk**(l + 2))*ear
END DO
END DO
END DO
END SUBROUTINE init_atom_basis_default_pp
! **************************************************************************************************
!> \brief ...
!> \param basis ...
!> \param gbasis ...
!> \param r ...
!> \param rab ...
! **************************************************************************************************
SUBROUTINE atom_basis_gridrep(basis, gbasis, r, rab)
TYPE(atom_basis_type), INTENT(IN) :: basis
TYPE(atom_basis_type), INTENT(INOUT) :: gbasis
REAL(KIND=dp), DIMENSION(:), INTENT(IN) :: r, rab
INTEGER :: i, j, k, l, m, n1, n2, n3, ngp, nl, nr, &
quadtype
REAL(KIND=dp) :: al, ear, pf, rk
NULLIFY (gbasis%am, gbasis%cm, gbasis%as, gbasis%ns, gbasis%bf, gbasis%dbf, gbasis%ddbf)
! copy basis info
gbasis%basis_type = basis%basis_type
gbasis%nbas(0:lmat) = basis%nbas(0:lmat)
gbasis%nprim(0:lmat) = basis%nprim(0:lmat)
IF (ASSOCIATED(basis%am)) THEN
n1 = SIZE(basis%am, 1)
n2 = SIZE(basis%am, 2)
ALLOCATE (gbasis%am(n1, 0:n2 - 1))
gbasis%am = basis%am
END IF
IF (ASSOCIATED(basis%cm)) THEN
n1 = SIZE(basis%cm, 1)
n2 = SIZE(basis%cm, 2)
n3 = SIZE(basis%cm, 3)
ALLOCATE (gbasis%cm(n1, n2, 0:n3 - 1))
gbasis%cm = basis%cm
END IF
IF (ASSOCIATED(basis%as)) THEN
n1 = SIZE(basis%as, 1)
n2 = SIZE(basis%as, 2)
ALLOCATE (gbasis%as(n1, 0:n2 - 1))
gbasis%as = basis%as
END IF
IF (ASSOCIATED(basis%ns)) THEN
n1 = SIZE(basis%ns, 1)
n2 = SIZE(basis%ns, 2)
ALLOCATE (gbasis%ns(n1, 0:n2 - 1))
gbasis%ns = basis%ns
END IF
gbasis%eps_eig = basis%eps_eig
gbasis%geometrical = basis%geometrical
gbasis%aval = basis%aval
gbasis%cval = basis%cval
gbasis%start(0:lmat) = basis%start(0:lmat)
! get information on quadrature type and number of grid points
! allocate and initialize the atomic grid
NULLIFY (gbasis%grid)
CALL allocate_grid_atom(gbasis%grid)
ngp = SIZE(r)
quadtype = do_gapw_log
IF (ngp <= 0) &
CPABORT("# point radial grid < 0")
CALL create_grid_atom(gbasis%grid, ngp, 1, 1, 0, quadtype)
gbasis%grid%nr = ngp
gbasis%grid%rad(:) = r(:)
gbasis%grid%rad2(:) = r(:)*r(:)
gbasis%grid%wr(:) = rab(:)*gbasis%grid%rad2(:)
! initialize basis function on a radial grid
nr = gbasis%grid%nr
m = MAXVAL(gbasis%nbas)
ALLOCATE (gbasis%bf(nr, m, 0:lmat))
ALLOCATE (gbasis%dbf(nr, m, 0:lmat))
ALLOCATE (gbasis%ddbf(nr, m, 0:lmat))
gbasis%bf = 0._dp
gbasis%dbf = 0._dp
gbasis%ddbf = 0._dp
SELECT CASE (gbasis%basis_type)
CASE DEFAULT
CPABORT("")
CASE (GTO_BASIS)
DO l = 0, lmat
DO i = 1, gbasis%nbas(l)
al = gbasis%am(i, l)
DO k = 1, nr
rk = gbasis%grid%rad(k)
ear = EXP(-al*gbasis%grid%rad(k)**2)
gbasis%bf(k, i, l) = rk**l*ear
gbasis%dbf(k, i, l) = (REAL(l, dp)*rk**(l - 1) - 2._dp*al*rk**(l + 1))*ear
gbasis%ddbf(k, i, l) = (REAL(l*(l - 1), dp)*rk**(l - 2) - &
2._dp*al*REAL(2*l + 1, dp)*rk**(l) + 4._dp*al*rk**(l + 2))*ear
END DO
END DO
END DO
CASE (CGTO_BASIS)
DO l = 0, lmat
DO i = 1, gbasis%nprim(l)
al = gbasis%am(i, l)
DO k = 1, nr
rk = gbasis%grid%rad(k)
ear = EXP(-al*gbasis%grid%rad(k)**2)
DO j = 1, gbasis%nbas(l)
gbasis%bf(k, j, l) = gbasis%bf(k, j, l) + rk**l*ear*gbasis%cm(i, j, l)
gbasis%dbf(k, j, l) = gbasis%dbf(k, j, l) &
+ (REAL(l, dp)*rk**(l - 1) - 2._dp*al*rk**(l + 1))*ear*gbasis%cm(i, j, l)
gbasis%ddbf(k, j, l) = gbasis%ddbf(k, j, l) + &
(REAL(l*(l - 1), dp)*rk**(l - 2) - 2._dp*al*REAL(2*l + 1, dp)*rk**(l) + 4._dp*al*rk**(l + 2))* &
ear*gbasis%cm(i, j, l)
END DO
END DO
END DO
END DO
CASE (STO_BASIS)
DO l = 0, lmat
DO i = 1, gbasis%nbas(l)
al = gbasis%as(i, l)
nl = gbasis%ns(i, l)
pf = (2._dp*al)**nl*SQRT(2._dp*al/fac(2*nl))
DO k = 1, nr
rk = gbasis%grid%rad(k)
ear = rk**(nl - 1)*EXP(-al*rk)
gbasis%bf(k, i, l) = pf*ear
gbasis%dbf(k, i, l) = pf*(REAL(nl - 1, dp)/rk - al)*ear
gbasis%ddbf(k, i, l) = pf*(REAL((nl - 2)*(nl - 1), dp)/rk/rk &
- al*REAL(2*(nl - 1), dp)/rk + al*al)*ear
END DO
END DO
END DO
CASE (NUM_BASIS)
gbasis%basis_type = NUM_BASIS
CPABORT("")
END SELECT
END SUBROUTINE atom_basis_gridrep
! **************************************************************************************************
!> \brief ...
!> \param basis ...
! **************************************************************************************************
SUBROUTINE release_atom_basis(basis)
TYPE(atom_basis_type), INTENT(INOUT) :: basis
IF (ASSOCIATED(basis%am)) THEN
DEALLOCATE (basis%am)
END IF
IF (ASSOCIATED(basis%cm)) THEN
DEALLOCATE (basis%cm)
END IF
IF (ASSOCIATED(basis%as)) THEN
DEALLOCATE (basis%as)
END IF
IF (ASSOCIATED(basis%ns)) THEN
DEALLOCATE (basis%ns)
END IF
IF (ASSOCIATED(basis%bf)) THEN
DEALLOCATE (basis%bf)
END IF
IF (ASSOCIATED(basis%dbf)) THEN
DEALLOCATE (basis%dbf)
END IF
IF (ASSOCIATED(basis%ddbf)) THEN
DEALLOCATE (basis%ddbf)
END IF
CALL deallocate_grid_atom(basis%grid)
END SUBROUTINE release_atom_basis
! **************************************************************************************************
! **************************************************************************************************
!> \brief ...
!> \param atom ...
! **************************************************************************************************
SUBROUTINE create_atom_type(atom)
TYPE(atom_type), POINTER :: atom
CPASSERT(.NOT. ASSOCIATED(atom))
ALLOCATE (atom)
NULLIFY (atom%zmp_section)
NULLIFY (atom%xc_section)
NULLIFY (atom%fmat)
atom%do_zmp = .FALSE.
atom%doread = .FALSE.
atom%read_vxc = .FALSE.
atom%dm = .FALSE.
atom%hfx_pot%scale_coulomb = 0.0_dp
atom%hfx_pot%scale_longrange = 0.0_dp
atom%hfx_pot%omega = 0.0_dp
END SUBROUTINE create_atom_type
! **************************************************************************************************
!> \brief ...
!> \param atom ...
! **************************************************************************************************
SUBROUTINE release_atom_type(atom)
TYPE(atom_type), POINTER :: atom
CPASSERT(ASSOCIATED(atom))
NULLIFY (atom%basis)
NULLIFY (atom%integrals)
IF (ASSOCIATED(atom%state)) THEN
DEALLOCATE (atom%state)
END IF
IF (ASSOCIATED(atom%orbitals)) THEN
CALL release_atom_orbs(atom%orbitals)
END IF
IF (ASSOCIATED(atom%fmat)) CALL release_opmat(atom%fmat)
DEALLOCATE (atom)
END SUBROUTINE release_atom_type
! ZMP adding input variables in subroutine do_zmp,doread,read_vxc,method_type
! **************************************************************************************************
!> \brief ...
!> \param atom ...
!> \param basis ...
!> \param state ...
!> \param integrals ...
!> \param orbitals ...
!> \param potential ...
!> \param zcore ...
!> \param pp_calc ...
!> \param do_zmp ...
!> \param doread ...
!> \param read_vxc ...