62#include "./base/base_uses.f90"
70 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'ex_property_calculation'
87 CHARACTER(LEN=*),
PARAMETER :: routinen =
'ex_properties'
89 CHARACTER(LEN=8),
DIMENSION(3) :: rlab
90 CHARACTER(LEN=default_path_length) :: filename
91 CHARACTER(LEN=default_string_length) :: description
92 INTEGER :: akind, handle, i, ia, iatom, idir, &
93 ikind, iounit, ispin, maxmom, natom, &
94 nspins, reference, unit_nr
95 LOGICAL :: magnetic, periodic, tb
96 REAL(kind=
dp) :: charge, dd, q, tmp
97 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: mcharge
98 REAL(kind=
dp),
DIMENSION(3) :: cdip, pdip, pedip, rcc, rdip, ria, tdip
99 REAL(kind=
dp),
DIMENSION(:),
POINTER :: ref_point
104 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_p, matrix_s, moments
110 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
114 CALL timeset(routinen, handle)
120 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control)
121 tb = (dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb)
124 IF (logger%para_env%is_source())
THEN
131 subsection_name=
"DFT%PRINT%MOMENTS")
136 keyword_name=
"DFT%PRINT%MOMENTS%MAX_MOMENT")
138 keyword_name=
"DFT%PRINT%MOMENTS%PERIODIC")
140 keyword_name=
"DFT%PRINT%MOMENTS%REFERENCE")
142 keyword_name=
"DFT%PRINT%MOMENTS%MAGNETIC")
146 print_key_path=
"DFT%PRINT%MOMENTS", extension=
".dat", &
147 middle_name=
"moments", log_filename=.false.)
150 IF (unit_nr /= iounit .AND. unit_nr > 0)
THEN
151 INQUIRE (unit=unit_nr, name=filename)
152 WRITE (unit=iounit, fmt=
"(/,T2,A,2(/,T3,A),/)") &
153 "MOMENTS",
"The electric/magnetic moments are written to file:", &
156 WRITE (unit=iounit, fmt=
"(/,T2,A)")
"ELECTRIC/MAGNETIC MOMENTS"
161 cpabort(
"Periodic moments not implemented with TDDFT")
164 cpassert(.NOT. magnetic)
165 IF (maxmom == 1)
THEN
166 CALL get_qs_env(qs_env=qs_env, cell=cell, para_env=para_env)
171 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set, &
172 qs_kind_set=qs_kind_set, local_particles=local_particles)
173 DO ikind = 1,
SIZE(local_particles%n_el)
174 DO ia = 1, local_particles%n_el(ikind)
175 iatom = local_particles%list(ikind)%array(ia)
177 ria =
pbc(particle_set(iatom)%r - rcc, cell) + rcc
179 atomic_kind => particle_set(iatom)%atomic_kind
181 CALL get_qs_kind(qs_kind_set(akind), core_charge=charge)
182 cdip(1:3) = cdip(1:3) - charge*ria(1:3)
185 CALL para_env%sum(cdip)
188 CALL get_qs_env(qs_env=qs_env, rho=rho, matrix_s=matrix_s)
190 nspins =
SIZE(matrix_p, 1)
192 ALLOCATE (matrix_pall)
193 CALL dbcsr_create(matrix_pall, template=matrix_s(1)%matrix)
194 CALL dbcsr_copy(matrix_pall, matrix_s(1)%matrix,
"Moments")
197 CALL dbcsr_add(matrix_pall, matrix_p(ispin)%matrix, 1.0_dp, 1.0_dp)
198 CALL dbcsr_add(matrix_pall, matrix_pe(ispin)%matrix, 1.0_dp, 1.0_dp)
199 CALL dbcsr_add(matrix_pall, p_env%p1(ispin)%matrix, 1.0_dp, 1.0_dp)
203 ALLOCATE (mcharge(natom))
210 DO i = 1,
SIZE(particle_set)
211 ria =
pbc(particle_set(i)%r - rcc, cell) + rcc
217 DEALLOCATE (matrix_pall)
224 ALLOCATE (moments(i)%matrix)
225 CALL dbcsr_copy(moments(i)%matrix, matrix_s(1)%matrix,
"Moments")
226 CALL dbcsr_set(moments(i)%matrix, 0.0_dp)
235 CALL dbcsr_dot(matrix_pe(ispin)%matrix, moments(idir)%matrix, tmp)
236 pedip(idir) = pedip(idir) + tmp
237 CALL dbcsr_dot(matrix_p(ispin)%matrix, moments(idir)%matrix, tmp)
238 pdip(idir) = pdip(idir) + tmp
239 CALL dbcsr_dot(p_env%p1(ispin)%matrix, moments(idir)%matrix, tmp)
240 rdip(idir) = rdip(idir) + tmp
246 tdip = -(rdip + pedip + pdip + cdip)
248 IF (unit_nr > 0)
THEN
249 WRITE (unit_nr,
"(T3,A)")
"Dipoles are based on the traditional operator."
250 dd = sqrt(sum(tdip(1:3)**2))*
debye
251 WRITE (unit_nr,
"(T3,A)")
"Dipole moment [Debye]"
252 WRITE (unit_nr,
"(T5,3(A,A,F14.8,1X),T60,A,T67,F14.8)") &
253 (trim(rlab(i)),
"=", tdip(i)*
debye, i=1, 3),
"Total=", dd
254 WRITE (unit_nr, fmt=
"(T2,A,T61,E20.12)")
' DIPOLE : CheckSum =', sum(abs(tdip))
259 CALL get_qs_env(qs_env=qs_env, results=results)
260 description =
"[DIPOLE]"
262 CALL put_results(results=results, description=description, values=tdip(1:3))
265 basis_section=qs_env%input, print_key_path=
"DFT%PRINT%MOMENTS")
268 CALL timestop(handle)
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
subroutine, public dbcsr_dot(matrix_a, matrix_b, trace)
Computes the dot product of two matrices, also known as the trace of their matrix product.
DBCSR operations in CP2K.
various routines to log and control the output. The idea is that decisions about where to log should ...
recursive integer function, public cp_logger_get_default_unit_nr(logger, local, skip_not_ionode)
asks the default unit number of the given logger. try to use cp_logger_get_unit_nr
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...
set of type/routines to handle the storage of results in force_envs
subroutine, public cp_results_erase(results, description, nval)
erase a part of result_list
set of type/routines to handle the storage of results in force_envs
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
Routines for property calculations of excited states.
subroutine, public ex_properties(qs_env, matrix_pe, p_env)
...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Interface to the message passing library MPI.
Calculates the moment integrals <a|r^m|b>
subroutine, public get_reference_point(rpoint, drpoint, qs_env, fist_env, reference, ref_point, ifirst, ilast)
...
compute mulliken charges we (currently) define them as c_i = 1/2 [ (PS)_{ii} + (SP)_{ii} ]
Define the data structure for the particle information.
Definition of physical constants:
real(kind=dp), parameter, public debye
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.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
Calculates the moment integrals <a|r^m|b> and <a|r x d/dr|b>
subroutine, public build_local_moment_matrix(qs_env, moments, nmoments, ref_point, ref_points, basis_type)
...
basis types for the calculation of the perturbation of density theory.
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_get(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)
returns info about the density described by this object. If some representation is not available an e...
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
contains arbitrary information which need to be stored
structure to store local (to a processor) ordered lists of integers.
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
Represent a qs system that is perturbed. Can calculate the linear operator and the rhs of the system ...
keeps the density in various representations, keeping track of which ones are valid.