26 use,
intrinsic :: iso_fortran_env
74 integer,
parameter,
public :: &
79 integer,
public,
parameter :: &
86 integer,
public,
parameter :: &
87 PROJ_J_INDEPENDENT = 0, & !< Non-relativisitic or scalar-relativistic pseudopotentials
91 integer,
parameter,
public :: INVALID_L = 333
93 character(len=4),
parameter :: ps_name(PSEUDO_FORMAT_UPF1:PSEUDO_FORMAT_PSP8) = &
94 (/
"upf1",
"upf2",
"qso ",
"psml",
"psf ",
"cpi ",
"fhi ",
"hgh ",
"psp8"/)
99 integer :: projector_type
100 integer :: relativistic_treatment
103 character(len=10),
private :: label
105 integer,
private :: ispin
107 real(real64),
private :: z
108 real(real64) :: z_val
109 type(valconf_t) :: conf
111 type(logrid_t),
private :: g
113 type(spline_t),
allocatable :: ur(:, :)
114 logical,
allocatable :: bound(:, :)
121 logical :: no_vl = .false.
123 real(real64) :: projectors_sphere_threshold
130 real(real64) :: rc_max
133 integer :: projectors_per_l(5)
134 real(real64),
allocatable :: h(:,:,:), k(:, :, :)
135 real(real64),
allocatable :: qij(:, :, :)
136 integer :: radial_augmentation_lmax = -1
137 integer :: radial_augmentation_nprojectors = 0
138 logical :: radial_augmentation_has_angular_channels = .false.
139 type(spline_t),
allocatable :: radial_augmentation(:, :)
140 type(spline_t),
allocatable :: kb(:, :)
141 type(spline_t),
allocatable :: dkb(:, :)
144 integer :: paw_nwavefunctions = 0
145 integer :: paw_augmentation_lmax = -1
147 real(real64) :: paw_core_energy =
m_zero
148 real(real64) :: paw_cutoff_radius =
m_zero
149 logical :: paw_has_ae_core = .false.
150 integer,
allocatable :: paw_l(:)
152 type(
spline_t),
allocatable :: paw_phi_ps(:)
153 logical :: paw_has_small = .false.
154 type(
spline_t),
allocatable :: paw_phi_ae_small(:)
162 real(real64),
allocatable :: paw_occ(:)
163 integer,
allocatable :: paw_2j(:)
164 integer :: paw_ncore = 0
166 integer,
allocatable :: paw_core_l(:)
167 real(real64),
allocatable :: paw_grid(:)
168 real(real64),
allocatable :: paw_rab(:)
169 real(real64),
allocatable :: paw_multipoles(:, :, :)
178 logical,
private :: has_long_range
179 logical,
private :: is_separated
184 real(real64) :: sigma_erf
186 logical,
private :: has_density
187 type(
spline_t),
allocatable :: density(:)
188 type(
spline_t),
allocatable :: density_der(:)
191 integer :: file_format
193 integer :: exchange_functional
194 integer :: correlation_functional
197 real(real64),
parameter ::
eps = 1.0e-8_real64
203 subroutine ps_init(ps, namespace, label, z, user_lmax, user_llocal, ispin, filename)
206 character(len=10),
intent(in) :: label
207 integer,
intent(in) :: user_lmax
208 integer,
intent(in) :: user_llocal
209 integer,
intent(in) :: ispin
210 real(real64),
intent(in) :: z
211 character(len=*),
intent(in) :: filename
213 integer :: l, ii, ll, is, ierr
219 real(real64),
allocatable :: eigen(:, :)
252 call parse_variable(namespace,
'SpeciesProjectorSphereThreshold', 0.001_real64, ps%projectors_sphere_threshold)
263 call messages_write(
"Cannot determine the pseudopotential type for species '"//trim(label)//
"' from", &
271 ps%relativistic_treatment = proj_j_independent
273 ps%sigma_erf = 0.625_real64
275 ps%projectors_per_l = 0
277 select case (ps%file_format)
279 ps%has_density = .
true.
281 ps%has_density = .false.
284 select case (ps%file_format)
288 call ps_psf_init(ps_psf, ispin, filename, namespace)
295 ps%lmax = ps_psf%ps_grid%no_l_channels - 1
297 if (user_lmax /= invalid_l)
then
298 ps%lmax = min(ps%lmax, user_lmax)
299 if (user_lmax /= ps%lmax)
then
300 message(1) =
"lmax in Species block for " // trim(label) // &
301 " is larger than number available in pseudopotential."
306 ps%conf%p = ps_psf%ps_grid%no_l_channels
307 if (ps%lmax == 0) ps%llocal = 0
310 if (user_llocal == invalid_l)
then
313 ps%llocal = user_llocal
316 ps%projectors_per_l(1:ps%lmax+1) = 1
317 if (ps%llocal > -1) ps%projectors_per_l(ps%llocal+1) = 0
326 call ps_cpi_init(ps_cpi, trim(filename), namespace)
327 ps%conf%p = ps_cpi%ps_grid%no_l_channels
329 call ps_fhi_init(ps_fhi, trim(filename), namespace)
330 ps%conf%p = ps_fhi%ps_grid%no_l_channels
334 ps%conf%symbol = label(1:2)
343 ps%lmax = ps%conf%p - 1
345 if (user_lmax /= invalid_l)
then
346 ps%lmax = min(ps%lmax, user_lmax)
347 if (user_lmax /= ps%lmax)
then
348 message(1) =
"lmax in Species block for " // trim(label) // &
349 " is larger than number available in pseudopotential."
354 if (ps%lmax == 0) ps%llocal = 0
357 if (user_llocal == invalid_l)
then
360 ps%llocal = user_llocal
363 ps%projectors_per_l(1:ps%lmax+1) = 1
364 if (ps%llocal > -1) ps%projectors_per_l(ps%llocal+1) = 0
378 call hgh_init(ps_hgh, trim(filename), namespace)
382 ps%z_val = ps_hgh%z_val
385 ps%lmax = ps_hgh%l_max
386 ps%conf%symbol = label(1:2)
387 ps%sigma_erf = ps_hgh%rlocal
389 ps%projectors_per_l(1:ps%lmax+1) = 1
409 call ps_xml_init(ps_xml, namespace, trim(filename), ps%file_format, ierr)
419 if (.not.
parse_is_defined(namespace,
'SpeciesProjectorSphereThreshold'))
then
420 ps%projectors_sphere_threshold = 1.0e-4_real64
433 if (ps_xml%kleinman_bylander)
then
434 ps%conf%p = ps_xml%nwavefunctions
436 ps%conf%p = ps_xml%lmax + 1
439 do ll = 0, ps_xml%lmax
440 ps%conf%l(ll + 1) = ll
443 ps%kbc = ps_xml%nchannels
444 ps%lmax = ps_xml%lmax
446 ps%projectors_per_l = 0
447 do ll = 0, ps_xml%lmax
451 if (ps_xml%kleinman_bylander)
then
452 ps%llocal = ps_xml%llocal
456 if (ps_xml%llocal >= 0) ps%llocal = ps_xml%llocal
457 if (user_llocal /= invalid_l) ps%llocal = user_llocal
458 assert(ps%llocal >= 0)
459 assert(ps%llocal <= ps%lmax)
462 ps%g%nrval = ps_xml%grid_size
464 safe_allocate(ps%g%rofi(1:ps%g%nrval))
465 safe_allocate(ps%g%r2ofi(1:ps%g%nrval))
467 do ii = 1, ps%g%nrval
468 ps%g%rofi(ii) = ps_xml%grid(ii)
469 ps%g%r2ofi(ii) = ps_xml%grid(ii)**2
474 ps%local = (ps%lmax == 0 .and. ps%llocal == 0 ) .or. (ps%lmax == -1 .and. ps%llocal == -1)
477 safe_allocate(ps%kb (0:ps%lmax, 1:ps%kbc))
478 safe_allocate(ps%dkb (0:ps%lmax, 1:ps%kbc))
479 safe_allocate(ps%ur (1:ps%conf%p, 1:ps%ispin))
480 safe_allocate(ps%bound(1:ps%conf%p, 1:ps%ispin))
481 safe_allocate(ps%h (0:ps%lmax, 1:ps%kbc, 1:ps%kbc))
482 safe_allocate(ps%qij (0:ps%lmax, 1:ps%kbc, 1:ps%kbc))
483 safe_allocate(ps%density(1:ps%ispin))
484 safe_allocate(ps%density_der(1:ps%ispin))
495 safe_allocate(eigen(1:ps%conf%p, 1:ps%ispin))
499 select case (ps%file_format)
512 safe_allocate(ps%k (0:ps%lmax, 1:ps%kbc, 1:ps%kbc))
522 call spline_der(ps%density(is), ps%density_der(is), ps%projectors_sphere_threshold)
527 call spline_der(ps%core, ps%core_der, ps%projectors_sphere_threshold)
532 ps%has_long_range = .
true.
533 ps%is_separated = .false.
535 call ps_info(ps, filename, namespace)
537 safe_deallocate_a(eigen)
544 subroutine ps_info(ps, filename, namespace)
545 type(
ps_t),
intent(in) :: ps
546 character(len=*),
intent(in) :: filename
555 select case (ps%file_format)
556 case (pseudo_format_upf1)
564 case (pseudo_format_psp8)
586 select case (ps%pseudo_type)
600 select case (ps%file_format)
614 if (ps%llocal >= 0)
then
626 if (ps%llocal < 0)
then
656 type(
ps_t),
intent(inout) :: ps
658 real(real64),
allocatable :: vsr(:), vlr(:), nlr(:)
659 real(real64) :: r, exp_arg, max_val_vsr
664 assert(ps%g%nrval > 0)
666 safe_allocate(vsr(1:ps%g%nrval))
667 safe_allocate(vlr(1:ps%g%nrval))
668 safe_allocate(nlr(1:ps%g%nrval))
674 do ii = 1, ps%g%nrval
680 if(abs(vsr(ii)) < 1.0e-14_real64) vsr(ii) =
m_zero
681 max_val_vsr = max(max_val_vsr, abs(vsr(ii)))
683 exp_arg = -
m_half*r**2/ps%sigma_erf**2
692 call spline_fit(ps%g%nrval, ps%g%rofi, vlr, ps%vlr, ps%projectors_sphere_threshold)
695 call spline_fit(ps%g%nrval, ps%g%rofi, nlr, ps%nlr, ps%projectors_sphere_threshold)
700 call spline_fit(ps%g%nrval, ps%g%rofi, vsr, ps%vl, ps%projectors_sphere_threshold)
701 if (max_val_vsr < 1.0e-12_real64) ps%no_vl = .
true.
703 safe_deallocate_a(vsr)
704 safe_deallocate_a(vlr)
705 safe_deallocate_a(nlr)
707 ps%is_separated = .
true.
713 real(real64)
pure function long_range_potential(r, sigma, z_val) result(vlr)
714 real(real64),
intent(in) :: r, sigma, z_val
721 if(arg > 1e-3_real64)
then
722 vlr = -z_val * erf(arg) / r
730 type(
ps_t),
intent(inout) :: ps
738 if (l == ps%llocal) cycle
740 ps%rc_max = max(ps%rc_max, ps%kb(l, j)%x_threshold)
750 type(
ps_t),
intent(inout) :: ps
757 call spline_der(ps%kb(l, j), ps%dkb(l, j), ps%projectors_sphere_threshold)
767 type(
ps_t),
intent(inout) :: ps
768 integer,
intent(in) :: filter
769 real(real64),
intent(in) :: gmax
771 integer :: l, k, ispin
773 real(real64) :: alpha, beta_fs, rmax, rcut, gamma, beta_rs
776 call profiling_in(
"PS_FILTER")
785 if(.not. ps%no_vl)
then
786 rmax = ps%vl%x_threshold
788 call spline_filter_mask(ps%vl, max(0, ps%llocal), rmax, gmax, alpha, gamma, ps%projectors_sphere_threshold)
792 if (l == ps%llocal) cycle
794 call spline_filter_mask(ps%kb(l, k), l, ps%rc_max, gmax, alpha, gamma, ps%projectors_sphere_threshold)
799 rmax = ps%core%x_threshold
800 call spline_filter_mask(ps%core, 0, rmax, gmax, alpha, gamma, ps%projectors_sphere_threshold)
804 do ispin = 1, ps%ispin
805 if (abs(spline_integral(ps%density(ispin))) > 1.0e-12_real64)
then
806 rmax = ps%density(ispin)%x_threshold
807 call spline_filter_mask(ps%density(ispin), 0, rmax, gmax, alpha, gamma, ps%projectors_sphere_threshold)
808 call spline_force_pos(ps%density(ispin), ps%projectors_sphere_threshold)
811 if (abs(spline_integral(ps%density_der(ispin))) > 1.0e-12_real64)
then
812 rmax = ps%density_der(ispin)%x_threshold
813 call spline_filter_mask(ps%density_der(ispin), 0, rmax, gmax, alpha, gamma, ps%projectors_sphere_threshold)
820 beta_fs = 18.0_real64
825 call spline_filter_bessel(ps%vl, max(0, ps%llocal), gmax, alpha, beta_fs, rcut, beta_rs, ps%projectors_sphere_threshold)
827 if (l == ps%llocal) cycle
829 call spline_filter_bessel(ps%kb(l, k), l, gmax, alpha, beta_fs, rcut, beta_rs, ps%projectors_sphere_threshold)
834 call spline_filter_bessel(ps%core, 0, gmax, alpha, beta_fs, rcut, beta_rs, ps%projectors_sphere_threshold)
838 do ispin = 1, ps%ispin
839 call spline_filter_bessel(ps%density(ispin), 0, gmax, alpha, beta_fs, rcut, beta_rs, ps%projectors_sphere_threshold)
840 call spline_force_pos(ps%density(ispin), ps%projectors_sphere_threshold)
841 call spline_filter_bessel(ps%density_der(ispin), 0, gmax, alpha, beta_fs, rcut, beta_rs, ps%projectors_sphere_threshold)
847 call profiling_out(
"PS_FILTER")
853 type(
ps_t),
intent(inout) :: ps
854 real(real64),
contiguous,
intent(in) :: eigen(:,:)
857 real(real64) :: ur1, ur2
862 where(eigen > m_zero)
871 if (.not. ps%bound(i, is)) cycle
873 do ir = ps%g%nrval, 3, -1
875 if (abs(spline_eval(ps%ur(i, is), ps%g%rofi(ir))*ps%g%rofi(ir)) > m_zero)
then
883 ur1 = spline_eval(ps%ur(i, is), ps%g%rofi(ir-2))*ps%g%rofi(ir-2)
884 ur2 = spline_eval(ps%ur(i, is), ps%g%rofi(ir-1))*ps%g%rofi(ir-1)
885 if ((ur1*ur2 > m_zero) .and. (abs(ur2) > abs(ur1))) ps%bound(i, is) = .false.
897 subroutine ps_debug(ps, dir, namespace, gmax)
898 type(
ps_t),
intent(in) :: ps
899 character(len=*),
intent(in) :: dir
900 type(namespace_t),
intent(in) :: namespace
901 real(real64),
intent(in) :: gmax
904 type(spline_t),
allocatable :: fw(:, :)
912 iunit = io_open(trim(dir)//
'/pseudo-info', namespace, action=
'write')
913 write(iunit,
'(a,/)') ps%label
914 write(iunit,
'(a,a,/)')
'Format : ',
ps_name(ps%file_format)
915 write(iunit,
'(a,f6.3)')
'z : ', ps%z
916 write(iunit,
'(a,f6.3,/)')
'zval : ', ps%z_val
917 write(iunit,
'(a,i4)')
'lmax : ', ps%lmax
918 write(iunit,
'(a,i4)')
'lloc : ', ps%llocal
919 write(iunit,
'(a,i4,/)')
'kbc : ', ps%kbc
920 write(iunit,
'(a,f9.5,/)')
'rcmax : ', ps%rc_max
921 write(iunit,
'(a,/)')
'h matrix:'
924 write(iunit,
'(10f9.5)') (ps%h(l, k, j), j = 1, ps%kbc)
927 if (
allocated(ps%k))
then
928 write(iunit,
'(/,a,/)')
'k matrix:'
931 write(iunit,
'(10f9.5)') (ps%k(l, k, j), j = 1, ps%kbc)
936 write(iunit,
'(/,a)')
'orbitals:'
938 if (ps%ispin == 2)
then
939 write(iunit,
'(1x,a,i2,3x,a,i2,3x,a,f5.1,3x,a,l1,3x,a,f5.1,3x,a,f5.1)')
'n = ', ps%conf%n(j),
'l = ', ps%conf%l(j), &
940 'j = ', ps%conf%j(j),
'bound = ', all(ps%bound(j,:)), &
941 'occ(1) = ', ps%conf%occ(j, 1),
'occ(2) = ', ps%conf%occ(j, 2)
943 write(iunit,
'(1x,a,i2,3x,a,i2,3x,a,f5.1,3x,a,l1,3x,a,f5.1)')
'n = ', ps%conf%n(j),
'l = ', ps%conf%l(j), &
944 'j = ', ps%conf%j(j),
'bound = ', all(ps%bound(j,:)), &
945 'occ = ', ps%conf%occ(j, 1)
953 iunit = io_open(trim(dir)//
'/local', namespace, action=
'write')
954 call spline_print(ps%vl, iunit)
958 iunit = io_open(trim(dir)//
'/local_long_range', namespace, action=
'write')
959 call spline_print(ps%vlr, iunit)
963 iunit = io_open(trim(dir)//
'/local_long_range_density', namespace, action=
'write')
964 call spline_print(ps%nlr, iunit)
968 iunit = io_open(trim(dir)//
'/local_ft', namespace, action=
'write')
969 safe_allocate(fw(1, 1))
970 call spline_init(fw(1, 1))
971 call spline_3dft(ps%vl, fw(1, 1), ps%projectors_sphere_threshold, gmax = gmax)
972 call spline_print(fw(1, 1), iunit)
973 call spline_end(fw(1, 1))
974 safe_deallocate_a(fw)
978 iunit = io_open(trim(dir)//
'/nonlocal', namespace, action=
'write')
979 call spline_print(ps%kb, iunit)
982 iunit = io_open(trim(dir)//
'/nonlocal_derivative', namespace, action=
'write')
983 call spline_print(ps%dkb, iunit)
986 iunit = io_open(trim(dir)//
'/nonlocal_ft', namespace, action=
'write')
987 safe_allocate(fw(0:ps%lmax, 1:ps%kbc))
991 call spline_besselft(ps%kb(k, j), fw(k, j), k, threshold=ps%projectors_sphere_threshold, &
995 call spline_print(fw, iunit)
997 safe_deallocate_a(fw)
1001 iunit = io_open(trim(dir)//
'/wavefunctions', namespace, action=
'write')
1002 call spline_print(ps%ur, iunit)
1003 call io_close(iunit)
1006 if (ps%has_density)
then
1007 iunit = io_open(trim(dir)//
'/density', namespace, action=
'write')
1008 call spline_print(ps%density, iunit)
1009 call io_close(iunit)
1011 iunit = io_open(trim(dir)//
'/density_derivative', namespace, action=
'write')
1012 call spline_print(ps%density_der, iunit)
1013 call io_close(iunit)
1018 iunit = io_open(trim(dir)//
'/nlcc', namespace, action=
'write')
1019 call spline_print(ps%core, iunit)
1020 call io_close(iunit)
1029 type(
ps_t),
intent(inout) :: ps
1031 if (.not.
allocated(ps%kb))
return
1035 if (ps%is_separated)
then
1036 call spline_end(ps%vlr)
1037 call spline_end(ps%nlr)
1040 call spline_end(ps%kb)
1041 call spline_end(ps%dkb)
1042 call spline_end(ps%ur)
1044 call spline_end(ps%vl)
1045 call spline_end(ps%core)
1046 call spline_end(ps%core_der)
1048 if (
allocated(ps%density))
call spline_end(ps%density)
1049 if (
allocated(ps%density_der))
call spline_end(ps%density_der)
1050 if (
allocated(ps%radial_augmentation))
call spline_end(ps%radial_augmentation)
1053 if (
allocated(ps%paw_phi_ae))
call spline_end(ps%paw_phi_ae)
1054 if (
allocated(ps%paw_phi_ae_small))
call spline_end(ps%paw_phi_ae_small)
1055 if (
allocated(ps%paw_phi_ps))
call spline_end(ps%paw_phi_ps)
1057 call spline_end(ps%paw_ae_vlocal)
1058 if (ps%paw_has_ae_core)
call spline_end(ps%paw_ae_core)
1059 if (
allocated(ps%paw_core_orbital))
call spline_end(ps%paw_core_orbital)
1062 call logrid_end(ps%g)
1064 safe_deallocate_a(ps%kb)
1065 safe_deallocate_a(ps%dkb)
1066 safe_deallocate_a(ps%ur)
1067 safe_deallocate_a(ps%bound)
1068 safe_deallocate_a(ps%h)
1069 safe_deallocate_a(ps%qij)
1070 safe_deallocate_a(ps%radial_augmentation)
1071 safe_deallocate_a(ps%k)
1072 safe_deallocate_a(ps%density)
1073 safe_deallocate_a(ps%density_der)
1074 safe_deallocate_a(ps%paw_l)
1075 safe_deallocate_a(ps%paw_phi_ae)
1076 safe_deallocate_a(ps%paw_phi_ae_small)
1077 safe_deallocate_a(ps%paw_phi_ps)
1078 safe_deallocate_a(ps%paw_occ)
1079 safe_deallocate_a(ps%paw_2j)
1080 safe_deallocate_a(ps%paw_core_orbital)
1081 safe_deallocate_a(ps%paw_core_l)
1082 safe_deallocate_a(ps%paw_grid)
1083 safe_deallocate_a(ps%paw_rab)
1084 safe_deallocate_a(ps%paw_multipoles)
1092 type(
ps_t),
intent(inout) :: ps
1093 type(ps_hgh_t),
intent(inout) :: ps_hgh
1099 if (ps%lmax >= 0)
then
1100 ps%rc_max = maxval(ps_hgh%kbr(0:ps%lmax))
1104 ps%h(0:ps%lmax, 1:ps%kbc, 1:ps%kbc) = ps_hgh%h(0:ps%lmax, 1:ps%kbc, 1:ps%kbc)
1105 ps%k(0:ps%lmax, 1:ps%kbc, 1:ps%kbc) = ps_hgh%k(0:ps%lmax, 1:ps%kbc, 1:ps%kbc)
1116 integer :: l, is, j, ip
1117 real(real64),
allocatable :: hato(:), dens(:)
1121 safe_allocate(hato(1:ps_hgh%g%nrval))
1122 safe_allocate(dens(1:ps_hgh%g%nrval))
1125 do l = 0, ps_hgh%l_max
1127 hato(:) = ps_hgh%kb(:, l, j)
1129 call spline_fit(ps_hgh%g%nrval, ps_hgh%g%rofi, hato, ps%kb(l, j), &
1130 ps%projectors_sphere_threshold)
1136 call spline_fit(ps_hgh%g%nrval, ps_hgh%g%rofi, ps_hgh%vlocal, ps%vl, ps%projectors_sphere_threshold)
1143 hato(2:ps_hgh%g%nrval) = ps_hgh%rphi(2:ps_hgh%g%nrval, l)/ps_hgh%g%rofi(2:ps_hgh%g%nrval)
1146 do ip = 1, ps_hgh%g%nrval
1147 dens(ip) = dens(ip) + ps%conf%occ(l, is)*hato(ip)**2/(m_four*m_pi)
1150 call spline_fit(ps_hgh%g%nrval, ps_hgh%g%rofi, hato, ps%ur(l, is), ps%projectors_sphere_threshold)
1152 call spline_fit(ps_hgh%g%nrval, ps_hgh%g%rofi, dens, ps%density(is), ps%projectors_sphere_threshold)
1155 safe_deallocate_a(hato)
1156 safe_deallocate_a(dens)
1165 type(
ps_t),
intent(inout) :: ps
1166 type(ps_in_grid_t),
intent(in) :: ps_grid
1171 ps%z_val = ps_grid%zval
1173 ps%nlcc = ps_grid%core_corrections
1175 ps%h(0:ps%lmax, 1, 1) = ps_grid%dkbcos(1:ps%lmax+1)
1177 ps%rc_max = maxval(ps_grid%kb_radius(1:ps%lmax+1))
1183 ps%h(0:ps%lmax,:,:) = ps%h(0:ps%lmax,:,:) / m_two
1190 type(logrid_t),
intent(in) :: g
1192 real(real64),
allocatable :: hato(:), dens(:)
1193 integer :: is, l, ir, nrc, ip
1197 safe_allocate(hato(1:g%nrval))
1198 safe_allocate(dens(1:g%nrval))
1205 do l = 1, ps_grid%no_l_channels
1206 hato(2:) = ps_grid%rphi(2:, l, 1+is)/g%rofi(2:)
1207 hato(1) = first_point_extrapolate(g%rofi, hato)
1209 if(ps%conf%occ(l, is) > m_epsilon)
then
1211 dens(ip) = dens(ip) + ps%conf%occ(l, is)*hato(ip)**2/(m_four*m_pi)
1215 call spline_fit(g%nrval, g%rofi, hato, ps%ur(l, is), ps%projectors_sphere_threshold)
1218 call spline_fit(g%nrval, g%rofi, dens, ps%density(is), ps%projectors_sphere_threshold)
1224 nrc = logrid_index(g, ps_grid%kb_radius(l)) + 1
1225 hato(1:nrc) = ps_grid%KB(1:nrc, l)
1226 hato(nrc+1:g%nrval) = m_zero
1228 nrc = ps_grid%kb_nrval(l)
1229 if (nrc == 0) nrc = g%nrval
1230 call spline_fit(nrc, g%rofi, hato, ps%kb(l-1, 1), ps%projectors_sphere_threshold)
1235 hato(:) = ps_grid%vlocal(:)/m_two
1236 call spline_fit(g%nrval, g%rofi, hato, ps%vl, ps%projectors_sphere_threshold)
1238 if (ps_grid%core_corrections)
then
1240 hato(2:) = ps_grid%chcore(2:)/(m_four*m_pi*g%r2ofi(2:))
1242 do ir = g%nrval-1, 2, -1
1243 if (hato(ir) >
eps)
then
1249 hato(nrc:g%nrval) = m_zero
1250 hato(1) = first_point_extrapolate(g%rofi, hato)
1252 call spline_fit(g%nrval, g%rofi, hato, ps%core, ps%projectors_sphere_threshold)
1255 safe_deallocate_a(hato)
1256 safe_deallocate_a(dens)
1267 type(
ps_t),
intent(inout) :: ps
1268 type(ps_xml_t),
intent(in) :: ps_xml
1269 type(namespace_t),
intent(in) :: namespace
1271 integer :: ll, ip, is, ic, jc, ir, nrc, ii, jj, nproj
1272 real(real64) :: rr, kbcos, kbnorm, dnrm, avgv, volume_element
1273 real(real64),
allocatable :: kbprojector(:), wavefunction(:), nlcc_density(:), dens(:,:)
1274 integer,
allocatable :: cmap(:, :)
1275 integer,
allocatable :: bmap_us(:)
1276 integer :: ib_us, ic_us, jc_us
1277 real(real64),
allocatable :: matrix(:, :), eigenvalues(:)
1278 logical :: density_is_known
1279 real(real64),
parameter :: tol_diagonal=1.0e-10_real64
1284 if (pseudo_has_total_angular_momentum(ps_xml%pseudo))
then
1285 if (ps%file_format == pseudo_format_psp8)
then
1287 message(1) =
"SOC from PSP8 is not currently supported."
1288 message(2) =
"Only scalar relativistic effects will be considered."
1289 call messages_warning(2, namespace=namespace)
1295 ps%nlcc = ps_xml%nlcc
1297 ps%z_val = ps_xml%valence_charge
1299 ps%has_density = ps_xml%has_density
1304 call spline_fit(ps%g%nrval, ps%g%rofi, ps_xml%potential(:, ps%llocal), ps%vl, ps%projectors_sphere_threshold)
1306 safe_allocate(kbprojector(1:ps%g%nrval))
1307 safe_allocate(wavefunction(1:ps%g%nrval))
1309 kbprojector = m_zero
1310 wavefunction = m_zero
1312 density_is_known = .false.
1315 if (ps_xml%kleinman_bylander)
then
1317 safe_allocate(cmap(0:ps_xml%lmax, 1:ps_xml%nchannels))
1321 do ll = 0, ps_xml%lmax
1322 do ic = 1, ps_xml%nchannels
1326 if (ll == ps_xml%llocal) cycle
1328 if (ic > pseudo_nprojectors_per_l(ps_xml%pseudo, ll)) cycle
1333 assert(mod(ps_xml%nchannels, 2)==0)
1334 if (pseudo_projector_2j(ps_xml%pseudo, ll, ic) == 2*ll - 1)
then
1335 cmap(ll, ic) = int((ic-1)/2)*2 + 2
1337 assert(pseudo_projector_2j(ps_xml%pseudo, ll, ic) == 2*ll + 1)
1338 cmap(ll, ic) = int((ic-1)/2)*2 + 1
1344 assert(sum(cmap(ll, 1:ps_xml%nchannels)) == (ps_xml%nchannels + 1)*ps_xml%nchannels/2)
1347 assert(all(cmap >= 0 .and. cmap <= ps_xml%nchannels))
1358 do ll = 0, ps_xml%lmax
1359 do ic_us = 1, ps_xml%nchannels
1360 do jc_us = 1, ps_xml%nchannels
1361 ps%qij(ll, cmap(ll, ic_us), cmap(ll, jc_us)) = ps_xml%qij(ll, ic_us, jc_us)
1368 ps%radial_augmentation_lmax = ps_xml%radial_augmentation_lmax
1369 ps%radial_augmentation_has_angular_channels = ps_xml%radial_augmentation_has_angular_channels
1371 if (ps_xml%has_radial_augmentation)
then
1372 nproj = pseudo_nprojectors(ps_xml%pseudo)
1373 ps%radial_augmentation_nprojectors = nproj
1374 assert(ps%radial_augmentation_lmax >= 0)
1375 if (.not. ps%radial_augmentation_has_angular_channels)
then
1376 call messages_not_implemented(
"ultrasoft augmentation density without angular-resolved Q_ij^L functions")
1379 safe_allocate(ps%radial_augmentation(1:nproj*nproj, 0:ps%radial_augmentation_lmax))
1380 call spline_init(ps%radial_augmentation)
1384 safe_allocate(bmap_us(1:nproj))
1386 do ll = 0, ps_xml%lmax
1387 if (ll == ps_xml%llocal) cycle
1388 do ic_us = 1, pseudo_nprojectors_per_l(ps_xml%pseudo, ll)
1390 bmap_us(ib_us) = ib_us - ic_us + cmap(ll, ic_us)
1393 assert(ib_us == nproj)
1397 do ll = 0, ps%radial_augmentation_lmax
1398 call spline_fit(ps_xml%grid_size, ps%g%rofi, ps_xml%radial_augmentation(:, ii, jj, ll), &
1399 ps%radial_augmentation((bmap_us(ii) - 1)*nproj + bmap_us(jj), ll), ps%projectors_sphere_threshold)
1403 safe_deallocate_a(bmap_us)
1409 if (pseudo_nprojectors(ps_xml%pseudo) > 0)
then
1410 safe_allocate(matrix(1:ps_xml%nchannels, 1:ps_xml%nchannels))
1411 safe_allocate(eigenvalues(1:ps_xml%nchannels))
1413 do ll = 0, ps_xml%lmax
1416 do ic = 1, ps_xml%nchannels
1418 call spline_fit(ps_xml%kb_radius(ll, ic), ps%g%rofi, ps_xml%projector(:, ll, ic), &
1419 ps%kb(ll, cmap(ll, ic)), ps%projectors_sphere_threshold)
1420 do jc = 1, ps_xml%nchannels
1421 ps%h(ll, cmap(ll, ic), cmap(ll, jc)) = ps_xml%dij(ll, ic, jc)
1424 else if (is_diagonal(ps_xml%nchannels, ps_xml%dij(ll, :, :), tol_diagonal) .or. &
1425 pseudo_has_total_angular_momentum(ps_xml%pseudo))
then
1426 do ic = 1, ps_xml%nchannels
1428 call spline_fit(ps_xml%kb_radius(ll, ic), ps%g%rofi, ps_xml%projector(:, ll, ic), &
1429 ps%kb(ll, cmap(ll, ic)), ps%projectors_sphere_threshold)
1430 ps%h(ll, cmap(ll, ic), cmap(ll, ic)) = ps_xml%dij(ll, ic, ic)
1434 matrix(1:ps_xml%nchannels, 1:ps_xml%nchannels) = ps_xml%dij(ll, 1:ps_xml%nchannels, 1:ps_xml%nchannels)
1435 call lalg_eigensolve(ps_xml%nchannels, matrix, eigenvalues)
1437 do ic = 1, ps_xml%nchannels
1438 kbprojector = m_zero
1439 do jc = 1, ps_xml%nchannels
1440 call lalg_axpy(ps_xml%grid_size, matrix(jc, ic), ps_xml%projector(:, ll, jc), kbprojector)
1443 call spline_fit(maxval(ps_xml%kb_radius(ll, :)), ps%g%rofi, kbprojector, &
1444 ps%kb(ll, cmap(ll, ic)), ps%projectors_sphere_threshold)
1445 ps%h(ll, cmap(ll, ic), cmap(ll, ic)) = eigenvalues(ic)
1450 safe_deallocate_a(matrix)
1451 safe_deallocate_a(eigenvalues)
1454 ps%conf%p = ps_xml%nwavefunctions
1461 if ((.not.
ps_has_density(ps) .or. ps%ispin == 2) .and. ps_xml%nwavefunctions > 0)
then
1462 safe_allocate(dens(1:ps%g%nrval, 1:ps%ispin))
1466 do ii = 1, ps_xml%nwavefunctions
1468 ps%conf%n(ii) = ps_xml%wf_n(ii)
1469 ps%conf%l(ii) = ps_xml%wf_l(ii)
1471 if (ps%ispin == 2)
then
1472 ps%conf%occ(ii, 1) = min(ps_xml%wf_occ(ii), m_two*ps_xml%wf_l(ii) + m_one)
1473 ps%conf%occ(ii, 2) = ps_xml%wf_occ(ii) - ps%conf%occ(ii, 1)
1475 ps%conf%occ(ii, 1) = ps_xml%wf_occ(ii)
1478 ps%conf%j(ii) = m_zero
1479 if (pseudo_has_total_angular_momentum(ps_xml%pseudo))
then
1480 ps%conf%j(ii) = m_half*pseudo_wavefunction_2j(ps_xml%pseudo, ii)
1483 do ip = 1, ps%g%nrval
1484 if (ip <= ps_xml%grid_size)
then
1485 wavefunction(ip) = ps_xml%wavefunction(ip, ii)
1487 wavefunction(ip) = m_zero
1492 call spline_fit(ps%g%nrval, ps%g%rofi, wavefunction, ps%ur(ii, is), ps%projectors_sphere_threshold)
1497 do ip = 1, ps_xml%grid_size
1498 dens(ip, is) = dens(ip, is) + ps%conf%occ(ii, is)*wavefunction(ip)**2/(m_four*m_pi)
1506 if ((.not.
ps_has_density(ps) .or. ps%ispin == 2) .and. ps_xml%nwavefunctions > 0)
then
1508 call spline_fit(ps%g%nrval, ps%g%rofi, dens(:,is), ps%density(is), ps%projectors_sphere_threshold)
1510 safe_deallocate_a(dens)
1511 density_is_known = .
true.
1512 ps%has_density = .
true.
1515 safe_deallocate_a(cmap)
1520 ps%conf%occ = m_zero
1521 ps%conf%symbol = ps%label(1:2)
1525 call valconf_sort_by_l(ps%conf, ps_xml%lmax)
1528 if (abs(sum(ps%conf%occ) - ps%z_val ) < m_epsilon)
then
1529 safe_allocate(dens(1:ps%g%nrval, 1:ps%ispin))
1533 do ll = 0, ps_xml%lmax
1538 do ip = 1, ps_xml%grid_size
1539 rr = ps_xml%grid(ip)
1540 volume_element = rr**2*ps_xml%weights(ip)
1541 kbprojector(ip) = (ps_xml%potential(ip, ll) - ps_xml%potential(ip, ps%llocal))*ps_xml%wavefunction(ip, ll)
1542 dnrm = dnrm + kbprojector(ip)**2*volume_element
1543 avgv = avgv + kbprojector(ip)*ps_xml%wavefunction(ip, ll)*volume_element
1546 kbcos = dnrm/(safe_tol(avgv,1.0e-20_real64))
1547 kbnorm = m_one/(safe_tol(
sqrt(dnrm),1.0e-20_real64))
1549 if (ll /= ps%llocal)
then
1550 ps%h(ll, 1, 1) = kbcos
1551 kbprojector = kbprojector*kbnorm
1553 ps%h(ll, 1, 1) = m_zero
1556 call spline_fit(ps%g%nrval, ps%g%rofi, kbprojector, ps%kb(ll, 1), ps%projectors_sphere_threshold)
1559 call lalg_copy(ps_xml%grid_size, ps_xml%wavefunction(:, ll), wavefunction)
1560 wavefunction(ps_xml%grid_size+1:ps%g%nrval) = m_zero
1563 call spline_fit(ps%g%nrval, ps%g%rofi, wavefunction, ps%ur(ll + 1, is), ps%projectors_sphere_threshold)
1567 if (abs(sum(ps%conf%occ) - ps%z_val) < m_epsilon)
then
1569 do ip = 1, ps_xml%grid_size
1570 dens(ip, is) = dens(ip, is) + ps%conf%occ(ll+1, is)*wavefunction(ip)**2/(m_four*m_pi)
1577 if (abs(sum(ps%conf%occ) - ps%z_val) < m_epsilon)
then
1579 call spline_fit(ps%g%nrval, ps%g%rofi, dens(:,is), ps%density(is), ps%projectors_sphere_threshold)
1581 safe_deallocate_a(dens)
1582 density_is_known = .
true.
1583 ps%has_density = .
true.
1590 safe_allocate(dens(1:ps%g%nrval, 1))
1592 dens(1:ps_xml%grid_size, 1) = ps_xml%density(1:ps_xml%grid_size)/ps%ispin
1593 dens(ps_xml%grid_size + 1:ps%g%nrval, 1) = m_zero
1596 call spline_fit(ps%g%nrval, ps%g%rofi, dens(:, 1), ps%density(is), ps%projectors_sphere_threshold)
1599 safe_deallocate_a(dens)
1604 if (ps_xml%nlcc)
then
1606 safe_allocate(nlcc_density(1:ps%g%nrval))
1608 call lalg_copy(ps_xml%grid_size, ps_xml%nlcc_density, nlcc_density)
1611 do ir = ps_xml%grid_size - 1, 1, -1
1612 if (nlcc_density(ir) >
eps)
then
1618 nlcc_density(nrc:ps%g%nrval) = m_zero
1620 call spline_fit(ps%g%nrval, ps%g%rofi, nlcc_density, ps%core, ps%projectors_sphere_threshold)
1622 safe_deallocate_a(nlcc_density)
1627 if (ps_xml%is_paw)
then
1628 nproj = pseudo_nprojectors(ps_xml%pseudo)
1629 ps%paw_nwavefunctions = ps_xml%paw_nwavefunctions
1630 ps%paw_augmentation_lmax = ps_xml%paw_augmentation_lmax
1631 ps%paw_shape = ps_xml%paw_shape
1632 ps%paw_core_energy = ps_xml%paw_core_energy
1633 ps%paw_cutoff_radius = ps_xml%paw_cutoff_radius
1634 ps%paw_has_ae_core = ps_xml%paw_has_ae_core
1636 safe_allocate(ps%paw_l(1:nproj))
1637 ps%paw_l(1:nproj) = ps_xml%paw_l(1:nproj)
1639 safe_allocate(ps%paw_phi_ae(1:nproj))
1640 safe_allocate(ps%paw_phi_ps(1:nproj))
1641 call spline_init(ps%paw_phi_ae)
1642 call spline_init(ps%paw_phi_ps)
1644 call spline_fit(ps%g%nrval, ps%g%rofi, ps_xml%paw_phi_ae(:, ii), ps%paw_phi_ae(ii), &
1645 ps%projectors_sphere_threshold)
1646 call spline_fit(ps%g%nrval, ps%g%rofi, ps_xml%paw_phi_ps(:, ii), ps%paw_phi_ps(ii), &
1647 ps%projectors_sphere_threshold)
1652 ps%paw_has_small = ps_xml%paw_has_small
1653 if (ps%paw_has_small)
then
1654 safe_allocate(ps%paw_phi_ae_small(1:nproj))
1655 call spline_init(ps%paw_phi_ae_small)
1657 call spline_fit(ps%g%nrval, ps%g%rofi, ps_xml%paw_phi_ae_small(:, ii), ps%paw_phi_ae_small(ii), &
1658 ps%projectors_sphere_threshold)
1662 call spline_init(ps%paw_ae_vlocal)
1663 call spline_fit(ps%g%nrval, ps%g%rofi, ps_xml%paw_ae_vlocal(:), ps%paw_ae_vlocal, &
1664 ps%projectors_sphere_threshold)
1666 if (ps%paw_has_ae_core)
then
1667 call spline_init(ps%paw_ae_core)
1668 call spline_fit(ps%g%nrval, ps%g%rofi, ps_xml%paw_ae_core(:), ps%paw_ae_core, &
1669 ps%projectors_sphere_threshold)
1672 safe_allocate(ps%paw_occ(1:nproj))
1673 ps%paw_occ(1:nproj) = ps_xml%paw_occ(1:nproj)
1677 safe_allocate(ps%paw_2j(1:nproj))
1683 if (ps%paw_l(jj) == ps%paw_l(ii)) ic = ic + 1
1685 ps%paw_2j(ii) = pseudo_projector_2j(ps_xml%pseudo, ps%paw_l(ii), ic)
1691 ps%paw_ncore = ps_xml%paw_ncore
1692 if (ps%paw_ncore > 0)
then
1693 safe_allocate(ps%paw_core_orbital(1:ps%paw_ncore))
1694 call spline_init(ps%paw_core_orbital)
1695 safe_allocate(ps%paw_core_l(1:ps%paw_ncore))
1696 do ii = 1, ps%paw_ncore
1697 call spline_fit(ps%g%nrval, ps%g%rofi, ps_xml%paw_core_orbital(:, ii), &
1698 ps%paw_core_orbital(ii), ps%projectors_sphere_threshold)
1699 ps%paw_core_l(ii) = ps_xml%paw_core_l(ii)
1703 safe_allocate(ps%paw_multipoles(1:nproj, 1:nproj, 0:ps%paw_augmentation_lmax))
1704 ps%paw_multipoles = ps_xml%paw_multipoles
1708 safe_allocate(ps%paw_grid(1:ps%g%nrval))
1709 safe_allocate(ps%paw_rab(1:ps%g%nrval))
1710 ps%paw_grid(1:ps%g%nrval) = ps%g%rofi(1:ps%g%nrval)
1711 ps%paw_rab(1:ps%g%nrval) = ps_xml%weights(1:ps%g%nrval)
1716 safe_deallocate_a(kbprojector)
1717 safe_deallocate_a(wavefunction)
1726 type(
ps_t),
intent(in) :: ps
1741 type(
ps_t),
intent(in) :: ps
1748 if (any(.not. ps%bound(i,:))) cycle
1757 type(
ps_t),
intent(in) :: ps
1759 has_density = ps%has_density
1765 pure logical function ps_has_nlcc(ps)
result(has_nlcc)
1766 type(
ps_t),
intent(in) :: ps
1774 type(
ps_t),
intent(in) :: ps
1776 is_ultrasoft = (ps%pseudo_type == pseudo_type_ultrasoft)
1781 pure logical function ps_is_paw(ps)
result(is_paw)
1782 type(
ps_t),
intent(in) :: ps
1784 is_paw = (ps%pseudo_type == pseudo_type_paw)
1790 type(
ps_t),
intent(in) :: ps
1792 requires_generalized_overlap =
ps_is_ultrasoft(ps) .or. (ps%pseudo_type == pseudo_type_paw)
1798 type(
ps_t),
intent(in) :: ps
1799 type(namespace_t),
intent(in) :: namespace
1801 integer :: ip, ispin
1803 real(real64),
allocatable ::vol(:)
1804 type(spline_t) :: volspl
1809 message(1) =
"The pseudopotential does not contain an atomic density"
1810 call messages_fatal(1, namespace=namespace)
1813 safe_allocate(vol(1:ps%g%nrval))
1815 do ip = 1, ps%g%nrval
1818 do ispin = 1, ps%ispin
1819 vol(ip) = vol(ip) + spline_eval(ps%density(ispin), rr)*m_four*m_pi*rr**5
1823 call spline_init(volspl)
1824 call spline_fit(ps%g%nrval, ps%g%rofi, vol, volspl, ps%projectors_sphere_threshold)
1825 volume = spline_integral(volspl)
1826 call spline_end(volspl)
1828 safe_deallocate_a(vol)
1837 type(namespace_t),
intent(in) :: namespace
1838 real(real64),
intent(in) :: zz
1839 real(real64),
intent(in) :: valcharge
1840 integer,
intent(in) :: ispin
1841 type(valconf_t),
intent(inout) :: conf
1853 write(message(1),
'(a,a,a)')
'Debug: Guessing the atomic occupations for ', trim(conf%symbol),
"."
1854 call messages_info(1, namespace=namespace, debug_only=.
true.)
1856 assert(valcharge <= zz)
1860 if(int(zz) > 2 .and. val > zz - 2)
then
1864 if(int(zz) > 4 .and. val > zz - 4)
then
1869 if(int(zz) > 18 .and. val > zz - 10)
then
1873 if(int(zz) > 12 .and. val > zz - 12)
then
1877 if(int(zz) > 18 .and. val > zz - 18)
then
1881 if(int(zz) > 28 .and. val > zz - 28)
then
1885 if(int(zz) > 30 .and. val > zz - 30)
then
1889 if(int(zz) > 36 .and. val > zz - 36)
then
1893 if(int(zz) > 46 .and. val > zz - 46)
then
1898 if((int(zz) > 48 .and. val > zz - 48) .or. &
1899 (int(zz) > 70 .and. int(zz) <= 81 .and. val > zz - 62))
then
1904 if((int(zz) > 54 .and. val > zz - 54) .or. &
1905 (int(zz) > 70 .and. int(zz) <= 81 .and. val > zz - 68) )
then
1910 if(int(zz) > 80 .and. val > zz - 68)
then
1916 select case (int(zz))
2233 if (val < m_epsilon)
then
2235 if (ispin == 2)
then
2236 call valconf_unpolarized_to_polarized(conf)
2240 message(1) =
"Error in attributing atomic occupations"
2241 call messages_warning(1, namespace=namespace)
2248 real(real64),
intent(inout) :: val
2249 integer,
intent(in) :: max_occ, nn
2252 conf%occ(conf%p,1) = min(val, real(max_occ, real64) )
2253 val = val - conf%occ(conf%p,1)
2259 real(real64),
intent(inout) :: val
2260 integer,
intent(in) :: max_occ, nn
2263 conf%occ(conf%p,1) = min(val, real(max_occ, real64) )
2264 val = val - conf%occ(conf%p,1)
2270 real(real64),
intent(inout) :: val
2271 integer,
intent(in) :: max_occ, nn
2274 conf%occ(conf%p,1) = min(val, real(max_occ, real64) )
2275 val = val - conf%occ(conf%p,1)
2281 real(real64),
intent(inout) :: val
2282 integer,
intent(in) :: max_occ, nn
2285 conf%occ(conf%p,1) = min(val, real(max_occ, real64) )
2286 val = val - conf%occ(conf%p,1)
2293#include "ps_pspio_inc.F90"
Some operations may be done for one spline-function, or for an array of them.
double exp(double __x) __attribute__((__nothrow__
double sqrt(double __x) __attribute__((__nothrow__
subroutine, public valconf_unpolarized_to_polarized(conf)
subroutine, public valconf_copy(cout, cin)
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
real(real64), parameter, public m_pi
some mathematical constants
real(real64), parameter, public m_min_exp_arg
real(real64), parameter, public m_half
real(real64), parameter, public m_one
real(real64), parameter, public m_three
subroutine, public logrid_copy(grid_in, grid_out)
This module is intended to contain "only mathematical" functions and procedures.
subroutine, public messages_obsolete_variable(namespace, name, rep)
subroutine, public messages_new_line()
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_input_error(namespace, var, details, row, column)
subroutine, public messages_experimental(name, namespace)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
logical function, public parse_is_defined(namespace, name)
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
subroutine, public ps_cpi_end(ps_cpi)
subroutine, public ps_cpi_init(ps_cpi, filename, namespace)
subroutine, public ps_cpi_process(ps_cpi, lloc, namespace)
subroutine, public ps_fhi_end(ps_fhi)
subroutine, public ps_fhi_init(ps_fhi, filename, namespace)
subroutine, public ps_fhi_process(ps_fhi, lmax, lloc, namespace)
subroutine, public hgh_end(psp)
subroutine, public hgh_get_eigen(psp, eigen)
subroutine, public hgh_process(psp, namespace)
subroutine, public hgh_init(psp, filename, namespace)
pure logical function, public ps_requires_generalized_overlap(ps)
pure logical function, public ps_has_density(ps)
integer, parameter, public ps_filter_ts
subroutine, public ps_end(ps)
subroutine hgh_load(ps, ps_hgh)
subroutine, public ps_init(ps, namespace, label, z, user_lmax, user_llocal, ispin, filename)
subroutine ps_info(ps, filename, namespace)
subroutine, public ps_separate(ps)
Separate the local potential into (soft) long-ranged and (hard) short-ranged parts.
subroutine ps_check_bound(ps, eigen)
subroutine ps_grid_load(ps, ps_grid)
subroutine, public ps_debug(ps, dir, namespace, gmax)
real(real64) pure function, public long_range_potential(r, sigma, z_val)
Evaluate the long-range potential at a given distance.
integer, parameter, public proj_hgh
pure integer function, public ps_bound_niwfs(ps)
Returns the number of bound atomic orbitals taking into account then m quantum number multiplicity.
real(real64), parameter eps
Cutoff for determining the radius of the NLCC.
subroutine, public ps_getradius(ps)
subroutine, public ps_guess_atomic_occupations(namespace, zz, valcharge, ispin, conf)
This routines provides, given Z and the number of valence electron the occupations of the orbitals....
pure logical function, public ps_is_paw(ps)
pure logical function, public ps_has_nlcc(ps)
pure integer function, public ps_niwfs(ps)
Returns the number of atomic orbitals taking into account then m quantum number multiplicity.
subroutine, public ps_pspio_init(ps, namespace, label, z, lmax, ispin, filename)
integer, parameter, public ps_filter_none
integer, parameter, public proj_j_average
Fully-relativistic pseudopotentials with separate j-average and SOC terms.
integer, parameter, public proj_uspp
integer, parameter, public proj_rkb
integer, parameter, public proj_j_dependent
Fully-relativistic j-dependent pseudopotentials.
subroutine, public ps_derivatives(ps)
subroutine, public ps_filter(ps, filter, gmax)
pure logical function, public ps_is_ultrasoft(ps)
real(real64) function, public ps_density_volume(ps, namespace)
character(len=4), dimension(pseudo_format_upf1:pseudo_format_psp8), parameter ps_name
integer, parameter, public ps_filter_bsb
integer, parameter, public proj_kb
subroutine ps_xml_load(ps, ps_xml, namespace)
Loads XML files for QSO, UPF1, UPF2, PSML, and PSP8 formats.
subroutine, public ps_psf_init(pstm, ispin, filename, namespace)
subroutine, public ps_psf_process(ps_psf, namespace, lmax, lloc)
subroutine, public ps_psf_get_eigen(ps_psf, eigen)
subroutine, public ps_psf_end(ps_psf)
subroutine, public ps_xml_end(this)
subroutine, public ps_xml_init(this, namespace, filename, fmt, ierr)
integer, parameter, public pseudo_format_file_not_found
integer, parameter, public pseudo_type_kleinman_bylander
integer, parameter, public pseudo_format_qso
integer, parameter, public pseudo_format_hgh
integer, parameter, public pseudo_format_upf2
integer, parameter, public pseudo_type_paw
integer, parameter, public pseudo_format_cpi
integer, parameter, public pseudo_exchange_unknown
integer, parameter, public pseudo_type_semilocal
integer, parameter, public pseudo_type_ultrasoft
integer, parameter, public pseudo_correlation_unknown
integer, parameter, public pseudo_format_psf
integer, parameter, public pseudo_format_fhi
integer, parameter, public pseudo_format_unknown
integer, parameter, public pseudo_paw_shape_unknown
integer, parameter, public pseudo_format_psml
subroutine, public spline_der(spl, dspl, threshold)
subroutine, public spline_fit(nrc, rofi, ffit, spl, threshold)
real(real64) function, public spline_eval(spl, x)
character(kind=c_char, len=1) function, dimension(:), allocatable, public string_f_to_c(f_string)
convert a Fortran string to a C string
subroutine fill_s_orbs(val, max_occ, nn)
subroutine fill_p_orbs(val, max_occ, nn)
subroutine fill_d_orbs(val, max_occ, nn)
subroutine fill_f_orbs(val, max_occ, nn)
remember that the FHI format is basically the CPI format with a header
The following data type contains: (a) the pseudopotential parameters, as read from a *....
A type storing the information and data about a pseudopotential.
the basic spline datatype