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