20 USE dbcsr_api,
ONLY: dbcsr_deallocate_matrix,&
28#include "./base/base_uses.f90"
33 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
34 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_wf_history_types'
62 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao
63 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp
64 TYPE(dbcsr_type),
POINTER :: overlap
76 TYPE qs_wf_snapshot_p_type
78 END TYPE qs_wf_snapshot_p_type
99 INTEGER :: ref_count, memory_depth, last_state_index, &
100 interpolation_method_nr, snapshot_count
101 LOGICAL :: store_wf, store_rho_r, store_rho_g, store_rho_ao, store_rho_ao_kp, &
102 store_overlap, store_frozen_density
103 TYPE(qs_wf_snapshot_p_type),
DIMENSION(:),
POINTER :: past_states
131 IF (
ASSOCIATED(snapshot%rho_ao))
THEN
134 IF (
ASSOCIATED(snapshot%rho_ao_kp))
THEN
137 IF (
ASSOCIATED(snapshot%overlap))
THEN
138 CALL dbcsr_deallocate_matrix(snapshot%overlap)
140 IF (
ASSOCIATED(snapshot%rho_frozen))
THEN
142 DEALLOCATE (snapshot%rho_frozen)
157 cpassert(
ASSOCIATED(wf_history))
158 wf_history%ref_count = wf_history%ref_count + 1
175 IF (
ASSOCIATED(wf_history))
THEN
176 cpassert(wf_history%ref_count > 0)
177 wf_history%ref_count = wf_history%ref_count - 1
178 IF (wf_history%ref_count == 0)
THEN
179 IF (
ASSOCIATED(wf_history%past_states))
THEN
180 DO i = 1,
SIZE(wf_history%past_states)
181 IF (
ASSOCIATED(wf_history%past_states(i)%snapshot))
THEN
182 CALL wfs_release(wf_history%past_states(i)%snapshot)
183 DEALLOCATE (wf_history%past_states(i)%snapshot)
186 DEALLOCATE (wf_history%past_states)
188 DEALLOCATE (wf_history)
205 INTEGER,
INTENT(in) :: wf_index
210 cpassert(
ASSOCIATED(wf_history))
211 cpassert(
ASSOCIATED(wf_history%past_states))
212 IF (wf_index > wf_history%memory_depth .OR. wf_index > wf_history%snapshot_count)
THEN
215 res => wf_history%past_states( &
216 modulo(wf_history%snapshot_count + 1 - wf_index, &
217 wf_history%memory_depth) + 1)%snapshot
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
DBCSR operations in CP2K.
represent a full matrix distributed on many processors
Defines the basic variable types.
integer, parameter, public dp
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_release(rho_struct)
releases a rho_struct by decreasing the reference count by one and deallocating if it reaches 0 (to b...
interpolate the wavefunctions to speed up the convergence when doing MD
type(qs_wf_snapshot_type) function, pointer, public wfi_get_snapshot(wf_history, wf_index)
returns a snapshot, the first being the latest snapshot
subroutine, public wfi_retain(wf_history)
retains a wf history (see doc/ReferenceCounting.html)
subroutine wfs_release(snapshot)
releases a snapshot of a wavefunction (see doc/ReferenceCounting.html)
subroutine, public wfi_release(wf_history)
releases a wf_history of a wavefunction (see doc/ReferenceCounting.html)
keeps the density in various representations, keeping track of which ones are valid.
to create arrays of pointers to qs_wf_history_type
keeps track of the previous wavefunctions and can extrapolate them for the next step of md
represent a past snapshot of the wavefunction. some elements might not be associated (to spare memory...