59 #include "./base/base_uses.f90"
67 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_linres_epr_utils'
81 TYPE(epr_env_type) :: epr_env
82 TYPE(qs_environment_type),
POINTER :: qs_env
84 CHARACTER(LEN=*),
PARAMETER :: routinen =
'epr_env_init'
86 INTEGER :: handle, i_b, idir, ispin, n_mo(2), nao, &
87 natom, nmoloc, nspins, output_unit
89 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
90 TYPE(cell_type),
POINTER :: cell
91 TYPE(cp_logger_type),
POINTER :: logger
92 TYPE(dft_control_type),
POINTER :: dft_control
93 TYPE(linres_control_type),
POINTER :: linres_control
94 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
95 TYPE(nablavks_atom_type),
DIMENSION(:),
POINTER :: nablavks_atom_set
96 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
97 TYPE(pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g
98 TYPE(pw_env_type),
POINTER :: pw_env
99 TYPE(pw_pool_type),
POINTER :: auxbas_pw_pool
100 TYPE(pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r
101 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
102 TYPE(qs_matrix_pools_type),
POINTER :: mpools
103 TYPE(scf_control_type),
POINTER :: scf_control
104 TYPE(section_vals_type),
POINTER :: lr_section
106 CALL timeset(routinen, handle)
108 NULLIFY (atomic_kind_set, qs_kind_set, cell, dft_control, linres_control, scf_control)
109 NULLIFY (logger, mos, mpools, particle_set)
110 NULLIFY (auxbas_pw_pool, pw_env)
111 NULLIFY (nablavks_atom_set)
121 extension=
".linresLog")
125 IF (output_unit > 0)
THEN
126 WRITE (output_unit,
"(/,T20,A,/)")
"*** Start EPR g tensor calculation ***"
127 WRITE (output_unit,
"(T10,A,/)")
"Initialization of the EPR environment"
131 atomic_kind_set=atomic_kind_set, &
132 qs_kind_set=qs_kind_set, &
134 dft_control=dft_control, &
135 linres_control=linres_control, &
138 particle_set=particle_set, &
140 scf_control=scf_control)
148 cpassert(linres_control%localized_psi0)
149 IF (output_unit > 0)
THEN
150 WRITE (output_unit,
'(A)') &
151 ' To get EPR parameters within PBC you need localized zero order orbitals '
153 gapw = dft_control%qs_control%gapw
154 nspins = dft_control%nspins
155 natom =
SIZE(particle_set, 1)
159 epr_env%g_free_factor = -1.0_dp*
e_gfactor
162 epr_env%g_so_factor_gapw = (
a_fine)**2*(-1.0_dp*
e_gfactor - 1.0_dp)/2.0_dp
166 epr_env%g_soo_chicorr_factor = 2.0/3.0_dp*
fourpi*(
a_fine)**2/cell%deth
169 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
175 nablavks_atom_set=nablavks_atom_set)
179 ALLOCATE (epr_env%bind_set(3, 3))
182 NULLIFY (epr_env%bind_set(idir, i_b)%rho, rho_r, rho_g)
183 ALLOCATE (epr_env%bind_set(idir, i_b)%rho)
185 ALLOCATE (rho_r(1), rho_g(1))
186 CALL auxbas_pw_pool%create_pw(rho_r(1))
187 CALL auxbas_pw_pool%create_pw(rho_g(1))
188 CALL qs_rho_set(epr_env%bind_set(idir, i_b)%rho, rho_r=rho_r, rho_g=rho_g)
193 ALLOCATE (epr_env%nablavks_set(3, dft_control%nspins))
196 NULLIFY (epr_env%nablavks_set(idir, ispin)%rho, rho_r, rho_g)
197 ALLOCATE (epr_env%nablavks_set(idir, ispin)%rho)
199 ALLOCATE (rho_r(1), rho_g(1))
200 CALL auxbas_pw_pool%create_pw(rho_r(1))
201 CALL auxbas_pw_pool%create_pw(rho_g(1))
202 CALL qs_rho_set(epr_env%nablavks_set(idir, ispin)%rho, &
203 rho_r=rho_r, rho_g=rho_g)
208 ALLOCATE (epr_env%g_total(3, 3))
209 ALLOCATE (epr_env%g_so(3, 3))
210 ALLOCATE (epr_env%g_soo(3, 3))
211 epr_env%g_total = 0.0_dp
212 epr_env%g_zke = 0.0_dp
213 epr_env%g_so = 0.0_dp
214 epr_env%g_soo = 0.0_dp
217 &
"PRINT%PROGRAM_RUN_INFO")
219 CALL timestop(handle)
232 TYPE(epr_env_type) :: epr_env
234 INTEGER :: i_b, idir, ispin
237 IF (
ASSOCIATED(epr_env%nablavks_set))
THEN
238 DO ispin = 1,
SIZE(epr_env%nablavks_set, 2)
239 DO idir = 1,
SIZE(epr_env%nablavks_set, 1)
240 CALL qs_rho_clear(epr_env%nablavks_set(idir, ispin)%rho)
241 DEALLOCATE (epr_env%nablavks_set(idir, ispin)%rho)
244 DEALLOCATE (epr_env%nablavks_set)
247 IF (
ASSOCIATED(epr_env%nablavks_atom_set))
THEN
251 IF (
ASSOCIATED(epr_env%vks_atom_set))
THEN
255 IF (
ASSOCIATED(epr_env%bind_set))
THEN
256 DO i_b = 1,
SIZE(epr_env%bind_set, 2)
257 DO idir = 1,
SIZE(epr_env%bind_set, 1)
259 DEALLOCATE (epr_env%bind_set(idir, i_b)%rho)
262 DEALLOCATE (epr_env%bind_set)
265 IF (
ASSOCIATED(epr_env%bind_atom_set))
THEN
266 DEALLOCATE (epr_env%bind_atom_set)
269 IF (
ASSOCIATED(epr_env%g_total))
THEN
270 DEALLOCATE (epr_env%g_total)
273 IF (
ASSOCIATED(epr_env%g_so))
THEN
274 DEALLOCATE (epr_env%g_so)
277 IF (
ASSOCIATED(epr_env%g_soo))
THEN
278 DEALLOCATE (epr_env%g_soo)
Define the atomic kind types and their sub types.
Handles all functions related to the CELL.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
real(kind=dp), parameter, public fourpi
real(kind=dp), parameter, public twopi
Define the data structure for the particle information.
Definition of physical constants:
real(kind=dp), parameter, public a_fine
real(kind=dp), parameter, public e_gfactor
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
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.
Define the quickstep kind type and their sub types.
g tensor calculation by dfpt Initialization of the epr_env, creation of the special neighbor lists Pe...
subroutine, public epr_env_cleanup(epr_env)
Deallocate the epr environment.
subroutine, public epr_env_init(epr_env, qs_env)
Initialize the epr environment.
Type definitiona for linear response calculations.
subroutine, public deallocate_nablavks_atom_set(nablavks_atom_set)
...
subroutine, public set_epr_env(epr_env, g_free_factor, g_soo_chicorr_factor, g_soo_factor, g_so_factor, g_so_factor_gapw, g_zke_factor, nablavks_set, nablavks_atom_set)
...
subroutine, public init_nablavks_atom_set(nablavks_atom_set, atomic_kind_set, qs_kind_set, nspins)
...
wrapper for the pools of matrixes
Definition and initialisation of the mo data type.
subroutine, public deallocate_rho_atom_set(rho_atom_set)
...
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_set(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
...
subroutine, public qs_rho_create(rho)
Allocates a new instance of rho.
subroutine, public qs_rho_clear(rho_struct)
Deallocates all components, without deallocating rho_struct itself.
parameters that control an scf iteration