26 INTEGER,
PARAMETER :: nr = 1601, ng = 32
27 REAL(
dp),
PARAMETER :: alpha = 1.4_dp, beta = 0.55_dp, box = 12.0_dp, dr = 0.00625_dp
28 REAL(
dp),
PARAMETER :: charges(2) = [-1.0_dp, 0.3_dp]
29 REAL(
dp) :: rad2(nr), weights(nr), delta_rho(nr), potential(nr), shifted(nr)
30 REAL(
dp) :: q, g2, periodic_difference, local_difference, correction, error, h, eplus, eminus
31 INTEGER :: i, ix, iy, iz, io_unit
37 rad2(i) = ((i - 1)*dr)**2
39 weights = 2.0_dp*dr/3.0_dp
40 weights(2:nr - 1:2) = 4.0_dp*dr/3.0_dp
41 weights(1) = dr/3.0_dp
42 weights(nr) = dr/3.0_dp
43 weights = weights*rad2
45 DO i = 1,
SIZE(charges)
49 delta_rho = q*sqrt(
fourpi)*((alpha/
pi)**1.5_dp*exp(-alpha*rad2) - &
50 (beta/
pi)**1.5_dp*exp(-beta*rad2))
52 correction = sum(potential*delta_rho*weights)
56 periodic_difference = 0.0_dp
60 IF (ix == 0 .AND. iy == 0 .AND. iz == 0) cycle
61 g2 = (2.0_dp*
pi/box)**2*real(ix*ix + iy*iy + iz*iz,
dp)
62 periodic_difference = periodic_difference + &
63 2.0_dp*
pi*q*q/box**3/g2*(exp(-g2/(2.0_dp*alpha)) - exp(-g2/(2.0_dp*beta)))
67 local_difference = q*q*(sqrt(alpha) - sqrt(beta))/sqrt(2.0_dp*
pi)
68 error = abs(periodic_difference - local_difference - correction)
69 IF (io_unit > 0)
WRITE (io_unit,
'(A,F8.3,ES16.7)')
"GAPW periodic Gaussian background:", q, error
70 IF (error > 1.e-12_dp) error stop
"GAPW background disagrees with periodic Gaussian electrostatics"
76 eplus = sum(shifted*delta_rho*weights)
78 eminus = sum(shifted*delta_rho*weights)
79 IF (abs(-(eplus - eminus)/(2.0_dp*h) - correction) > 1.e-11_dp)
THEN
80 error stop
"GAPW background volume derivative failed"
84 IF (any(potential /= 0.0_dp)) error stop
"Neutral cell has a background potential"
92 INTEGER,
PARAMETER :: expected(4) = [3, 4, 5, 7]
93 REAL(KIND=
dp),
PARAMETER :: spacing(4) = [2.5_dp, 2.0_dp, 1.75_dp, 1.5_dp]
96 REAL(KIND=
dp) :: diffuse, ratio
99 NULLIFY (extended, orbitals, seed)
103 ratio = spacing(level)
105 seed%name =
'two-s-primitives'
108 ALLOCATE (seed%lmin(1), seed%lmax(1), seed%npgf(1), seed%zet(2, 1))
114 seed%zet(:, 1) = [1.0_dp, 1.0_dp/sqrt(ratio)]
116 orbitals%set_radius = 0.0_dp
118 diffuse = 1.0_dp/(ratio*sqrt(ratio))
119 IF (io_unit > 0)
WRITE (io_unit,
'(A,I2,A,I3)') &
120 'GAPW extension level ', level,
': added s primitives ', extended%npgf(2)
121 IF (extended%npgf(2) /= expected(level)) error stop
'GAPW extension lost admissible diffuse exponents'
122 IF (minval(abs(extended%zet(:extended%npgf(2), 2) - diffuse)) > 1.e-12_dp)
THEN
123 error stop
'GAPW extension is missing the first admissible diffuse exponent'
125 IF (minval(abs(extended%zet(:extended%npgf(2), 2) - seed%zet(2, 1))) < 1.e-12_dp)
THEN
126 error stop
'GAPW extension duplicated an existing soft exponent'
subroutine check_1c_basis()
Check that one-centre basis extension retains diffuse exponents without duplicates.
subroutine, public deallocate_gto_basis_set(gto_basis_set)
...
subroutine, public allocate_gto_basis_set(gto_basis_set)
...
subroutine, public create_primitive_basis_set(basis_set, pbasis, lmax)
...
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
subroutine, public create_1c_basis(orb_basis, soft_basis, gapw_1c_basis, basis_1c_level)
create the one center basis from the orbital basis
pure real(dp) function, dimension(size(rad2)), public gapw_background_potential(net_charge, volume, rad2)
l=0 potential for the periodic mean-potential correction. For a neutral localized difference delta_rh...
Defines the basic variable types.
integer, parameter, public dp
subroutine, public cp2k_finalize()
...
subroutine, public cp2k_init()
...
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
real(kind=dp), parameter, public fourpi
Provides Cartesian and spherical orbital pointers and indices.
subroutine, public init_orbital_pointers(maxl)
Initialize or update the orbital pointers.