28
28
! * Read information about the valence charge density in the
29
29
! pseudopotential file and determine whether there are semicore
31
! (A further semicore analysis is 'autobasis')
31
! (A further semicore analysis is in 'autobasis')
32
32
! * Read the optional fdf blocks:
33
33
! AtomicMass (routine remass)
34
34
! PAO.BasisSize - Overrides the default 'basis_size' on a per-species basis.
35
! PAO.PolarizationScheme - Whether to use the standard perturbative approach
36
! for polarization orbitals, or to promote the shell
37
! to a stand-alone status.
35
38
! PAO.Basis - This is the most complex block, very flexible but in
36
39
! need of spelling-out the specific restrictions. Line by
80
83
! There are no 'per l-shell' polarization orbitals, except if the
81
84
! third character of 'basis_size' is 'p' (as in 'dzp'), in which
82
85
! case polarization orbitals are defined so they have the minimum
83
! angular momentum l such that there are not occupied orbitals
86
! angular momentum l such that there are no occupied orbitals
84
87
! with the same l in the valence shell of the ground-state
85
88
! atomic configuration. They polarize the corresponding l-1 shell.
89
! (See above for generation scheme)
87
91
! The Soft-Confinement parameters 'rinn' and 'vcte' are set to 0.0
88
92
! The Charge-Confinement parameters 'qcoe', 'qyuk' and 'qwid'
89
93
! are set to 0.0, 0.0 and 0.01
143
147
type(basis_def_t), pointer :: basp => null()
144
148
type(shell_t), pointer :: s => null()
149
type(shell_t), pointer :: polarized_shell_ptr
145
150
type(lshell_t), pointer :: ls => null()
146
151
type(kbshell_t), pointer :: k => null()
828
836
! Clean up for this species
831
! OK, now classify the states by l-shells
839
! OK, now classify the (l,n) states by l-shells
834
842
basp => basis_parameters(isp)
835
843
if (basp%lmxo .eq. -1) cycle !! Species not in block
845
polarized_shell_ptr => null()
837
846
allocate (basp%lshell(0:basp%lmxo))
838
848
loop_l: do l= 0, basp%lmxo
839
849
ls => basp%lshell(l)
840
850
call initialize(ls)
844
854
do ish= 1, basp%nshells_tmp
845
855
s => basp%tmp_shell(ish)
846
856
if (s%l .eq. l) nn=nn+1
858
if (basp%non_perturbative_polorbs) then
859
! Make room for a new one (explicit polarization orbital)
860
if (s%polarized .and. (s%l == (l-1))) nn=nn+1
849
864
if (nn.eq.0) then
857
872
do ish=1, basp%nshells_tmp
858
873
s => basp%tmp_shell(ish)
859
875
if (s%l .eq. l) then
861
877
call copy_shell(source=s,target=ls%shell(ind))
878
if (basp%non_perturbative_polorbs) then
879
if (s%polarized) then
880
! Save for later. There should be just one 'polarized' shell
881
polarized_shell_ptr => ls%shell(ind)
882
! Remove markers (in new objects)
883
ls%shell(ind)%polarized = .false.
884
ls%shell(ind)%was_polarized = .true.
885
ls%shell(ind)%nzeta_pol = 0
890
if (basp%non_perturbative_polorbs) then
891
if (s%polarized .and. (s%l == (l-1))) then
892
! Note that we have already seen this (parent) shell
893
! in the previous iteration of loop_l
895
! Copy again to inherit data
896
call copy_shell(source=s,target=ls%shell(ind))
897
ls%shell(ind)%n = -1 ! reset to find later
899
ls%shell(ind)%nzeta = s%nzeta_pol
900
ls%shell(ind)%nzeta_pol = 0
901
ls%shell(ind)%polarized = .false.
902
ls%shell(ind)%polarization_shell = .true.
903
ls%shell(ind)%shell_being_polarized =>
904
$ polarized_shell_ptr
905
polarized_shell_ptr => null()
906
! rc's, lambdas, etc, will remain as in s.
865
913
! If n was not specified, set it to ground state n
866
914
if (ls%shell(1)%n.eq.-1)
867
915
. ls%shell(1)%n=basp%ground_state%n(l)
883
931
integer, intent(in) :: is
888
934
basp=>basis_parameters(is)
889
935
if (basp%z .le. 0) return ! Leave it at -1 for floating orbs.
891
lmxkb = basp%lmxo + 1
893
! But watch out for polarization orbitals...
894
! We ASSUME that these do not count towards lshell%nn...
901
if (s%polarized) lpol = s%l + 1
904
if (lpol .gt. basp%lmxo) lmxkb = lpol + 1
937
lmxkb = basp%lmxo + 1 ! This now includes any polarization orbitals
906
939
write(6,'(3a,i1,/,2a,/,a)') 'For ', trim(basp%label),
907
940
. ', standard SIESTA heuristics set lmxkb to ',
961
994
end subroutine resizes
963
996
!-----------------------------------------------------------------------
997
subroutine read_polarization_scheme()
999
! Optionally read polarization orbital scheme for different species.
1001
type(block_fdf) :: bfdf
1002
type(parsed_line), pointer :: pline
1004
character(len=40) :: string
1005
logical :: non_perturbative_pols
1008
non_perturbative_pols =
1009
$ fdf_boolean('PAO.NonPerturbative.Polarization.Orbitals',
1013
basp=>basis_parameters(isp)
1014
basp%non_perturbative_polorbs = non_perturbative_pols
1018
if (fdf_block('PAO.PolarizationScheme',bfdf)) then
1019
do while(fdf_bline(bfdf,pline))
1020
if (.not. fdf_bmatch(pline,'nn'))
1021
. call die("Wrong format in PAO.PolarizationScheme")
1022
isp = label2species(fdf_bnames(pline,1))
1023
if (isp .eq. 0) then
1025
. "WRONG species symbol in PAO.PolarizationScheme:",
1026
. trim(fdf_bnames(pline,1))
1027
call die("Wrong species in PAO.PolarizationScheme")
1030
basp => basis_parameters(isp)
1031
string = fdf_bnames(pline,2)
1033
select case (trim(string))
1034
case ("non-perturbative")
1035
basp%non_perturbative_polorbs = .true.
1036
case ("perturbative")
1037
basp%non_perturbative_polorbs = .false.
1039
call die("Bad keyword in PAO.PolarizationScheme")
1046
end subroutine read_polarization_scheme
1048
!-----------------------------------------------------------------------
965
1050
subroutine relmxkb()
1158
1243
integer l, nzeta, nzeta_pol
1159
1244
integer :: nsemic_shells(0:3), nsh, i
1245
type(lshell_t), pointer :: ls_parent
1161
1247
loop: do isp=1, nsp
1162
1248
basp=>basis_parameters(isp)
1181
1267
if (nsemic_shells(l) > 0) basp%lmxo = max(l,basp%lmxo)
1270
! Check whether we need to consider larger l's due to
1271
! polarization orbitals (this is a new behavior -- in the
1272
! case of perturbative pol orbs, the highest-l shell will remain empty)
1273
! But lmxo in the 'specs' output will be correct, and not confusing
1275
if (basp%basis_size(3:3) .eq. 'p') then
1276
loop_pol: do l=1,4 ! Note that l starts at 1
1277
if ( (.not. basp%ground_state%occupied(l)) ) then
1278
basp%lmxo = max(l,basp%lmxo)
1186
1284
allocate (basp%lshell(0:basp%lmxo))
1188
1286
if (basp%basis_size(1:2) .eq. 'sz') nzeta = 1
1265
1365
allocate(s%lambda(1:s%nzeta))
1266
1366
s%rc(1:s%nzeta) = 0.0d0
1267
1367
s%lambda(1:s%nzeta) = 1.0d0
1369
! This option needs scale factors for multiple-z
1370
if (basp%basis_type.eq.'nonodes') then
1372
if (s%nzeta > 1) then
1373
write(6,"(a)") "WARNING: NONODES: " //
1374
$ "Default scale factors set for shell (x0.8)"
1377
s%lambda(i) = 0.8d0 * s%lambda(i-1)
1271
1383
if (basp%basis_size(3:3) .eq. 'p') then
1273
1385
! Polarization orbitals are defined so they have the minimum
1274
! angular momentum l such that there are not occupied orbitals
1386
! angular momentum l such that there are no occupied orbitals
1275
1387
! with the same l in the valence shell of the ground-state
1276
1388
! atomic configuration. They polarize the corresponding l-1
1292
1404
! For example, in Ti, p is not occupied in the GS
1293
1405
! The following code will mark the top-most s shell
1294
1406
! as polarizable
1296
if (.not. basp%ground_state%occupied(l)) then
1408
! Note that l goes from 1 to 4
1409
if ( (.not. basp%ground_state%occupied(l)) ) then
1411
if (basp%non_perturbative_polorbs) then
1413
nsh = size(ls%shell)
1414
! This can happen, for example, for Ge (3d is semicore,
1415
! but the polarization shell is 4d (from 4p)
1416
!if (nsh /= 1) call die("Empty l-shell with nsh>1?")
1419
allocate(s%rc(1:s%nzeta))
1420
allocate(s%lambda(1:s%nzeta))
1421
s%rc(1:s%nzeta) = 0.0d0
1422
s%lambda(1:s%nzeta) = 1.0d0
1424
s%polarization_shell = .true.
1426
ls_parent=> basp%lshell(l-1)
1427
nsh = size(ls_parent%shell) ! Parent is the last (l-1) shell
1428
s%shell_being_polarized => ls_parent%shell(nsh)
1429
! Now, reset the polarization flags of the parent
1430
ls_parent%shell(nsh)%polarized = .false.
1431
ls_parent%shell(nsh)%was_polarized = .true.
1432
ls_parent%shell(nsh)%nzeta_pol = 0
1434
EXIT loop_angmom ! Polarize only one shell!
1297
1438
ls=>basp%lshell(l-1)
1298
nsh = size(ls%shell) ! Use only the last shell
1439
nsh = size(ls%shell) ! Use only the last shell
1299
1440
s => ls%shell(nsh)
1301
1442
! Check whether shell to be polarized is occupied in the gs.
1302
1443
! (i.e., whether PAOs are going to be generated for it)
1303
1444
! If it is not, mark it for PAO generation anyway.