51 integer,
public,
parameter :: &
52 SPECIES_PSEUDO = 7, & !< pseudopotential
61 type(ps_t),
allocatable,
public :: ps
64 integer :: user_llocal
66 integer,
public :: pseudopotential_set_id
67 logical,
public :: pseudopotential_set_initialized
68 type(pseudo_set_t),
public :: pseudopotential_set
95 procedure pseudopotential_constructor
107 class(pseudopotential_t),
pointer :: spec
108 character(len=*),
intent(in) :: label
109 integer,
intent(in) :: index
124 spec%pseudopotential_set_id = option__pseudopotentialset__none
125 spec%pseudopotential_set_initialized = .false.
138 if (spec%pseudopotential_set_initialized)
then
140 spec%pseudopotential_set_initialized = .false.
143 if (
allocated(spec%ps))
call ps_end(spec%ps)
144 safe_deallocate_a(spec%ps)
161 is_ultrasoft =
allocated(spec%ps) .and. ps_is_ultrasoft(spec%ps)
168 is_paw =
allocated(spec%ps) .and. ps_is_paw(spec%ps)
175 requires_generalized_overlap =
allocated(spec%ps) .and. ps_requires_generalized_overlap(spec%ps)
187 select case (spec%pseudopotential_set_id)
189 option__pseudopotentialset__standard, &
190 option__pseudopotentialset__hgh_lda, &
191 option__pseudopotentialset__hgh_lda_sc, &
192 option__pseudopotentialset__gbrv_lda, &
193 option__pseudopotentialset__hscv_lda)
197 case (option__pseudopotentialset__hscv_pbe)
206 integer pure function pseudopotential_c_functional(spec)
213 select case (spec%pseudopotential_set_id)
215 option__pseudopotentialset__standard, &
216 option__pseudopotentialset__hgh_lda, &
217 option__pseudopotentialset__hgh_lda_sc, &
218 option__pseudopotentialset__gbrv_lda, &
219 option__pseudopotentialset__hscv_lda)
223 case (option__pseudopotentialset__hscv_pbe)
235 radius = spec%ps%rc_max
241 lloc = spec%user_llocal
247 lmax = spec%user_lmax
253 integer,
intent(in) :: ll
260 integer,
intent(in) :: ll
261 spec%user_llocal = ll
267 integer,
intent(in) :: set_id
272 case (option__pseudopotentialset__standard)
273 filename = trim(conf%share)//
'/pseudopotentials/PSF'
274 case (option__pseudopotentialset__sg15)
275 filename = trim(conf%share)//
'/pseudopotentials/quantum-simulation.org/sg15/'
276 case (option__pseudopotentialset__hgh_lda)
277 filename = trim(conf%share)//
'/pseudopotentials/HGH/lda/'
278 case (option__pseudopotentialset__hgh_lda_sc)
279 filename = trim(conf%share)//
'/pseudopotentials/HGH/lda_sc/'
280 case (option__pseudopotentialset__hscv_lda)
281 filename = trim(conf%share)//
'/pseudopotentials/quantum-simulation.org/hscv/lda/'
282 case (option__pseudopotentialset__hscv_pbe)
283 filename = trim(conf%share)//
'/pseudopotentials/quantum-simulation.org/hscv/pbe/'
284 case (option__pseudopotentialset__gbrv_lda)
285 filename = trim(conf%share)//
'/pseudopotentials/gbrv/lda/'
286 case (option__pseudopotentialset__pseudodojo_lda)
287 filename = trim(conf%share)//
'/pseudopotentials/pseudo-dojo.org/nc-sr-04_pw_standard/'
288 case (option__pseudopotentialset__pseudodojo_pbe)
289 filename = trim(conf%share)//
'/pseudopotentials/pseudo-dojo.org/nc-sr-05_pbe_standard/'
290 case (option__pseudopotentialset__pseudodojo_pbesol)
291 filename = trim(conf%share)//
'/pseudopotentials/pseudo-dojo.org/nc-sr-04_pbesol_standard/'
292 case (option__pseudopotentialset__pseudodojo_pbe_fr)
293 filename = trim(conf%share)//
'/pseudopotentials/pseudo-dojo.org/nc-fr-04_pbe_standard/'
294 case (option__pseudopotentialset__none)
307 integer,
intent(in) :: set_id
308 type(pseudo_set_t),
intent(in) :: set
309 integer,
intent(out) :: read_data
311 type(element_t) :: el
315 spec%pseudopotential_set_id = set_id
316 spec%pseudopotential_set = set
318 call element_init(el, get_symbol(spec%get_label()))
320 if (spec%pseudopotential_set_id /= option__pseudopotentialset__none .and. pseudo_set_has(spec%pseudopotential_set, el))
then
321 call spec%set_filename(pseudo_set_file_path(spec%pseudopotential_set, el))
324 if (spec%get_z() < 0)
call spec%set_z(real(element_atomic_number(el), real64))
325 if (spec%user_lmax == invalid_l) spec%user_lmax = pseudo_set_lmax(spec%pseudopotential_set, el)
326 if (spec%user_llocal == invalid_l) spec%user_llocal = pseudo_set_llocal(spec%pseudopotential_set, el)
327 if (spec%get_mass() < 0)
call spec%set_mass(element_mass(el))
328 if (spec%get_vdw_radius() < 0)
call spec%set_vdw_radius(element_vdw_radius(el))
342 integer,
intent(in) :: iunit
343 integer,
intent(inout) :: read_data
346 character(len=LABEL_LEN) :: label
347 character(len=MAX_PATH_LEN) :: filename
348 type(element_t) :: element
349 integer :: lmax, llocal
356 read(iunit,*) label, filename, zz, lmax, llocal
358 call spec%set_filename(trim(conf%share)//
'/pseudopotentials/'//trim(filename))
360 assert(trim(label) == trim(spec%get_label()))
365 call element_init(element, get_symbol(label))
367 assert(element_valid(element))
370 if (spec%get_z() < 0)
call spec%set_z(zz)
371 if (spec%get_z() < 0)
call spec%set_z(real(element_atomic_number(element), real64))
372 if (spec%user_lmax == invalid_l) spec%user_lmax = lmax
373 if (spec%user_llocal == invalid_l) spec%user_llocal = llocal
374 if (spec%get_mass() < 0)
call spec%set_mass(element_mass(element))
375 if (spec%get_vdw_radius() < 0)
call spec%set_vdw_radius(element_vdw_radius(element))
377 call element_end(element)
387 integer,
intent(in) :: np
388 real(real64),
contiguous,
intent(in) :: x(:,:)
389 real(real64),
contiguous,
intent(in) :: r(:)
390 integer,
intent(in) :: l, lm, i
391 real(real64),
contiguous,
intent(out) :: uv(:)
399 if (r(ip) <= spec%ps%kb(l, i)%x_threshold)
then
400 uv(ip) = spline_eval(spec%ps%kb(l, i), r(ip))
401 call ylmr_real(x(1:3, ip), l, lm, ylm)
402 uv(ip) = uv(ip) * ylm
416 integer,
intent(in) :: np
417 real(real64),
contiguous,
intent(in) :: x(:,:)
418 real(real64),
contiguous,
intent(in) :: r(:)
419 integer,
intent(in) :: l, lm, i
420 complex(real64),
contiguous,
intent(out) :: uv(:)
423 complex(real64) :: ylm
428 if (r(ip) <= spec%ps%kb(l, i)%x_threshold)
then
429 uv(ip) = spline_eval(spec%ps%kb(l, i), r(ip))
430 call ylmr_cmplx(x(1:3, ip), l, lm, ylm)
431 uv(ip) = uv(ip) * ylm
444 type(namespace_t),
intent(in) :: namespace
445 integer,
intent(in) :: nspin
446 integer,
intent(in) :: dim
448 integer :: is, n, i, l, m
454 do i = 1, spec%ps%conf%p
455 if (n > spec%niwfs)
exit
456 l = spec%ps%conf%l(i)
458 if (.not. spec%ps%bound(i,is)) cycle
461 spec%iwf_i(n, is) = i
462 spec%iwf_n(n, is) = spec%ps%conf%n(i)
463 spec%iwf_l(n, is) = l
464 spec%iwf_m(n, is) = m
465 spec%iwf_j(n) = spec%ps%conf%j(i)
479 integer,
intent(in) :: ii
480 integer,
intent(in) :: is
481 real(real64),
optional,
intent(in) :: threshold
483 real(real64) threshold_
487 threshold_ = optional_default(threshold, spec%ps%projectors_sphere_threshold)
488 assert(ii <= spec%ps%conf%p)
489 radius = spline_x_threshold(spec%ps%ur(ii, is), threshold_)
501 if (spec%ps%lmax == 0 .and. spec%ps%llocal == 0) is_local = .
true.
513 type(namespace_t),
intent(in) :: namespace
514 real(real64),
intent(in) :: grid_cutoff
515 integer,
intent(in) :: filter
517 character(len=256) :: dirname
518 integer :: iorb, ispin
519 real(real64) :: local_radius, orbital_radius
523 call ps_separate(this%ps)
525 call ps_getradius(this%ps)
527 if (filter /= ps_filter_none .and. this%ps%projector_type /= proj_hgh)
then
528 call ps_filter(this%ps, filter, grid_cutoff)
529 call ps_getradius(this%ps)
532 call ps_derivatives(this%ps)
534 local_radius = this%ps%vl%x_threshold
536 orbital_radius = m_zero
537 do iorb = 1, this%get_niwfs()
538 do ispin = 1,
size(this%iwf_i, 2)
539 orbital_radius = max(orbital_radius, &
540 this%get_iwf_radius(this%iwf_i(iorb, ispin), is = ispin))
544 call messages_write(
'Info: Pseudopotential for '//trim(this%get_label()), new_line = .
true.)
545 call messages_write(
' Radii for localized parts:', new_line = .
true.)
546 call messages_write(
' local part = ')
547 call messages_write(local_radius, fmt =
'f5.1', units = units_out%length, new_line = .
true.)
548 call messages_write(
' non-local part = ')
549 call messages_write(this%ps%rc_max, fmt =
'f5.1', units = units_out%length, new_line = .
true.)
550 call messages_write(
' orbitals = ')
551 call messages_write(orbital_radius, fmt =
'f5.1', units = units_out%length, new_line = .
true.)
552 call messages_info(namespace=namespace)
554 if (max(local_radius, this%ps%rc_max) > 6.0_real64)
then
555 call messages_write(
"One of the radii of your pseudopotential's localized parts seems", new_line = .
true.)
556 call messages_write(
"unusually large; check that your pseudopotential is correct.")
557 call messages_warning(namespace=namespace)
560 if (orbital_radius > 20.0_real64)
then
561 call messages_write(
"The radius of the atomic orbitals given by your pseudopotential seems", new_line = .
true.)
562 call messages_write(
"unusually large; check that your pseudopotential is correct.")
563 call messages_warning(namespace=namespace)
567 write(dirname,
'(a)')
'debug/geometry'
568 call io_mkdir(dirname, namespace)
569 call this%debug(trim(dirname), namespace, grid_cutoff)
578 character(len=*),
intent(in) :: dir
579 type(namespace_t),
intent(in) :: namespace
580 real(real64),
intent(in) :: gmax
583 character(len=256) :: dirname
586 if (.not. mpi_world%is_root())
then
592 dirname = trim(dir)//
'/'//trim(spec%get_label())
594 call io_mkdir(dirname, namespace)
596 iunit = io_open(trim(dirname)//
'/info', namespace, action=
'write')
598 write(iunit,
'(a,i3)')
'Index = ', spec%get_index()
599 write(iunit,
'(2a)')
'Label = ', trim(spec%get_label())
601 write(iunit,
'(a,f15.2)')
'z = ', spec%get_z()
602 write(iunit,
'(a,f15.2)')
'z_val = ', spec%get_zval()
603 write(iunit,
'(a,f15.2)')
'mass = ', spec%get_mass()
604 write(iunit,
'(a,f15.2)')
'vdw_radius = ', spec%get_vdw_radius()
605 write(iunit,
'(a,l1)')
'local = ', spec%is_local()
606 write(iunit,
'(a,l1)')
'nlcc = ', spec%nlcc
607 write(iunit,
'(a,i3)')
'hubbard_l = ', spec%get_hubbard_l()
608 write(iunit,
'(a,f15.2)')
'hubbard_U = ', spec%get_hubbard_U()
609 write(iunit,
'(a,f15.2)')
'hubbard_j = ', spec%get_hubbard_j()
610 write(iunit,
'(a,f15.2)')
'hubbard_alpha = ', spec%get_hubbard_alpha()
612 if (debug%info)
call ps_debug(spec%ps, trim(dirname), namespace, gmax)
621 type(namespace_t),
intent(in) :: namespace
622 integer,
intent(in) :: ispin
623 integer,
intent(in) :: dim
624 logical,
optional,
intent(in) :: print_info
630 call spec%set_mass(units_to_atomic(unit_amu, spec%get_mass()))
632 spec%has_density = .false.
635 safe_allocate(spec%ps)
637 call ps_pspio_init(spec%ps, namespace, spec%get_label(), spec%get_z(), spec%user_lmax, &
638 ispin, spec%get_filename())
640 call ps_init(spec%ps, namespace, spec%get_label(), spec%get_z(), spec%user_lmax, &
641 spec%user_llocal, ispin, spec%get_filename())
643 call spec%set_zval(spec%ps%z_val)
644 spec%nlcc = spec%ps%nlcc
645 spec%niwfs = ps_bound_niwfs(spec%ps)
648 spec%user_lmax = invalid_l
649 spec%user_llocal = invalid_l
651 safe_allocate(spec%iwf_n(1:spec%niwfs, 1:ispin))
652 safe_allocate(spec%iwf_l(1:spec%niwfs, 1:ispin))
653 safe_allocate(spec%iwf_m(1:spec%niwfs, 1:ispin))
654 safe_allocate(spec%iwf_i(1:spec%niwfs, 1:ispin))
655 safe_allocate(spec%iwf_j(1:spec%niwfs))
657 call spec%iwf_fix_qn(namespace, ispin, dim)
664 logical pure function pseudopotential_is_ps(this)
672 logical pure function pseudopotential_is_ps_with_nlcc(this)
680 logical pure function pseudopotential_represents_real_atom(spec)
This module is intended to contain "only mathematical" functions and procedures.
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
subroutine, public ps_end(ps)
integer, parameter, public invalid_l
real(real64) pure function pseudopotential_get_radius(spec)
Return radius of the pseudopotential if this is a pseudo, zero otherwise.
subroutine pseudopotential_build(spec, namespace, ispin, dim, print_info)
subroutine, public pseudopotential_nl_projector(spec, np, x, r, l, lm, i, uV)
This routine returns the non-local projector, built using spherical harmonics.
logical pure function pseudopotential_has_nlcc(spec)
integer pure function pseudopotential_get_user_lmax(spec)
logical pure function pseudopotential_is_ps_with_nlcc(this)
Is the species a pseudopotential derived class or not with nlcc.
subroutine pseudopotential_iwf_fix_qn(spec, namespace, nspin, dim)
set up quantum numbers of orbitals
subroutine pseudopotential_finalize(spec)
real(real64) function pseudopotential_get_iwf_radius(spec, ii, is, threshold)
Return radius outside which orbital is less than threshold value 0.001.
character(len=max_path_len) function, public get_set_directory(set_id)
subroutine, public read_from_default_file(iunit, read_data, spec)
subroutine, public read_from_set(spec, set_id, set, read_data)
Creates a pseudopotential type from a set.
logical pure function pseudopotential_is_ultrasoft(spec)
logical pure function pseudopotential_represents_real_atom(spec)
Is the species representing an atomic species or not.
logical function pseudopotential_is_local(spec)
integer pure function pseudopotential_x_functional(spec)
subroutine pseudopotential_init_potential(this, namespace, grid_cutoff, filter)
This routine performs some operations on the pseudopotential functions (filtering,...
integer pure function pseudopotential_c_functional(spec)
logical pure function pseudopotential_is_ps(this)
Is the species a pseudopotential derived class or not.
integer pure function pseudopotential_get_user_lloc(spec)
logical pure function pseudopotential_is_paw(spec)
pure subroutine pseudopotential_set_user_lloc(spec, ll)
pure subroutine pseudopotential_set_user_lmax(spec, ll)
subroutine, public pseudopotential_real_nl_projector(spec, np, x, r, l, lm, i, uV)
This routine returns the non-local projector and its derivative, built using real spherical harmonics...
subroutine pseudopotential_debug(spec, dir, namespace, gmax)
class(pseudopotential_t) function, pointer pseudopotential_constructor(label, index)
The factory routine (or constructor) allocates a pointer of the corresponding type and then calls the...
logical pure function pseudopotential_requires_generalized_overlap(spec)
integer, parameter, public species_pspio
pseudopotential parsed by pspio library
subroutine, public species_end(species)
subroutine, public species_init(this, label, index)
Initializes a species object. This should be the first routine to be called (before species_read and ...
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
This module defines the unit system, used for input and output.
An abstract class for species. Derived classes include jellium, all electron, and pseudopotential spe...