33 #include "../base/base_uses.f90"
38 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
39 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'xc_derivative_set_types'
41 PUBLIC :: xc_derivative_set_type
49 TYPE xc_derivative_set_type
50 TYPE(pw_pool_type),
POINTER,
PRIVATE :: pw_pool => null()
51 TYPE(cp_sll_xc_deriv_type),
POINTER :: derivs => null()
52 END TYPE xc_derivative_set_type
67 TYPE(xc_derivative_set_type),
INTENT(IN) :: derivative_set
68 INTEGER,
DIMENSION(:),
INTENT(in) :: description
69 LOGICAL,
INTENT(in),
OPTIONAL :: allocate_deriv
70 TYPE(xc_derivative_type),
POINTER :: res
72 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: std_deriv_desc
73 LOGICAL :: my_allocate_deriv
74 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :, :), &
76 TYPE(cp_sll_xc_deriv_type),
POINTER :: pos
77 TYPE(xc_derivative_type),
POINTER :: deriv_att
79 NULLIFY (pos, deriv_att, r3d_ptr)
81 my_allocate_deriv = .false.
82 IF (
PRESENT(allocate_deriv)) my_allocate_deriv = allocate_deriv
85 pos => derivative_set%derivs
87 IF (
SIZE(deriv_att%split_desc) ==
SIZE(std_deriv_desc))
THEN
88 IF (all(deriv_att%split_desc == std_deriv_desc))
THEN
94 IF (.NOT.
ASSOCIATED(res) .AND. my_allocate_deriv)
THEN
95 CALL derivative_set%pw_pool%create_cr3d(r3d_ptr)
113 TYPE(xc_derivative_set_type),
INTENT(OUT) :: derivative_set
114 TYPE(pw_pool_type),
OPTIONAL,
POINTER :: pw_pool
115 INTEGER,
DIMENSION(2, 3),
INTENT(IN),
OPTIONAL :: local_bounds
117 TYPE(pw_grid_type),
POINTER :: pw_grid
121 IF (
PRESENT(pw_pool))
THEN
122 derivative_set%pw_pool => pw_pool
123 CALL pw_pool%retain()
124 IF (
PRESENT(local_bounds))
THEN
125 IF (any(pw_pool%pw_grid%bounds_local /= local_bounds)) &
126 cpabort(
"incompatible local_bounds and pw_pool")
130 cpassert(
PRESENT(local_bounds))
132 pw_grid%bounds_local = local_bounds
145 TYPE(xc_derivative_set_type) :: derivative_set
147 TYPE(cp_sll_xc_deriv_type),
POINTER :: pos
148 TYPE(xc_derivative_type),
POINTER :: deriv_att
150 NULLIFY (deriv_att, pos)
152 pos => derivative_set%derivs
155 DEALLOCATE (deriv_att)
158 IF (
ASSOCIATED(derivative_set%pw_pool))
CALL pw_pool_release(derivative_set%pw_pool)
168 TYPE(xc_derivative_set_type),
INTENT(IN) :: deriv_set
170 TYPE(cp_sll_xc_deriv_type),
POINTER :: pos
171 TYPE(xc_derivative_type),
POINTER :: deriv_att
173 NULLIFY (pos, deriv_att)
175 IF (
ASSOCIATED(deriv_set%derivs))
THEN
176 pos => deriv_set%derivs
178 deriv_att%deriv_data = 0.0_dp
194 TYPE(xc_derivative_set_type),
INTENT(IN) :: deriv_set
195 INTEGER,
DIMENSION(:),
INTENT(IN) :: description
196 TYPE(pw_r3d_rs_type),
INTENT(OUT) :: pw
197 TYPE(pw_grid_type),
INTENT(IN),
POINTER :: pw_grid
198 TYPE(pw_pool_type),
INTENT(IN),
OPTIONAL,
POINTER :: pw_pool
200 TYPE(xc_derivative_type),
POINTER :: deriv_att
203 IF (
ASSOCIATED(deriv_att))
THEN
204 CALL pw%create(pw_grid=pw_grid, array_ptr=deriv_att%deriv_data)
205 NULLIFY (deriv_att%deriv_data)
206 ELSE IF (
PRESENT(pw_pool))
THEN
207 CALL pw_pool%create_pw(pw)
logical function, public cp_sll_xc_deriv_next(iterator, el_att)
returns true if the actual element is valid (i.e. iterator ont at end) moves the iterator to the next...
subroutine, public cp_sll_xc_deriv_dealloc(sll)
deallocates the singly linked list starting at sll. Does not work if loops are present!
subroutine, public cp_sll_xc_deriv_insert_el(sll, el)
insert an element at the beginning of the list
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
type(mp_comm_type), parameter, public mp_comm_self
This module defines the grid data type and some basic operations on it.
subroutine, public pw_grid_release(pw_grid)
releases the given pw grid
subroutine, public pw_grid_create(pw_grid, pe_group, local)
Initialize a PW grid with all defaults.
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
subroutine, public pw_pool_release(pool)
releases the given pool (see cp2k/doc/ReferenceCounting.html)
subroutine, public pw_pool_create(pool, pw_grid, max_cache)
creates a pool for pw
Module with functions to handle derivative descriptors. derivative description are strings have the f...
subroutine, public standardize_desc(desc, split_desc)
...
represent a group ofunctional derivatives
subroutine, public xc_dset_zero_all(deriv_set)
...
subroutine, public xc_dset_recover_pw(deriv_set, description, pw, pw_grid, pw_pool)
Recovers a derivative on a pw_r3d_rs_type, the caller is responsible to release the grid later If the...
type(xc_derivative_type) function, pointer, public xc_dset_get_derivative(derivative_set, description, allocate_deriv)
returns the requested xc_derivative
subroutine, public xc_dset_release(derivative_set)
releases a derivative set
subroutine, public xc_dset_create(derivative_set, pw_pool, local_bounds)
creates a derivative set object
Provides types for the management of the xc-functionals and their derivatives.
subroutine, public xc_derivative_release(derivative, pw_pool)
allocates and initializes a derivative type
subroutine, public xc_derivative_create(derivative, desc, r3d_ptr)
allocates and initializes a derivative type