26 USE dbcsr_api,
ONLY: dbcsr_distribution_release,&
27 dbcsr_distribution_type,&
36 kpoint_transitional_type,&
65 #include "./base/base_uses.f90"
70 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
71 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_ks_types'
137 LOGICAL :: s_mstruct_changed = .true., &
138 rho_changed = .true., &
139 potential_changed = .true., &
140 forces_up_to_date = .false., &
142 INTEGER :: n_evals = 0
146 TYPE(pw_r3d_rs_type),
POINTER :: v_hartree_rspace => null()
148 TYPE(kpoint_transitional_type) :: matrix_ks, &
158 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_p_mp2 => null(), &
159 matrix_p_mp2_admm => null()
161 TYPE(qs_rho_type),
POINTER :: rho => null(), &
164 TYPE(pw_r3d_rs_type),
POINTER :: vppl => null(), &
166 TYPE(pw_c1d_gs_type),
POINTER :: rho_nlcc_g => null()
168 TYPE(pw_c1d_gs_type),
POINTER :: rho_core => null()
169 TYPE(pw_r3d_rs_type),
POINTER :: vee => null()
171 INTEGER :: neighbor_list_id = -1
172 TYPE(neighbor_list_set_p_type),
DIMENSION(:),
POINTER :: sab_orb => null(), &
176 sap_ppnl => null(), &
182 sab_xtbe => null(), &
183 sab_core => null(), &
185 sab_xtb_nonbond => null(), &
188 sab_almo => null(), &
190 sab_kp_nosym => null()
192 TYPE(task_list_type),
POINTER :: task_list => null()
193 TYPE(task_list_type),
POINTER :: task_list_soft => null()
195 TYPE(kpoint_type),
POINTER :: kpoints => null()
196 TYPE(qs_subsys_type),
POINTER :: subsys => null()
197 TYPE(dft_control_type),
POINTER :: dft_control => null()
198 TYPE(dbcsr_distribution_type),
POINTER :: dbcsr_dist => null()
199 TYPE(distribution_2d_type),
POINTER :: distribution_2d => null()
200 TYPE(pw_env_type),
POINTER :: pw_env => null()
201 TYPE(mp_para_env_type),
POINTER :: para_env => null()
202 TYPE(cp_blacs_env_type),
POINTER :: blacs_env => null()
203 END TYPE qs_ks_env_type
213 TYPE(qs_ks_env_type),
INTENT(OUT) :: ks_env
215 ALLOCATE (ks_env%rho)
217 ALLOCATE (ks_env%rho_xc)
310 s_mstruct_changed, rho_changed, &
311 potential_changed, forces_up_to_date, complex_ks, &
312 matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, &
314 matrix_s_RI_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, &
315 matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, &
316 matrix_s_RI_aux_kp, matrix_ks_im_kp, &
318 vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, &
320 sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, &
321 sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_vdw, sab_scp, &
322 sab_almo, sab_kp, sab_kp_nosym, &
323 task_list, task_list_soft, &
324 kpoints, do_kpoints, &
325 atomic_kind_set, qs_kind_set, cell, cell_ref, use_ref_cell, &
326 particle_set, energy, force, local_particles, local_molecules, &
327 molecule_kind_set, molecule_set, subsys, cp_subsys, virial, results, atprop, &
328 nkind, natom, dft_control, dbcsr_dist, distribution_2d, pw_env, &
329 para_env, blacs_env, nelectron_total, nelectron_spin)
331 TYPE(qs_ks_env_type),
INTENT(IN) :: ks_env
332 TYPE(pw_r3d_rs_type),
OPTIONAL,
POINTER :: v_hartree_rspace
333 LOGICAL,
OPTIONAL :: s_mstruct_changed, rho_changed, &
334 potential_changed, forces_up_to_date, &
336 TYPE(dbcsr_p_type),
DIMENSION(:),
OPTIONAL,
POINTER :: matrix_h, matrix_h_im, matrix_ks, &
337 matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, &
339 TYPE(dbcsr_p_type),
DIMENSION(:, :),
OPTIONAL,
POINTER :: matrix_h_kp, matrix_h_im_kp, &
340 matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, &
342 TYPE(qs_rho_type),
OPTIONAL,
POINTER :: rho, rho_xc
343 TYPE(pw_r3d_rs_type),
OPTIONAL,
POINTER :: vppl
344 TYPE(pw_c1d_gs_type),
OPTIONAL,
POINTER :: rho_core
345 TYPE(pw_r3d_rs_type),
OPTIONAL,
POINTER :: rho_nlcc
346 TYPE(pw_c1d_gs_type),
OPTIONAL,
POINTER :: rho_nlcc_g
347 TYPE(pw_r3d_rs_type),
OPTIONAL,
POINTER :: vee
348 INTEGER,
OPTIONAL :: neighbor_list_id
349 TYPE(neighbor_list_set_p_type),
DIMENSION(:),
OPTIONAL,
POINTER :: sab_orb, sab_all, sac_ae, &
350 sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, &
351 sab_xb, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym
352 TYPE(task_list_type),
OPTIONAL,
POINTER :: task_list, task_list_soft
353 TYPE(kpoint_type),
OPTIONAL,
POINTER :: kpoints
354 LOGICAL,
OPTIONAL :: do_kpoints
355 TYPE(atomic_kind_type),
DIMENSION(:),
OPTIONAL, &
356 POINTER :: atomic_kind_set
357 TYPE(qs_kind_type),
DIMENSION(:),
OPTIONAL, &
358 POINTER :: qs_kind_set
359 TYPE(cell_type),
OPTIONAL,
POINTER :: cell, cell_ref
360 LOGICAL,
OPTIONAL :: use_ref_cell
361 TYPE(particle_type),
DIMENSION(:),
OPTIONAL, &
362 POINTER :: particle_set
363 TYPE(qs_energy_type),
OPTIONAL,
POINTER :: energy
364 TYPE(qs_force_type),
DIMENSION(:),
OPTIONAL, &
366 TYPE(distribution_1d_type),
OPTIONAL,
POINTER :: local_particles, local_molecules
367 TYPE(molecule_kind_type),
DIMENSION(:),
OPTIONAL, &
368 POINTER :: molecule_kind_set
369 TYPE(molecule_type),
DIMENSION(:),
OPTIONAL, &
370 POINTER :: molecule_set
371 TYPE(qs_subsys_type),
OPTIONAL,
POINTER :: subsys
372 TYPE(cp_subsys_type),
OPTIONAL,
POINTER :: cp_subsys
373 TYPE(virial_type),
OPTIONAL,
POINTER :: virial
374 TYPE(cp_result_type),
OPTIONAL,
POINTER :: results
375 TYPE(atprop_type),
OPTIONAL,
POINTER :: atprop
376 INTEGER,
OPTIONAL :: nkind, natom
377 TYPE(dft_control_type),
OPTIONAL,
POINTER :: dft_control
378 TYPE(dbcsr_distribution_type),
OPTIONAL,
POINTER :: dbcsr_dist
379 TYPE(distribution_2d_type),
OPTIONAL,
POINTER :: distribution_2d
380 TYPE(pw_env_type),
OPTIONAL,
POINTER :: pw_env
381 TYPE(mp_para_env_type),
OPTIONAL,
POINTER :: para_env
382 TYPE(cp_blacs_env_type),
OPTIONAL,
POINTER :: blacs_env
383 INTEGER,
OPTIONAL :: nelectron_total
384 INTEGER,
DIMENSION(2),
OPTIONAL :: nelectron_spin
386 IF (.NOT.
ASSOCIATED(ks_env%subsys)) cpabort(
"get_ks_env: subsys not associated")
388 IF (
PRESENT(s_mstruct_changed)) s_mstruct_changed = ks_env%s_mstruct_changed
389 IF (
PRESENT(rho_changed)) rho_changed = ks_env%rho_changed
390 IF (
PRESENT(potential_changed)) potential_changed = ks_env%potential_changed
391 IF (
PRESENT(forces_up_to_date)) forces_up_to_date = ks_env%forces_up_to_date
392 IF (
PRESENT(complex_ks)) complex_ks = ks_env%complex_ks
393 IF (
PRESENT(v_hartree_rspace)) v_hartree_rspace => ks_env%v_hartree_rspace
395 IF (
PRESENT(matrix_ks)) matrix_ks =>
get_1d_pointer(ks_env%matrix_ks)
396 IF (
PRESENT(matrix_s)) matrix_s =>
get_1d_pointer(ks_env%matrix_s)
397 IF (
PRESENT(matrix_s_ri_aux)) matrix_s_ri_aux =>
get_1d_pointer(ks_env%matrix_s_RI_aux)
399 IF (
PRESENT(matrix_h)) matrix_h =>
get_1d_pointer(ks_env%matrix_h)
400 IF (
PRESENT(matrix_h_im)) matrix_h_im =>
get_1d_pointer(ks_env%matrix_h_im)
401 IF (
PRESENT(matrix_w)) matrix_w =>
get_1d_pointer(ks_env%matrix_w)
402 IF (
PRESENT(matrix_vxc)) matrix_vxc =>
get_1d_pointer(ks_env%matrix_vxc)
404 IF (
PRESENT(matrix_ks_kp)) matrix_ks_kp =>
get_2d_pointer(ks_env%matrix_ks)
405 IF (
PRESENT(matrix_ks_im_kp)) matrix_ks_im_kp =>
get_2d_pointer(ks_env%matrix_ks_im)
406 IF (
PRESENT(matrix_s_kp)) matrix_s_kp =>
get_2d_pointer(ks_env%matrix_s)
407 IF (
PRESENT(matrix_s_ri_aux_kp)) matrix_s_ri_aux_kp =>
get_2d_pointer(ks_env%matrix_s_RI_aux)
408 IF (
PRESENT(matrix_w_kp)) matrix_w_kp =>
get_2d_pointer(ks_env%matrix_w)
409 IF (
PRESENT(kinetic_kp)) kinetic_kp =>
get_2d_pointer(ks_env%kinetic)
410 IF (
PRESENT(matrix_h_kp)) matrix_h_kp =>
get_2d_pointer(ks_env%matrix_h)
411 IF (
PRESENT(matrix_h_im_kp)) matrix_h_im_kp =>
get_2d_pointer(ks_env%matrix_h_im)
412 IF (
PRESENT(matrix_vxc_kp)) matrix_vxc_kp =>
get_2d_pointer(ks_env%matrix_vxc)
413 IF (
PRESENT(matrix_ks_im)) matrix_ks_im =>
get_1d_pointer(ks_env%matrix_ks_im)
415 IF (
PRESENT(matrix_p_mp2)) matrix_p_mp2 => ks_env%matrix_p_mp2
416 IF (
PRESENT(matrix_p_mp2_admm)) matrix_p_mp2_admm => ks_env%matrix_p_mp2_admm
417 IF (
PRESENT(rho)) rho => ks_env%rho
418 IF (
PRESENT(rho_xc)) rho_xc => ks_env%rho_xc
419 IF (
PRESENT(rho_core)) rho_core => ks_env%rho_core
420 IF (
PRESENT(rho_nlcc)) rho_nlcc => ks_env%rho_nlcc
421 IF (
PRESENT(rho_nlcc_g)) rho_nlcc_g => ks_env%rho_nlcc_g
422 IF (
PRESENT(vppl)) vppl => ks_env%vppl
423 IF (
PRESENT(vee)) vee => ks_env%vee
425 IF (
PRESENT(neighbor_list_id)) neighbor_list_id = ks_env%neighbor_list_id
426 IF (
PRESENT(sab_orb)) sab_orb => ks_env%sab_orb
427 IF (
PRESENT(sab_all)) sab_all => ks_env%sab_all
428 IF (
PRESENT(sab_vdw)) sab_vdw => ks_env%sab_vdw
429 IF (
PRESENT(sab_scp)) sab_scp => ks_env%sab_scp
430 IF (
PRESENT(sac_ae)) sac_ae => ks_env%sac_ae
431 IF (
PRESENT(sac_ppl)) sac_ppl => ks_env%sac_ppl
432 IF (
PRESENT(sac_lri)) sac_lri => ks_env%sac_lri
433 IF (
PRESENT(sap_ppnl)) sap_ppnl => ks_env%sap_ppnl
434 IF (
PRESENT(sap_oce)) sap_oce => ks_env%sap_oce
435 IF (
PRESENT(sab_se)) sab_se => ks_env%sab_se
436 IF (
PRESENT(sab_lrc)) sab_lrc => ks_env%sab_lrc
437 IF (
PRESENT(sab_tbe)) sab_tbe => ks_env%sab_tbe
438 IF (
PRESENT(sab_xtbe)) sab_xtbe => ks_env%sab_xtbe
439 IF (
PRESENT(sab_core)) sab_core => ks_env%sab_core
440 IF (
PRESENT(sab_xb)) sab_xb => ks_env%sab_xb
441 IF (
PRESENT(sab_xtb_nonbond)) sab_xtb_nonbond => ks_env%sab_xtb_nonbond
442 IF (
PRESENT(sab_almo)) sab_almo => ks_env%sab_almo
443 IF (
PRESENT(sab_kp)) sab_kp => ks_env%sab_kp
444 IF (
PRESENT(sab_kp_nosym)) sab_kp_nosym => ks_env%sab_kp_nosym
445 IF (
PRESENT(dft_control)) dft_control => ks_env%dft_control
446 IF (
PRESENT(dbcsr_dist)) dbcsr_dist => ks_env%dbcsr_dist
447 IF (
PRESENT(distribution_2d)) distribution_2d => ks_env%distribution_2d
448 IF (
PRESENT(pw_env)) pw_env => ks_env%pw_env
449 IF (
PRESENT(para_env)) para_env => ks_env%para_env
450 IF (
PRESENT(blacs_env)) blacs_env => ks_env%blacs_env
452 IF (
PRESENT(task_list)) task_list => ks_env%task_list
453 IF (
PRESENT(task_list_soft)) task_list_soft => ks_env%task_list_soft
455 IF (
PRESENT(kpoints)) kpoints => ks_env%kpoints
456 IF (
PRESENT(do_kpoints))
THEN
457 do_kpoints = (ks_env%kpoints%nkp > 0)
460 IF (
PRESENT(subsys)) subsys => ks_env%subsys
462 local_molecules=local_molecules, &
463 local_particles=local_particles, &
469 use_ref_cell=use_ref_cell, &
472 qs_kind_set=qs_kind_set, &
473 cp_subsys=cp_subsys, &
474 atomic_kind_set=atomic_kind_set, &
475 particle_set=particle_set, &
476 molecule_kind_set=molecule_kind_set, &
477 molecule_set=molecule_set, &
480 nelectron_total=nelectron_total, &
481 nelectron_spin=nelectron_spin)
551 s_mstruct_changed, rho_changed, &
552 potential_changed, forces_up_to_date, complex_ks, &
553 matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, &
555 matrix_s_RI_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, &
556 matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, &
557 matrix_s_RI_aux_kp, matrix_ks_im_kp, &
558 vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, &
561 sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, &
562 sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_vdw, sab_scp, &
563 sab_almo, sab_kp, sab_kp_nosym, &
564 task_list, task_list_soft, &
565 subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, &
568 TYPE(qs_ks_env_type),
INTENT(INOUT) :: ks_env
569 TYPE(pw_r3d_rs_type),
OPTIONAL,
POINTER :: v_hartree_rspace
570 LOGICAL,
OPTIONAL :: s_mstruct_changed, rho_changed, &
571 potential_changed, forces_up_to_date, &
573 TYPE(dbcsr_p_type),
DIMENSION(:),
OPTIONAL,
POINTER :: matrix_h, matrix_h_im, matrix_ks, &
574 matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, &
576 TYPE(dbcsr_p_type),
DIMENSION(:, :),
OPTIONAL,
POINTER :: matrix_h_kp, matrix_h_im_kp, &
577 matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, &
579 TYPE(pw_r3d_rs_type),
OPTIONAL,
POINTER :: vppl
580 TYPE(pw_c1d_gs_type),
OPTIONAL,
POINTER :: rho_core
581 TYPE(pw_r3d_rs_type),
OPTIONAL,
POINTER :: rho_nlcc
582 TYPE(pw_c1d_gs_type),
OPTIONAL,
POINTER :: rho_nlcc_g
583 TYPE(pw_r3d_rs_type),
OPTIONAL,
POINTER :: vee
584 INTEGER,
OPTIONAL :: neighbor_list_id
585 TYPE(kpoint_type),
OPTIONAL,
POINTER :: kpoints
586 TYPE(neighbor_list_set_p_type),
DIMENSION(:),
OPTIONAL,
POINTER :: sab_orb, sab_all, sac_ae, &
587 sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, &
588 sab_xb, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym
589 TYPE(task_list_type),
OPTIONAL,
POINTER :: task_list, task_list_soft
590 TYPE(qs_subsys_type),
OPTIONAL,
POINTER :: subsys
591 TYPE(dft_control_type),
OPTIONAL,
POINTER :: dft_control
592 TYPE(dbcsr_distribution_type),
OPTIONAL,
POINTER :: dbcsr_dist
593 TYPE(distribution_2d_type),
OPTIONAL,
POINTER :: distribution_2d
594 TYPE(pw_env_type),
OPTIONAL,
POINTER :: pw_env
595 TYPE(mp_para_env_type),
OPTIONAL,
POINTER :: para_env
596 TYPE(cp_blacs_env_type),
OPTIONAL,
POINTER :: blacs_env
598 IF (
PRESENT(s_mstruct_changed)) ks_env%s_mstruct_changed = s_mstruct_changed
599 IF (
PRESENT(rho_changed)) ks_env%rho_changed = rho_changed
600 IF (
PRESENT(potential_changed)) ks_env%potential_changed = potential_changed
601 IF (
PRESENT(forces_up_to_date)) ks_env%forces_up_to_date = forces_up_to_date
602 IF (
PRESENT(complex_ks)) ks_env%complex_ks = complex_ks
603 IF (ks_env%s_mstruct_changed .OR. ks_env%potential_changed .OR. ks_env%rho_changed) &
604 ks_env%forces_up_to_date = .false.
605 IF (
PRESENT(v_hartree_rspace)) ks_env%v_hartree_rspace => v_hartree_rspace
607 IF (
PRESENT(matrix_h))
CALL set_1d_pointer(ks_env%matrix_h, matrix_h)
608 IF (
PRESENT(matrix_h_kp))
CALL set_2d_pointer(ks_env%matrix_h, matrix_h_kp)
610 IF (
PRESENT(matrix_h_im))
CALL set_1d_pointer(ks_env%matrix_h_im, matrix_h_im)
611 IF (
PRESENT(matrix_h_im_kp))
CALL set_2d_pointer(ks_env%matrix_h_im, matrix_h_im_kp)
613 IF (
PRESENT(matrix_ks))
CALL set_1d_pointer(ks_env%matrix_ks, matrix_ks)
614 IF (
PRESENT(matrix_ks_kp))
CALL set_2d_pointer(ks_env%matrix_ks, matrix_ks_kp)
616 IF (
PRESENT(matrix_vxc))
CALL set_1d_pointer(ks_env%matrix_vxc, matrix_vxc)
617 IF (
PRESENT(matrix_vxc_kp))
CALL set_2d_pointer(ks_env%matrix_vxc, matrix_vxc_kp)
619 IF (
PRESENT(matrix_s))
CALL set_1d_pointer(ks_env%matrix_s, matrix_s)
620 IF (
PRESENT(matrix_s_kp))
CALL set_2d_pointer(ks_env%matrix_s, matrix_s_kp)
622 IF (
PRESENT(kinetic))
CALL set_1d_pointer(ks_env%kinetic, kinetic)
623 IF (
PRESENT(kinetic_kp))
CALL set_2d_pointer(ks_env%kinetic, kinetic_kp)
625 IF (
PRESENT(matrix_w))
CALL set_1d_pointer(ks_env%matrix_w, matrix_w)
626 IF (
PRESENT(matrix_w_kp))
CALL set_2d_pointer(ks_env%matrix_w, matrix_w_kp)
628 IF (
PRESENT(matrix_s_ri_aux))
CALL set_1d_pointer(ks_env%matrix_s_RI_aux, matrix_s_ri_aux)
629 IF (
PRESENT(matrix_s_ri_aux_kp))
CALL set_2d_pointer(ks_env%matrix_s_RI_aux, matrix_s_ri_aux_kp)
631 IF (
PRESENT(matrix_ks_im))
CALL set_1d_pointer(ks_env%matrix_ks_im, matrix_ks_im)
632 IF (
PRESENT(matrix_ks_im_kp))
CALL set_2d_pointer(ks_env%matrix_ks_im, matrix_ks_im_kp)
634 IF (
PRESENT(matrix_p_mp2)) ks_env%matrix_p_mp2 => matrix_p_mp2
635 IF (
PRESENT(matrix_p_mp2_admm)) ks_env%matrix_p_mp2_admm => matrix_p_mp2_admm
636 IF (
PRESENT(rho_core)) ks_env%rho_core => rho_core
637 IF (
PRESENT(rho_nlcc)) ks_env%rho_nlcc => rho_nlcc
638 IF (
PRESENT(rho_nlcc_g)) ks_env%rho_nlcc_g => rho_nlcc_g
639 IF (
PRESENT(vppl)) ks_env%vppl => vppl
640 IF (
PRESENT(vee)) ks_env%vee => vee
642 IF (
PRESENT(neighbor_list_id)) ks_env%neighbor_list_id = neighbor_list_id
643 IF (
PRESENT(kpoints)) ks_env%kpoints => kpoints
644 IF (
PRESENT(sab_orb)) ks_env%sab_orb => sab_orb
645 IF (
PRESENT(sab_vdw)) ks_env%sab_vdw => sab_vdw
646 IF (
PRESENT(sab_scp)) ks_env%sab_scp => sab_scp
647 IF (
PRESENT(sab_all)) ks_env%sab_all => sab_all
648 IF (
PRESENT(sac_ae)) ks_env%sac_ae => sac_ae
649 IF (
PRESENT(sac_ppl)) ks_env%sac_ppl => sac_ppl
650 IF (
PRESENT(sac_lri)) ks_env%sac_lri => sac_lri
651 IF (
PRESENT(sap_ppnl)) ks_env%sap_ppnl => sap_ppnl
652 IF (
PRESENT(sap_oce)) ks_env%sap_oce => sap_oce
653 IF (
PRESENT(sab_se)) ks_env%sab_se => sab_se
654 IF (
PRESENT(sab_lrc)) ks_env%sab_lrc => sab_lrc
655 IF (
PRESENT(sab_tbe)) ks_env%sab_tbe => sab_tbe
656 IF (
PRESENT(sab_xtbe)) ks_env%sab_xtbe => sab_xtbe
657 IF (
PRESENT(sab_core)) ks_env%sab_core => sab_core
658 IF (
PRESENT(sab_xb)) ks_env%sab_xb => sab_xb
659 IF (
PRESENT(sab_xtb_nonbond)) ks_env%sab_xtb_nonbond => sab_xtb_nonbond
660 IF (
PRESENT(sab_almo)) ks_env%sab_almo => sab_almo
661 IF (
PRESENT(sab_kp)) ks_env%sab_kp => sab_kp
662 IF (
PRESENT(sab_kp_nosym)) ks_env%sab_kp_nosym => sab_kp_nosym
664 IF (
PRESENT(task_list)) ks_env%task_list => task_list
665 IF (
PRESENT(task_list_soft)) ks_env%task_list_soft => task_list_soft
667 IF (
PRESENT(subsys))
THEN
668 IF (
ASSOCIATED(ks_env%subsys))
THEN
669 IF (
ASSOCIATED(ks_env%subsys, subsys))
THEN
671 DEALLOCATE (ks_env%subsys)
674 ks_env%subsys => subsys
676 IF (
PRESENT(dft_control))
THEN
677 IF (
ASSOCIATED(ks_env%dft_control))
THEN
678 IF (.NOT.
ASSOCIATED(ks_env%dft_control, dft_control))
THEN
680 DEALLOCATE (ks_env%dft_control)
683 ks_env%dft_control => dft_control
685 IF (
PRESENT(dbcsr_dist))
THEN
686 IF (
ASSOCIATED(ks_env%dbcsr_dist))
THEN
687 IF (.NOT.
ASSOCIATED(ks_env%dbcsr_dist, dbcsr_dist))
THEN
688 CALL dbcsr_distribution_release(ks_env%dbcsr_dist)
689 DEALLOCATE (ks_env%dbcsr_dist)
692 ks_env%dbcsr_dist => dbcsr_dist
694 IF (
PRESENT(distribution_2d))
THEN
697 ks_env%distribution_2d => distribution_2d
699 IF (
PRESENT(pw_env))
THEN
702 ks_env%pw_env => pw_env
704 IF (
PRESENT(para_env))
THEN
705 CALL para_env%retain()
707 ks_env%para_env => para_env
709 IF (
PRESENT(blacs_env))
THEN
710 CALL blacs_env%retain()
712 ks_env%blacs_env => blacs_env
724 TYPE(qs_ks_env_type),
INTENT(INOUT) :: ks_env
726 IF (
ASSOCIATED(ks_env%v_hartree_rspace))
THEN
727 CALL ks_env%v_hartree_rspace%release()
728 DEALLOCATE (ks_env%v_hartree_rspace)
741 IF (
ASSOCIATED(ks_env%matrix_p_mp2)) &
743 IF (
ASSOCIATED(ks_env%matrix_p_mp2_admm)) &
745 IF (
ASSOCIATED(ks_env%rho))
THEN
747 DEALLOCATE (ks_env%rho)
749 IF (
ASSOCIATED(ks_env%rho_xc))
THEN
751 DEALLOCATE (ks_env%rho_xc)
753 IF (
ASSOCIATED(ks_env%distribution_2d)) &
755 IF (
ASSOCIATED(ks_env%task_list)) &
757 IF (
ASSOCIATED(ks_env%task_list_soft)) &
760 IF (
ASSOCIATED(ks_env%rho_nlcc_g))
THEN
761 CALL ks_env%rho_nlcc_g%release()
762 DEALLOCATE (ks_env%rho_nlcc_g)
764 IF (
ASSOCIATED(ks_env%rho_nlcc))
THEN
765 CALL ks_env%rho_nlcc%release()
766 DEALLOCATE (ks_env%rho_nlcc)
768 IF (
ASSOCIATED(ks_env%rho_core))
THEN
769 CALL ks_env%rho_core%release()
770 DEALLOCATE (ks_env%rho_core)
772 IF (
ASSOCIATED(ks_env%vppl))
THEN
773 CALL ks_env%vppl%release()
774 DEALLOCATE (ks_env%vppl)
776 IF (
ASSOCIATED(ks_env%vee))
THEN
777 CALL ks_env%vee%release()
778 DEALLOCATE (ks_env%vee)
780 IF (
ASSOCIATED(ks_env%dbcsr_dist))
THEN
781 CALL dbcsr_distribution_release(ks_env%dbcsr_dist)
782 DEALLOCATE (ks_env%dbcsr_dist)
804 IF (
ASSOCIATED(ks_env%dft_control))
THEN
806 DEALLOCATE (ks_env%dft_control)
809 IF (
ASSOCIATED(ks_env%subsys))
THEN
811 DEALLOCATE (ks_env%subsys)
826 TYPE(qs_ks_env_type),
INTENT(INOUT) :: ks_env
828 IF (
ASSOCIATED(ks_env%v_hartree_rspace))
THEN
829 CALL ks_env%v_hartree_rspace%release()
830 DEALLOCATE (ks_env%v_hartree_rspace)
841 IF (
ASSOCIATED(ks_env%matrix_p_mp2)) &
843 IF (
ASSOCIATED(ks_env%matrix_p_mp2_admm)) &
845 IF (
ASSOCIATED(ks_env%rho))
THEN
847 DEALLOCATE (ks_env%rho)
849 IF (
ASSOCIATED(ks_env%rho_xc))
THEN
851 DEALLOCATE (ks_env%rho_xc)
853 IF (
ASSOCIATED(ks_env%task_list)) &
855 IF (
ASSOCIATED(ks_env%task_list_soft)) &
858 IF (
ASSOCIATED(ks_env%rho_nlcc_g))
THEN
859 CALL ks_env%rho_nlcc_g%release()
860 DEALLOCATE (ks_env%rho_nlcc_g)
862 IF (
ASSOCIATED(ks_env%rho_nlcc))
THEN
863 CALL ks_env%rho_nlcc%release()
864 DEALLOCATE (ks_env%rho_nlcc)
866 IF (
ASSOCIATED(ks_env%rho_core))
THEN
867 CALL ks_env%rho_core%release()
868 DEALLOCATE (ks_env%rho_core)
870 IF (
ASSOCIATED(ks_env%vppl))
THEN
871 CALL ks_env%vppl%release()
872 DEALLOCATE (ks_env%vppl)
874 IF (
ASSOCIATED(ks_env%vee))
THEN
875 CALL ks_env%vee%release()
876 DEALLOCATE (ks_env%vee)
918 potential_changed, full_reset)
919 TYPE(qs_ks_env_type),
INTENT(INOUT) :: ks_env
920 LOGICAL,
INTENT(in),
OPTIONAL :: s_mstruct_changed, rho_changed, &
921 potential_changed, full_reset
923 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_ks_did_change'
926 LOGICAL :: my_mstruct_chg
928 CALL timeset(routinen, handle)
929 my_mstruct_chg = .false.
931 IF (
PRESENT(rho_changed))
THEN
932 IF (rho_changed) ks_env%rho_changed = .true.
935 IF (
PRESENT(potential_changed))
THEN
936 IF (potential_changed) ks_env%potential_changed = .true.
939 IF (
PRESENT(s_mstruct_changed))
THEN
940 IF (s_mstruct_changed) my_mstruct_chg = .true.
943 IF (
PRESENT(full_reset))
THEN
945 ks_env%potential_changed = .true.
946 my_mstruct_chg = .true.
950 IF (my_mstruct_chg)
THEN
951 ks_env%s_mstruct_changed = .true.
955 IF (ks_env%complex_ks)
THEN
962 CALL timestop(handle)
Define the atomic kind types and their sub types.
Holds information on atomic properties.
Handles all functions related to the CELL.
methods related to the blacs parallel environment
subroutine, public cp_blacs_env_release(blacs_env)
releases the given blacs_env
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dft_control_release(dft_control)
...
DBCSR operations in CP2K.
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...
subroutine, public distribution_2d_release(distribution_2d)
...
subroutine, public distribution_2d_retain(distribution_2d)
...
Datatype to translate between k-points (2d) and gamma-point (1d) code.
type(dbcsr_p_type) function, dimension(:), pointer, public get_1d_pointer(this)
Smart getter, raises an error when called during a k-point calculation.
type(dbcsr_p_type) function, dimension(:, :), pointer, public get_2d_pointer(this)
Simple getter, needed because of PRIVATE.
subroutine, public kpoint_transitional_release(this)
Release the matrix set, using the right pointer.
subroutine, public set_1d_pointer(this, ptr_1d)
Assigns a 1D pointer.
subroutine, public set_2d_pointer(this, ptr_2d)
Assigns a 2D pointer.
Types and basic routines needed for a kpoint calculation.
subroutine, public kpoint_release(kpoint)
Release a kpoint environment, deallocate all data.
Interface to the message passing library MPI.
subroutine, public mp_para_env_release(para_env)
releases the para object (to be called when you don't want anymore the shared copy of this object)
Define the molecule kind structure types and the corresponding functionality.
Define the data structure for the molecule information.
Define the data structure for the particle information.
container for various plainwaves related things
subroutine, public pw_env_retain(pw_env)
retains the pw_env (see doc/ReferenceCounting.html)
subroutine, public pw_env_release(pw_env, para_env)
releases the given pw_env (see doc/ReferenceCounting.html)
Define the quickstep kind type and their sub types.
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_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 qs_ks_did_change(ks_env, s_mstruct_changed, rho_changed, potential_changed, full_reset)
tells that some of the things relevant to the ks calculation did change. has to be called when change...
subroutine, public qs_ks_part_release(ks_env)
releases part of the ks_env
subroutine, public qs_ks_env_create(ks_env)
Allocates a new instance of ks_env.
Define the neighbor list data types and the corresponding functionality.
subroutine, public release_neighbor_list_sets(nlists)
releases an array of neighbor_list_sets
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_create(rho)
Allocates a new instance of rho.
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...
types that represent a quickstep subsys
subroutine, public qs_subsys_release(subsys)
releases a subsys (see doc/ReferenceCounting.html)
subroutine, public qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
...
subroutine, public deallocate_task_list(task_list)
deallocates the components and the object itself