(git:374b731)
Loading...
Searching...
No Matches
qs_tddfpt_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! **************************************************************************************************
18 USE cp_fm_types, ONLY: cp_fm_create,&
21 USE kinds, ONLY: dp
27#include "./base/base_uses.f90"
28
29 IMPLICIT NONE
30
31! **************************************************************************************************
33 REAL(kind=dp), DIMENSION(:), POINTER :: evals ! eigenvalues
34 TYPE(cp_fm_type), DIMENSION(:, :), &
35 POINTER :: evecs ! eigenvectors
36 TYPE(cp_fm_type), DIMENSION(:), POINTER :: invs ! the inverse of the metric
37 TYPE(cp_fm_pool_p_type), DIMENSION(:), &
38 POINTER :: ao_mo_fm_pools
39 END TYPE tddfpt_env_type
40
41 CHARACTER(len=*), PARAMETER, PRIVATE :: modulen = 'qs_tddfpt_types'
42
43 PRIVATE
44
45 PUBLIC :: tddfpt_env_type
46
47 PUBLIC :: tddfpt_env_allocate, &
49
50CONTAINS
51
52! **************************************************************************************************
53!> \brief ...
54!> \param t_env ...
55!> \param p_env ...
56!> \param qs_env ...
57! **************************************************************************************************
58 SUBROUTINE tddfpt_env_allocate(t_env, p_env, qs_env)
59
60 TYPE(tddfpt_env_type) :: t_env
61 TYPE(qs_p_env_type) :: p_env
62 TYPE(qs_environment_type), POINTER :: qs_env
63
64 CHARACTER(len=*), PARAMETER :: routinen = 'tddfpt_env_allocate', &
65 routinep = modulen//':'//routinen
66
67 INTEGER :: i, n_ev, n_spins, spin
68 TYPE(cp_blacs_env_type), POINTER :: blacs_env
69 TYPE(cp_fm_struct_type), POINTER :: fm_struct
70 TYPE(dft_control_type), POINTER :: dft_control
71 TYPE(mp_para_env_type), POINTER :: para_env
72
73 NULLIFY (dft_control, para_env, blacs_env)
74
75 CALL get_qs_env(qs_env, &
76 dft_control=dft_control, &
77 para_env=para_env, &
78 blacs_env=blacs_env)
79
80 n_ev = dft_control%tddfpt_control%n_ev
81 n_spins = dft_control%nspins
82 CALL mpools_get(qs_env%mpools, ao_mo_fm_pools=t_env%ao_mo_fm_pools)
83
84 ALLOCATE (t_env%evals(n_ev))
85 ALLOCATE (t_env%evecs(n_ev, n_spins))
86 DO spin = 1, n_spins
87 DO i = 1, n_ev
88 CALL fm_pool_create_fm(t_env%ao_mo_fm_pools(spin)%pool, &
89 t_env%evecs(i, spin))
90 END DO
91 END DO
92
93 !-------------------------------------------------!
94 ! allocate memory for the inverse of the S matrix !
95 !-------------------------------------------------!
96 ALLOCATE (t_env%invS(n_spins))
97 DO spin = 1, n_spins
98 NULLIFY (fm_struct)
99 CALL cp_fm_struct_create(fm_struct, para_env, blacs_env, &
100 p_env%n_ao(spin), p_env%n_ao(spin))
101 CALL cp_fm_create(t_env%invS(spin), fm_struct, routinep//"invS")
102 CALL cp_fm_struct_release(fm_struct)
103 END DO
104
105 END SUBROUTINE tddfpt_env_allocate
106
107! **************************************************************************************************
108!> \brief ...
109!> \param t_env ...
110! **************************************************************************************************
111 SUBROUTINE tddfpt_env_deallocate(t_env)
112
113 TYPE(tddfpt_env_type), INTENT(inout) :: t_env
114
115 INTEGER :: i, spin
116
117 DO spin = 1, SIZE(t_env%evecs, 2)
118 DO i = 1, SIZE(t_env%evecs, 1)
119 CALL fm_pool_give_back_fm(t_env%ao_mo_fm_pools(spin)%pool, &
120 t_env%evecs(i, spin))
121 END DO
122 END DO
123 DEALLOCATE (t_env%evecs, t_env%evals)
124
125 CALL cp_fm_release(t_env%invS)
126
127 END SUBROUTINE tddfpt_env_deallocate
128
129END MODULE qs_tddfpt_types
methods related to the blacs parallel environment
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
pool for for elements that are retained and released
subroutine, public fm_pool_create_fm(pool, element, name)
returns an element, allocating it if none is in the pool
subroutine, public fm_pool_give_back_fm(pool, element)
returns the element to the pool
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Interface to the message passing library MPI.
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.
wrapper for the pools of matrixes
subroutine, public mpools_get(mpools, ao_mo_fm_pools, ao_ao_fm_pools, mo_mo_fm_pools, ao_mosub_fm_pools, mosub_mosub_fm_pools, maxao_maxmo_fm_pool, maxao_maxao_fm_pool, maxmo_maxmo_fm_pool)
returns various attributes of the mpools (notably the pools contained in it)
basis types for the calculation of the perturbation of density theory.
subroutine, public tddfpt_env_deallocate(t_env)
...
subroutine, public tddfpt_env_allocate(t_env, p_env, qs_env)
...
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
keeps the information about the structure of a full matrix
represent a full matrix
stores all the informations relevant to an mpi environment
Represent a qs system that is perturbed. Can calculate the linear operator and the rhs of the system ...