46 integer,
public,
parameter :: &
47 SPECIES_JELLIUM = 3, & !< jellium sphere.
73 real(real64) :: jradius
84 real(real64) :: jthick
96 character(len=200),
public :: density_formula
113 character(len=1024),
public :: potential_formula
122 character(len=200),
public :: density_formula
129 procedure jellium_sphere_constructor
133 procedure jellium_slab_constructor
137 procedure jellium_charge_constructor
149 procedure species_charge_density_constructor
159 character(len=*),
intent(in) :: label
160 integer,
intent(in) :: index
176 type(jellium_slab_t),
intent(inout) :: this
187 class(jellium_sphere_t),
pointer :: spec
188 character(len=*),
intent(in) :: label
189 integer,
intent(in) :: index
218 character(len=*),
intent(in) :: label
219 integer,
intent(in) :: index
228 spec%density_formula =
""
249 character(len=*),
intent(in) :: label
250 integer,
intent(in) :: index
278 character(len=*),
intent(in) :: label
279 integer,
intent(in) :: index
287 spec%potential_formula =
""
309 character(len=*),
intent(in) :: label
310 integer,
intent(in) :: index
319 spec%density_formula =
""
337 real(real64)
pure function jellium_get_omega(spec)
339 jellium_get_omega = spec%omega
352 real(real64),
intent(in) :: radius
353 spec%jradius = radius
357 real(real64)
pure function jellium_thick(spec)
365 real(real64),
intent(in) :: thick
385 integer,
intent(in) :: dim
386 real(real64),
intent(in) :: xx(:)
387 real(real64),
intent(in) :: r
389 real(real64) :: pot_re, pot_im
393 call parse_expression(pot_re, pot_im, dim, xx, r, m_zero, spec%potential_formula)
403 type(namespace_t),
intent(in) :: namespace
404 integer,
intent(in) :: nspin
405 integer,
intent(in) :: dim
407 integer :: is, i, n1, n2, n3
415 spec%iwf_i(i, is) = i
416 spec%iwf_n(i, is) = 0
417 spec%iwf_l(i, is) = 0
418 spec%iwf_m(i, is) = 0
419 spec%iwf_j(i) = m_zero
429 spec%iwf_i(i, is) = n1
430 spec%iwf_n(i, is) = 1
431 spec%iwf_l(i, is) = n2
432 spec%iwf_m(i, is) = 0
433 spec%iwf_j(i) = m_zero
435 if (i>spec%niwfs)
exit
437 spec%iwf_i(i, is) = n1+1
438 spec%iwf_n(i, is) = 1
439 spec%iwf_l(i, is) = n2
440 spec%iwf_m(i, is) = 0
441 spec%iwf_j(i) = m_zero
443 if (i>spec%niwfs)
exit
445 spec%iwf_i(i, is) = n1
446 spec%iwf_n(i, is) = 1
447 spec%iwf_l(i, is) = n2+1
448 spec%iwf_m(i, is) = 0
449 spec%iwf_j(i) = m_zero
451 if (i>spec%niwfs)
exit
453 n1 = n1 + 1; n2 = n2 + 1
464 spec%iwf_i(i, is) = n1
465 spec%iwf_n(i, is) = 1
466 spec%iwf_l(i, is) = n2
467 spec%iwf_m(i, is) = n3
468 spec%iwf_j(i) = m_zero
470 if (i>spec%niwfs)
exit
472 spec%iwf_i(i, is) = n1+1
473 spec%iwf_n(i, is) = 1
474 spec%iwf_l(i, is) = n2
475 spec%iwf_m(i, is) = n3
476 spec%iwf_j(i) = m_zero
478 if (i>spec%niwfs)
exit
480 spec%iwf_i(i, is) = n1
481 spec%iwf_n(i, is) = 1
482 spec%iwf_l(i, is) = n2+1
483 spec%iwf_m(i, is) = 0
484 spec%iwf_j(i) = m_zero
486 if (i>spec%niwfs)
exit
488 spec%iwf_i(i, is) = n1
489 spec%iwf_n(i, is) = 1
490 spec%iwf_l(i, is) = n2
491 spec%iwf_m(i, is) = n3+1
492 spec%iwf_j(i) = m_zero
494 if (i>spec%niwfs)
exit
496 spec%iwf_i(i, is) = n1+1
497 spec%iwf_n(i, is) = 1
498 spec%iwf_l(i, is) = n2+1
499 spec%iwf_m(i, is) = n3
500 spec%iwf_j(i) = m_zero
502 if (i>spec%niwfs)
exit
504 spec%iwf_i(i, is) = n1+1
505 spec%iwf_n(i, is) = 1
506 spec%iwf_l(i, is) = n2
507 spec%iwf_m(i, is) = n3+1
508 spec%iwf_j(i) = m_zero
510 if (i>spec%niwfs)
exit
512 spec%iwf_i(i, is) = n1
513 spec%iwf_n(i, is) = 1
514 spec%iwf_l(i, is) = n2+1
515 spec%iwf_m(i, is) = n3+1
516 spec%iwf_j(i) = m_zero
518 if (i>spec%niwfs)
exit
534 real(real64)
pure function jellium_get_iwf_radius(spec, ii, is, threshold) result(radius)
536 integer,
intent(in) :: ii
537 integer,
intent(in) :: is
538 real(real64),
optional,
intent(in) :: threshold
540 real(real64) threshold_
542 threshold_ = optional_default(threshold, 0.001_real64)
544 radius =
sqrt(-m_two*
log(threshold_)/spec%omega)
553 logical pure function jellium_is_local(spec) result(is_local)
564 type(namespace_t),
intent(in) :: namespace
565 real(real64),
intent(in) :: grid_cutoff
566 integer,
intent(in) :: filter
577 character(len=*),
intent(in) :: dir
578 type(namespace_t),
intent(in) :: namespace
579 real(real64),
intent(in) :: gmax
581 character(len=256) :: dirname
584 if (.not. mpi_grp_is_root(mpi_world))
then
590 dirname = trim(dir)//
'/'//trim(spec%get_label())
592 call io_mkdir(dirname, namespace)
594 iunit = io_open(trim(dirname)//
'/info', namespace, action=
'write')
596 write(iunit,
'(a,i3)')
'Index = ', spec%get_index()
597 write(iunit,
'(2a)')
'Label = ', trim(spec%get_label())
598 write(iunit,
'(a,f15.2)')
'z_val = ', spec%get_zval()
599 write(iunit,
'(a,f15.2)')
'mass = ', spec%get_mass()
600 write(iunit,
'(a,f15.2)')
'vdw_radius = ', spec%get_vdw_radius()
601 write(iunit,
'(a,l1)')
'local = ', spec%is_local()
605 write(iunit,
'(a,f15.2)')
'z = ', spec%get_z()
606 write(iunit,
'(a)')
'Species read from file "'//trim(spec%get_filename())//
'".'
608 write(iunit,
'(a,f15.2)')
'z = ', spec%get_z()
609 write(iunit,
'(a,f15.2)')
'jradius= ', spec%radius()
611 write(iunit,
'(a,f15.2)')
'z = ', spec%get_z()
612 write(iunit,
'(a,f15.2)')
'jthick= ', spec%thickness()
614 write(iunit,
'(2a)')
'usdef = ', trim(spec%potential_formula)
617 write(iunit,
'(a,i3)')
'hubbard_l = ', spec%get_hubbard_l()
618 write(iunit,
'(a,f15.2)')
'hubbard_U = ', spec%get_hubbard_U()
619 write(iunit,
'(a,f15.2)')
'hubbard_j = ', spec%get_hubbard_j()
620 write(iunit,
'(a,f15.2)')
'hubbard_alpha = ', spec%get_hubbard_alpha()
629 type(namespace_t),
intent(in) :: namespace
630 integer,
intent(in) :: ispin
631 integer,
intent(in) :: dim
632 logical,
optional,
intent(in) :: print_info
634 logical :: print_info_
636 real(real64) :: pot_re, pot_im, xx(dim), rr
640 print_info_ = optional_default(print_info, .
true.)
643 call spec%set_mass(units_to_atomic(unit_amu, spec%get_mass()))
645 spec%has_density = .false.
649 if (print_info_)
then
650 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is a user-defined potential.'
651 i = min(237, len_trim(spec%potential_formula)-1)
652 write(message(2),
'(a,a)')
' Potential = ', trim(spec%potential_formula(1:i))
653 if (len(trim(spec%potential_formula)) > 237)
then
654 message(2) = trim(message(2))//
'...'
656 call messages_info(2, namespace=namespace)
658 spec%niwfs = int(max(2*spec%get_zval(), m_one))
663 call parse_expression(pot_re, pot_im, dim, xx, rr, m_zero, spec%potential_formula)
664 spec%omega =
sqrt(abs(m_two / 1.0e-4_real64 * pot_re))
666 if (spec%omega <= m_zero) spec%omega = 0.1_real64
669 if (print_info_)
then
670 write(message(1),
'(a)')
'Species read from file "'//trim(spec%get_filename())//
'".'
671 call messages_info(1, namespace=namespace)
673 spec%niwfs = 2*nint(spec%get_zval()+m_half)
674 spec%omega = 0.1_real64
677 if (print_info_)
then
678 write(message(1),
'(a,a,a)')
'Species "', trim(spec%get_label()), &
679 '" is a jellium sphere / approximated point particle.'
680 write(message(2),
'(a,f11.6)')
' Valence charge = ', spec%get_zval()
681 write(message(3),
'(a,f11.6)')
' Radius [a.u] = ', spec%jradius
682 write(message(4),
'(a,f11.6)')
' Rs [a.u] = ', spec%jradius * spec%get_zval() ** (-m_one/m_three)
683 call messages_info(4, namespace=namespace)
685 spec%niwfs = species_closed_shell_size(2*nint(spec%get_zval()+m_half))
686 spec%omega = 0.1_real64
689 if (print_info_)
then
690 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is a jellium slab.'
691 write(message(2),
'(a,f11.6)')
' Valence charge = ', spec%get_zval()
692 write(message(3),
'(a,f11.6)')
' Thickness [a.u] = ', spec%jthick
695 call messages_info(3, namespace=namespace)
697 spec%niwfs = 2*nint(spec%get_zval()+m_half)
698 spec%omega = 0.1_real64
701 spec%niwfs = int(max(2*spec%get_zval(), m_one))
702 spec%omega = spec%get_zval()
703 spec%has_density = .
true.
704 if (print_info_)
then
705 write(message(1),
'(a,a,a)')
'Species "', trim(spec%get_label()),
'" is a distribution of charge:'
706 write(message(2),
'(a,a,a)')
' rho is enclosed in volume defined by the "', &
707 trim(spec%density_formula),
'" block'
708 write(message(3),
'(a,f11.6)')
' Z = ', spec%get_zval()
709 call messages_info(3, namespace=namespace)
713 spec%niwfs = int(max(2*spec%get_zval(), m_one))
714 spec%omega = spec%get_zval()
715 spec%has_density = .
true.
716 if (print_info_)
then
717 write(message(1),
'(a,a,a)')
'Species "', trim(spec%get_label()),
'" is a distribution of charge:'
718 write(message(2),
'(a,a)')
' rho = ', trim(spec%density_formula)
719 write(message(3),
'(a,f11.6)')
' Z = ', spec%get_zval()
720 call messages_info(3, namespace=namespace)
723 call messages_input_error(namespace,
'Species',
'Unknown species type')
727 spec%niwfs = max(5, spec%niwfs)
729 safe_allocate(spec%iwf_n(1:spec%niwfs, 1:ispin))
730 safe_allocate(spec%iwf_l(1:spec%niwfs, 1:ispin))
731 safe_allocate(spec%iwf_m(1:spec%niwfs, 1:ispin))
732 safe_allocate(spec%iwf_i(1:spec%niwfs, 1:ispin))
733 safe_allocate(spec%iwf_j(1:spec%niwfs))
735 call spec%iwf_fix_qn(namespace, ispin, dim)
737 write(message(1),
'(a,i6,a,i6)')
'Number of orbitals: ', spec%niwfs
738 if (print_info_)
call messages_info(1, namespace=namespace)
745 logical pure function jellium_user_defined(spec)
763 real(real64)
pure function jellium_slab_density(slab, box_dim) result(density)
765 real(real64),
intent(in) :: box_dim(:)
768 density = slab%get_zval() / (box_dim(1) * box_dim(2) * m_four * slab%jthick)
double log(double __x) __attribute__((__nothrow__
double sqrt(double __x) __attribute__((__nothrow__
real(real64), parameter, public m_zero
real(real64), parameter, public m_half
real(real64), parameter, public m_one
subroutine species_user_defined_finalize(this)
real(real64) pure function jellium_get_omega(spec)
real(real64) pure function jellium_radius(spec)
logical pure function jellium_user_defined(spec)
Is the species user-defined or not.
logical pure function jellium_is_local(spec)
pure subroutine jellium_set_thickness(spec, thick)
subroutine jellium_iwf_fix_qn(spec, namespace, nspin, dim)
set up quantum numbers of orbitals
integer, parameter, public species_charge_density
user-defined function for charge density
integer, parameter, public species_jellium_charge_density
jellium volume read from file
subroutine jellium_charge_finalize(this)
class(jellium_slab_t) function, pointer jellium_slab_constructor(label, index)
class(species_user_defined_t) function, pointer species_user_defined_constructor(label, index)
subroutine jellium_slab_finalize(this)
subroutine jellium_build(spec, namespace, ispin, dim, print_info)
real(real64) pure function jellium_get_iwf_radius(spec, ii, is, threshold)
Return radius outside which orbital is less than threshold value 0.001.
class(jellium_charge_t) function, pointer jellium_charge_constructor(label, index)
class(jellium_sphere_t) function, pointer jellium_sphere_constructor(label, index)
pure subroutine jellium_set_radius(spec, radius)
subroutine species_charge_density_finalize(this)
character(len=200) pure function jellium_rho_string(spec)
subroutine species_from_file_finalize(this)
real(real64) pure function jellium_thick(spec)
real(real64) pure function jellium_slab_density(slab, box_dim)
Returns the electron density of a jellium slab.
complex(real64) function jellium_userdef_pot(spec, dim, xx, r)
integer, parameter, public species_from_file
class(species_from_file_t) function, pointer species_from_file_constructor(label, index)
integer, parameter, public species_usdef
user-defined function for local potential
subroutine jellium_sphere_finalize(this)
class(species_charge_density_t) function, pointer species_charge_density_constructor(label, index)
integer, parameter, public species_jellium_slab
jellium slab.
subroutine jellium_init_potential(this, namespace, grid_cutoff, filter)
Some operations like filtering of the potentials.
character(len=200) pure function species_rho_string(spec)
subroutine jellium_debug(spec, dir, namespace, gmax)
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...