(git:e5b1968)
Loading...
Searching...
No Matches
qs_environment_types.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2025 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \par History
10!> - mo_set_p_type added to qs_env (23.04.02,MK)
11!> - qs_force_type added to qs_env (05.06.02,MK)
12!> \author MK (23.01.2002)
13! **************************************************************************************************
15 USE admm_types, ONLY: admm_env_release,&
20 USE atprop_types, ONLY: atprop_type
21 USE cell_types, ONLY: cell_release,&
33 USE cp_fm_types, ONLY: cp_fm_release,&
41 USE ec_env_types, ONLY: ec_env_release,&
60 USE hfx_types, ONLY: hfx_release,&
69 USE kinds, ONLY: dp
70 USE kpoint_types, ONLY: kpoint_type
78 USE mp2_types, ONLY: mp2_env_release,&
85 USE pw_env_types, ONLY: pw_env_type
86 USE pw_types, ONLY: pw_c1d_gs_type,&
99 USE qs_gcp_types, ONLY: qs_gcp_release,&
103 USE qs_kind_types, ONLY: qs_kind_type
106 USE qs_ks_types, ONLY: get_ks_env,&
119 rhoz_type,&
124 USE qs_mo_types, ONLY: deallocate_mo_set,&
131 USE qs_rho0_types, ONLY: rho0_atom_type,&
134 USE qs_rho_types, ONLY: qs_rho_p_type,&
137 USE qs_scf_types, ONLY: qs_scf_env_type,&
139 USE qs_subsys_types, ONLY: qs_subsys_set,&
161 USE virial_types, ONLY: virial_type
163 USE xas_env_types, ONLY: xas_env_release,&
165#include "./base/base_uses.f90"
166
167 IMPLICIT NONE
168
169 PRIVATE
170
171 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_environment_types'
172
173! *** Public data types ***
174
175 PUBLIC :: qs_environment_type
176
177! *** Public subroutines ***
178
179 PUBLIC :: get_qs_env, &
184
185! **************************************************************************************************
186!> \param local_rho_set contains the atomic, compensations and core densities
187!> and the local parts of the xc terms
188!> \param hartree_local contains the 1, 2 and 3 centers coulomb terms
189!> \param requires_mo_derivs logical, true if dE/dC is required (e.g. OT)
190!> \param has_unit_metric logical, true if the S matrix is considered unity for the SCF
191!> \param mo_derivs the actual derivatives of the total energy wrt to MO coeffs (divided by 2*f_i)
192!> \param xas_env temporary information for xas calculation
193!> \param dftb_potential pair potentials for use with DFTB
194!> \param dispersion_env environment for use with QS dispersion
195!>
196!> compatibility get (things that you should get from the subsys):
197!> \param atomic_kind_set array with infos about the species (atomic_kinds)
198!> present in the system
199!> \param particle_set info on the atoms you simulate, pos,...
200!> \param local_particles which particles ar local to this processor
201!> new:
202!> \param local_molecules which molecules are local to this processor
203!> \param molecule_kind_set description of the molecule kinds
204!> \param molecule_set all the molecule description
205!> \param rtp all data needed for real time propagation
206!> \param x contains data used in Hartree-Fock-Exchange calculations
207!> \param task_list the list of tasks used in collocate and integrate
208!> \param task_list_soft the list of tasks used in collocate and integrate in case of soft basis functions
209!> \param mo_loc_history if a history of localized wfn is kept, they are stored here.
210!> \param molecular_scf_guess_env contains inforamation about and results of claculations
211!> on separate molecules
212!> \par History
213!> 11.2002 added doc and attribute description [fawzi]
214!> 08.2004 renamed some of the very short names (s,c,k,h) for easier grepping
215!> 06.2018 polar_env added (MK)
216!> \author Matthias Krack & fawzi
217! **************************************************************************************************
218
220 LOGICAL :: qmmm = .false., qmmm_periodic = .false.
221 LOGICAL :: requires_mo_derivs = .false.
222 LOGICAL :: requires_matrix_vxc = .false.
223 LOGICAL :: has_unit_metric = .false.
224 LOGICAL :: run_rtp = .false.
225 LOGICAL :: linres_run = .false.
226 LOGICAL :: calc_image_preconditioner = .false.
227 LOGICAL :: do_transport = .false.
228 LOGICAL :: single_point_run = .false.
229 LOGICAL :: given_embed_pot = .false.
230 LOGICAL :: energy_correction = .false.
231 LOGICAL :: harris_method = .false.
232 REAL(kind=dp) :: sim_time = -1.0_dp
233 REAL(kind=dp) :: start_time = -1.0_dp, target_time = -1.0_dp
234 REAL(kind=dp), DIMENSION(:, :), POINTER :: image_matrix => null()
235 REAL(kind=dp), DIMENSION(:), POINTER :: image_coeff => null()
236 INTEGER, DIMENSION(:), POINTER :: ipiv => null()
237 INTEGER :: sim_step = -1
238 TYPE(ls_scf_env_type), POINTER :: ls_scf_env => null()
239 TYPE(almo_scf_env_type), POINTER :: almo_scf_env => null()
240 TYPE(transport_env_type), POINTER :: transport_env => null()
241 TYPE(cell_type), POINTER :: super_cell => null()
242 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos => null()
243 TYPE(cp_fm_type), DIMENSION(:), POINTER :: mo_loc_history => null()
244 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: mo_derivs => null()
245 TYPE(scf_control_type), POINTER :: scf_control => null()
246 TYPE(rel_control_type), POINTER :: rel_control => null()
247 ! ZMP adding variables
248 TYPE(qs_rho_type), POINTER :: rho_external => null()
249 TYPE(pw_r3d_rs_type), POINTER :: external_vxc => null()
250 TYPE(pw_r3d_rs_type), POINTER :: mask => null()
251 TYPE(qs_charges_type), POINTER :: qs_charges => null()
252 TYPE(qs_ks_env_type), POINTER :: ks_env => null()
253 TYPE(qs_ks_qmmm_env_type), POINTER :: ks_qmmm_env => null()
254 TYPE(qmmm_env_qm_type), POINTER :: qmmm_env_qm => null()
255 TYPE(qs_wf_history_type), POINTER :: wf_history => null()
256 TYPE(qs_scf_env_type), POINTER :: scf_env => null()
257 TYPE(qs_matrix_pools_type), POINTER :: mpools => null()
258 TYPE(oce_matrix_type), POINTER :: oce => null()
259 TYPE(local_rho_type), POINTER :: local_rho_set => null()
260 TYPE(hartree_local_type), POINTER :: hartree_local => null()
261 TYPE(section_vals_type), POINTER :: input => null()
262 TYPE(linres_control_type), POINTER :: linres_control => null()
263 TYPE(xas_environment_type), POINTER :: xas_env => null()
264 TYPE(cp_ddapc_type), POINTER :: cp_ddapc_env => null()
265 TYPE(cp_ddapc_ewald_type), POINTER :: cp_ddapc_ewald => null()
266 REAL(kind=dp), DIMENSION(:, :), POINTER :: outer_scf_history => null()
267 INTEGER :: outer_scf_ihistory = -1
268 REAL(kind=dp), DIMENSION(:, :), POINTER :: gradient_history => null(), &
269 variable_history => null()
270 TYPE(hfx_type), DIMENSION(:, :), POINTER :: x_data => null()
271 TYPE(et_coupling_type), POINTER :: et_coupling => null()
272 TYPE(qs_dftb_pairpot_type), DIMENSION(:, :), POINTER :: dftb_potential => null()
273 TYPE(admm_type), POINTER :: admm_env => null()
274 TYPE(active_space_type), POINTER :: active_space => null()
275 ! LRI
276 TYPE(lri_environment_type), POINTER :: lri_env => null()
277 TYPE(lri_density_type), POINTER :: lri_density => null()
278 ! Harris model
279 TYPE(harris_type), POINTER :: harris_env => null()
280 ! Energy correction
281 TYPE(energy_correction_type), POINTER :: ec_env => null()
282 ! Excited States
283 LOGICAL :: excited_state = .false.
284 TYPE(excited_energy_type), POINTER :: exstate_env => null()
285 ! Empirical dispersion
286 TYPE(qs_dispersion_type), POINTER :: dispersion_env => null()
287 ! Empirical geometrical BSSE correction
288 TYPE(qs_gcp_type), POINTER :: gcp_env => null()
289 ! Semi-empirical and DFTB types
290 TYPE(ewald_environment_type), POINTER :: ewald_env => null()
291 TYPE(ewald_pw_type), POINTER :: ewald_pw => null()
292 ! Semi-empirical types
293 TYPE(se_taper_type), POINTER :: se_taper => null()
294 TYPE(semi_empirical_si_type), POINTER :: se_store_int_env => null()
295 TYPE(nddo_mpole_type), POINTER :: se_nddo_mpole => null()
296 TYPE(fist_nonbond_env_type), POINTER :: se_nonbond_env => null()
297 TYPE(rt_prop_type), POINTER :: rtp => null()
298 TYPE(efield_berry_type), POINTER :: efield => null()
299 ! a history for the broyden ot
300 REAL(kind=dp) :: broyden_adaptive_sigma = -1.0_dp
301 TYPE(mp2_type), POINTER :: mp2_env => null()
302 TYPE(post_scf_bandstructure_type), POINTER :: bs_env => null()
303 TYPE(kg_environment_type), POINTER :: kg_env => null()
304 TYPE(wannier_centres_type), POINTER, DIMENSION(:) :: wanniercentres => null()
305 TYPE(molecular_scf_guess_env_type), POINTER :: molecular_scf_guess_env => null()
306 ! Subsystem densities
307 TYPE(qs_rho_p_type), DIMENSION(:), POINTER :: subsys_dens => null()
308 ! Embedding potential
309 TYPE(pw_r3d_rs_type), POINTER :: embed_pot => null()
310 TYPE(pw_r3d_rs_type), POINTER :: spin_embed_pot => null()
311 ! Polarizability tensor
312 TYPE(polar_env_type), POINTER :: polar_env => null()
313 ! EEQ charges
314 REAL(kind=dp), DIMENSION(:), POINTER :: eeq => null()
315 ! Resp charges
316 REAL(kind=dp), DIMENSION(:), POINTER :: rhs => null()
317 REAL(kind=dp) :: total_zeff_corr = -1.0_dp, surface_dipole_moment = -1.0_dp
318 LOGICAL :: surface_dipole_switch_off = .false.
319 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos_last_converged => null()
320 ! tblite
321 TYPE(tblite_type), POINTER :: tb_tblite => null()
322 END TYPE qs_environment_type
323
324CONTAINS
325
326! **************************************************************************************************
327!> \brief Get the QUICKSTEP environment.
328!> \param qs_env ...
329!> \param atomic_kind_set ...
330!> \param qs_kind_set ...
331!> \param cell ...
332!> \param super_cell ...
333!> \param cell_ref ...
334!> \param use_ref_cell ...
335!> \param kpoints ...
336!> \param dft_control ...
337!> \param mos ...
338!> \param sab_orb ...
339!> \param sab_all ...
340!> \param qmmm ...
341!> \param qmmm_periodic ...
342!> \param sac_ae ...
343!> \param sac_ppl ...
344!> \param sac_lri ...
345!> \param sap_ppnl ...
346!> \param sab_vdw ...
347!> \param sab_scp ...
348!> \param sap_oce ...
349!> \param sab_lrc ...
350!> \param sab_se ...
351!> \param sab_xtbe ...
352!> \param sab_tbe ...
353!> \param sab_core ...
354!> \param sab_xb ...
355!> \param sab_xtb_pp ...
356!> \param sab_xtb_nonbond ...
357!> \param sab_almo ...
358!> \param sab_kp ...
359!> \param sab_kp_nosym ...
360!> \param particle_set ...
361!> \param energy ...
362!> \param force ...
363!> \param matrix_h ...
364!> \param matrix_h_im ...
365!> \param matrix_ks ...
366!> \param matrix_ks_im ...
367!> \param matrix_vxc ...
368!> \param run_rtp ...
369!> \param rtp ...
370!> \param matrix_h_kp ...
371!> \param matrix_h_im_kp ...
372!> \param matrix_ks_kp ...
373!> \param matrix_ks_im_kp ...
374!> \param matrix_vxc_kp ...
375!> \param kinetic_kp ...
376!> \param matrix_s_kp ...
377!> \param matrix_w_kp ...
378!> \param matrix_s_RI_aux_kp ...
379!> \param matrix_s ...
380!> \param matrix_s_RI_aux ...
381!> \param matrix_w ...
382!> \param matrix_p_mp2 ...
383!> \param matrix_p_mp2_admm ...
384!> \param rho ...
385!> \param rho_xc ...
386!> \param pw_env ...
387!> \param ewald_env ...
388!> \param ewald_pw ...
389!> \param active_space ...
390!> \param mpools ...
391!> \param input ...
392!> \param para_env ...
393!> \param blacs_env ...
394!> \param scf_control ...
395!> \param rel_control ...
396!> \param kinetic ...
397!> \param qs_charges ...
398!> \param vppl ...
399!> \param rho_core ...
400!> \param rho_nlcc ...
401!> \param rho_nlcc_g ...
402!> \param ks_env ...
403!> \param ks_qmmm_env ...
404!> \param wf_history ...
405!> \param scf_env ...
406!> \param local_particles ...
407!> \param local_molecules ...
408!> \param distribution_2d ...
409!> \param dbcsr_dist ...
410!> \param molecule_kind_set ...
411!> \param molecule_set ...
412!> \param subsys ...
413!> \param cp_subsys ...
414!> \param oce ...
415!> \param local_rho_set ...
416!> \param rho_atom_set ...
417!> \param task_list ...
418!> \param task_list_soft ...
419!> \param rho0_atom_set ...
420!> \param rho0_mpole ...
421!> \param rhoz_set ...
422!> \param ecoul_1c ...
423!> \param rho0_s_rs ...
424!> \param rho0_s_gs ...
425!> \param do_kpoints ...
426!> \param has_unit_metric ...
427!> \param requires_mo_derivs ...
428!> \param mo_derivs ...
429!> \param mo_loc_history ...
430!> \param nkind ...
431!> \param natom ...
432!> \param nelectron_total ...
433!> \param nelectron_spin ...
434!> \param efield ...
435!> \param neighbor_list_id ...
436!> \param linres_control ...
437!> \param xas_env ...
438!> \param virial ...
439!> \param cp_ddapc_env ...
440!> \param cp_ddapc_ewald ...
441!> \param outer_scf_history ...
442!> \param outer_scf_ihistory ...
443!> \param x_data ...
444!> \param et_coupling ...
445!> \param dftb_potential ...
446!> \param results ...
447!> \param se_taper ...
448!> \param se_store_int_env ...
449!> \param se_nddo_mpole ...
450!> \param se_nonbond_env ...
451!> \param admm_env ...
452!> \param lri_env ...
453!> \param lri_density ...
454!> \param exstate_env ...
455!> \param ec_env ...
456!> \param harris_env ...
457!> \param dispersion_env ...
458!> \param gcp_env ...
459!> \param vee ...
460!> \param rho_external ...
461!> \param external_vxc ...
462!> \param mask ...
463!> \param mp2_env ...
464!> \param bs_env ...
465!> \param kg_env ...
466!> \param WannierCentres ...
467!> \param atprop ...
468!> \param ls_scf_env ...
469!> \param do_transport ...
470!> \param transport_env ...
471!> \param v_hartree_rspace ...
472!> \param s_mstruct_changed ...
473!> \param rho_changed ...
474!> \param potential_changed ...
475!> \param forces_up_to_date ...
476!> \param mscfg_env ...
477!> \param almo_scf_env ...
478!> \param gradient_history ...
479!> \param variable_history ...
480!> \param embed_pot ...
481!> \param spin_embed_pot ...
482!> \param polar_env ...
483!> \param mos_last_converged ... [SGh]
484!> \param eeq ...
485!> \param rhs ...
486!> \param tb_tblite ...
487!> \date 23.01.2002
488!> \author MK
489!> \version 1.0
490! **************************************************************************************************
491 SUBROUTINE get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, &
492 dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, &
493 sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, &
494 sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, &
495 sab_kp, sab_kp_nosym, particle_set, energy, force, &
496 matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, &
497 matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, &
498 matrix_w_kp, matrix_s_RI_aux_kp, matrix_s, matrix_s_RI_aux, matrix_w, &
499 matrix_p_mp2, matrix_p_mp2_admm, rho, &
500 rho_xc, pw_env, ewald_env, ewald_pw, active_space, &
501 mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, &
502 vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, &
503 local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, &
504 molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, &
505 task_list, task_list_soft, &
506 rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, &
507 rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, &
508 mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, &
509 neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, &
510 outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, &
511 se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, &
512 lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, &
513 rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, &
514 WannierCentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, &
515 s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, &
516 gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, &
517 eeq, rhs, tb_tblite)
518 TYPE(qs_environment_type), INTENT(IN) :: qs_env
519 TYPE(atomic_kind_type), DIMENSION(:), OPTIONAL, &
520 POINTER :: atomic_kind_set
521 TYPE(qs_kind_type), DIMENSION(:), OPTIONAL, &
522 POINTER :: qs_kind_set
523 TYPE(cell_type), OPTIONAL, POINTER :: cell, super_cell, cell_ref
524 LOGICAL, OPTIONAL :: use_ref_cell
525 TYPE(kpoint_type), OPTIONAL, POINTER :: kpoints
526 TYPE(dft_control_type), OPTIONAL, POINTER :: dft_control
527 TYPE(mo_set_type), DIMENSION(:), OPTIONAL, POINTER :: mos
528 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
529 OPTIONAL, POINTER :: sab_orb, sab_all
530 LOGICAL, OPTIONAL :: qmmm, qmmm_periodic
531 TYPE(neighbor_list_set_p_type), DIMENSION(:), OPTIONAL, POINTER :: sac_ae, sac_ppl, sac_lri, &
532 sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, &
533 sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym
534 TYPE(particle_type), DIMENSION(:), OPTIONAL, &
535 POINTER :: particle_set
536 TYPE(qs_energy_type), OPTIONAL, POINTER :: energy
537 TYPE(qs_force_type), DIMENSION(:), OPTIONAL, &
538 POINTER :: force
539 TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
540 POINTER :: matrix_h, matrix_h_im, matrix_ks, &
541 matrix_ks_im, matrix_vxc
542 LOGICAL, OPTIONAL :: run_rtp
543 TYPE(rt_prop_type), OPTIONAL, POINTER :: rtp
544 TYPE(dbcsr_p_type), DIMENSION(:, :), OPTIONAL, POINTER :: matrix_h_kp, matrix_h_im_kp, &
545 matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, &
546 matrix_s_ri_aux_kp
547 TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
548 POINTER :: matrix_s, matrix_s_ri_aux, matrix_w, &
549 matrix_p_mp2, matrix_p_mp2_admm
550 TYPE(qs_rho_type), OPTIONAL, POINTER :: rho, rho_xc
551 TYPE(pw_env_type), OPTIONAL, POINTER :: pw_env
552 TYPE(ewald_environment_type), OPTIONAL, POINTER :: ewald_env
553 TYPE(ewald_pw_type), OPTIONAL, POINTER :: ewald_pw
554 TYPE(active_space_type), OPTIONAL, POINTER :: active_space
555 TYPE(qs_matrix_pools_type), OPTIONAL, POINTER :: mpools
556 TYPE(section_vals_type), OPTIONAL, POINTER :: input
557 TYPE(mp_para_env_type), OPTIONAL, POINTER :: para_env
558 TYPE(cp_blacs_env_type), OPTIONAL, POINTER :: blacs_env
559 TYPE(scf_control_type), OPTIONAL, POINTER :: scf_control
560 TYPE(rel_control_type), OPTIONAL, POINTER :: rel_control
561 TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
562 POINTER :: kinetic
563 TYPE(qs_charges_type), OPTIONAL, POINTER :: qs_charges
564 TYPE(pw_r3d_rs_type), OPTIONAL, POINTER :: vppl
565 TYPE(pw_c1d_gs_type), OPTIONAL, POINTER :: rho_core
566 TYPE(pw_r3d_rs_type), OPTIONAL, POINTER :: rho_nlcc
567 TYPE(pw_c1d_gs_type), OPTIONAL, POINTER :: rho_nlcc_g
568 TYPE(qs_ks_env_type), OPTIONAL, POINTER :: ks_env
569 TYPE(qs_ks_qmmm_env_type), OPTIONAL, POINTER :: ks_qmmm_env
570 TYPE(qs_wf_history_type), OPTIONAL, POINTER :: wf_history
571 TYPE(qs_scf_env_type), OPTIONAL, POINTER :: scf_env
572 TYPE(distribution_1d_type), OPTIONAL, POINTER :: local_particles, local_molecules
573 TYPE(distribution_2d_type), OPTIONAL, POINTER :: distribution_2d
574 TYPE(dbcsr_distribution_type), OPTIONAL, POINTER :: dbcsr_dist
575 TYPE(molecule_kind_type), DIMENSION(:), OPTIONAL, &
576 POINTER :: molecule_kind_set
577 TYPE(molecule_type), DIMENSION(:), OPTIONAL, &
578 POINTER :: molecule_set
579 TYPE(qs_subsys_type), OPTIONAL, POINTER :: subsys
580 TYPE(cp_subsys_type), OPTIONAL, POINTER :: cp_subsys
581 TYPE(oce_matrix_type), OPTIONAL, POINTER :: oce
582 TYPE(local_rho_type), OPTIONAL, POINTER :: local_rho_set
583 TYPE(rho_atom_type), DIMENSION(:), OPTIONAL, &
584 POINTER :: rho_atom_set
585 TYPE(task_list_type), OPTIONAL, POINTER :: task_list, task_list_soft
586 TYPE(rho0_atom_type), DIMENSION(:), OPTIONAL, &
587 POINTER :: rho0_atom_set
588 TYPE(rho0_mpole_type), OPTIONAL, POINTER :: rho0_mpole
589 TYPE(rhoz_type), DIMENSION(:), OPTIONAL, POINTER :: rhoz_set
590 TYPE(ecoul_1center_type), DIMENSION(:), OPTIONAL, &
591 POINTER :: ecoul_1c
592 TYPE(pw_r3d_rs_type), OPTIONAL, POINTER :: rho0_s_rs
593 TYPE(pw_c1d_gs_type), OPTIONAL, POINTER :: rho0_s_gs
594 LOGICAL, OPTIONAL :: do_kpoints, has_unit_metric, &
595 requires_mo_derivs
596 TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
597 POINTER :: mo_derivs
598 TYPE(cp_fm_type), DIMENSION(:), OPTIONAL, POINTER :: mo_loc_history
599 INTEGER, OPTIONAL :: nkind, natom, nelectron_total
600 INTEGER, DIMENSION(2), OPTIONAL :: nelectron_spin
601 TYPE(efield_berry_type), OPTIONAL, POINTER :: efield
602 INTEGER, OPTIONAL :: neighbor_list_id
603 TYPE(linres_control_type), OPTIONAL, POINTER :: linres_control
604 TYPE(xas_environment_type), OPTIONAL, POINTER :: xas_env
605 TYPE(virial_type), OPTIONAL, POINTER :: virial
606 TYPE(cp_ddapc_type), OPTIONAL, POINTER :: cp_ddapc_env
607 TYPE(cp_ddapc_ewald_type), OPTIONAL, POINTER :: cp_ddapc_ewald
608 REAL(kind=dp), DIMENSION(:, :), OPTIONAL, POINTER :: outer_scf_history
609 INTEGER, INTENT(out), OPTIONAL :: outer_scf_ihistory
610 TYPE(hfx_type), DIMENSION(:, :), OPTIONAL, POINTER :: x_data
611 TYPE(et_coupling_type), OPTIONAL, POINTER :: et_coupling
612 TYPE(qs_dftb_pairpot_type), DIMENSION(:, :), &
613 OPTIONAL, POINTER :: dftb_potential
614 TYPE(cp_result_type), OPTIONAL, POINTER :: results
615 TYPE(se_taper_type), OPTIONAL, POINTER :: se_taper
616 TYPE(semi_empirical_si_type), OPTIONAL, POINTER :: se_store_int_env
617 TYPE(nddo_mpole_type), OPTIONAL, POINTER :: se_nddo_mpole
618 TYPE(fist_nonbond_env_type), OPTIONAL, POINTER :: se_nonbond_env
619 TYPE(admm_type), OPTIONAL, POINTER :: admm_env
620 TYPE(lri_environment_type), OPTIONAL, POINTER :: lri_env
621 TYPE(lri_density_type), OPTIONAL, POINTER :: lri_density
622 TYPE(excited_energy_type), OPTIONAL, POINTER :: exstate_env
623 TYPE(energy_correction_type), OPTIONAL, POINTER :: ec_env
624 TYPE(harris_type), OPTIONAL, POINTER :: harris_env
625 TYPE(qs_dispersion_type), OPTIONAL, POINTER :: dispersion_env
626 TYPE(qs_gcp_type), OPTIONAL, POINTER :: gcp_env
627 TYPE(pw_r3d_rs_type), OPTIONAL, POINTER :: vee
628 TYPE(qs_rho_type), OPTIONAL, POINTER :: rho_external
629 TYPE(pw_r3d_rs_type), OPTIONAL, POINTER :: external_vxc, mask
630 TYPE(mp2_type), OPTIONAL, POINTER :: mp2_env
631 TYPE(post_scf_bandstructure_type), OPTIONAL, &
632 POINTER :: bs_env
633 TYPE(kg_environment_type), OPTIONAL, POINTER :: kg_env
634 TYPE(wannier_centres_type), DIMENSION(:), &
635 OPTIONAL, POINTER :: wanniercentres
636 TYPE(atprop_type), OPTIONAL, POINTER :: atprop
637 TYPE(ls_scf_env_type), OPTIONAL, POINTER :: ls_scf_env
638 LOGICAL, OPTIONAL :: do_transport
639 TYPE(transport_env_type), OPTIONAL, POINTER :: transport_env
640 TYPE(pw_r3d_rs_type), OPTIONAL, POINTER :: v_hartree_rspace
641 LOGICAL, OPTIONAL :: s_mstruct_changed, rho_changed, &
642 potential_changed, forces_up_to_date
643 TYPE(molecular_scf_guess_env_type), OPTIONAL, &
644 POINTER :: mscfg_env
645 TYPE(almo_scf_env_type), OPTIONAL, POINTER :: almo_scf_env
646 REAL(kind=dp), DIMENSION(:, :), OPTIONAL, POINTER :: gradient_history, variable_history
647 TYPE(pw_r3d_rs_type), OPTIONAL, POINTER :: embed_pot, spin_embed_pot
648 TYPE(polar_env_type), OPTIONAL, POINTER :: polar_env
649 TYPE(mo_set_type), DIMENSION(:), OPTIONAL, POINTER :: mos_last_converged
650 REAL(kind=dp), DIMENSION(:), OPTIONAL, POINTER :: eeq, rhs
651 TYPE(tblite_type), OPTIONAL, POINTER :: tb_tblite
652
653 TYPE(rho0_mpole_type), POINTER :: rho0_m
654
655 NULLIFY (rho0_m)
656 cpassert(ASSOCIATED(qs_env%ks_env))
657
658 IF (PRESENT(outer_scf_history)) outer_scf_history => qs_env%outer_scf_history
659 IF (PRESENT(outer_scf_ihistory)) outer_scf_ihistory = qs_env%outer_scf_ihistory
660 IF (PRESENT(gradient_history)) gradient_history => qs_env%gradient_history
661 IF (PRESENT(variable_history)) variable_history => qs_env%variable_history
662 IF (PRESENT(mp2_env)) mp2_env => qs_env%mp2_env
663 IF (PRESENT(bs_env)) bs_env => qs_env%bs_env
664 IF (PRESENT(kg_env)) kg_env => qs_env%kg_env
665 IF (PRESENT(super_cell)) super_cell => qs_env%super_cell
666 IF (PRESENT(qmmm)) qmmm = qs_env%qmmm
667 IF (PRESENT(qmmm_periodic)) qmmm_periodic = qs_env%qmmm_periodic
668 IF (PRESENT(mos)) mos => qs_env%mos
669 IF (PRESENT(mos_last_converged)) mos_last_converged => qs_env%mos_last_converged
670 IF (PRESENT(ewald_env)) ewald_env => qs_env%ewald_env
671 IF (PRESENT(ewald_pw)) ewald_pw => qs_env%ewald_pw
672 IF (PRESENT(mpools)) mpools => qs_env%mpools
673 IF (PRESENT(scf_control)) scf_control => qs_env%scf_control
674 IF (PRESENT(rel_control)) rel_control => qs_env%rel_control
675 ! ZMP pointing vectors
676 IF (PRESENT(rho_external)) rho_external => qs_env%rho_external
677 IF (PRESENT(external_vxc)) external_vxc => qs_env%external_vxc
678 IF (PRESENT(mask)) mask => qs_env%mask
679 IF (PRESENT(qs_charges)) qs_charges => qs_env%qs_charges
680 IF (PRESENT(ks_env)) ks_env => qs_env%ks_env
681 IF (PRESENT(ks_qmmm_env)) ks_qmmm_env => qs_env%ks_qmmm_env
682 IF (PRESENT(wf_history)) wf_history => qs_env%wf_history
683 IF (PRESENT(scf_env)) scf_env => qs_env%scf_env
684 IF (PRESENT(oce)) oce => qs_env%oce
685 IF (PRESENT(requires_mo_derivs)) requires_mo_derivs = qs_env%requires_mo_derivs
686 IF (PRESENT(has_unit_metric)) has_unit_metric = qs_env%has_unit_metric
687 IF (PRESENT(mo_derivs)) mo_derivs => qs_env%mo_derivs
688 IF (PRESENT(mo_loc_history)) mo_loc_history => qs_env%mo_loc_history
689 IF (PRESENT(linres_control)) linres_control => qs_env%linres_control
690 IF (PRESENT(se_taper)) se_taper => qs_env%se_taper
691 IF (PRESENT(se_store_int_env)) se_store_int_env => qs_env%se_store_int_env
692 IF (PRESENT(se_nddo_mpole)) se_nddo_mpole => qs_env%se_nddo_mpole
693 IF (PRESENT(se_nonbond_env)) se_nonbond_env => qs_env%se_nonbond_env
694 IF (PRESENT(lri_env)) lri_env => qs_env%lri_env
695 IF (PRESENT(lri_density)) lri_density => qs_env%lri_density
696 IF (PRESENT(harris_env)) harris_env => qs_env%harris_env
697 IF (PRESENT(ec_env)) ec_env => qs_env%ec_env
698 IF (PRESENT(exstate_env)) exstate_env => qs_env%exstate_env
699 IF (PRESENT(dispersion_env)) dispersion_env => qs_env%dispersion_env
700 IF (PRESENT(gcp_env)) gcp_env => qs_env%gcp_env
701 IF (PRESENT(run_rtp)) run_rtp = qs_env%run_rtp
702 IF (PRESENT(rtp)) rtp => qs_env%rtp
703 IF (PRESENT(ls_scf_env)) ls_scf_env => qs_env%ls_scf_env
704 IF (PRESENT(almo_scf_env)) almo_scf_env => qs_env%almo_scf_env
705 IF (PRESENT(do_transport)) do_transport = qs_env%do_transport
706 IF (PRESENT(transport_env)) transport_env => qs_env%transport_env
707 IF (PRESENT(mscfg_env)) mscfg_env => qs_env%molecular_scf_guess_env
708 IF (PRESENT(active_space)) active_space => qs_env%active_space
709 IF (PRESENT(admm_env)) admm_env => qs_env%admm_env
710
711 ! Embedding potential
712 IF (PRESENT(embed_pot)) embed_pot => qs_env%embed_pot
713 IF (PRESENT(spin_embed_pot)) spin_embed_pot => qs_env%spin_embed_pot
714
715 ! Polarisability tensor
716 IF (PRESENT(polar_env)) polar_env => qs_env%polar_env
717
718 ! EEQ charges
719 IF (PRESENT(eeq)) eeq => qs_env%eeq
720
721 ! Resp charges
722 IF (PRESENT(rhs)) rhs => qs_env%rhs
723
724 IF (PRESENT(local_rho_set)) &
725 local_rho_set => qs_env%local_rho_set
726 IF (PRESENT(rho_atom_set)) &
727 CALL get_local_rho(qs_env%local_rho_set, rho_atom_set=rho_atom_set)
728 IF (PRESENT(rho0_atom_set)) &
729 CALL get_local_rho(qs_env%local_rho_set, rho0_atom_set=rho0_atom_set)
730 IF (PRESENT(rho0_mpole)) &
731 CALL get_local_rho(qs_env%local_rho_set, rho0_mpole=rho0_mpole)
732 IF (PRESENT(rhoz_set)) &
733 CALL get_local_rho(qs_env%local_rho_set, rhoz_set=rhoz_set)
734 IF (PRESENT(ecoul_1c)) &
735 CALL get_hartree_local(qs_env%hartree_local, ecoul_1c=ecoul_1c)
736 IF (PRESENT(rho0_s_rs)) THEN
737 CALL get_local_rho(qs_env%local_rho_set, rho0_mpole=rho0_m)
738 IF (ASSOCIATED(rho0_m)) THEN
739 rho0_s_rs => rho0_m%rho0_s_rs
740 END IF
741 END IF
742 IF (PRESENT(rho0_s_gs)) THEN
743 CALL get_local_rho(qs_env%local_rho_set, rho0_mpole=rho0_m)
744 IF (ASSOCIATED(rho0_m)) THEN
745 rho0_s_gs => rho0_m%rho0_s_gs
746 END IF
747 END IF
748
749 IF (PRESENT(xas_env)) xas_env => qs_env%xas_env
750 IF (PRESENT(input)) input => qs_env%input
751 IF (PRESENT(cp_ddapc_env)) cp_ddapc_env => qs_env%cp_ddapc_env
752 IF (PRESENT(cp_ddapc_ewald)) cp_ddapc_ewald => qs_env%cp_ddapc_ewald
753 IF (PRESENT(x_data)) x_data => qs_env%x_data
754 IF (PRESENT(et_coupling)) et_coupling => qs_env%et_coupling
755 IF (PRESENT(dftb_potential)) dftb_potential => qs_env%dftb_potential
756 IF (PRESENT(efield)) efield => qs_env%efield
757 IF (PRESENT(wanniercentres)) wanniercentres => qs_env%WannierCentres
758
759 CALL get_ks_env(qs_env%ks_env, &
760 v_hartree_rspace=v_hartree_rspace, &
761 s_mstruct_changed=s_mstruct_changed, &
762 rho_changed=rho_changed, &
763 potential_changed=potential_changed, &
764 forces_up_to_date=forces_up_to_date, &
765 matrix_h=matrix_h, &
766 matrix_h_im=matrix_h_im, &
767 matrix_ks=matrix_ks, &
768 matrix_ks_im=matrix_ks_im, &
769 matrix_vxc=matrix_vxc, &
770 kinetic=kinetic, &
771 matrix_s=matrix_s, &
772 matrix_s_ri_aux=matrix_s_ri_aux, &
773 matrix_ks_im_kp=matrix_ks_im_kp, &
774 matrix_w=matrix_w, &
775 matrix_p_mp2=matrix_p_mp2, &
776 matrix_p_mp2_admm=matrix_p_mp2_admm, &
777 matrix_h_kp=matrix_h_kp, &
778 matrix_h_im_kp=matrix_h_im_kp, &
779 matrix_ks_kp=matrix_ks_kp, &
780 matrix_vxc_kp=matrix_vxc_kp, &
781 kinetic_kp=kinetic_kp, &
782 matrix_s_kp=matrix_s_kp, &
783 matrix_w_kp=matrix_w_kp, &
784 matrix_s_ri_aux_kp=matrix_s_ri_aux_kp, &
785 rho=rho, &
786 rho_xc=rho_xc, &
787 rho_core=rho_core, &
788 rho_nlcc=rho_nlcc, &
789 rho_nlcc_g=rho_nlcc_g, &
790 vppl=vppl, &
791 vee=vee, &
792 neighbor_list_id=neighbor_list_id, &
793 sab_orb=sab_orb, &
794 sab_all=sab_all, &
795 sab_scp=sab_scp, &
796 sab_vdw=sab_vdw, &
797 sac_ae=sac_ae, &
798 sac_ppl=sac_ppl, &
799 sac_lri=sac_lri, &
800 sap_ppnl=sap_ppnl, &
801 sap_oce=sap_oce, &
802 sab_se=sab_se, &
803 sab_lrc=sab_lrc, &
804 sab_tbe=sab_tbe, &
805 sab_xtbe=sab_xtbe, &
806 sab_core=sab_core, &
807 sab_xb=sab_xb, &
808 sab_xtb_pp=sab_xtb_pp, &
809 sab_xtb_nonbond=sab_xtb_nonbond, &
810 sab_almo=sab_almo, &
811 sab_kp=sab_kp, &
812 sab_kp_nosym=sab_kp_nosym, &
813 task_list=task_list, &
814 task_list_soft=task_list_soft, &
815 kpoints=kpoints, &
816 do_kpoints=do_kpoints, &
817 local_molecules=local_molecules, &
818 local_particles=local_particles, &
819 atprop=atprop, &
820 virial=virial, &
821 results=results, &
822 cell=cell, &
823 cell_ref=cell_ref, &
824 use_ref_cell=use_ref_cell, &
825 energy=energy, &
826 force=force, &
827 qs_kind_set=qs_kind_set, &
828 subsys=subsys, &
829 cp_subsys=cp_subsys, &
830 atomic_kind_set=atomic_kind_set, &
831 particle_set=particle_set, &
832 molecule_kind_set=molecule_kind_set, &
833 molecule_set=molecule_set, &
834 natom=natom, &
835 nkind=nkind, &
836 dft_control=dft_control, &
837 dbcsr_dist=dbcsr_dist, &
838 distribution_2d=distribution_2d, &
839 pw_env=pw_env, &
840 para_env=para_env, &
841 blacs_env=blacs_env, &
842 nelectron_total=nelectron_total, &
843 nelectron_spin=nelectron_spin)
844
845 IF (PRESENT(tb_tblite)) tb_tblite => qs_env%tb_tblite
846
847 END SUBROUTINE get_qs_env
848
849! **************************************************************************************************
850!> \brief Initialise the QUICKSTEP environment.
851!> \param qs_env ...
852!> \param globenv ...
853!> \date 25.01.2002
854!> \author MK
855!> \version 1.0
856! **************************************************************************************************
857 SUBROUTINE init_qs_env(qs_env, globenv)
858
859 TYPE(qs_environment_type), INTENT(INOUT) :: qs_env
860 TYPE(global_environment_type), OPTIONAL, POINTER :: globenv
861
862 NULLIFY (qs_env%ls_scf_env)
863 NULLIFY (qs_env%almo_scf_env)
864 NULLIFY (qs_env%transport_env)
865 NULLIFY (qs_env%image_matrix)
866 NULLIFY (qs_env%ipiv)
867 NULLIFY (qs_env%image_coeff)
868 NULLIFY (qs_env%super_cell)
869 NULLIFY (qs_env%mos)
870 NULLIFY (qs_env%mos_last_converged)
871 NULLIFY (qs_env%mpools)
872 NULLIFY (qs_env%ewald_env)
873 NULLIFY (qs_env%ewald_pw)
874 NULLIFY (qs_env%scf_control)
875 NULLIFY (qs_env%rel_control)
876 NULLIFY (qs_env%qs_charges)
877 ! ZMP initializing arrays
878 NULLIFY (qs_env%rho_external)
879 NULLIFY (qs_env%external_vxc)
880 NULLIFY (qs_env%mask)
881 ! Embedding potential
882 NULLIFY (qs_env%embed_pot)
883 NULLIFY (qs_env%spin_embed_pot)
884
885 ! Polarisability tensor
886 NULLIFY (qs_env%polar_env)
887
888 NULLIFY (qs_env%ks_env)
889 NULLIFY (qs_env%ks_qmmm_env)
890 NULLIFY (qs_env%wf_history)
891 NULLIFY (qs_env%scf_env)
892 NULLIFY (qs_env%oce)
893 NULLIFY (qs_env%local_rho_set)
894 NULLIFY (qs_env%hartree_local)
895 NULLIFY (qs_env%input)
896 NULLIFY (qs_env%linres_control)
897 NULLIFY (qs_env%xas_env)
898 NULLIFY (qs_env%cp_ddapc_env)
899 NULLIFY (qs_env%cp_ddapc_ewald)
900 NULLIFY (qs_env%outer_scf_history)
901 NULLIFY (qs_env%gradient_history)
902 NULLIFY (qs_env%variable_history)
903 NULLIFY (qs_env%x_data)
904 NULLIFY (qs_env%et_coupling)
905 NULLIFY (qs_env%dftb_potential)
906 NULLIFY (qs_env%active_space)
907
908 NULLIFY (qs_env%se_taper)
909 NULLIFY (qs_env%se_store_int_env)
910 NULLIFY (qs_env%se_nddo_mpole)
911 NULLIFY (qs_env%se_nonbond_env)
912 NULLIFY (qs_env%admm_env)
913 NULLIFY (qs_env%efield)
914 NULLIFY (qs_env%lri_env)
915 NULLIFY (qs_env%harris_env)
916 NULLIFY (qs_env%ec_env)
917 NULLIFY (qs_env%exstate_env)
918 NULLIFY (qs_env%lri_density)
919 NULLIFY (qs_env%gcp_env)
920 NULLIFY (qs_env%rtp)
921 NULLIFY (qs_env%mp2_env)
922 NULLIFY (qs_env%bs_env)
923 NULLIFY (qs_env%kg_env)
924 NULLIFY (qs_env%WannierCentres)
925
926 qs_env%outer_scf_ihistory = 0
927 qs_env%broyden_adaptive_sigma = -1.0_dp
928
929 CALL local_rho_set_create(qs_env%local_rho_set)
930 CALL hartree_local_create(qs_env%hartree_local)
931 qs_env%run_rtp = .false.
932 qs_env%linres_run = .false.
933 qs_env%single_point_run = .false.
934 qs_env%qmmm = .false.
935 qs_env%qmmm_periodic = .false.
936 qs_env%requires_mo_derivs = .false.
937 qs_env%requires_matrix_vxc = .false.
938 qs_env%has_unit_metric = .false.
939 qs_env%calc_image_preconditioner = .true.
940 qs_env%do_transport = .false.
941 qs_env%given_embed_pot = .false.
942 IF (PRESENT(globenv)) THEN
943 qs_env%target_time = globenv%cp2k_target_time
944 qs_env%start_time = globenv%cp2k_start_time
945 qs_env%single_point_run = (globenv%run_type_id == energy_run .OR. &
946 globenv%run_type_id == energy_force_run)
947 ELSE
948 qs_env%target_time = 0.0_dp
949 qs_env%start_time = 0.0_dp
950 END IF
951
952 qs_env%sim_time = 0._dp
953 qs_env%sim_step = 0
954
955 qs_env%total_zeff_corr = 0.0_dp
956 qs_env%surface_dipole_moment = 0.0_dp
957 qs_env%surface_dipole_switch_off = .false.
958
959 ! Zero all variables containing results
960 NULLIFY (qs_env%mo_derivs)
961 NULLIFY (qs_env%mo_loc_history)
962
963 IF (.NOT. ASSOCIATED(qs_env%molecular_scf_guess_env)) ALLOCATE (qs_env%molecular_scf_guess_env)
964
965 NULLIFY (qs_env%tb_tblite)
966
967 END SUBROUTINE init_qs_env
968
969! **************************************************************************************************
970!> \brief Set the QUICKSTEP environment.
971!> \param qs_env ...
972!> \param super_cell ...
973!> \param mos ...
974!> \param qmmm ...
975!> \param qmmm_periodic ...
976!> \param ewald_env ...
977!> \param ewald_pw ...
978!> \param mpools ...
979!> \param rho_external ...
980!> \param external_vxc ...
981!> \param mask ...
982!> \param scf_control ...
983!> \param rel_control ...
984!> \param qs_charges ...
985!> \param ks_env ...
986!> \param ks_qmmm_env ...
987!> \param wf_history ...
988!> \param scf_env ...
989!> \param active_space ...
990!> \param input ...
991!> \param oce ...
992!> \param rho_atom_set ...
993!> \param rho0_atom_set ...
994!> \param rho0_mpole ...
995!> \param run_rtp ...
996!> \param rtp ...
997!> \param rhoz_set ...
998!> \param rhoz_tot ...
999!> \param ecoul_1c ...
1000!> \param has_unit_metric ...
1001!> \param requires_mo_derivs ...
1002!> \param mo_derivs ...
1003!> \param mo_loc_history ...
1004!> \param efield ...
1005!> \param linres_control ...
1006!> \param xas_env ...
1007!> \param cp_ddapc_env ...
1008!> \param cp_ddapc_ewald ...
1009!> \param outer_scf_history ...
1010!> \param outer_scf_ihistory ...
1011!> \param x_data ...
1012!> \param et_coupling ...
1013!> \param dftb_potential ...
1014!> \param se_taper ...
1015!> \param se_store_int_env ...
1016!> \param se_nddo_mpole ...
1017!> \param se_nonbond_env ...
1018!> \param admm_env ...
1019!> \param ls_scf_env ...
1020!> \param do_transport ...
1021!> \param transport_env ...
1022!> \param lri_env ...
1023!> \param lri_density ...
1024!> \param exstate_env ...
1025!> \param ec_env ...
1026!> \param dispersion_env ...
1027!> \param harris_env ...
1028!> \param gcp_env ...
1029!> \param mp2_env ...
1030!> \param bs_env ...
1031!> \param kg_env ...
1032!> \param force ...
1033!> \param kpoints ...
1034!> \param WannierCentres ...
1035!> \param almo_scf_env ...
1036!> \param gradient_history ...
1037!> \param variable_history ...
1038!> \param embed_pot ...
1039!> \param spin_embed_pot ...
1040!> \param polar_env ...
1041!> \param mos_last_converged ... [SGh]
1042!> \param eeq ...
1043!> \param rhs ...
1044!> \param tb_tblite ...
1045!> \date 23.01.2002
1046!> \author MK
1047!> \version 1.0
1048! **************************************************************************************************
1049 SUBROUTINE set_qs_env(qs_env, super_cell, &
1050 mos, qmmm, qmmm_periodic, &
1051 ewald_env, ewald_pw, mpools, &
1052 rho_external, external_vxc, mask, &
1053 scf_control, rel_control, qs_charges, ks_env, &
1054 ks_qmmm_env, wf_history, scf_env, active_space, &
1055 input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, &
1056 rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, &
1057 mo_loc_history, efield, &
1058 linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, &
1059 outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, &
1060 se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, &
1061 do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, &
1062 harris_env, gcp_env, mp2_env, bs_env, kg_env, force, &
1063 kpoints, WannierCentres, almo_scf_env, gradient_history, variable_history, embed_pot, &
1064 spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, tb_tblite)
1065
1066 TYPE(qs_environment_type), INTENT(INOUT) :: qs_env
1067 TYPE(cell_type), OPTIONAL, POINTER :: super_cell
1068 TYPE(mo_set_type), DIMENSION(:), OPTIONAL, POINTER :: mos
1069 LOGICAL, OPTIONAL :: qmmm, qmmm_periodic
1070 TYPE(ewald_environment_type), OPTIONAL, POINTER :: ewald_env
1071 TYPE(ewald_pw_type), OPTIONAL, POINTER :: ewald_pw
1072 TYPE(qs_matrix_pools_type), OPTIONAL, POINTER :: mpools
1073 TYPE(qs_rho_type), OPTIONAL, POINTER :: rho_external
1074 TYPE(pw_r3d_rs_type), OPTIONAL, POINTER :: external_vxc, mask
1075 TYPE(scf_control_type), OPTIONAL, POINTER :: scf_control
1076 TYPE(rel_control_type), OPTIONAL, POINTER :: rel_control
1077 TYPE(qs_charges_type), OPTIONAL, POINTER :: qs_charges
1078 TYPE(qs_ks_env_type), OPTIONAL, POINTER :: ks_env
1079 TYPE(qs_ks_qmmm_env_type), OPTIONAL, POINTER :: ks_qmmm_env
1080 TYPE(qs_wf_history_type), OPTIONAL, POINTER :: wf_history
1081 TYPE(qs_scf_env_type), OPTIONAL, POINTER :: scf_env
1082 TYPE(active_space_type), OPTIONAL, POINTER :: active_space
1083 TYPE(section_vals_type), OPTIONAL, POINTER :: input
1084 TYPE(oce_matrix_type), OPTIONAL, POINTER :: oce
1085 TYPE(rho_atom_type), DIMENSION(:), OPTIONAL, &
1086 POINTER :: rho_atom_set
1087 TYPE(rho0_atom_type), DIMENSION(:), OPTIONAL, &
1088 POINTER :: rho0_atom_set
1089 TYPE(rho0_mpole_type), OPTIONAL, POINTER :: rho0_mpole
1090 LOGICAL, OPTIONAL :: run_rtp
1091 TYPE(rt_prop_type), OPTIONAL, POINTER :: rtp
1092 TYPE(rhoz_type), DIMENSION(:), OPTIONAL, POINTER :: rhoz_set
1093 REAL(dp), OPTIONAL :: rhoz_tot
1094 TYPE(ecoul_1center_type), DIMENSION(:), OPTIONAL, &
1095 POINTER :: ecoul_1c
1096 LOGICAL, OPTIONAL :: has_unit_metric, requires_mo_derivs
1097 TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
1098 POINTER :: mo_derivs
1099 TYPE(cp_fm_type), DIMENSION(:), OPTIONAL, POINTER :: mo_loc_history
1100 TYPE(efield_berry_type), OPTIONAL, POINTER :: efield
1101 TYPE(linres_control_type), OPTIONAL, POINTER :: linres_control
1102 TYPE(xas_environment_type), OPTIONAL, POINTER :: xas_env
1103 TYPE(cp_ddapc_type), OPTIONAL, POINTER :: cp_ddapc_env
1104 TYPE(cp_ddapc_ewald_type), OPTIONAL, POINTER :: cp_ddapc_ewald
1105 REAL(kind=dp), DIMENSION(:, :), OPTIONAL, POINTER :: outer_scf_history
1106 INTEGER, INTENT(IN), OPTIONAL :: outer_scf_ihistory
1107 TYPE(hfx_type), DIMENSION(:, :), OPTIONAL, POINTER :: x_data
1108 TYPE(et_coupling_type), OPTIONAL, POINTER :: et_coupling
1109 TYPE(qs_dftb_pairpot_type), DIMENSION(:, :), &
1110 OPTIONAL, POINTER :: dftb_potential
1111 TYPE(se_taper_type), OPTIONAL, POINTER :: se_taper
1112 TYPE(semi_empirical_si_type), OPTIONAL, POINTER :: se_store_int_env
1113 TYPE(nddo_mpole_type), OPTIONAL, POINTER :: se_nddo_mpole
1114 TYPE(fist_nonbond_env_type), OPTIONAL, POINTER :: se_nonbond_env
1115 TYPE(admm_type), OPTIONAL, POINTER :: admm_env
1116 TYPE(ls_scf_env_type), OPTIONAL, POINTER :: ls_scf_env
1117 LOGICAL, OPTIONAL :: do_transport
1118 TYPE(transport_env_type), OPTIONAL, POINTER :: transport_env
1119 TYPE(lri_environment_type), OPTIONAL, POINTER :: lri_env
1120 TYPE(lri_density_type), OPTIONAL, POINTER :: lri_density
1121 TYPE(excited_energy_type), OPTIONAL, POINTER :: exstate_env
1122 TYPE(energy_correction_type), OPTIONAL, POINTER :: ec_env
1123 TYPE(qs_dispersion_type), OPTIONAL, POINTER :: dispersion_env
1124 TYPE(harris_type), OPTIONAL, POINTER :: harris_env
1125 TYPE(qs_gcp_type), OPTIONAL, POINTER :: gcp_env
1126 TYPE(mp2_type), OPTIONAL, POINTER :: mp2_env
1127 TYPE(post_scf_bandstructure_type), OPTIONAL, &
1128 POINTER :: bs_env
1129 TYPE(kg_environment_type), OPTIONAL, POINTER :: kg_env
1130 TYPE(qs_force_type), DIMENSION(:), OPTIONAL, &
1131 POINTER :: force
1132 TYPE(kpoint_type), OPTIONAL, POINTER :: kpoints
1133 TYPE(wannier_centres_type), DIMENSION(:), &
1134 OPTIONAL, POINTER :: wanniercentres
1135 TYPE(almo_scf_env_type), OPTIONAL, POINTER :: almo_scf_env
1136 REAL(kind=dp), DIMENSION(:, :), OPTIONAL, POINTER :: gradient_history, variable_history
1137 TYPE(pw_r3d_rs_type), OPTIONAL, POINTER :: embed_pot, spin_embed_pot
1138 TYPE(polar_env_type), OPTIONAL, POINTER :: polar_env
1139 TYPE(mo_set_type), DIMENSION(:), OPTIONAL, POINTER :: mos_last_converged
1140 REAL(kind=dp), DIMENSION(:), OPTIONAL, POINTER :: eeq, rhs
1141 TYPE(tblite_type), OPTIONAL, POINTER :: tb_tblite
1142
1143 TYPE(qs_subsys_type), POINTER :: subsys
1144
1145 IF (PRESENT(mp2_env)) qs_env%mp2_env => mp2_env
1146 IF (PRESENT(bs_env)) qs_env%bs_env => bs_env
1147 IF (PRESENT(kg_env)) qs_env%kg_env => kg_env
1148 IF (PRESENT(super_cell)) THEN
1149 CALL cell_retain(super_cell)
1150 CALL cell_release(qs_env%super_cell)
1151 qs_env%super_cell => super_cell
1152 END IF
1153 !
1154 IF (PRESENT(qmmm)) qs_env%qmmm = qmmm
1155 IF (PRESENT(qmmm_periodic)) qs_env%qmmm_periodic = qmmm_periodic
1156 IF (PRESENT(mos)) qs_env%mos => mos
1157 IF (PRESENT(mos_last_converged)) qs_env%mos_last_converged => mos_last_converged
1158 IF (PRESENT(ls_scf_env)) qs_env%ls_scf_env => ls_scf_env
1159 IF (PRESENT(almo_scf_env)) qs_env%almo_scf_env => almo_scf_env
1160 IF (PRESENT(do_transport)) qs_env%do_transport = do_transport
1161 IF (PRESENT(transport_env)) qs_env%transport_env => transport_env
1162 ! if intels checking (-C) complains here, you have rediscovered a bug in the intel
1163 ! compiler (present in at least 10.0.025). A testcase has been submitted to intel.
1164 IF (PRESENT(oce)) qs_env%oce => oce
1165 IF (PRESENT(outer_scf_history)) qs_env%outer_scf_history => outer_scf_history
1166 IF (PRESENT(gradient_history)) qs_env%gradient_history => gradient_history
1167 IF (PRESENT(variable_history)) qs_env%variable_history => variable_history
1168 IF (PRESENT(outer_scf_ihistory)) qs_env%outer_scf_ihistory = outer_scf_ihistory
1169 IF (PRESENT(requires_mo_derivs)) qs_env%requires_mo_derivs = requires_mo_derivs
1170 IF (PRESENT(has_unit_metric)) qs_env%has_unit_metric = has_unit_metric
1171 IF (PRESENT(mo_derivs)) qs_env%mo_derivs => mo_derivs
1172 IF (PRESENT(mo_loc_history)) qs_env%mo_loc_history => mo_loc_history
1173 IF (PRESENT(run_rtp)) qs_env%run_rtp = run_rtp
1174 IF (PRESENT(rtp)) qs_env%rtp => rtp
1175 IF (PRESENT(efield)) qs_env%efield => efield
1176 IF (PRESENT(active_space)) qs_env%active_space => active_space
1177
1178 IF (PRESENT(ewald_env)) THEN ! accept also null pointers?
1179 IF (ASSOCIATED(qs_env%ewald_env)) THEN
1180 IF (.NOT. ASSOCIATED(qs_env%ewald_env, ewald_env)) THEN
1181 CALL ewald_env_release(qs_env%ewald_env)
1182 DEALLOCATE (qs_env%ewald_env)
1183 END IF
1184 END IF
1185 qs_env%ewald_env => ewald_env
1186 END IF
1187 IF (PRESENT(ewald_pw)) THEN ! accept also null pointers?
1188 IF (ASSOCIATED(qs_env%ewald_pw)) THEN
1189 IF (.NOT. ASSOCIATED(ewald_pw, qs_env%ewald_pw)) THEN
1190 CALL ewald_pw_release(qs_env%ewald_pw)
1191 DEALLOCATE (qs_env%ewald_pw)
1192 END IF
1193 END IF
1194 qs_env%ewald_pw => ewald_pw
1195 END IF
1196 IF (PRESENT(scf_control)) THEN ! accept also null pointers?
1197 IF (ASSOCIATED(qs_env%scf_control)) THEN
1198 IF (.NOT. ASSOCIATED(qs_env%scf_control, scf_control)) THEN
1199 CALL scf_c_release(qs_env%scf_control)
1200 DEALLOCATE (qs_env%scf_control)
1201 END IF
1202 END IF
1203 qs_env%scf_control => scf_control
1204 END IF
1205 IF (PRESENT(rel_control)) THEN ! accept also null pointers?
1206 IF (ASSOCIATED(qs_env%rel_control)) THEN
1207 IF (.NOT. ASSOCIATED(qs_env%rel_control, rel_control)) THEN
1208 CALL rel_c_release(qs_env%rel_control)
1209 DEALLOCATE (qs_env%rel_control)
1210 END IF
1211 END IF
1212 qs_env%rel_control => rel_control
1213 END IF
1214 IF (PRESENT(linres_control)) THEN ! accept also null pointers?
1215 IF (ASSOCIATED(qs_env%linres_control)) THEN
1216 IF (.NOT. ASSOCIATED(qs_env%linres_control, linres_control)) THEN
1217 CALL linres_control_release(qs_env%linres_control)
1218 DEALLOCATE (qs_env%linres_control)
1219 END IF
1220 END IF
1221 qs_env%linres_control => linres_control
1222 END IF
1223 ! ZMP associating variables
1224 IF (PRESENT(rho_external)) THEN
1225 IF (ASSOCIATED(qs_env%rho_external)) THEN
1226 IF (.NOT. ASSOCIATED(qs_env%rho_external, rho_external)) THEN
1227 CALL qs_rho_release(qs_env%rho_external)
1228 DEALLOCATE (qs_env%rho_external)
1229 END IF
1230 END IF
1231 qs_env%rho_external => rho_external
1232 END IF
1233 IF (PRESENT(external_vxc)) qs_env%external_vxc => external_vxc
1234 IF (PRESENT(mask)) qs_env%mask => mask
1235 ! Embedding potential
1236 IF (PRESENT(embed_pot)) qs_env%embed_pot => embed_pot
1237 IF (PRESENT(spin_embed_pot)) qs_env%spin_embed_pot => spin_embed_pot
1238
1239 ! Polarisability tensor
1240 IF (PRESENT(polar_env)) qs_env%polar_env => polar_env
1241
1242 IF (PRESENT(qs_charges)) THEN
1243 IF (ASSOCIATED(qs_env%qs_charges)) THEN
1244 IF (.NOT. ASSOCIATED(qs_env%qs_charges, qs_charges)) THEN
1245 CALL qs_charges_release(qs_env%qs_charges)
1246 DEALLOCATE (qs_env%qs_charges)
1247 END IF
1248 END IF
1249 qs_env%qs_charges => qs_charges
1250 END IF
1251 IF (PRESENT(ks_qmmm_env)) THEN
1252 IF (ASSOCIATED(qs_env%ks_qmmm_env)) THEN
1253 IF (.NOT. ASSOCIATED(qs_env%ks_qmmm_env, ks_qmmm_env)) THEN
1254 CALL qs_ks_qmmm_release(qs_env%ks_qmmm_env)
1255 DEALLOCATE (qs_env%ks_qmmm_env)
1256 END IF
1257 END IF
1258 qs_env%ks_qmmm_env => ks_qmmm_env
1259 END IF
1260 IF (PRESENT(ks_env)) THEN ! accept also null pointers?
1261 IF (ASSOCIATED(qs_env%ks_env)) THEN
1262 IF (.NOT. ASSOCIATED(qs_env%ks_env, ks_env)) THEN
1263 CALL qs_ks_release(qs_env%ks_env)
1264 DEALLOCATE (qs_env%ks_env)
1265 END IF
1266 END IF
1267 qs_env%ks_env => ks_env
1268 END IF
1269 IF (PRESENT(wf_history)) THEN ! accept also null pointers ?
1270 CALL wfi_retain(wf_history)
1271 CALL wfi_release(qs_env%wf_history)
1272 qs_env%wf_history => wf_history
1273 END IF
1274 IF (PRESENT(scf_env)) THEN ! accept also null pointers ?
1275 IF (ASSOCIATED(qs_env%scf_env)) THEN
1276 IF (.NOT. ASSOCIATED(qs_env%scf_env, scf_env)) THEN
1277 CALL scf_env_release(qs_env%scf_env)
1278 DEALLOCATE (qs_env%scf_env)
1279 END IF
1280 END IF
1281 qs_env%scf_env => scf_env
1282 END IF
1283 IF (PRESENT(xas_env)) THEN ! accept also null pointers?
1284 IF (ASSOCIATED(qs_env%xas_env)) THEN
1285 IF (.NOT. ASSOCIATED(qs_env%xas_env, xas_env)) THEN
1286 CALL xas_env_release(qs_env%xas_env)
1287 DEALLOCATE (qs_env%xas_env)
1288 END IF
1289 END IF
1290 qs_env%xas_env => xas_env
1291 END IF
1292 IF (PRESENT(mpools)) THEN
1293 CALL mpools_retain(mpools)
1294 CALL mpools_release(qs_env%mpools)
1295 qs_env%mpools => mpools
1296 END IF
1297 IF (PRESENT(rho_atom_set)) THEN
1298 CALL set_local_rho(qs_env%local_rho_set, rho_atom_set=rho_atom_set)
1299 END IF
1300 IF (PRESENT(rho0_atom_set)) THEN
1301 CALL set_local_rho(qs_env%local_rho_set, rho0_atom_set=rho0_atom_set)
1302 END IF
1303 IF (PRESENT(rho0_mpole)) THEN
1304 CALL set_local_rho(qs_env%local_rho_set, rho0_mpole=rho0_mpole)
1305 END IF
1306 IF (PRESENT(rhoz_set)) THEN
1307 CALL set_local_rho(qs_env%local_rho_set, rhoz_set=rhoz_set)
1308 END IF
1309 IF (PRESENT(rhoz_tot)) qs_env%local_rho_set%rhoz_tot = rhoz_tot
1310 IF (PRESENT(ecoul_1c)) THEN
1311 CALL set_hartree_local(qs_env%hartree_local, ecoul_1c=ecoul_1c)
1312 END IF
1313 IF (PRESENT(input)) THEN
1314 CALL section_vals_retain(input)
1315 CALL section_vals_release(qs_env%input)
1316 qs_env%input => input
1317 END IF
1318 IF (PRESENT(cp_ddapc_env)) THEN
1319 IF (ASSOCIATED(qs_env%cp_ddapc_env)) THEN
1320 IF (.NOT. ASSOCIATED(qs_env%cp_ddapc_env, cp_ddapc_env)) THEN
1321 CALL cp_ddapc_release(qs_env%cp_ddapc_env)
1322 DEALLOCATE (qs_env%cp_ddapc_env)
1323 END IF
1324 END IF
1325 qs_env%cp_ddapc_env => cp_ddapc_env
1326 END IF
1327 IF (PRESENT(cp_ddapc_ewald)) THEN
1328 qs_env%cp_ddapc_ewald => cp_ddapc_ewald
1329 END IF
1330 IF (PRESENT(x_data)) qs_env%x_data => x_data
1331 IF (PRESENT(et_coupling)) qs_env%et_coupling => et_coupling
1332 IF (PRESENT(dftb_potential)) qs_env%dftb_potential => dftb_potential
1333 IF (PRESENT(se_taper)) THEN
1334 CALL se_taper_release(qs_env%se_taper)
1335 qs_env%se_taper => se_taper
1336 END IF
1337 IF (PRESENT(se_store_int_env)) THEN
1338 CALL semi_empirical_si_release(qs_env%se_store_int_env)
1339 qs_env%se_store_int_env => se_store_int_env
1340 END IF
1341 IF (PRESENT(se_nddo_mpole)) THEN
1342 CALL nddo_mpole_release(qs_env%se_nddo_mpole)
1343 qs_env%se_nddo_mpole => se_nddo_mpole
1344 END IF
1345 IF (PRESENT(se_nonbond_env)) THEN
1346 IF (ASSOCIATED(qs_env%se_nonbond_env)) THEN
1347 IF (.NOT. ASSOCIATED(qs_env%se_nonbond_env, se_nonbond_env)) THEN
1348 CALL fist_nonbond_env_release(qs_env%se_nonbond_env)
1349 DEALLOCATE (qs_env%se_nonbond_env)
1350 END IF
1351 END IF
1352 qs_env%se_nonbond_env => se_nonbond_env
1353 END IF
1354 IF (PRESENT(admm_env)) qs_env%admm_env => admm_env
1355 IF (PRESENT(lri_env)) qs_env%lri_env => lri_env
1356 IF (PRESENT(lri_density)) qs_env%lri_density => lri_density
1357 IF (PRESENT(harris_env)) qs_env%harris_env => harris_env
1358 IF (PRESENT(ec_env)) qs_env%ec_env => ec_env
1359 IF (PRESENT(exstate_env)) qs_env%exstate_env => exstate_env
1360 IF (PRESENT(dispersion_env)) qs_env%dispersion_env => dispersion_env
1361 IF (PRESENT(gcp_env)) qs_env%gcp_env => gcp_env
1362 IF (PRESENT(wanniercentres)) qs_env%WannierCentres => wanniercentres
1363 IF (PRESENT(kpoints)) CALL set_ks_env(qs_env%ks_env, kpoints=kpoints)
1364
1365 ! EEQ charges
1366 IF (PRESENT(eeq)) qs_env%eeq => eeq
1367
1368 ! Resp charges
1369 IF (PRESENT(rhs)) qs_env%rhs => rhs
1370
1371 IF (PRESENT(force)) THEN
1372 CALL get_qs_env(qs_env, subsys=subsys)
1373 CALL qs_subsys_set(subsys, force=force)
1374 END IF
1375
1376 IF (PRESENT(tb_tblite)) qs_env%tb_tblite => tb_tblite
1377
1378 END SUBROUTINE set_qs_env
1379
1380! **************************************************************************************************
1381!> \brief allocates and intitializes a qs_env
1382!> \param qs_env the object to create
1383!> \param globenv ...
1384!> \par History
1385!> 12.2002 created [fawzi]
1386!> \author Fawzi Mohamed
1387! **************************************************************************************************
1388 SUBROUTINE qs_env_create(qs_env, globenv)
1389 TYPE(qs_environment_type), INTENT(OUT) :: qs_env
1390 TYPE(global_environment_type), OPTIONAL, POINTER :: globenv
1391
1392 CALL init_qs_env(qs_env, globenv=globenv)
1393 END SUBROUTINE qs_env_create
1394
1395! **************************************************************************************************
1396!> \brief releases the given qs_env (see doc/ReferenceCounting.html)
1397!> \param qs_env the object to release
1398!> \par History
1399!> 12.2002 created [fawzi]
1400!> 06.2018 polar_env added (MK)
1401!> \author Fawzi Mohamed
1402! **************************************************************************************************
1403 SUBROUTINE qs_env_release(qs_env)
1404 TYPE(qs_environment_type), INTENT(INOUT) :: qs_env
1405
1406 INTEGER :: i
1407
1408 CALL cell_release(qs_env%super_cell)
1409 IF (ASSOCIATED(qs_env%mos)) THEN
1410 DO i = 1, SIZE(qs_env%mos)
1411 CALL deallocate_mo_set(qs_env%mos(i))
1412 END DO
1413 DEALLOCATE (qs_env%mos)
1414 END IF
1415 IF (ASSOCIATED(qs_env%mos_last_converged)) THEN
1416 DO i = 1, SIZE(qs_env%mos_last_converged)
1417 CALL deallocate_mo_set(qs_env%mos_last_converged(i))
1418 END DO
1419 DEALLOCATE (qs_env%mos_last_converged)
1420 END IF
1421
1422 IF (ASSOCIATED(qs_env%mo_derivs)) THEN
1423 DO i = 1, SIZE(qs_env%mo_derivs)
1424 CALL dbcsr_release_p(qs_env%mo_derivs(i)%matrix)
1425 END DO
1426 DEALLOCATE (qs_env%mo_derivs)
1427 END IF
1428
1429 CALL cp_fm_release(qs_env%mo_loc_history)
1430
1431 IF (ASSOCIATED(qs_env%rtp)) THEN
1432 CALL rt_prop_release(qs_env%rtp)
1433 DEALLOCATE (qs_env%rtp)
1434 END IF
1435 IF (ASSOCIATED(qs_env%outer_scf_history)) THEN
1436 DEALLOCATE (qs_env%outer_scf_history)
1437 qs_env%outer_scf_ihistory = 0
1438 END IF
1439 IF (ASSOCIATED(qs_env%gradient_history)) &
1440 DEALLOCATE (qs_env%gradient_history)
1441 IF (ASSOCIATED(qs_env%variable_history)) &
1442 DEALLOCATE (qs_env%variable_history)
1443 IF (ASSOCIATED(qs_env%oce)) CALL deallocate_oce_set(qs_env%oce)
1444 IF (ASSOCIATED(qs_env%local_rho_set)) THEN
1445 CALL local_rho_set_release(qs_env%local_rho_set)
1446 END IF
1447 IF (ASSOCIATED(qs_env%hartree_local)) THEN
1448 CALL hartree_local_release(qs_env%hartree_local)
1449 END IF
1450 IF (ASSOCIATED(qs_env%scf_control)) THEN
1451 CALL scf_c_release(qs_env%scf_control)
1452 DEALLOCATE (qs_env%scf_control)
1453 END IF
1454 IF (ASSOCIATED(qs_env%rel_control)) THEN
1455 CALL rel_c_release(qs_env%rel_control)
1456 DEALLOCATE (qs_env%rel_control)
1457 END IF
1458
1459 IF (ASSOCIATED(qs_env%linres_control)) THEN
1460 CALL linres_control_release(qs_env%linres_control)
1461 DEALLOCATE (qs_env%linres_control)
1462 END IF
1463
1464 IF (ASSOCIATED(qs_env%almo_scf_env)) THEN
1465 CALL almo_scf_env_release(qs_env%almo_scf_env)
1466 END IF
1467
1468 IF (ASSOCIATED(qs_env%ls_scf_env)) THEN
1469 CALL ls_scf_release(qs_env%ls_scf_env)
1470 END IF
1471 IF (ASSOCIATED(qs_env%molecular_scf_guess_env)) THEN
1472 CALL molecular_scf_guess_env_destroy(qs_env%molecular_scf_guess_env)
1473 DEALLOCATE (qs_env%molecular_scf_guess_env)
1474 END IF
1475
1476 IF (ASSOCIATED(qs_env%transport_env)) THEN
1477 CALL transport_env_release(qs_env%transport_env)
1478 END IF
1479
1480 !Only if do_xas_calculation
1481 IF (ASSOCIATED(qs_env%xas_env)) THEN
1482 CALL xas_env_release(qs_env%xas_env)
1483 DEALLOCATE (qs_env%xas_env)
1484 END IF
1485 IF (ASSOCIATED(qs_env%ewald_env)) THEN
1486 CALL ewald_env_release(qs_env%ewald_env)
1487 DEALLOCATE (qs_env%ewald_env)
1488 END IF
1489 IF (ASSOCIATED(qs_env%ewald_pw)) THEN
1490 CALL ewald_pw_release(qs_env%ewald_pw)
1491 DEALLOCATE (qs_env%ewald_pw)
1492 END IF
1493 IF (ASSOCIATED(qs_env%image_matrix)) THEN
1494 DEALLOCATE (qs_env%image_matrix)
1495 END IF
1496 IF (ASSOCIATED(qs_env%ipiv)) THEN
1497 DEALLOCATE (qs_env%ipiv)
1498 END IF
1499 IF (ASSOCIATED(qs_env%image_coeff)) THEN
1500 DEALLOCATE (qs_env%image_coeff)
1501 END IF
1502 ! ZMP
1503 IF (ASSOCIATED(qs_env%rho_external)) THEN
1504 CALL qs_rho_release(qs_env%rho_external)
1505 DEALLOCATE (qs_env%rho_external)
1506 END IF
1507 IF (ASSOCIATED(qs_env%external_vxc)) THEN
1508 CALL qs_env%external_vxc%release()
1509 DEALLOCATE (qs_env%external_vxc)
1510 END IF
1511 IF (ASSOCIATED(qs_env%mask)) THEN
1512 CALL qs_env%mask%release()
1513 DEALLOCATE (qs_env%mask)
1514 END IF
1515 IF (ASSOCIATED(qs_env%active_space)) THEN
1516 CALL release_active_space_type(qs_env%active_space)
1517 END IF
1518 ! Embedding potentials if provided as input
1519 IF (qs_env%given_embed_pot) THEN
1520 CALL qs_env%embed_pot%release()
1521 DEALLOCATE (qs_env%embed_pot)
1522 IF (ASSOCIATED(qs_env%spin_embed_pot)) THEN
1523 CALL qs_env%spin_embed_pot%release()
1524 DEALLOCATE (qs_env%spin_embed_pot)
1525 END IF
1526 END IF
1527
1528 ! Polarisability tensor
1529 CALL polar_env_release(qs_env%polar_env)
1530
1531 IF (ASSOCIATED(qs_env%qs_charges)) THEN
1532 CALL qs_charges_release(qs_env%qs_charges)
1533 DEALLOCATE (qs_env%qs_charges)
1534 END IF
1535 IF (ASSOCIATED(qs_env%ks_env)) THEN
1536 CALL qs_ks_release(qs_env%ks_env)
1537 DEALLOCATE (qs_env%ks_env)
1538 END IF
1539 IF (ASSOCIATED(qs_env%ks_qmmm_env)) THEN
1540 CALL qs_ks_qmmm_release(qs_env%ks_qmmm_env)
1541 DEALLOCATE (qs_env%ks_qmmm_env)
1542 END IF
1543 CALL wfi_release(qs_env%wf_history)
1544 IF (ASSOCIATED(qs_env%scf_env)) THEN
1545 CALL scf_env_release(qs_env%scf_env)
1546 DEALLOCATE (qs_env%scf_env)
1547 END IF
1548 CALL mpools_release(qs_env%mpools)
1549 CALL section_vals_release(qs_env%input)
1550 IF (ASSOCIATED(qs_env%cp_ddapc_env)) THEN
1551 CALL cp_ddapc_release(qs_env%cp_ddapc_env)
1552 DEALLOCATE (qs_env%cp_ddapc_env)
1553 END IF
1554 CALL cp_ddapc_ewald_release(qs_env%cp_ddapc_ewald)
1555 CALL efield_berry_release(qs_env%efield)
1556 IF (ASSOCIATED(qs_env%x_data)) THEN
1557 CALL hfx_release(qs_env%x_data)
1558 END IF
1559 IF (ASSOCIATED(qs_env%et_coupling)) THEN
1560 CALL et_coupling_release(qs_env%et_coupling)
1561 END IF
1562 IF (ASSOCIATED(qs_env%dftb_potential)) THEN
1563 CALL qs_dftb_pairpot_release(qs_env%dftb_potential)
1564 END IF
1565 IF (ASSOCIATED(qs_env%se_taper)) THEN
1566 CALL se_taper_release(qs_env%se_taper)
1567 END IF
1568 IF (ASSOCIATED(qs_env%se_store_int_env)) THEN
1569 CALL semi_empirical_si_release(qs_env%se_store_int_env)
1570 END IF
1571 IF (ASSOCIATED(qs_env%se_nddo_mpole)) THEN
1572 CALL nddo_mpole_release(qs_env%se_nddo_mpole)
1573 END IF
1574 IF (ASSOCIATED(qs_env%se_nonbond_env)) THEN
1575 CALL fist_nonbond_env_release(qs_env%se_nonbond_env)
1576 DEALLOCATE (qs_env%se_nonbond_env)
1577 END IF
1578 IF (ASSOCIATED(qs_env%admm_env)) THEN
1579 CALL admm_env_release(qs_env%admm_env)
1580 END IF
1581 IF (ASSOCIATED(qs_env%lri_env)) THEN
1582 CALL lri_env_release(qs_env%lri_env)
1583 DEALLOCATE (qs_env%lri_env)
1584 END IF
1585 IF (ASSOCIATED(qs_env%lri_density)) THEN
1586 CALL lri_density_release(qs_env%lri_density)
1587 DEALLOCATE (qs_env%lri_density)
1588 END IF
1589 IF (ASSOCIATED(qs_env%harris_env)) THEN
1590 CALL harris_env_release(qs_env%harris_env)
1591 END IF
1592 IF (ASSOCIATED(qs_env%ec_env)) THEN
1593 CALL ec_env_release(qs_env%ec_env)
1594 END IF
1595 IF (ASSOCIATED(qs_env%exstate_env)) THEN
1596 CALL exstate_release(qs_env%exstate_env)
1597 END IF
1598 IF (ASSOCIATED(qs_env%mp2_env)) THEN
1599 CALL mp2_env_release(qs_env%mp2_env)
1600 DEALLOCATE (qs_env%mp2_env)
1601 NULLIFY (qs_env%mp2_env)
1602 END IF
1603 IF (ASSOCIATED(qs_env%bs_env)) THEN
1604 CALL bs_env_release(qs_env%bs_env)
1605 END IF
1606 IF (ASSOCIATED(qs_env%kg_env)) THEN
1607 CALL kg_env_release(qs_env%kg_env)
1608 END IF
1609
1610 ! dispersion
1611 CALL qs_dispersion_release(qs_env%dispersion_env)
1612 ! gCP
1613 IF (ASSOCIATED(qs_env%gcp_env)) THEN
1614 CALL qs_gcp_release(qs_env%gcp_env)
1615 END IF
1616
1617 IF (ASSOCIATED(qs_env%WannierCentres)) THEN
1618 DO i = 1, SIZE(qs_env%WannierCentres)
1619 DEALLOCATE (qs_env%WannierCentres(i)%WannierHamDiag)
1620 DEALLOCATE (qs_env%WannierCentres(i)%centres)
1621 END DO
1622 DEALLOCATE (qs_env%WannierCentres)
1623 END IF
1624 ! EEQ charges
1625 IF (ASSOCIATED(qs_env%eeq)) DEALLOCATE (qs_env%eeq)
1626 ! Resp charges
1627 IF (ASSOCIATED(qs_env%rhs)) DEALLOCATE (qs_env%rhs)
1628
1629 ! tblite
1630 IF (ASSOCIATED(qs_env%tb_tblite)) THEN
1631 CALL deallocate_tblite_type(qs_env%tb_tblite)
1632 END IF
1633
1634 END SUBROUTINE qs_env_release
1635
1636! **************************************************************************************************
1637!> \brief releases part of the given qs_env in order to save memory
1638!> \param qs_env the object to release
1639!> \par History
1640!> 04.2022 created [JGH]
1641! **************************************************************************************************
1642 SUBROUTINE qs_env_part_release(qs_env)
1643 TYPE(qs_environment_type), INTENT(INOUT) :: qs_env
1644
1645 INTEGER :: i
1646
1647 IF (ASSOCIATED(qs_env%mos_last_converged)) THEN
1648 DO i = 1, SIZE(qs_env%mos_last_converged)
1649 CALL deallocate_mo_set(qs_env%mos_last_converged(i))
1650 END DO
1651 DEALLOCATE (qs_env%mos_last_converged)
1652 END IF
1653
1654 IF (ASSOCIATED(qs_env%mo_derivs)) THEN
1655 DO i = 1, SIZE(qs_env%mo_derivs)
1656 CALL dbcsr_release_p(qs_env%mo_derivs(i)%matrix)
1657 END DO
1658 DEALLOCATE (qs_env%mo_derivs)
1659 END IF
1660
1661 CALL cp_fm_release(qs_env%mo_loc_history)
1662
1663 IF (ASSOCIATED(qs_env%rtp)) THEN
1664 CALL rt_prop_release(qs_env%rtp)
1665 DEALLOCATE (qs_env%rtp)
1666 END IF
1667 IF (ASSOCIATED(qs_env%outer_scf_history)) THEN
1668 DEALLOCATE (qs_env%outer_scf_history)
1669 qs_env%outer_scf_ihistory = 0
1670 END IF
1671 IF (ASSOCIATED(qs_env%gradient_history)) &
1672 DEALLOCATE (qs_env%gradient_history)
1673 IF (ASSOCIATED(qs_env%variable_history)) &
1674 DEALLOCATE (qs_env%variable_history)
1675 IF (ASSOCIATED(qs_env%oce)) CALL deallocate_oce_set(qs_env%oce)
1676 IF (ASSOCIATED(qs_env%local_rho_set)) THEN
1677 CALL local_rho_set_release(qs_env%local_rho_set)
1678 END IF
1679 IF (ASSOCIATED(qs_env%hartree_local)) THEN
1680 CALL hartree_local_release(qs_env%hartree_local)
1681 END IF
1682 IF (ASSOCIATED(qs_env%scf_control)) THEN
1683 CALL scf_c_release(qs_env%scf_control)
1684 DEALLOCATE (qs_env%scf_control)
1685 END IF
1686 IF (ASSOCIATED(qs_env%rel_control)) THEN
1687 CALL rel_c_release(qs_env%rel_control)
1688 DEALLOCATE (qs_env%rel_control)
1689 END IF
1690
1691 IF (ASSOCIATED(qs_env%linres_control)) THEN
1692 CALL linres_control_release(qs_env%linres_control)
1693 DEALLOCATE (qs_env%linres_control)
1694 END IF
1695
1696 IF (ASSOCIATED(qs_env%almo_scf_env)) THEN
1697 CALL almo_scf_env_release(qs_env%almo_scf_env)
1698 END IF
1699
1700 IF (ASSOCIATED(qs_env%ls_scf_env)) THEN
1701 CALL ls_scf_release(qs_env%ls_scf_env)
1702 END IF
1703 IF (ASSOCIATED(qs_env%molecular_scf_guess_env)) THEN
1704 CALL molecular_scf_guess_env_destroy(qs_env%molecular_scf_guess_env)
1705 DEALLOCATE (qs_env%molecular_scf_guess_env)
1706 END IF
1707
1708 IF (ASSOCIATED(qs_env%transport_env)) THEN
1709 CALL transport_env_release(qs_env%transport_env)
1710 END IF
1711
1712 !Only if do_xas_calculation
1713 IF (ASSOCIATED(qs_env%xas_env)) THEN
1714 CALL xas_env_release(qs_env%xas_env)
1715 DEALLOCATE (qs_env%xas_env)
1716 END IF
1717 IF (ASSOCIATED(qs_env%ewald_env)) THEN
1718 CALL ewald_env_release(qs_env%ewald_env)
1719 DEALLOCATE (qs_env%ewald_env)
1720 END IF
1721 IF (ASSOCIATED(qs_env%ewald_pw)) THEN
1722 CALL ewald_pw_release(qs_env%ewald_pw)
1723 DEALLOCATE (qs_env%ewald_pw)
1724 END IF
1725 IF (ASSOCIATED(qs_env%image_matrix)) THEN
1726 DEALLOCATE (qs_env%image_matrix)
1727 END IF
1728 IF (ASSOCIATED(qs_env%ipiv)) THEN
1729 DEALLOCATE (qs_env%ipiv)
1730 END IF
1731 IF (ASSOCIATED(qs_env%image_coeff)) THEN
1732 DEALLOCATE (qs_env%image_coeff)
1733 END IF
1734 ! ZMP
1735 IF (ASSOCIATED(qs_env%rho_external)) THEN
1736 CALL qs_rho_release(qs_env%rho_external)
1737 DEALLOCATE (qs_env%rho_external)
1738 END IF
1739 IF (ASSOCIATED(qs_env%external_vxc)) THEN
1740 CALL qs_env%external_vxc%release()
1741 DEALLOCATE (qs_env%external_vxc)
1742 END IF
1743 IF (ASSOCIATED(qs_env%mask)) THEN
1744 CALL qs_env%mask%release()
1745 DEALLOCATE (qs_env%mask)
1746 END IF
1747 IF (ASSOCIATED(qs_env%active_space)) THEN
1748 CALL release_active_space_type(qs_env%active_space)
1749 END IF
1750 ! Embedding potentials if provided as input
1751 IF (qs_env%given_embed_pot) THEN
1752 CALL qs_env%embed_pot%release()
1753 DEALLOCATE (qs_env%embed_pot)
1754 IF (ASSOCIATED(qs_env%spin_embed_pot)) THEN
1755 CALL qs_env%spin_embed_pot%release()
1756 DEALLOCATE (qs_env%spin_embed_pot)
1757 END IF
1758 END IF
1759
1760 ! Polarisability tensor
1761 CALL polar_env_release(qs_env%polar_env)
1762
1763 IF (ASSOCIATED(qs_env%qs_charges)) THEN
1764 CALL qs_charges_release(qs_env%qs_charges)
1765 DEALLOCATE (qs_env%qs_charges)
1766 END IF
1767 CALL qs_ks_part_release(qs_env%ks_env)
1768 IF (ASSOCIATED(qs_env%ks_qmmm_env)) THEN
1769 CALL qs_ks_qmmm_release(qs_env%ks_qmmm_env)
1770 DEALLOCATE (qs_env%ks_qmmm_env)
1771 END IF
1772 CALL wfi_release(qs_env%wf_history)
1773 IF (ASSOCIATED(qs_env%scf_env)) THEN
1774 CALL scf_env_release(qs_env%scf_env)
1775 DEALLOCATE (qs_env%scf_env)
1776 END IF
1777 IF (ASSOCIATED(qs_env%cp_ddapc_env)) THEN
1778 CALL cp_ddapc_release(qs_env%cp_ddapc_env)
1779 DEALLOCATE (qs_env%cp_ddapc_env)
1780 END IF
1781 CALL cp_ddapc_ewald_release(qs_env%cp_ddapc_ewald)
1782 CALL efield_berry_release(qs_env%efield)
1783 IF (ASSOCIATED(qs_env%x_data)) THEN
1784 CALL hfx_release(qs_env%x_data)
1785 END IF
1786 IF (ASSOCIATED(qs_env%et_coupling)) THEN
1787 CALL et_coupling_release(qs_env%et_coupling)
1788 END IF
1789 IF (ASSOCIATED(qs_env%dftb_potential)) THEN
1790 CALL qs_dftb_pairpot_release(qs_env%dftb_potential)
1791 END IF
1792 IF (ASSOCIATED(qs_env%se_taper)) THEN
1793 CALL se_taper_release(qs_env%se_taper)
1794 END IF
1795 IF (ASSOCIATED(qs_env%se_store_int_env)) THEN
1796 CALL semi_empirical_si_release(qs_env%se_store_int_env)
1797 END IF
1798 IF (ASSOCIATED(qs_env%se_nddo_mpole)) THEN
1799 CALL nddo_mpole_release(qs_env%se_nddo_mpole)
1800 END IF
1801 IF (ASSOCIATED(qs_env%se_nonbond_env)) THEN
1802 CALL fist_nonbond_env_release(qs_env%se_nonbond_env)
1803 DEALLOCATE (qs_env%se_nonbond_env)
1804 END IF
1805 IF (ASSOCIATED(qs_env%admm_env)) THEN
1806 CALL admm_env_release(qs_env%admm_env)
1807 END IF
1808 IF (ASSOCIATED(qs_env%lri_env)) THEN
1809 CALL lri_env_release(qs_env%lri_env)
1810 DEALLOCATE (qs_env%lri_env)
1811 END IF
1812 IF (ASSOCIATED(qs_env%lri_density)) THEN
1813 CALL lri_density_release(qs_env%lri_density)
1814 DEALLOCATE (qs_env%lri_density)
1815 END IF
1816 IF (ASSOCIATED(qs_env%harris_env)) THEN
1817 CALL harris_env_release(qs_env%harris_env)
1818 END IF
1819 IF (ASSOCIATED(qs_env%ec_env)) THEN
1820 CALL ec_env_release(qs_env%ec_env)
1821 END IF
1822 IF (ASSOCIATED(qs_env%exstate_env)) THEN
1823 CALL exstate_release(qs_env%exstate_env)
1824 END IF
1825 IF (ASSOCIATED(qs_env%mp2_env)) THEN
1826 CALL mp2_env_release(qs_env%mp2_env)
1827 DEALLOCATE (qs_env%mp2_env)
1828 NULLIFY (qs_env%mp2_env)
1829 END IF
1830 IF (ASSOCIATED(qs_env%kg_env)) THEN
1831 CALL kg_env_release(qs_env%kg_env)
1832 END IF
1833
1834 ! dispersion
1835 CALL qs_dispersion_release(qs_env%dispersion_env)
1836 ! gCP
1837 IF (ASSOCIATED(qs_env%gcp_env)) THEN
1838 CALL qs_gcp_release(qs_env%gcp_env)
1839 END IF
1840
1841 IF (ASSOCIATED(qs_env%WannierCentres)) THEN
1842 DO i = 1, SIZE(qs_env%WannierCentres)
1843 DEALLOCATE (qs_env%WannierCentres(i)%WannierHamDiag)
1844 DEALLOCATE (qs_env%WannierCentres(i)%centres)
1845 END DO
1846 DEALLOCATE (qs_env%WannierCentres)
1847 END IF
1848 ! EEQ charges
1849 IF (ASSOCIATED(qs_env%eeq)) DEALLOCATE (qs_env%eeq)
1850 ! Resp charges
1851 IF (ASSOCIATED(qs_env%rhs)) DEALLOCATE (qs_env%rhs)
1852
1853 ! tblite
1854 IF (ASSOCIATED(qs_env%tb_tblite)) THEN
1855 CALL deallocate_tblite_type(qs_env%tb_tblite)
1856 END IF
1857
1858 END SUBROUTINE qs_env_part_release
1859
1860END MODULE qs_environment_types
Types and set/get functions for auxiliary density matrix methods.
Definition admm_types.F:15
subroutine, public admm_env_release(admm_env)
releases the ADMM environment, cleans up all types
Definition admm_types.F:426
Types for all ALMO-based methods.
subroutine, public almo_scf_env_release(almo_scf_env)
release the almo scf envirnoment
Define the atomic kind types and their sub types.
Holds information on atomic properties.
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
Definition cell_types.F:559
subroutine, public cell_retain(cell)
retains the given cell (see doc/ReferenceCounting.html)
Definition cell_types.F:542
methods related to the blacs parallel environment
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_release_p(matrix)
...
contains information regarding the decoupling/recoupling method of Bloechl
subroutine, public cp_ddapc_release(cp_ddapc_env)
...
subroutine, public cp_ddapc_ewald_release(cp_ddapc_ewald)
...
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
set of type/routines to handle the storage of results in force_envs
types that represent a subsys, i.e. a part of the system
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
stores a mapping of 2D info (e.g. matrix) on a 2D processor distribution (i.e. blacs grid) where cpus...
Types needed for a linear scaling quickstep SCF run based on the density matrix.
subroutine, public ls_scf_release(ls_scf_env)
release the LS type.
Types needed for a for a Energy Correction.
subroutine, public ec_env_release(ec_env)
...
Definition and initialisation of the et_coupling data type.
subroutine, public et_coupling_release(et_coupling)
...
calculates the electron transfer coupling elements Wu, Van Voorhis, JCP 125, 164105 (2006)
Definition et_coupling.F:13
subroutine, public ewald_env_release(ewald_env)
releases the given ewald_env (see doc/ReferenceCounting.html)
subroutine, public ewald_pw_release(ewald_pw)
releases the memory used by the ewald_pw
Types for excited states potential energies.
subroutine, public exstate_release(ex_env)
...
subroutine, public fist_nonbond_env_release(fist_nonbond_env)
releases the given fist_nonbond_env (see doc/ReferenceCounting.html)
Define type storing the global information of a run. Keep the amount of stored data small....
subroutine, public get_hartree_local(hartree_local, ecoul_1c)
...
subroutine, public set_hartree_local(hartree_local, ecoul_1c)
...
subroutine, public hartree_local_release(hartree_local)
...
subroutine, public hartree_local_create(hartree_local)
...
Types and set/get functions for HFX.
Definition hfx_types.F:15
subroutine, public hfx_release(x_data)
This routine deallocates all data structures
Definition hfx_types.F:1905
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public energy_run
integer, parameter, public energy_force_run
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_retain(section_vals)
retains the given section values (see doc/ReferenceCounting.html)
recursive subroutine, public section_vals_release(section_vals)
releases the given object
Types needed for a Kim-Gordon-like partitioning into molecular subunits.
subroutine, public kg_env_release(kg_env)
...
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Types and basic routines needed for a kpoint calculation.
contains the types and subroutines for dealing with the lri_env lri : local resolution of the identit...
subroutine, public lri_density_release(lri_density)
releases the given lri_density
subroutine, public lri_env_release(lri_env)
releases the given lri_env
Interface to the message passing library MPI.
Define the molecule kind structure types and the corresponding functionality.
Define the data structure for the molecule information.
Types needed for MP2 calculations.
Definition mp2_types.F:14
subroutine, public mp2_env_release(mp2_env)
...
Definition mp2_types.F:436
Types used to generate the molecular SCF guess.
Definition mscfg_types.F:14
subroutine, public molecular_scf_guess_env_destroy(env)
Destroyes both data and environment.
Definition mscfg_types.F:94
Define the data structure for the particle information.
subroutine, public bs_env_release(bs_env)
...
container for various plainwaves related things
The types needed for the calculation of active space Hamiltonians.
subroutine, public release_active_space_type(active_space_env)
Releases all quantities in the active space environment.
container for information about total charges on the grids
subroutine, public qs_charges_release(qs_charges)
releases the charges object (see cp2k/doc/ReferenceCounting.html)
Definition of the DFTB parameter types.
subroutine, public qs_dftb_pairpot_release(pairpot)
...
Definition of disperson types for DFT calculations.
subroutine, public qs_dispersion_release(dispersion_env)
...
subroutine, public qs_env_release(qs_env)
releases the given qs_env (see doc/ReferenceCounting.html)
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, harris_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, wanniercentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, tb_tblite)
Set the QUICKSTEP environment.
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, tb_tblite)
Get the QUICKSTEP environment.
subroutine, public qs_env_part_release(qs_env)
releases part of the given qs_env in order to save memory
subroutine, public qs_env_create(qs_env, globenv)
allocates and intitializes a qs_env
Definition of gCP types for DFT calculations.
subroutine, public qs_gcp_release(gcp_env)
...
Types needed for a for a Harris model calculation.
subroutine, public harris_env_release(harris_env)
...
Define the quickstep kind type and their sub types.
subroutine, public qs_ks_qmmm_release(ks_qmmm_env)
releases the ks_qmmm_env (see doc/ReferenceCounting.html)
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
subroutine, public qs_ks_release(ks_env)
releases the ks_env (see doc/ReferenceCounting.html)
subroutine, public get_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, rho, rho_xc, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, task_list, task_list_soft, kpoints, do_kpoints, atomic_kind_set, qs_kind_set, cell, cell_ref, use_ref_cell, particle_set, energy, force, local_particles, local_molecules, molecule_kind_set, molecule_set, subsys, cp_subsys, virial, results, atprop, nkind, natom, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env, nelectron_total, nelectron_spin)
...
subroutine, public qs_ks_part_release(ks_env)
releases part of the ks_env
Type definitiona for linear response calculations.
subroutine, public polar_env_release(polar_env)
Deallocate the polar environment.
subroutine, public linres_control_release(linres_control)
...
subroutine, public local_rho_set_create(local_rho_set)
...
subroutine, public local_rho_set_release(local_rho_set)
...
subroutine, public set_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, rhoz_set)
...
subroutine, public get_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, rhoz_set)
...
wrapper for the pools of matrixes
subroutine, public mpools_release(mpools)
releases the given mpools
subroutine, public mpools_retain(mpools)
retains the given qs_matrix_pools_type
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
subroutine, public deallocate_mo_set(mo_set)
Deallocate a wavefunction data structure.
Define the neighbor list data types and the corresponding functionality.
subroutine, public deallocate_oce_set(oce_set)
Deallocate the matrix set of oce coefficients.
type for berry phase efield matrices. At the moment only used for cosmat and sinmat
subroutine, public efield_berry_release(efield)
...
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...
module that contains the definitions of the scf types
subroutine, public scf_env_release(scf_env)
releases an scf_env (see doc/ReferenceCounting.html)
types that represent a quickstep subsys
subroutine, public qs_subsys_set(subsys, cp_subsys, local_particles, local_molecules, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, nelectron_total, nelectron_spin)
...
interpolate the wavefunctions to speed up the convergence when doing MD
subroutine, public wfi_retain(wf_history)
retains a wf history (see doc/ReferenceCounting.html)
subroutine, public wfi_release(wf_history)
releases a wf_history of a wavefunction (see doc/ReferenceCounting.html)
parameters that control a relativistic calculation
subroutine, public rel_c_release(rel_control)
releases the given rel_control (see cp2k/doc/ReferenceCounting.html)
Types and set_get for real time propagation depending on runtype and diagonalization method different...
subroutine, public rt_prop_release(rtp)
...
parameters that control an scf iteration
subroutine, public scf_c_release(scf_control)
releases the given scf_control (see cp2k/doc/ReferenceCounting.html)
Definition of the semi empirical multipole integral expansions types.
subroutine, public nddo_mpole_release(nddo_mpole)
Deallocate NDDO multipole type.
Type to store integrals for semi-empirical calculations.
subroutine, public semi_empirical_si_release(store_int_env)
Deallocate the semi-empirical store integrals type.
Definition of the semi empirical parameter types.
subroutine, public se_taper_release(se_taper)
Releases the taper type used in SE calculations.
types for task lists
types for tblite
subroutine, public deallocate_tblite_type(tb_tblite)
...
CP2K transport environment and related C-interoperable types.
subroutine, public transport_env_release(transport_env)
releases the transport_env
defines the type needed for computing wannier states expectations
define create destroy get and put information in xas_env to calculate the x-ray absorption spectra
subroutine, public xas_env_release(xas_env)
...
stores some data used in wavefunction fitting
Definition admm_types.F:120
Provides all information about an atomic kind.
type for the atomic properties
Type defining parameters related to the simulation cell.
Definition cell_types.F:55
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
represent a full matrix
contains arbitrary information which need to be stored
represents a system: atoms, molecules, their pos,vel,...
structure to store local (to a processor) ordered lists of integers.
distributes pairs on a 2d grid of processors
Contains information on the energy correction functional for KG.
Contains information on the excited states energy.
contains the initially parsed file and the initial parallel environment
stores some data used in construction of Kohn-Sham matrix
Definition hfx_types.F:509
Contains all the info needed for KG runs...
Contains information about kpoints.
stores all the informations relevant to an mpi environment
contained for different pw related things
Container for information about total charges on the grids.
Contains information on the Harris method.
Provides all information about a quickstep kind.
calculation environment to calculate the ks_qmmm matrix, holds the QM/MM potential and all the needed...
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
General settings for linear response calculations.
container for the pools of matrixes used by qs
keeps the density in various representations, keeping track of which ones are valid.
keeps track of the previous wavefunctions and can extrapolate them for the next step of md
contains the parameters needed by a relativistic calculation
Global Multipolar NDDO information type.
Taper type use in semi-empirical calculations.