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