50 integer,
public,
parameter :: &
51 SPECIES_PSEUDO = 7, & !< pseudopotential
60 type(ps_t),
allocatable,
public :: ps
63 integer :: user_llocal
65 integer,
public :: pseudopotential_set_id
66 logical,
public :: pseudopotential_set_initialized
67 type(pseudo_set_t),
public :: pseudopotential_set
91 procedure pseudopotential_constructor
103 class(pseudopotential_t),
pointer :: spec
104 character(len=*),
intent(in) :: label
105 integer,
intent(in) :: index
120 spec%pseudopotential_set_id = option__pseudopotentialset__none
121 spec%pseudopotential_set_initialized = .false.
130 type(pseudopotential_t),
intent(inout) :: spec
134 if (spec%pseudopotential_set_initialized)
then
136 spec%pseudopotential_set_initialized = .false.
139 if (
allocated(spec%ps))
call ps_end(spec%ps)
140 safe_deallocate_a(spec%ps)
148 logical pure function pseudopotential_has_nlcc(spec)
149 class(pseudopotential_t),
intent(in) :: spec
150 pseudopotential_has_nlcc = spec%nlcc
162 select case (spec%pseudopotential_set_id)
164 option__pseudopotentialset__standard, &
165 option__pseudopotentialset__hgh_lda, &
166 option__pseudopotentialset__hgh_lda_sc, &
167 option__pseudopotentialset__hscv_lda)
171 case (option__pseudopotentialset__hscv_pbe)
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__hscv_lda)
196 case (option__pseudopotentialset__hscv_pbe)
208 radius = spec%ps%rc_max
214 lloc = spec%user_llocal
220 lmax = spec%user_lmax
226 integer,
intent(in) :: ll
233 integer,
intent(in) :: ll
234 spec%user_llocal = ll
240 integer,
intent(in) :: set_id
245 case (option__pseudopotentialset__standard)
246 filename = trim(conf%share)//
'/pseudopotentials/PSF'
247 case (option__pseudopotentialset__sg15)
248 filename = trim(conf%share)//
'/pseudopotentials/quantum-simulation.org/sg15/'
249 case (option__pseudopotentialset__hgh_lda)
250 filename = trim(conf%share)//
'/pseudopotentials/HGH/lda/'
251 case (option__pseudopotentialset__hgh_lda_sc)
252 filename = trim(conf%share)//
'/pseudopotentials/HGH/lda_sc/'
253 case (option__pseudopotentialset__hscv_lda)
254 filename = trim(conf%share)//
'/pseudopotentials/quantum-simulation.org/hscv/lda/'
255 case (option__pseudopotentialset__hscv_pbe)
256 filename = trim(conf%share)//
'/pseudopotentials/quantum-simulation.org/hscv/pbe/'
257 case (option__pseudopotentialset__pseudodojo_lda)
258 filename = trim(conf%share)//
'/pseudopotentials/pseudo-dojo.org/nc-sr-04_pw_standard/'
259 case (option__pseudopotentialset__pseudodojo_pbe)
260 filename = trim(conf%share)//
'/pseudopotentials/pseudo-dojo.org/nc-sr-04_pbe_standard/'
261 case (option__pseudopotentialset__pseudodojo_pbesol)
262 filename = trim(conf%share)//
'/pseudopotentials/pseudo-dojo.org/nc-sr-04_pbesol_standard/'
263 case (option__pseudopotentialset__none)
276 integer,
intent(in) :: set_id
277 type(pseudo_set_t),
intent(in) :: set
278 integer,
intent(out) :: read_data
280 type(element_t) :: el
284 spec%pseudopotential_set_id = set_id
285 spec%pseudopotential_set = set
287 call element_init(el, get_symbol(spec%get_label()))
289 if (spec%pseudopotential_set_id /= option__pseudopotentialset__none .and. pseudo_set_has(spec%pseudopotential_set, el))
then
290 call spec%set_filename(pseudo_set_file_path(spec%pseudopotential_set, el))
293 if (spec%get_z() < 0)
call spec%set_z(real(element_atomic_number(el), real64))
294 if (spec%user_lmax == invalid_l) spec%user_lmax = pseudo_set_lmax(spec%pseudopotential_set, el)
295 if (spec%user_llocal == invalid_l) spec%user_llocal = pseudo_set_llocal(spec%pseudopotential_set, el)
296 if (spec%get_mass() < 0)
call spec%set_mass(element_mass(el))
297 if (spec%get_vdw_radius() < 0)
call spec%set_vdw_radius(element_vdw_radius(el))
311 integer,
intent(in) :: iunit
312 integer,
intent(inout) :: read_data
315 character(len=LABEL_LEN) :: label
316 character(len=MAX_PATH_LEN) :: filename
317 type(element_t) :: element
318 integer :: lmax, llocal
325 read(iunit,*) label, filename, zz, lmax, llocal
327 call spec%set_filename(trim(conf%share)//
'/pseudopotentials/'//trim(filename))
329 assert(trim(label) == trim(spec%get_label()))
334 call element_init(element, get_symbol(label))
336 assert(element_valid(element))
339 if (spec%get_z() < 0)
call spec%set_z(zz)
340 if (spec%get_z() < 0)
call spec%set_z(real(element_atomic_number(element), real64))
341 if (spec%user_lmax == invalid_l) spec%user_lmax = lmax
342 if (spec%user_llocal == invalid_l) spec%user_llocal = llocal
343 if (spec%get_mass() < 0)
call spec%set_mass(element_mass(element))
344 if (spec%get_vdw_radius() < 0)
call spec%set_vdw_radius(element_vdw_radius(element))
346 call element_end(element)
356 integer,
intent(in) :: np
357 real(real64),
intent(in) :: x(:,:)
358 real(real64),
intent(in) :: r(:)
359 integer,
intent(in) :: l, lm, i
360 real(real64),
intent(out) :: uv(:)
369 call spline_eval_vec(spec%ps%kb(l, i), np, uv)
372 call ylmr_real(x(1:3, ip), l, lm, ylm)
373 uv(ip) = uv(ip) * ylm
385 integer,
intent(in) :: np
386 real(real64),
intent(in) :: x(:,:)
387 real(real64),
intent(in) :: r(:)
388 integer,
intent(in) :: l, lm, i
389 complex(real64),
intent(out) :: uv(:)
392 complex(real64) :: ylm
398 call spline_eval_vec(spec%ps%kb(l, i), np, uv)
401 call ylmr_cmplx(x(1:3, ip), l, lm, ylm)
402 uv(ip) = uv(ip) * ylm
413 type(namespace_t),
intent(in) :: namespace
414 integer,
intent(in) :: nspin
415 integer,
intent(in) :: dim
417 integer :: is, n, i, l, m
423 do i = 1, spec%ps%conf%p
424 if (n > spec%niwfs)
exit
425 l = spec%ps%conf%l(i)
427 if (.not. spec%ps%bound(i,is)) cycle
430 spec%iwf_i(n, is) = i
431 spec%iwf_n(n, is) = spec%ps%conf%n(i)
432 spec%iwf_l(n, is) = l
433 spec%iwf_m(n, is) = m
434 spec%iwf_j(n) = spec%ps%conf%j(i)
448 integer,
intent(in) :: ii
449 integer,
intent(in) :: is
450 real(real64),
optional,
intent(in) :: threshold
452 real(real64) threshold_
456 threshold_ = optional_default(threshold, spec%ps%projectors_sphere_threshold)
457 assert(ii <= spec%ps%conf%p)
458 radius = spline_x_threshold(spec%ps%ur(ii, is), threshold_)
470 if (spec%ps%lmax == 0 .and. spec%ps%llocal == 0) is_local = .
true.
482 type(namespace_t),
intent(in) :: namespace
483 real(real64),
intent(in) :: grid_cutoff
484 integer,
intent(in) :: filter
486 character(len=256) :: dirname
488 real(real64) :: local_radius, orbital_radius
492 call ps_separate(this%ps)
494 call ps_getradius(this%ps)
496 if (filter /= ps_filter_none .and. this%ps%projector_type /= proj_hgh)
then
497 call ps_filter(this%ps, filter, grid_cutoff)
498 call ps_getradius(this%ps)
501 call ps_derivatives(this%ps)
503 local_radius = this%ps%vl%x_threshold
505 orbital_radius = m_zero
507 do iorb = 1, this%get_niwfs()
508 orbital_radius = max(orbital_radius, this%get_iwf_radius(this%iwf_i(iorb, 1), is = 1))
511 call messages_write(
'Info: Pseudopotential for '//trim(this%get_label()), new_line = .
true.)
512 call messages_write(
' Radii for localized parts:', new_line = .
true.)
513 call messages_write(
' local part = ')
514 call messages_write(local_radius, fmt =
'f5.1', units = units_out%length, new_line = .
true.)
515 call messages_write(
' non-local part = ')
516 call messages_write(this%ps%rc_max, fmt =
'f5.1', units = units_out%length, new_line = .
true.)
517 call messages_write(
' orbitals = ')
518 call messages_write(orbital_radius, fmt =
'f5.1', units = units_out%length, new_line = .
true.)
519 call messages_info(namespace=namespace)
521 if (max(local_radius, this%ps%rc_max) > 6.0_real64)
then
522 call messages_write(
"One of the radii of your pseudopotential's localized parts seems", new_line = .
true.)
523 call messages_write(
"unusually large; check that your pseudopotential is correct.")
524 call messages_warning(namespace=namespace)
527 if (orbital_radius > 20.0_real64)
then
528 call messages_write(
"The radius of the atomic orbitals given by your pseudopotential seems", new_line = .
true.)
529 call messages_write(
"unusually large; check that your pseudopotential is correct.")
530 call messages_warning(namespace=namespace)
534 write(dirname,
'(a)')
'debug/geometry'
535 call io_mkdir(dirname, namespace)
536 call this%debug(trim(dirname), namespace, grid_cutoff)
545 character(len=*),
intent(in) :: dir
546 type(namespace_t),
intent(in) :: namespace
547 real(real64),
intent(in) :: gmax
550 character(len=256) :: dirname
553 if (.not. mpi_grp_is_root(mpi_world))
then
559 dirname = trim(dir)//
'/'//trim(spec%get_label())
561 call io_mkdir(dirname, namespace)
563 iunit = io_open(trim(dirname)//
'/info', namespace, action=
'write')
565 write(iunit,
'(a,i3)')
'Index = ', spec%get_index()
566 write(iunit,
'(2a)')
'Label = ', trim(spec%get_label())
568 write(iunit,
'(a,f15.2)')
'z = ', spec%get_z()
569 write(iunit,
'(a,f15.2)')
'z_val = ', spec%get_zval()
570 write(iunit,
'(a,f15.2)')
'mass = ', spec%get_mass()
571 write(iunit,
'(a,f15.2)')
'vdw_radius = ', spec%get_vdw_radius()
572 write(iunit,
'(a,l1)')
'local = ', spec%is_local()
573 write(iunit,
'(a,l1)')
'nlcc = ', spec%nlcc
574 write(iunit,
'(a,i3)')
'hubbard_l = ', spec%get_hubbard_l()
575 write(iunit,
'(a,f15.2)')
'hubbard_U = ', spec%get_hubbard_U()
576 write(iunit,
'(a,f15.2)')
'hubbard_j = ', spec%get_hubbard_j()
577 write(iunit,
'(a,f15.2)')
'hubbard_alpha = ', spec%get_hubbard_alpha()
579 if (debug%info)
call ps_debug(spec%ps, trim(dirname), namespace, gmax)
588 type(namespace_t),
intent(in) :: namespace
589 integer,
intent(in) :: ispin
590 integer,
intent(in) :: dim
591 logical,
optional,
intent(in) :: print_info
593 logical :: print_info_
597 print_info_ = optional_default(print_info, .
true.)
600 call spec%set_mass(units_to_atomic(unit_amu, spec%get_mass()))
602 spec%has_density = .false.
605 safe_allocate(spec%ps)
607 call ps_pspio_init(spec%ps, namespace, spec%get_label(), spec%get_z(), spec%user_lmax, &
608 ispin, spec%get_filename())
610 call ps_init(spec%ps, namespace, spec%get_label(), spec%get_z(), spec%user_lmax, &
611 spec%user_llocal, ispin, spec%get_filename())
613 call spec%set_zval(spec%ps%z_val)
614 spec%nlcc = spec%ps%nlcc
615 spec%niwfs = ps_bound_niwfs(spec%ps)
618 spec%user_lmax = invalid_l
619 spec%user_llocal = invalid_l
621 safe_allocate(spec%iwf_n(1:spec%niwfs, 1:ispin))
622 safe_allocate(spec%iwf_l(1:spec%niwfs, 1:ispin))
623 safe_allocate(spec%iwf_m(1:spec%niwfs, 1:ispin))
624 safe_allocate(spec%iwf_i(1:spec%niwfs, 1:ispin))
625 safe_allocate(spec%iwf_j(1:spec%niwfs))
627 call spec%iwf_fix_qn(namespace, ispin, dim)
634 logical pure function pseudopotential_is_ps(this)
642 logical pure function pseudopotential_is_ps_with_nlcc(this)
650 logical pure function pseudopotential_represents_real_atom(spec)
This module is intended to contain "only mathematical" functions and procedures.
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_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)
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...
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...