71#include "./base/base_uses.f90"
77 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_tddfpt2_fprint'
101 gs_mos, kernel_env, sub_env, work_matrices)
103 TYPE(
cp_fm_type),
DIMENSION(:, :),
INTENT(in) :: evects
104 REAL(kind=
dp),
DIMENSION(:),
INTENT(in) :: evals, ostrength
112 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tddfpt_print_forces'
113 LOGICAL,
PARAMETER :: debug_forces = .false.
115 INTEGER :: handle, iounit, is, ispin, istate, iw, &
116 iwunit, kstate, natom, nspins, nstates
117 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: alist, natom_of_kind, state_list
118 REAL(kind=
dp) :: eener, threshold
125 TYPE(
qs_force_type),
DIMENSION(:),
POINTER :: gs_force, ks_force, td_force
129 CALL timeset(routinen, handle)
137 IF (sub_env%is_split)
THEN
138 CALL cp_abort(__location__,
"Excited state forces not possible when states"// &
139 " are distributed to different CPU pools.")
142 nspins =
SIZE(evects, 1)
143 nstates =
SIZE(evects, 2)
145 WRITE (iounit,
"(1X,A)")
"", &
146 "-------------------------------------------------------------------------------", &
147 "- TDDFPT PROPERTIES: Nuclear Forces -", &
148 "-------------------------------------------------------------------------------"
153 ALLOCATE (state_list(nstates))
154 CALL build_state_list(force_section, state_list)
158 DO istate = 1, nstates
159 IF (ostrength(istate) < threshold) state_list(istate) = 0
162 WRITE (iounit,
"(1X,A,T61,E20.8)")
" Screening threshold for oscillator strength ", threshold
163 ALLOCATE (alist(nstates))
165 DO istate = 1, nstates
166 IF (state_list(istate) == 1)
THEN
171 WRITE (iounit,
"(1X,A,T71,I10)")
" List of states requested for force calculation ", is
172 WRITE (iounit,
"(16I5)") alist(1:is)
176 extension=
".tdfrc", file_status=
'REPLACE')
179 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, natom=natom)
181 NULLIFY (td_force, gs_force)
185 CALL gs_forces(qs_env, gs_force)
190 CALL get_qs_env(qs_env, exstate_env=ex_env, para_env=para_env)
191 kstate = ex_env%state
192 eener = ex_env%evalue
194 DO istate = 1, nstates
195 IF (state_list(istate) == 1)
THEN
197 WRITE (iounit,
"(1X,A,I3,T30,F10.5,A,T50,A,T71,F10.7)")
" STATE NR. ", istate, &
198 evals(istate)*
evolt,
" eV",
"Oscillator strength:", ostrength(istate)
201 WRITE (iwunit,
"(1X,A,I3,T30,F10.5,A,T50,A,T71,F10.7)")
" # STATE NR. ", istate, &
202 evals(istate)*
evolt,
" eV",
"Oscillator strength:", ostrength(istate)
204 ex_env%state = istate
205 ex_env%evalue = evals(istate)
207 ALLOCATE (ex_env%evect(nspins))
209 CALL cp_fm_get_info(matrix=evects(ispin, 1), matrix_struct=matrix_struct)
211 CALL cp_fm_to_fm(evects(ispin, istate), ex_env%evect(ispin))
218 IF (debug_forces)
THEN
225 CALL get_qs_env(qs_env, dft_control=dft_control)
226 IF (dft_control%qs_control%semi_empirical)
THEN
227 cpabort(
"Not available")
228 ELSEIF (dft_control%qs_control%dftb)
THEN
229 cpabort(
"Not available")
230 ELSEIF (dft_control%qs_control%xtb)
THEN
234 vxc_rspace=ex_env%vxc_rspace, vtau_rspace=ex_env%vtau_rspace, &
235 vadmm_rspace=ex_env%vadmm_rspace, matrix_hz=ex_env%matrix_hz, &
236 matrix_pz=ex_env%matrix_px1, matrix_pz_admm=p_env%p1_admm, &
237 matrix_wz=p_env%w1, p_env=p_env, ex_env=ex_env, debug=debug_forces)
243 CALL pforce(iwunit, td_force, atomic_kind_set, natom)
247 WRITE (iwunit,
"(1X,A,I3,T30,F10.5,A,T50,A,T71,F10.7)")
" # STATE NR. ", istate, &
248 evals(istate)*
evolt,
" eV",
"Oscillator strength:", ostrength(istate)
255 DEALLOCATE (state_list)
257 ex_env%state = kstate
258 ex_env%evalue = eener
263 WRITE (iounit,
"(1X,A)") &
264 "-------------------------------------------------------------------------------"
269 CALL timestop(handle)
281 SUBROUTINE gs_forces(qs_env, gs_force)
286 CHARACTER(len=*),
PARAMETER :: routinen =
'gs_forces'
289 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_w_b, matrix_w_kp
296 CALL timeset(routinen, handle)
304 CALL get_qs_env(qs_env, dft_control=dft_control)
305 cpassert(.NOT. dft_control%qs_control%cdft)
306 cpassert(.NOT. qs_env%run_rtp)
307 cpassert(.NOT. dft_control%qs_control%mulliken_restraint)
308 cpassert(.NOT. dft_control%dft_plus_u)
309 cpassert(.NOT. qs_env%energy_correction)
310 IF (
ASSOCIATED(qs_env%mp2_env))
THEN
311 cpabort(
"TDDFPT| MP2 not available")
315 CALL get_qs_env(qs_env=qs_env, matrix_w_kp=matrix_w_b)
316 NULLIFY (matrix_w_kp)
318 CALL set_ks_env(ks_env, matrix_w_kp=matrix_w_kp)
321 cpassert(.NOT. dft_control%qs_control%do_ls_scf)
322 cpassert(.NOT. dft_control%qs_control%do_almo_scf)
330 IF (dft_control%qs_control%semi_empirical)
THEN
331 cpabort(
"TDDFPT| SE not available")
332 ELSEIF (dft_control%qs_control%dftb)
THEN
333 cpabort(
"TDDFPT| DFTB not available")
334 ELSEIF (dft_control%qs_control%xtb)
THEN
343 IF (.NOT. dft_control%qs_control%gapw)
THEN
346 IF (dft_control%qs_control%rigpw)
THEN
347 CALL get_qs_env(qs_env=qs_env, lri_env=lri_env)
355 CALL get_qs_env(qs_env=qs_env, force=gs_force)
361 CALL get_qs_env(qs_env=qs_env, matrix_w_kp=matrix_w_kp)
363 NULLIFY (matrix_w_kp)
365 CALL set_ks_env(ks_env, matrix_w_kp=matrix_w_b)
367 CALL timestop(handle)
369 END SUBROUTINE gs_forces
376 SUBROUTINE build_state_list(section, state_list)
379 INTEGER,
DIMENSION(:),
INTENT(OUT) :: state_list
381 INTEGER :: i, is, k, n_rep, nstate
382 INTEGER,
DIMENSION(:),
POINTER :: indexes
385 nstate =
SIZE(state_list)
392 DO is = 1,
SIZE(indexes)
394 IF (k <= 0 .OR. k > nstate)
THEN
395 CALL cp_warn(__location__,
"State List contains invalid state.")
396 cpabort(
"TDDFPT Print Forces: Invalid State")
405 END SUBROUTINE build_state_list
414 SUBROUTINE pforce(iwunit, td_force, atomic_kind_set, natom)
415 INTEGER,
INTENT(IN) :: iwunit
418 INTEGER,
INTENT(IN) :: natom
421 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: force
423 ALLOCATE (force(3, natom))
427 WRITE (iwunit, *) natom
430 WRITE (iwunit,
"(3F24.14)") - force(1:3, iatom)
435 END SUBROUTINE pforce
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
represent the structure of a full matrix
represent a full matrix distributed on many processors
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
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,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
all routins needed for a nonperiodic electric field
subroutine, public calculate_ecore_efield(qs_env, calculate_forces)
Computes the force and the energy due to a efield on the cores Note: In the velocity gauge,...
Types for excited states potential energies.
Defines the basic variable types.
integer, parameter, public dp
contains the types and subroutines for dealing with the lri_env lri : local resolution of the identit...
Interface to the message passing library MPI.
Definition of physical constants:
real(kind=dp), parameter, public evolt
Calculation of the energies concerning the core charge distribution.
subroutine, public calculate_ecore_overlap(qs_env, para_env, calculate_forces, molecular, e_overlap_core, atecc)
Calculate the overlap energy of the core charge distribution.
subroutine, public calculate_ecore_self(qs_env, e_self_core, atecc)
Calculate the self energy of the core charge distribution.
Calculation of the core Hamiltonian integral matrix <a|H|b> over Cartesian Gaussian-type functions.
subroutine, public build_core_hamiltonian_matrix(qs_env, calculate_forces)
Cosntruction of the QS Core Hamiltonian Matrix.
Utility subroutine for qs energy calculation.
subroutine, public qs_energies_init(qs_env, calc_forces)
Refactoring of qs_energies_scf. Driver routine for the initial setup and calculations for a qs energy...
qs_environment methods that use many other modules
subroutine, public qs_env_rebuild_pw_env(qs_env)
rebuilds the pw_env in the given qs_env, allocating it if necessary
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, 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, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs)
Get the QUICKSTEP environment.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, harris_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, wanniercentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs)
Set the QUICKSTEP environment.
Routines to handle an external electrostatic field The external field can be generic and is provided ...
subroutine, public external_c_potential(qs_env, calculate_forces)
Computes the force and the energy due to the external potential on the cores.
subroutine, public external_e_potential(qs_env)
Computes the external potential on the grid.
subroutine, public sum_qs_force(qs_force_out, qs_force_in)
Sum up two qs_force entities qs_force_out = qs_force_out + qs_force_in.
subroutine, public replicate_qs_force(qs_force, para_env)
Replicate and sum up the force.
subroutine, public deallocate_qs_force(qs_force)
Deallocate a Quickstep force data structure.
subroutine, public zero_qs_force(qs_force)
Initialize a Quickstep force data structure.
subroutine, public allocate_qs_force(qs_force, natom_of_kind)
Allocate a Quickstep force data structure.
subroutine, public total_qs_force(force, qs_force, atomic_kind_set)
Get current total force.
routines that build the Kohn-Sham matrix (i.e calculate the coulomb and xc parts
subroutine, public qs_ks_build_kohn_sham_matrix(qs_env, calculate_forces, just_energy, print_active, ext_ks_matrix)
routine where the real calculations are made: the KS matrix is calculated
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
Utility subroutine for qs energy calculation.
subroutine, public compute_matrix_w(qs_env, calc_forces)
Refactoring of qs_energies_scf. Moves computation of matrix_w into separate subroutine.
basis types for the calculation of the perturbation of density theory.
subroutine, public p_env_release(p_env)
relases the given p_env (see doc/ReferenceCounting.html)
Routines for the Quickstep SCF run.
subroutine, public scf(qs_env, has_converged, total_scf_steps)
perform an scf procedure in the given qs_env
subroutine, public tddfpt_forces_main(qs_env, gs_mos, ex_env, kernel_env, sub_env, work_matrices)
Perform TDDFPT gradient calculation.
subroutine, public tddfpt_print_forces(qs_env, evects, evals, ostrength, print_section, gs_mos, kernel_env, sub_env, work_matrices)
Calculate and print forces of selected excited states.
Calculate the CPKS equation and the resulting forces.
subroutine, public response_force_xtb(qs_env, p_env, matrix_hz, ex_env, debug)
...
subroutine, public response_force(qs_env, vh_rspace, vxc_rspace, vtau_rspace, vadmm_rspace, matrix_hz, matrix_pz, matrix_pz_admm, matrix_wz, zehartree, zexc, zexc_aux_fit, rhopz_r, p_env, ex_env, debug)
...
subroutine, public response_equation(qs_env, p_env, cpmos, iounit, lr_section)
Initializes vectors for MO-coefficient based linear response solver and calculates response density,...
Calculates integral matrices for RIGPW method.
subroutine, public build_ri_matrices(lri_env, qs_env, calculate_forces)
creates and initializes an lri_env
Calculation of KS matrix in xTB Reference: Stefan Grimme, Christoph Bannwarth, Philip Shushkov JCTC 1...
subroutine, public build_xtb_ks_matrix(qs_env, calculate_forces, just_energy, ext_ks_matrix)
...
Calculation of Overlap and Hamiltonian matrices in xTB Reference: Stefan Grimme, Christoph Bannwarth,...
subroutine, public build_xtb_matrices(qs_env, calculate_forces)
...
Provides all information about an atomic kind.
keeps the information about the structure of a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
Contains information on the excited states energy.
stores all the informations relevant to an mpi environment
Type to hold environments for the different kernels.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
Represent a qs system that is perturbed. Can calculate the linear operator and the rhs of the system ...
Parallel (sub)group environment.
Ground state molecular orbitals.
Set of temporary ("work") matrices.