38#include "../base/base_uses.f90"
44 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'rs_pw_interface'
72 CHARACTER(LEN=*),
PARAMETER :: routinen =
'density_rs2pw'
74 INTEGER :: handle, igrid_level, interp_kind
82 CALL timeset(routinen, handle)
83 NULLIFY (gridlevel_info, rs_descs, pw_pools)
84 CALL pw_env_get(pw_env, rs_descs=rs_descs, pw_pools=pw_pools)
86 gridlevel_info => pw_env%gridlevel_info
94 IF (gridlevel_info%ngrid_levels == 1)
THEN
97 IF (rho%pw_grid%spherical)
THEN
101 DO igrid_level = 1, gridlevel_info%ngrid_levels
103 mgrid_rspace(igrid_level))
107 SELECT CASE (interp_kind)
110 DO igrid_level = 1, gridlevel_info%ngrid_levels
112 mgrid_gspace(igrid_level))
113 CALL pw_axpy(mgrid_gspace(igrid_level), rho_gspace)
117 DO igrid_level = gridlevel_info%ngrid_levels, 2, -1
119 mgrid_rspace(igrid_level - 1), pw_pools(igrid_level)%pool, &
120 pw_env%interp_section)
122 CALL pw_copy(mgrid_rspace(1), rho)
125 CALL cp_abort(__location__, &
134 CALL timestop(handle)
158 CHARACTER(len=*),
PARAMETER :: routinen =
'potential_pw2rs'
160 INTEGER :: auxbas_grid, handle, igrid_level, &
162 REAL(kind=
dp) :: scale
168 CALL timeset(routinen, handle)
171 CALL pw_env_get(pw_env, pw_pools=pw_pools, gridlevel_info=gridlevel_info, &
172 auxbas_grid=auxbas_grid)
178 SELECT CASE (interp_kind)
181 CALL pw_transfer(v_rspace, mgrid_gspace(auxbas_grid))
182 DO igrid_level = 1, gridlevel_info%ngrid_levels
183 IF (igrid_level /= auxbas_grid)
THEN
184 CALL pw_copy(mgrid_gspace(auxbas_grid), mgrid_gspace(igrid_level))
185 CALL pw_transfer(mgrid_gspace(igrid_level), mgrid_rspace(igrid_level))
187 IF (mgrid_gspace(auxbas_grid)%pw_grid%spherical)
THEN
188 CALL pw_transfer(mgrid_gspace(auxbas_grid), mgrid_rspace(auxbas_grid))
190 CALL pw_copy(v_rspace, mgrid_rspace(auxbas_grid))
194 IF (igrid_level /= auxbas_grid)
THEN
195 scale = mgrid_rspace(igrid_level)%pw_grid%dvol/ &
196 mgrid_rspace(auxbas_grid)%pw_grid%dvol
197 mgrid_rspace(igrid_level)%array = &
198 scale*mgrid_rspace(igrid_level)%array
203 CALL pw_copy(v_rspace, mgrid_rspace(1))
204 DO igrid_level = 1, gridlevel_info%ngrid_levels - 1
205 CALL pw_zero(mgrid_rspace(igrid_level + 1))
207 mgrid_rspace(igrid_level + 1), pw_pools(igrid_level + 1)%pool, &
208 pw_env%interp_section)
210 mgrid_rspace(igrid_level + 1)%array = &
211 mgrid_rspace(igrid_level + 1)%array*8._dp
214 CALL cp_abort(__location__, &
215 "interpolation not supported "// &
219 DO igrid_level = 1, gridlevel_info%ngrid_levels
221 mgrid_rspace(igrid_level))
226 CALL timestop(handle)
various routines to log and control the output. The idea is that decisions about where to log should ...
utils to manipulate splines on the regular grid of a pw
integer, parameter, public pw_interp
subroutine, public pw_prolongate_s3(pw_coarse_in, pw_fine_out, coarse_pool, param_section)
prolongates a function from a coarse grid into a fine one
integer, parameter, public spline3_pbc_interp
subroutine, public pw_restrict_s3(pw_fine_in, pw_coarse_out, coarse_pool, param_section)
restricts the function from a fine grid to a coarse one
Defines the basic variable types.
integer, parameter, public dp
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
subroutine, public transfer_pw2rs(rs, pw)
...
subroutine, public transfer_rs2pw(rs, pw)
...
Transfers densities from PW to RS grids and potentials from PW to RS.
subroutine, public density_rs2pw(pw_env, rs_rho, rho, rho_gspace)
given partial densities on the realspace multigrids, computes the full density on the plane wave grid...
subroutine, public potential_pw2rs(rs_v, v_rspace, pw_env)
transfers a potential from a pw_grid to a vector of realspace multigrids
contained for different pw related things
to create arrays of pools