54 real(real64) :: sigma = -
m_one
56 type(valconf_t),
public :: conf
75 real(real64) :: softening2
85 real(real64) :: aa = -
m_one
86 real(real64) :: bb =
m_zero
109 procedure soft_coulomb_constructor
113 procedure full_delta_constructor
117 procedure full_gaussian_constructor
121 procedure full_anc_constructor
124 real(real64) :: alpha_p
125 type(logrid_t),
pointer :: grid_p
132 class(soft_coulomb_t),
pointer :: spec
133 character(len=*),
intent(in) :: label
134 integer,
intent(in) :: index
144 spec%softening2 = -
m_one
153 character(len=*),
intent(in) :: label
154 integer,
intent(in) :: index
155 real(real64),
intent(in) :: a
175 character(len=*),
intent(in) :: label
176 integer,
intent(in) :: index
177 real(real64),
intent(in) :: sigma
194 class(full_gaussian_t),
pointer :: spec
195 character(len=*),
intent(in) :: label
196 integer,
intent(in) :: index
197 real(real64),
intent(in) :: sigma
213 real(real64)
pure function allelectron_sigma(spec)
214 class(allelectron_t),
intent(in) :: spec
215 allelectron_sigma = spec%sigma
221 real(real64),
intent(in) :: sigma
246 real(real64),
intent(in) :: a
261 real(real64),
intent(in) :: a2
270 type(namespace_t),
intent(in) :: namespace
271 integer,
intent(in) :: nspin
272 integer,
intent(in) :: dim
274 integer :: is, n, i, l, m, n1, n2, ii, nn
284 spec%iwf_i(i, is) = i
285 spec%iwf_n(i, is) = 0
286 spec%iwf_l(i, is) = 0
287 spec%iwf_m(i, is) = 0
288 spec%iwf_j(i) = m_zero
298 spec%iwf_i(i, is) = n1
299 spec%iwf_n(i, is) = 1
300 spec%iwf_l(i, is) = n2
301 spec%iwf_m(i, is) = 0
302 spec%iwf_j(i) = m_zero
304 if (i>spec%niwfs)
exit
306 spec%iwf_i(i, is) = n1+1
307 spec%iwf_n(i, is) = 1
308 spec%iwf_l(i, is) = n2
309 spec%iwf_m(i, is) = 0
310 spec%iwf_j(i) = m_zero
312 if (i>spec%niwfs)
exit
314 spec%iwf_i(i, is) = n1
315 spec%iwf_n(i, is) = 1
316 spec%iwf_l(i, is) = n2+1
317 spec%iwf_m(i, is) = 0
318 spec%iwf_j(i) = m_zero
320 if (i>spec%niwfs)
exit
322 n1 = n1 + 1; n2 = n2 + 1
333 if (n > spec%niwfs)
exit
336 spec%iwf_i(n, is) = ii
337 spec%iwf_n(n, is) = nn
338 spec%iwf_l(n, is) = l
339 spec%iwf_m(n, is) = m
340 spec%iwf_j(n) = m_zero
355 spec%conf%symbol = species_label_short(spec)
356 call ps_guess_atomic_occupations(namespace, spec%get_z(), spec%get_zval(), nspin, spec%conf)
361 do i = 1, spec%conf%p
362 if (n > spec%niwfs)
exit
366 spec%iwf_i(n, is) = i
367 spec%iwf_n(n, is) = spec%conf%n(i)
368 spec%iwf_l(n, is) = l
369 spec%iwf_m(n, is) = m
370 spec%iwf_j(n) = spec%conf%j(i)
386 real(real64) function allelectron_get_iwf_radius(spec, ii, is, threshold) result(radius)
388 integer,
intent(in) :: ii
389 integer,
intent(in) :: is
390 real(real64),
optional,
intent(in) :: threshold
392 real(real64) threshold_
396 threshold_ = optional_default(threshold, 0.001_real64)
400 radius = -ii*
log(threshold_)/spec%get_zval()
403 radius = -
log(threshold_*
sqrt(m_pi/(spec%get_zval()**3)))/spec%get_zval()
411 radius = radius * ii**2
423 logical pure function allelectron_is_local(spec) result(is_local)
436 type(namespace_t),
intent(in) :: namespace
437 real(real64),
intent(in) :: grid_cutoff
438 integer,
intent(in) :: filter
440 real(real64) :: grid_aa, grid_bb, bb(1), startval(1)
443 type(root_solver_t) :: rs
452 call logrid_find_parameters(namespace, int(this%get_z()), grid_aa, grid_bb, grid_np)
454 call logrid_init(
grid_p, logrid_psf, grid_aa, grid_bb, grid_np)
458 startval(1) = -0.1_real64
461 call root_solver_init(rs, namespace, 1, solver_type=root_newton, maxiter=500, abs_tolerance=1.0e-10_real64)
462 call droot_solver_run(rs,
func_anc, bb, conv, startval=startval)
465 write(message(1),
'(a)')
'Root finding in allelectron_init_potential did not converge.'
466 call messages_fatal(1, namespace=namespace)
471 write(message(1),
'(3a, f12.6)')
'Info: species_full_anc species ', trim(this%get_label()), &
472 ': optimized value of b = ', this%bb
473 call messages_info(1, namespace=namespace)
487 subroutine func_anc(xin, ff, jacobian)
488 real(real64),
intent(in) :: xin(:)
489 real(real64),
intent(out) :: ff(:), jacobian(:,:)
491 real(real64),
allocatable :: rho(:)
497 safe_allocate(rho(1:
grid_p%nrval))
498 norm = m_one/
sqrt(m_pi)
501 rho(ip) = norm *
exp(rho(ip))
505 ff(1) = sum(
grid_p%drdi*rho**2*
grid_p%r2ofi) - m_one/m_four/m_pi
513 safe_deallocate_a(rho)
521 character(len=*),
intent(in) :: dir
522 type(namespace_t),
intent(in) :: namespace
523 real(real64),
intent(in) :: gmax
525 character(len=256) :: dirname
528 if (.not. mpi_world%is_root())
then
534 dirname = trim(dir)//
'/'//trim(spec%get_label())
536 call io_mkdir(dirname, namespace)
538 iunit = io_open(trim(dirname)//
'/info', namespace, action=
'write')
540 write(iunit,
'(a,i3)')
'Index = ', spec%get_index()
541 write(iunit,
'(2a)')
'Label = ', trim(spec%get_label())
542 write(iunit,
'(a,f15.2)')
'z = ', spec%get_z()
543 write(iunit,
'(a,f15.2)')
'z_val = ', spec%get_zval()
544 write(iunit,
'(a,f15.2)')
'mass = ', spec%get_mass()
545 write(iunit,
'(a,f15.2)')
'vdw_radius = ', spec%get_vdw_radius()
546 write(iunit,
'(a,l1)')
'local = ', spec%is_local()
547 write(iunit,
'(a,i3)')
'hubbard_l = ', spec%get_hubbard_l()
548 write(iunit,
'(a,f15.2)')
'hubbard_U = ', spec%get_hubbard_U()
549 write(iunit,
'(a,f15.2)')
'hubbard_j = ', spec%get_hubbard_j()
550 write(iunit,
'(a,f15.2)')
'hubbard_alpha = ', spec%get_hubbard_alpha()
559 type(namespace_t),
intent(in) :: namespace
560 integer,
intent(in) :: ispin
561 integer,
intent(in) :: dim
562 logical,
optional,
intent(in) :: print_info
564 logical :: print_info_
568 print_info_ = optional_default(print_info, .
true.)
571 call spec%set_mass(units_to_atomic(unit_amu, spec%get_mass()))
573 spec%has_density = .false.
577 if (print_info_)
then
578 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is a soft-Coulomb potential.'
579 call messages_info(1, namespace=namespace)
583 spec%has_density = .
true.
584 if (print_info_)
then
585 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is an all-electron atom.'
586 write(message(2),
'(a,f11.6)')
' Z = ', spec%get_z()
587 write(message(3),
'(a)')
' Potential will be calculated solving the Poisson equation'
588 write(message(4),
'(a)')
' for a delta density distribution.'
589 call messages_info(4, namespace=namespace)
593 spec%has_density = .
true.
594 if (print_info_)
then
595 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is an all-electron atom.'
596 write(message(2),
'(a,f11.6)')
' Z = ', spec%get_z()
597 write(message(3),
'(a)')
' Potential will be calculated solving the Poisson equation'
598 write(message(4),
'(a)')
' for a Gaussian density distribution.'
599 write(message(5),
'(a,f11.6)')
' sigma = ', spec%sigma
600 call messages_info(5, namespace=namespace)
602 assert(spec%sigma > 0)
605 spec%has_density = .false.
606 if (print_info_)
then
607 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is an all-electron atom.'
608 write(message(2),
'(a,f11.6)')
' Z = ', spec%get_z()
609 write(message(3),
'(a)')
' Potential is an analytical norm-conserving regularized potential'
610 write(message(4),
'(a,f11.6)')
' a = ', spec%aa
611 write(message(5),
'(a,f11.6,a)')
' regularization length 1/(a Z) = ', &
612 m_one/(spec%aa*spec%get_z()),
' [bohr]'
613 call messages_info(5, namespace=namespace)
618 call messages_input_error(namespace,
'Species',
'Unknown species type')
621 spec%niwfs = species_closed_shell_size(
floor(m_half*spec%get_zval()+m_half))
625 spec%niwfs = species_closed_shell_size(spec%niwfs+1)
626 spec%omega = spec%get_z()
628 safe_allocate(spec%iwf_n(1:spec%niwfs, 1:ispin))
629 safe_allocate(spec%iwf_l(1:spec%niwfs, 1:ispin))
630 safe_allocate(spec%iwf_m(1:spec%niwfs, 1:ispin))
631 safe_allocate(spec%iwf_i(1:spec%niwfs, 1:ispin))
632 safe_allocate(spec%iwf_j(1:spec%niwfs))
634 call spec%iwf_fix_qn(namespace, ispin, dim)
636 write(message(1),
'(a,i6)')
'Number of orbitals: ', spec%niwfs
637 if (print_info_)
call messages_info(1, namespace=namespace)
644 logical pure function allelectron_is_full(this)
657 logical pure function allelectron_represents_real_atom(spec)
double log(double __x) __attribute__((__nothrow__
double exp(double __x) __attribute__((__nothrow__
double sqrt(double __x) __attribute__((__nothrow__
double floor(double __x) __attribute__((__nothrow__
pure subroutine allelectron_set_sigma(spec, sigma)
type(logrid_t), pointer grid_p
logical pure function allelectron_represents_real_atom(spec)
Is the species representing an atomic species or not.
real(real64) function allelectron_get_iwf_radius(spec, ii, is, threshold)
Return radius outside which orbital is less than threshold value 0.001.
class(full_gaussian_t) function, pointer full_gaussian_constructor(label, index, sigma)
Constructor for full_gaussian_t.
pure subroutine full_anc_set_a(spec, a)
real(real64) pure function soft_coulomb_softening2(spec)
Get the square of the softening parameter a.
class(soft_coulomb_t) function, pointer soft_coulomb_constructor(label, index)
real(real64) pure function full_anc_b(spec)
real(real64) pure function allelectron_sigma(spec)
subroutine allelectron_iwf_fix_qn(spec, namespace, nspin, dim)
set up quantum numbers of orbitals
real(real64) pure function full_anc_a(spec)
class(full_anc_t) function, pointer full_anc_constructor(label, index, a)
Constructor for full_anc_t.
subroutine allelectron_build(spec, namespace, ispin, dim, print_info)
subroutine allelectron_debug(spec, dir, namespace, gmax)
subroutine allelectron_init_potential(this, namespace, grid_cutoff, filter)
This routine performs some operations on the pseudopotential functions (filtering,...
real(real64) pure function allelectron_omega(spec)
class(full_delta_t) function, pointer full_delta_constructor(label, index, sigma)
Constructor for full_delta_t.
logical pure function allelectron_is_local(spec)
pure subroutine soft_coulomb_set_softening2(spec, a2)
Set the square of the softening parameter a.
subroutine func_anc(xin, ff, jacobian)
logical pure function allelectron_is_full(this)
Is the species an all-electron derived class or not.
real(real64), parameter, public m_zero
real(real64), parameter, public m_one
This module is intended to contain "only mathematical" functions and procedures.
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 type for all electron species.
An abstract class for species. Derived classes include jellium, all electron, and pseudopotential spe...