22 fm_pools_give_back_fm_vect
25 USE dbcsr_api,
ONLY: dbcsr_p_type
33 #include "./base/base_uses.f90"
38 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'xas_env_types'
42 PUBLIC :: xas_environment_type
69 TYPE xas_environment_type
70 INTEGER :: nao = 0, exc_state = 0, xas_estate = 0
71 INTEGER :: nexc_search = 0, nexc_atoms = 0
72 INTEGER :: spin_channel = 0
73 INTEGER :: nvirtual = 0, nvirtual2 = 0
74 INTEGER :: unoccupied_max_iter = 0
76 INTEGER,
DIMENSION(:),
POINTER :: atom_of_state => null()
77 INTEGER,
DIMENSION(:),
POINTER :: type_of_state => null()
78 INTEGER,
DIMENSION(:),
POINTER :: mykind_of_atom => null()
79 INTEGER,
DIMENSION(:),
POINTER :: mykind_of_kind => null()
80 INTEGER,
DIMENSION(:),
POINTER :: exc_atoms => null()
81 INTEGER,
DIMENSION(:),
POINTER :: nexc_states => null()
82 INTEGER,
DIMENSION(:, :),
POINTER :: state_of_atom => null()
84 REAL(dp) :: ip_energy = 0.0_dp, occ_estate = 0.0_dp, unoccupied_eps = 0.0_dp, xas_nelectron = 0.0_dp, homo_occ = 0.0_dp
85 REAL(dp),
DIMENSION(:),
POINTER :: all_evals => null()
86 REAL(dp),
DIMENSION(:),
POINTER :: unoccupied_evals => null()
87 REAL(dp),
DIMENSION(:, :),
POINTER :: spectrum => null()
88 REAL(dp),
DIMENSION(:, :),
POINTER :: centers_wfn => null()
89 TYPE(cp_2d_r_p_type),
DIMENSION(:),
POINTER :: stogto_overlap => null()
90 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: my_gto_basis => null()
91 TYPE(cp_fm_type),
DIMENSION(:),
POINTER :: groundstate_coeff => null()
92 TYPE(cp_fm_type),
DIMENSION(:, :),
POINTER :: dip_fm_set => null()
93 TYPE(cp_fm_pool_p_type),
DIMENSION(:), &
94 POINTER :: ao_mo_fm_pools => null()
95 TYPE(cp_fm_type),
POINTER :: excvec_coeff => null()
96 TYPE(cp_fm_type),
POINTER :: excvec_overlap => null()
97 TYPE(cp_fm_type),
POINTER :: unoccupied_orbs => null()
98 TYPE(cp_fm_type),
POINTER :: all_vectors => null()
99 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: ostrength_sm => null()
100 TYPE(qs_loc_env_type),
POINTER :: qs_loc_env => null()
101 TYPE(qs_scf_env_type),
POINTER :: scf_env => null()
102 TYPE(scf_control_type),
POINTER :: scf_control => null()
104 END TYPE xas_environment_type
146 SUBROUTINE get_xas_env(xas_env, exc_state, nao, nvirtual, nvirtual2, &
147 centers_wfn, atom_of_state, exc_atoms, nexc_states, type_of_state, mykind_of_atom, &
148 mykind_of_kind, state_of_atom, spectrum, groundstate_coeff, ostrength_sm, &
149 dip_fm_set, excvec_coeff, excvec_overlap, &
150 unoccupied_orbs, unoccupied_evals, unoccupied_max_iter, unoccupied_eps, &
151 all_vectors, all_evals, my_gto_basis, qs_loc_env, &
152 stogto_overlap, occ_estate, xas_nelectron, xas_estate, nexc_atoms, nexc_search, spin_channel, &
153 scf_env, scf_control)
155 TYPE(xas_environment_type),
INTENT(IN) :: xas_env
156 INTEGER,
INTENT(OUT),
OPTIONAL :: exc_state, nao, nvirtual, nvirtual2
157 REAL(
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: centers_wfn
158 INTEGER,
DIMENSION(:),
OPTIONAL,
POINTER :: atom_of_state, exc_atoms, nexc_states, &
159 type_of_state, mykind_of_atom, &
161 INTEGER,
DIMENSION(:, :),
OPTIONAL,
POINTER :: state_of_atom
162 REAL(
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: spectrum
163 TYPE(cp_fm_type),
DIMENSION(:),
OPTIONAL,
POINTER :: groundstate_coeff
164 TYPE(dbcsr_p_type),
DIMENSION(:),
OPTIONAL, &
165 POINTER :: ostrength_sm
166 TYPE(cp_fm_type),
DIMENSION(:, :),
OPTIONAL, &
167 POINTER :: dip_fm_set
168 TYPE(cp_fm_type),
OPTIONAL,
POINTER :: excvec_coeff, excvec_overlap, &
170 REAL(
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: unoccupied_evals
171 INTEGER,
INTENT(OUT),
OPTIONAL :: unoccupied_max_iter
172 REAL(
dp),
OPTIONAL :: unoccupied_eps
173 TYPE(cp_fm_type),
OPTIONAL,
POINTER :: all_vectors
174 REAL(
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: all_evals
175 TYPE(gto_basis_set_p_type),
DIMENSION(:), &
176 OPTIONAL,
POINTER :: my_gto_basis
177 TYPE(qs_loc_env_type),
OPTIONAL,
POINTER :: qs_loc_env
178 TYPE(cp_2d_r_p_type),
DIMENSION(:),
OPTIONAL, &
179 POINTER :: stogto_overlap
180 REAL(
dp),
INTENT(OUT),
OPTIONAL :: occ_estate, xas_nelectron
181 INTEGER,
INTENT(OUT),
OPTIONAL :: xas_estate, nexc_atoms, nexc_search, &
183 TYPE(qs_scf_env_type),
OPTIONAL,
POINTER :: scf_env
184 TYPE(scf_control_type),
OPTIONAL,
POINTER :: scf_control
186 IF (
PRESENT(exc_state)) exc_state = xas_env%exc_state
187 IF (
PRESENT(nao)) nao = xas_env%nao
188 IF (
PRESENT(nvirtual)) nvirtual = xas_env%nvirtual
189 IF (
PRESENT(nvirtual2)) nvirtual2 = xas_env%nvirtual2
190 IF (
PRESENT(xas_nelectron)) xas_nelectron = xas_env%xas_nelectron
191 IF (
PRESENT(occ_estate)) occ_estate = xas_env%occ_estate
192 IF (
PRESENT(xas_estate)) xas_estate = xas_env%xas_estate
193 IF (
PRESENT(nexc_search)) nexc_search = xas_env%nexc_search
194 IF (
PRESENT(nexc_states)) nexc_states => xas_env%nexc_states
195 IF (
PRESENT(spin_channel)) spin_channel = xas_env%spin_channel
196 IF (
PRESENT(nexc_atoms)) nexc_atoms = xas_env%nexc_atoms
197 IF (
PRESENT(unoccupied_eps)) unoccupied_eps = xas_env%unoccupied_eps
198 IF (
PRESENT(unoccupied_max_iter)) unoccupied_max_iter = xas_env%unoccupied_max_iter
199 IF (
PRESENT(centers_wfn)) centers_wfn => xas_env%centers_wfn
200 IF (
PRESENT(atom_of_state)) atom_of_state => xas_env%atom_of_state
201 IF (
PRESENT(exc_atoms)) exc_atoms => xas_env%exc_atoms
202 IF (
PRESENT(type_of_state)) type_of_state => xas_env%type_of_state
203 IF (
PRESENT(state_of_atom)) state_of_atom => xas_env%state_of_atom
204 IF (
PRESENT(mykind_of_atom)) mykind_of_atom => xas_env%mykind_of_atom
205 IF (
PRESENT(mykind_of_kind)) mykind_of_kind => xas_env%mykind_of_kind
206 IF (
PRESENT(unoccupied_evals)) unoccupied_evals => xas_env%unoccupied_evals
207 IF (
PRESENT(all_evals)) all_evals => xas_env%all_evals
208 IF (
PRESENT(spectrum)) spectrum => xas_env%spectrum
209 IF (
PRESENT(groundstate_coeff)) groundstate_coeff => xas_env%groundstate_coeff
210 IF (
PRESENT(ostrength_sm)) ostrength_sm => xas_env%ostrength_sm
211 IF (
PRESENT(excvec_overlap)) excvec_overlap => xas_env%excvec_overlap
212 IF (
PRESENT(unoccupied_orbs)) unoccupied_orbs => xas_env%unoccupied_orbs
213 IF (
PRESENT(all_vectors)) all_vectors => xas_env%all_vectors
214 IF (
PRESENT(dip_fm_set)) dip_fm_set => xas_env%dip_fm_set
215 IF (
PRESENT(qs_loc_env)) qs_loc_env => xas_env%qs_loc_env
216 IF (
PRESENT(excvec_coeff)) excvec_coeff => xas_env%excvec_coeff
217 IF (
PRESENT(my_gto_basis)) my_gto_basis => xas_env%my_gto_basis
218 IF (
PRESENT(stogto_overlap)) stogto_overlap => xas_env%stogto_overlap
219 IF (
PRESENT(scf_env)) scf_env => xas_env%scf_env
220 IF (
PRESENT(scf_control)) scf_control => xas_env%scf_control
240 SUBROUTINE set_xas_env(xas_env, nexc_search, spin_channel, nexc_atoms, &
241 nvirtual, nvirtual2, ip_energy, occ_estate, qs_loc_env, &
242 xas_estate, xas_nelectron, homo_occ, scf_env, scf_control)
244 TYPE(xas_environment_type),
INTENT(INOUT) :: xas_env
245 INTEGER,
INTENT(IN),
OPTIONAL :: nexc_search, spin_channel, nexc_atoms, &
247 REAL(
dp),
INTENT(IN),
OPTIONAL :: ip_energy, occ_estate
248 TYPE(qs_loc_env_type),
OPTIONAL,
POINTER :: qs_loc_env
249 INTEGER,
INTENT(IN),
OPTIONAL :: xas_estate
250 REAL(
dp),
INTENT(IN),
OPTIONAL :: xas_nelectron, homo_occ
251 TYPE(qs_scf_env_type),
OPTIONAL,
POINTER :: scf_env
252 TYPE(scf_control_type),
OPTIONAL,
POINTER :: scf_control
254 IF (
PRESENT(nexc_search)) xas_env%nexc_search = nexc_search
255 IF (
PRESENT(spin_channel)) xas_env%spin_channel = spin_channel
256 IF (
PRESENT(nexc_atoms)) xas_env%nexc_atoms = nexc_atoms
257 IF (
PRESENT(nvirtual)) xas_env%nvirtual = nvirtual
258 IF (
PRESENT(nvirtual2)) xas_env%nvirtual2 = nvirtual2
259 IF (
PRESENT(occ_estate)) xas_env%occ_estate = occ_estate
260 IF (
PRESENT(xas_nelectron)) xas_env%xas_nelectron = xas_nelectron
261 IF (
PRESENT(homo_occ)) xas_env%homo_occ = homo_occ
262 IF (
PRESENT(xas_estate)) xas_env%xas_estate = xas_estate
263 IF (
PRESENT(ip_energy)) xas_env%ip_energy = ip_energy
264 IF (
PRESENT(qs_loc_env))
THEN
265 IF (
ASSOCIATED(xas_env%qs_loc_env))
THEN
266 IF (.NOT.
ASSOCIATED(xas_env%qs_loc_env, qs_loc_env))
THEN
268 DEALLOCATE (xas_env%qs_loc_env)
271 xas_env%qs_loc_env => qs_loc_env
273 IF (
PRESENT(scf_env))
THEN
274 IF (
ASSOCIATED(xas_env%scf_env))
THEN
275 IF (
ASSOCIATED(xas_env%scf_env, scf_env))
THEN
277 DEALLOCATE (xas_env%scf_env)
280 xas_env%scf_env => scf_env
282 IF (
PRESENT(scf_control))
THEN
283 IF (
ASSOCIATED(xas_env%scf_control))
THEN
284 IF (.NOT.
ASSOCIATED(xas_env%scf_control, scf_control))
THEN
286 DEALLOCATE (xas_env%scf_control)
289 xas_env%scf_control => scf_control
300 TYPE(xas_environment_type),
INTENT(OUT) :: xas_env
303 xas_env%nvirtual2 = 0
305 NULLIFY (xas_env%ao_mo_fm_pools)
306 NULLIFY (xas_env%my_gto_basis)
307 NULLIFY (xas_env%atom_of_state)
308 NULLIFY (xas_env%nexc_states)
309 NULLIFY (xas_env%state_of_atom)
310 NULLIFY (xas_env%exc_atoms)
311 NULLIFY (xas_env%excvec_coeff, xas_env%excvec_overlap)
312 NULLIFY (xas_env%type_of_state, xas_env%mykind_of_atom)
313 NULLIFY (xas_env%type_of_state, xas_env%mykind_of_kind)
314 NULLIFY (xas_env%groundstate_coeff, xas_env%dip_fm_set)
315 NULLIFY (xas_env%ostrength_sm, xas_env%qs_loc_env, xas_env%spectrum)
316 NULLIFY (xas_env%all_evals, xas_env%all_vectors)
317 NULLIFY (xas_env%unoccupied_evals, xas_env%unoccupied_orbs)
318 NULLIFY (xas_env%stogto_overlap)
319 NULLIFY (xas_env%scf_env)
320 NULLIFY (xas_env%scf_control)
330 TYPE(xas_environment_type),
INTENT(INOUT) :: xas_env
334 DEALLOCATE (xas_env%state_of_atom, xas_env%atom_of_state)
335 DEALLOCATE (xas_env%nexc_states)
336 DEALLOCATE (xas_env%type_of_state)
337 DEALLOCATE (xas_env%mykind_of_atom)
338 DEALLOCATE (xas_env%mykind_of_kind)
339 DEALLOCATE (xas_env%exc_atoms)
340 DEALLOCATE (xas_env%centers_wfn)
341 IF (
ASSOCIATED(xas_env%all_evals))
THEN
342 DEALLOCATE (xas_env%all_evals)
344 IF (
ASSOCIATED(xas_env%unoccupied_evals))
THEN
345 DEALLOCATE (xas_env%unoccupied_evals)
347 CALL fm_pools_give_back_fm_vect(xas_env%ao_mo_fm_pools, &
348 xas_env%groundstate_coeff)
350 CALL cp_fm_release(xas_env%dip_fm_set)
352 IF (
ASSOCIATED(xas_env%excvec_coeff))
THEN
353 CALL cp_fm_release(xas_env%excvec_coeff)
354 DEALLOCATE (xas_env%excvec_coeff)
355 NULLIFY (xas_env%excvec_coeff)
357 IF (
ASSOCIATED(xas_env%excvec_overlap))
THEN
358 CALL cp_fm_release(xas_env%excvec_overlap)
359 DEALLOCATE (xas_env%excvec_overlap)
360 NULLIFY (xas_env%excvec_overlap)
362 IF (
ASSOCIATED(xas_env%unoccupied_orbs))
THEN
363 CALL cp_fm_release(xas_env%unoccupied_orbs)
364 DEALLOCATE (xas_env%unoccupied_orbs)
365 NULLIFY (xas_env%unoccupied_orbs)
367 NULLIFY (xas_env%ao_mo_fm_pools)
368 IF (
ASSOCIATED(xas_env%all_vectors) .AND. xas_env%nvirtual .GT. 0)
THEN
369 CALL cp_fm_release(xas_env%all_vectors)
370 DEALLOCATE (xas_env%all_vectors)
371 NULLIFY (xas_env%all_vectors)
373 NULLIFY (xas_env%all_vectors)
376 IF (
ASSOCIATED(xas_env%ostrength_sm))
THEN
379 IF (
ASSOCIATED(xas_env%qs_loc_env))
THEN
381 DEALLOCATE (xas_env%qs_loc_env)
384 IF (
ASSOCIATED(xas_env%my_gto_basis))
THEN
385 DO ik = 1,
SIZE(xas_env%my_gto_basis, 1)
388 DEALLOCATE (xas_env%my_gto_basis)
391 IF (
ASSOCIATED(xas_env%stogto_overlap))
THEN
392 DO ik = 1,
SIZE(xas_env%stogto_overlap, 1)
393 DEALLOCATE (xas_env%stogto_overlap(ik)%array)
395 DEALLOCATE (xas_env%stogto_overlap)
398 IF (
ASSOCIATED(xas_env%scf_env))
THEN
400 DEALLOCATE (xas_env%scf_env)
402 IF (
ASSOCIATED(xas_env%scf_control))
THEN
404 DEALLOCATE (xas_env%scf_control)
subroutine, public deallocate_gto_basis_set(gto_basis_set)
...
various utilities that regard array of different kinds: output, allocation,... maybe it is not a good...
DBCSR operations in CP2K.
pool for for elements that are retained and released
represent a full matrix distributed on many processors
Defines the basic variable types.
integer, parameter, public dp
New version of the module for the localization of the molecular orbitals This should be able to use d...
subroutine, public qs_loc_env_release(qs_loc_env)
...
module that contains the definitions of the scf types
subroutine, public scf_env_release(scf_env)
releases an scf_env (see doc/ReferenceCounting.html)
parameters that control an scf iteration
subroutine, public scf_c_release(scf_control)
releases the given scf_control (see cp2k/doc/ReferenceCounting.html)
define create destroy get and put information in xas_env to calculate the x-ray absorption spectra
subroutine, public xas_env_release(xas_env)
...
subroutine, public set_xas_env(xas_env, nexc_search, spin_channel, nexc_atoms, nvirtual, nvirtual2, ip_energy, occ_estate, qs_loc_env, xas_estate, xas_nelectron, homo_occ, scf_env, scf_control)
...
subroutine, public xas_env_create(xas_env)
...
subroutine, public get_xas_env(xas_env, exc_state, nao, nvirtual, nvirtual2, centers_wfn, atom_of_state, exc_atoms, nexc_states, type_of_state, mykind_of_atom, mykind_of_kind, state_of_atom, spectrum, groundstate_coeff, ostrength_sm, dip_fm_set, excvec_coeff, excvec_overlap, unoccupied_orbs, unoccupied_evals, unoccupied_max_iter, unoccupied_eps, all_vectors, all_evals, my_gto_basis, qs_loc_env, stogto_overlap, occ_estate, xas_nelectron, xas_estate, nexc_atoms, nexc_search, spin_channel, scf_env, scf_control)
...