54 real(real64) :: sigma = -
m_one
56 type(valconf_t),
public :: conf
75 real(real64) :: softening
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%softening = -
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) :: soft
262 spec%softening = soft
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-20_real64)
462 call droot_solver_run(rs,
func_anc, bb, conv, startval=startval)
467 write(message(1),
'(a)')
'Root finding in species_pot did not converge/'
468 call messages_fatal(1, namespace=namespace)
472 write(message(1),
'(a, f12.6)')
'Debug: Optimized value of b for the ANC potential = ', this%bb
473 call messages_info(1, namespace=namespace)
486 subroutine func_anc(xin, ff, jacobian)
487 real(real64),
intent(in) :: xin(:)
488 real(real64),
intent(out) :: ff(:), jacobian(:,:)
490 real(real64),
allocatable :: rho(:)
496 safe_allocate(rho(1:
grid_p%nrval))
497 norm = m_one/
sqrt(m_pi)
500 rho(ip) = norm *
exp(rho(ip))
504 ff(1) = sum(
grid_p%drdi*rho**2*
grid_p%r2ofi) - m_one/m_four/m_pi
512 safe_deallocate_a(rho)
522 character(len=*),
intent(in) :: dir
523 type(namespace_t),
intent(in) :: namespace
524 real(real64),
intent(in) :: gmax
526 character(len=256) :: dirname
529 if (.not. mpi_grp_is_root(mpi_world))
then
535 dirname = trim(dir)//
'/'//trim(spec%get_label())
537 call io_mkdir(dirname, namespace)
539 iunit = io_open(trim(dirname)//
'/info', namespace, action=
'write')
541 write(iunit,
'(a,i3)')
'Index = ', spec%get_index()
542 write(iunit,
'(2a)')
'Label = ', trim(spec%get_label())
543 write(iunit,
'(a,f15.2)')
'z = ', spec%get_z()
544 write(iunit,
'(a,f15.2)')
'z_val = ', spec%get_zval()
545 write(iunit,
'(a,f15.2)')
'mass = ', spec%get_mass()
546 write(iunit,
'(a,f15.2)')
'vdw_radius = ', spec%get_vdw_radius()
547 write(iunit,
'(a,l1)')
'local = ', spec%is_local()
548 write(iunit,
'(a,i3)')
'hubbard_l = ', spec%get_hubbard_l()
549 write(iunit,
'(a,f15.2)')
'hubbard_U = ', spec%get_hubbard_U()
550 write(iunit,
'(a,f15.2)')
'hubbard_j = ', spec%get_hubbard_j()
551 write(iunit,
'(a,f15.2)')
'hubbard_alpha = ', spec%get_hubbard_alpha()
560 type(namespace_t),
intent(in) :: namespace
561 integer,
intent(in) :: ispin
562 integer,
intent(in) :: dim
563 logical,
optional,
intent(in) :: print_info
565 logical :: print_info_
569 print_info_ = optional_default(print_info, .
true.)
572 call spec%set_mass(units_to_atomic(unit_amu, spec%get_mass()))
574 spec%has_density = .false.
578 if (print_info_)
then
579 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is a soft-Coulomb potential.'
580 call messages_info(1, namespace=namespace)
582 spec%niwfs = species_closed_shell_size(2*nint(spec%get_zval()+m_half))
583 spec%omega = 0.1_real64
586 spec%niwfs = max(5, spec%niwfs)
589 spec%has_density = .
true.
590 if (print_info_)
then
591 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is an all-electron atom.'
592 write(message(2),
'(a,f11.6)')
' Z = ', spec%get_z()
593 write(message(3),
'(a)')
' Potential will be calculated solving the Poisson equation'
594 write(message(4),
'(a)')
' for a delta density distribution.'
595 call messages_info(4, namespace=namespace)
597 spec%niwfs = species_closed_shell_size(
floor(m_half*spec%get_zval()+m_half))
601 spec%niwfs = species_closed_shell_size(spec%niwfs+1)
602 spec%omega = spec%get_z()
605 spec%has_density = .
true.
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 will be calculated solving the Poisson equation'
610 write(message(4),
'(a)')
' for a Gaussian density distribution.'
611 call messages_info(4, namespace=namespace)
613 spec%niwfs = species_closed_shell_size(
floor(m_half*spec%get_zval()+m_half))
617 spec%niwfs = species_closed_shell_size(spec%niwfs+1)
618 spec%omega = spec%get_z()
619 assert(spec%sigma > 0)
622 spec%has_density = .false.
623 if (print_info_)
then
624 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is an all-electron atom.'
625 write(message(2),
'(a,f11.6)')
' Z = ', spec%get_z()
626 write(message(3),
'(a)')
' Potential is an analytical norm-conserving regularized potential'
627 call messages_info(3, namespace=namespace)
629 spec%niwfs = species_closed_shell_size(
floor(m_half*spec%get_zval()+m_half))
633 spec%niwfs = species_closed_shell_size(spec%niwfs+1)
634 spec%omega = spec%get_z()
638 call messages_input_error(namespace,
'Species',
'Unknown species type')
641 safe_allocate(spec%iwf_n(1:spec%niwfs, 1:ispin))
642 safe_allocate(spec%iwf_l(1:spec%niwfs, 1:ispin))
643 safe_allocate(spec%iwf_m(1:spec%niwfs, 1:ispin))
644 safe_allocate(spec%iwf_i(1:spec%niwfs, 1:ispin))
645 safe_allocate(spec%iwf_j(1:spec%niwfs))
647 call spec%iwf_fix_qn(namespace, ispin, dim)
649 write(message(1),
'(a,i6,a,i6)')
'Number of orbitals: ', spec%niwfs
650 if (print_info_)
call messages_info(1, namespace=namespace)
657 logical pure function allelectron_is_full(this)
670 logical pure function allelectron_represents_real_atom(spec)
subroutine func_anc(xin, ff, jacobian)
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)
pure subroutine soft_coulomb_set_softening(spec, soft)
Set the softening parameter.
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)
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)
real(real64) pure function soft_coulomb_softening(spec)
Get the softening parameter.
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)
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...