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)
471 write(message(1),
'(a, f12.6)')
'Debug: Optimized value of b for the ANC potential = ', this%bb
472 call messages_info(1, namespace=namespace, debug_only=.
true.)
484 subroutine func_anc(xin, ff, jacobian)
485 real(real64),
intent(in) :: xin(:)
486 real(real64),
intent(out) :: ff(:), jacobian(:,:)
488 real(real64),
allocatable :: rho(:)
494 safe_allocate(rho(1:
grid_p%nrval))
495 norm = m_one/
sqrt(m_pi)
498 rho(ip) = norm *
exp(rho(ip))
502 ff(1) = sum(
grid_p%drdi*rho**2*
grid_p%r2ofi) - m_one/m_four/m_pi
510 safe_deallocate_a(rho)
520 character(len=*),
intent(in) :: dir
521 type(namespace_t),
intent(in) :: namespace
522 real(real64),
intent(in) :: gmax
524 character(len=256) :: dirname
527 if (.not. mpi_grp_is_root(mpi_world))
then
533 dirname = trim(dir)//
'/'//trim(spec%get_label())
535 call io_mkdir(dirname, namespace)
537 iunit = io_open(trim(dirname)//
'/info', namespace, action=
'write')
539 write(iunit,
'(a,i3)')
'Index = ', spec%get_index()
540 write(iunit,
'(2a)')
'Label = ', trim(spec%get_label())
541 write(iunit,
'(a,f15.2)')
'z = ', spec%get_z()
542 write(iunit,
'(a,f15.2)')
'z_val = ', spec%get_zval()
543 write(iunit,
'(a,f15.2)')
'mass = ', spec%get_mass()
544 write(iunit,
'(a,f15.2)')
'vdw_radius = ', spec%get_vdw_radius()
545 write(iunit,
'(a,l1)')
'local = ', spec%is_local()
546 write(iunit,
'(a,i3)')
'hubbard_l = ', spec%get_hubbard_l()
547 write(iunit,
'(a,f15.2)')
'hubbard_U = ', spec%get_hubbard_U()
548 write(iunit,
'(a,f15.2)')
'hubbard_j = ', spec%get_hubbard_j()
549 write(iunit,
'(a,f15.2)')
'hubbard_alpha = ', spec%get_hubbard_alpha()
558 type(namespace_t),
intent(in) :: namespace
559 integer,
intent(in) :: ispin
560 integer,
intent(in) :: dim
561 logical,
optional,
intent(in) :: print_info
563 logical :: print_info_
567 print_info_ = optional_default(print_info, .
true.)
570 call spec%set_mass(units_to_atomic(unit_amu, spec%get_mass()))
572 spec%has_density = .false.
576 if (print_info_)
then
577 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is a soft-Coulomb potential.'
578 call messages_info(1, namespace=namespace)
580 spec%niwfs = species_closed_shell_size(2*nint(spec%get_zval()+m_half))
581 spec%omega = 0.1_real64
584 spec%niwfs = max(5, spec%niwfs)
587 spec%has_density = .
true.
588 if (print_info_)
then
589 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is an all-electron atom.'
590 write(message(2),
'(a,f11.6)')
' Z = ', spec%get_z()
591 write(message(3),
'(a)')
' Potential will be calculated solving the Poisson equation'
592 write(message(4),
'(a)')
' for a delta density distribution.'
593 call messages_info(4, namespace=namespace)
595 spec%niwfs = species_closed_shell_size(
floor(m_half*spec%get_zval()+m_half))
599 spec%niwfs = species_closed_shell_size(spec%niwfs+1)
600 spec%omega = spec%get_z()
603 spec%has_density = .
true.
604 if (print_info_)
then
605 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is an all-electron atom.'
606 write(message(2),
'(a,f11.6)')
' Z = ', spec%get_z()
607 write(message(3),
'(a)')
' Potential will be calculated solving the Poisson equation'
608 write(message(4),
'(a)')
' for a Gaussian density distribution.'
609 call messages_info(4, namespace=namespace)
611 spec%niwfs = species_closed_shell_size(
floor(m_half*spec%get_zval()+m_half))
615 spec%niwfs = species_closed_shell_size(spec%niwfs+1)
616 spec%omega = spec%get_z()
617 assert(spec%sigma > 0)
620 spec%has_density = .false.
621 if (print_info_)
then
622 write(message(1),
'(a,a,a)')
'Species "',trim(spec%get_label()),
'" is an all-electron atom.'
623 write(message(2),
'(a,f11.6)')
' Z = ', spec%get_z()
624 write(message(3),
'(a)')
' Potential is an analytical norm-conserving regularized potential'
625 call messages_info(3, namespace=namespace)
627 spec%niwfs = species_closed_shell_size(
floor(m_half*spec%get_zval()+m_half))
631 spec%niwfs = species_closed_shell_size(spec%niwfs+1)
632 spec%omega = spec%get_z()
636 call messages_input_error(namespace,
'Species',
'Unknown species type')
639 safe_allocate(spec%iwf_n(1:spec%niwfs, 1:ispin))
640 safe_allocate(spec%iwf_l(1:spec%niwfs, 1:ispin))
641 safe_allocate(spec%iwf_m(1:spec%niwfs, 1:ispin))
642 safe_allocate(spec%iwf_i(1:spec%niwfs, 1:ispin))
643 safe_allocate(spec%iwf_j(1:spec%niwfs))
645 call spec%iwf_fix_qn(namespace, ispin, dim)
647 write(message(1),
'(a,i6,a,i6)')
'Number of orbitals: ', spec%niwfs
648 if (print_info_)
call messages_info(1, namespace=namespace)
655 logical pure function allelectron_is_full(this)
668 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...