(git:b76ce4e)
Loading...
Searching...
No Matches
localized_moments.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Routines for the calculation of moments from Wannier functions
10!> \author Lukas Schreder
11! **************************************************************************************************
13
16 USE bibliography, ONLY: schreder2021,&
18 cite_reference
19 USE cell_types, ONLY: cell_type,&
20 pbc
22 USE cp_cfm_types, ONLY: cp_cfm_create,&
28 USE cp_dbcsr_api, ONLY: &
32 dbcsr_type_antisymmetric, dbcsr_type_symmetric
40 USE cp_fm_types, ONLY: cp_fm_create,&
53 USE kinds, ONLY: default_string_length,&
54 dp
61 indco
65 USE qs_kind_types, ONLY: get_qs_kind,&
77 USE qs_rho_types, ONLY: qs_rho_get,&
79#include "./base/base_uses.f90"
80
81 IMPLICIT NONE
82
83 PRIVATE
84
85! *** public subroutines ***
86
87 PUBLIC :: calculate_kg_moments, &
89
90! *** body ***
91
92CONTAINS
93
94! **************************************************************************************************
95!> \brief Calculates localized multipole moments per molecule in the Wannier MO basis
96!> \param qs_env ...
97!> \param qs_loc_env ...
98!> \param mo_local ...
99!> \param max_moment ...
100!> \param magnetic ...
101!> \param vel_reprs ...
102!> \param com_nl ...
103!> \param loc_print_section ...
104! **************************************************************************************************
105 SUBROUTINE calculate_localized_moments(qs_env, qs_loc_env, mo_local, max_moment, magnetic, &
106 vel_reprs, com_nl, loc_print_section)
107 TYPE(qs_environment_type), POINTER :: qs_env
108 TYPE(qs_loc_env_type), INTENT(IN) :: qs_loc_env
109 TYPE(cp_fm_type), DIMENSION(:), INTENT(IN) :: mo_local
110 INTEGER, INTENT(IN) :: max_moment
111 LOGICAL, INTENT(IN) :: magnetic, vel_reprs, com_nl
112 TYPE(section_vals_type), POINTER :: loc_print_section
113
114 CHARACTER(LEN=*), PARAMETER :: routinen = 'calculate_localized_moments'
115
116 CHARACTER(LEN=8), ALLOCATABLE, DIMENSION(:) :: rlab
117 CHARACTER(LEN=default_string_length) :: mol_name
118 INTEGER :: akind, first_atom, handle, i, iatom, idir, imo_im, imo_re, imol, iounit, iproc, &
119 ispin, ix, iy, iz, l, last_atom, nao, natom, nm, nmols, nmom, ns, nspins, order, &
120 rmom_vel_size
121 INTEGER, ALLOCATABLE, DIMENSION(:) :: states
122 INTEGER, DIMENSION(2) :: nstates
123 LOGICAL :: do_rtp, floating, ghost
124 REAL(dp) :: charge, dd, im_part, re_part, zwfc
125 REAL(dp), ALLOCATABLE, DIMENSION(:) :: mmom, nlcom_rrv, nlcom_rrv_vrr, &
126 nlcom_rv, nlcom_rvr, nlcom_rxrv, &
127 qupole_der, rmom_vel
128 REAL(dp), ALLOCATABLE, DIMENSION(:, :) :: rmom
129 REAL(dp), DIMENSION(3) :: rcc, ria
130 REAL(dp), DIMENSION(:), POINTER :: ref_point
131 TYPE(atomic_kind_type), POINTER :: atomic_kind
132 TYPE(cell_type), POINTER :: cell
133 TYPE(cp_cfm_type) :: ov_cfm, v_cfm, vov_cfm
134 TYPE(cp_fm_struct_type), POINTER :: o_struct, v_struct, vov_struct
135 TYPE(cp_fm_type) :: or_fm, vi_fm, vr_fm
136 TYPE(cp_logger_type), POINTER :: logger
137 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: magmom, matrix_s, moments, momentum
138 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: moments_der
139 TYPE(dft_control_type), POINTER :: dft_control
140 TYPE(molecule_kind_type), POINTER :: molecule_kind
141 TYPE(molecule_type), POINTER :: molecule_set(:)
142 TYPE(mp_para_env_type), POINTER :: para_env
143 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
144 POINTER :: sab_orb
145 TYPE(particle_type), POINTER :: particle_set(:)
146 TYPE(qs_kind_type), POINTER :: qs_kind_set(:)
147
148 CALL timeset(routinen, handle)
149
150 CALL cite_reference(schreder2021)
151 IF (max_moment > 1 .OR. magnetic .OR. vel_reprs .OR. com_nl) THEN
152 CALL cite_reference(schreder2024_1)
153 END IF
154
155 logger => cp_get_default_logger()
156
157 NULLIFY (cell, dft_control, matrix_s, molecule_set, qs_kind_set, sab_orb)
158 CALL get_qs_env(qs_env, &
159 cell=cell, &
160 dft_control=dft_control, &
161 matrix_s=matrix_s, &
162 molecule_set=molecule_set, &
163 qs_kind_set=qs_kind_set, &
164 sab_orb=sab_orb)
165 particle_set => qs_loc_env%particle_set
166 para_env => qs_loc_env%para_env
167
168 nspins = dft_control%nspins
169 zwfc = 3.0_dp - real(nspins, kind=dp)
170 ! mo_local is sized nspins for SCF and 2*nspins for RTP (real, imag interleaved per spin)
171 do_rtp = qs_env%run_rtp .OR. (SIZE(mo_local) == 2*nspins)
172
173 nmom = min(max_moment, current_maxl)
174 ! number of independent multipole components for orders 1..nmom
175 nm = (6 + 11*nmom + 6*nmom**2 + nmom**3)/6 - 1
176 nmols = SIZE(molecule_set)
177
178 iounit = cp_print_key_unit_nr(logger, loc_print_section, "LOCALIZED_MOMENTS", &
179 extension=".LocMom", middle_name="LOCALIZED_MOMENTS")
180
181 ALLOCATE (rmom(nm + 1, 3), rlab(nm + 1))
182 IF (magnetic) ALLOCATE (mmom(3))
183 IF (vel_reprs) THEN
184 IF (com_nl .AND. (nmom >= 2)) THEN
185 rmom_vel_size = 21
186 ELSE
187 rmom_vel_size = max(nm, 9)
188 END IF
189 ALLOCATE (rmom_vel(rmom_vel_size))
190 END IF
191
192 DO imol = 1, nmols
193 molecule_kind => molecule_set(imol)%molecule_kind
194 first_atom = molecule_set(imol)%first_atom
195 last_atom = molecule_set(imol)%last_atom
196 CALL get_molecule_kind(molecule_kind=molecule_kind, natom=natom, name=mol_name)
197 NULLIFY (ref_point)
198 CALL get_reference_point(rcc, qs_env=qs_env, reference=use_mom_ref_com, &
199 ref_point=ref_point, ifirst=first_atom, &
200 ilast=last_atom)
201
202 rmom = 0.0_dp
203 rlab = ""
204
205 NULLIFY (moments)
206 CALL dbcsr_allocate_matrix_set(moments, nm)
207 DO i = 1, nm
208 ALLOCATE (moments(i)%matrix)
209 IF (vel_reprs .AND. (nmom >= 2)) THEN
210 CALL dbcsr_create(moments(i)%matrix, template=matrix_s(1)%matrix, &
211 matrix_type=dbcsr_type_symmetric)
212 CALL cp_dbcsr_alloc_block_from_nbl(moments(i)%matrix, sab_orb)
213 ELSE
214 CALL dbcsr_copy(moments(i)%matrix, matrix_s(1)%matrix, "Moments")
215 END IF
216 CALL dbcsr_set(moments(i)%matrix, 0.0_dp)
217 END DO
218 IF (vel_reprs .AND. (nmom >= 2)) THEN
219 NULLIFY (moments_der)
220 CALL dbcsr_allocate_matrix_set(moments_der, 3, 3)
221 DO i = 1, 3
222 DO idir = 1, 3
223 CALL dbcsr_init_p(moments_der(i, idir)%matrix)
224 CALL dbcsr_create(moments_der(i, idir)%matrix, template=matrix_s(1)%matrix, &
225 matrix_type=dbcsr_type_antisymmetric)
226 CALL cp_dbcsr_alloc_block_from_nbl(moments_der(i, idir)%matrix, sab_orb)
227 CALL dbcsr_set(moments_der(i, idir)%matrix, 0.0_dp)
228 END DO
229 END DO
230 CALL build_local_moments_der_matrix(qs_env, moments_der, 1, 2, ref_point=rcc, &
231 moments=moments)
232 ELSE
233 CALL build_local_moment_matrix(qs_env, moments, nmom, ref_point=rcc)
234 END IF
235
236 IF (magnetic) THEN
237 NULLIFY (magmom)
238 CALL dbcsr_allocate_matrix_set(magmom, 3)
239 DO i = 1, 3
240 CALL dbcsr_init_p(magmom(i)%matrix)
241 CALL dbcsr_create(magmom(i)%matrix, template=matrix_s(1)%matrix, &
242 matrix_type=dbcsr_type_antisymmetric)
243 CALL cp_dbcsr_alloc_block_from_nbl(magmom(i)%matrix, sab_orb)
244 CALL dbcsr_set(magmom(i)%matrix, 0.0_dp)
245 END DO
246 CALL build_local_magmom_matrix(qs_env, magmom, nmom, ref_point=rcc)
247 mmom = 0.0_dp
248 END IF
249
250 IF (vel_reprs) THEN
251 NULLIFY (momentum)
252 CALL dbcsr_allocate_matrix_set(momentum, 3)
253 DO i = 1, 3
254 CALL dbcsr_init_p(momentum(i)%matrix)
255 CALL dbcsr_create(momentum(i)%matrix, template=matrix_s(1)%matrix, &
256 matrix_type=dbcsr_type_antisymmetric)
257 CALL cp_dbcsr_alloc_block_from_nbl(momentum(i)%matrix, sab_orb)
258 CALL dbcsr_set(momentum(i)%matrix, 0.0_dp)
259 END DO
260 CALL build_lin_mom_matrix(qs_env, momentum)
261 rmom_vel = 0.0_dp
262 END IF
263
264 CALL cp_fm_get_info(mo_local(1), nrow_global=nao)
265 CALL cp_fm_struct_create(o_struct, nrow_global=nao, ncol_global=nao, &
266 template_fmstruct=mo_local(1)%matrix_struct)
267 CALL cp_fm_create(or_fm, o_struct)
268
269 DO ispin = 1, nspins
270 IF (ASSOCIATED(molecule_set(imol)%lmi)) THEN
271 nstates(1) = molecule_set(imol)%lmi(ispin)%nstates
272 ELSE
273 nstates(1) = 0
274 END IF
275 nstates(2) = para_env%mepos
276 CALL para_env%maxloc(nstates)
277 IF (nstates(1) == 0) cycle
278 ns = nstates(1)
279 iproc = nstates(2)
280 ALLOCATE (states(ns))
281 IF (iproc == para_env%mepos) THEN
282 states(:) = molecule_set(imol)%lmi(ispin)%states(:)
283 ELSE
284 states(:) = 0
285 END IF
286 CALL para_env%bcast(states, iproc)
287
288 IF (do_rtp) THEN
289 imo_re = 2*ispin - 1
290 imo_im = 2*ispin
291 ELSE
292 imo_re = ispin
293 imo_im = 0
294 END IF
295
296 CALL cp_fm_struct_create(v_struct, nrow_global=nao, ncol_global=ns, &
297 template_fmstruct=mo_local(imo_re)%matrix_struct)
298 CALL cp_fm_struct_create(vov_struct, nrow_global=ns, ncol_global=ns, &
299 template_fmstruct=mo_local(imo_re)%matrix_struct)
300 CALL cp_fm_create(vr_fm, v_struct, name="vr")
301 CALL cp_fm_set_all(vr_fm, 0.0_dp)
302 IF (do_rtp) THEN
303 CALL cp_fm_create(vi_fm, v_struct, name="vi")
304 CALL cp_fm_set_all(vi_fm, 0.0_dp)
305 END IF
306 CALL cp_cfm_create(v_cfm, v_struct, name="v")
307 CALL cp_cfm_create(ov_cfm, v_struct, name="ov")
308 CALL cp_cfm_create(vov_cfm, vov_struct, name="vov")
309 CALL cp_fm_struct_release(v_struct)
310 CALL cp_fm_struct_release(vov_struct)
311
312 DO i = 1, ns
313 CALL cp_fm_to_fm(mo_local(imo_re), vr_fm, 1, states(i), i)
314 IF (do_rtp) THEN
315 CALL cp_fm_to_fm(mo_local(imo_im), vi_fm, 1, states(i), i)
316 END IF
317 END DO
318 IF (do_rtp) THEN
319 CALL cp_fm_to_cfm(vr_fm, vi_fm, v_cfm)
320 CALL cp_fm_release(vi_fm)
321 ELSE
322 CALL cp_fm_to_cfm(vr_fm, mtarget=v_cfm)
323 END IF
324 CALL cp_fm_release(vr_fm)
325
326 DO i = 1, nm
327 CALL trace_op_in_mo(moments(i)%matrix, or_fm, v_cfm, ov_cfm, vov_cfm, &
328 o_struct, ns, nao, re_part, im_part)
329 rmom(i + 1, 1) = rmom(i + 1, 1) + zwfc*re_part
330 END DO
331 rmom(1, 1) = rmom(1, 1) + zwfc*real(ns, kind=dp)
332
333 IF (magnetic) THEN
334 DO i = 1, 3
335 CALL trace_op_in_mo(magmom(i)%matrix, or_fm, v_cfm, ov_cfm, vov_cfm, &
336 o_struct, ns, nao, re_part, im_part)
337 mmom(i) = mmom(i) - zwfc*im_part
338 END DO
339 END IF
340
341 IF (vel_reprs) THEN
342 DO order = 1, nmom
343 SELECT CASE (order)
344 CASE (1)
345 DO i = 1, 3
346 CALL trace_op_in_mo(momentum(i)%matrix, or_fm, v_cfm, ov_cfm, vov_cfm, &
347 o_struct, ns, nao, re_part, im_part)
348 rmom_vel(i) = rmom_vel(i) - zwfc*im_part
349 END DO
350 CASE (2)
351 ALLOCATE (qupole_der(9))
352 qupole_der = 0.0_dp
353 DO i = 1, 3
354 DO idir = 1, 3
355 CALL trace_op_in_mo(moments_der(i, idir)%matrix, or_fm, v_cfm, ov_cfm, &
356 vov_cfm, o_struct, ns, nao, re_part, im_part)
357 qupole_der((i - 1)*3 + idir) = &
358 qupole_der((i - 1)*3 + idir) + zwfc*(re_part - im_part)
359 END DO
360 END DO
361 rmom_vel(4) = -2.0_dp*qupole_der(1) - rmom(1, 1)
362 rmom_vel(5) = -qupole_der(2) - qupole_der(4)
363 rmom_vel(6) = -qupole_der(3) - qupole_der(7)
364 rmom_vel(7) = -2.0_dp*qupole_der(5) - rmom(1, 1)
365 rmom_vel(8) = -qupole_der(6) - qupole_der(8)
366 rmom_vel(9) = -2.0_dp*qupole_der(9) - rmom(1, 1)
367 DEALLOCATE (qupole_der)
368 END SELECT
369 END DO
370 END IF
371
372 CALL cp_cfm_release(v_cfm)
373 CALL cp_cfm_release(ov_cfm)
374 CALL cp_cfm_release(vov_cfm)
375 DEALLOCATE (states)
376 END DO
377
378 CALL cp_fm_release(or_fm)
379 CALL cp_fm_struct_release(o_struct)
380
381 CALL para_env%sum(rmom(:, 1))
382 IF (magnetic) CALL para_env%sum(mmom)
383 IF (vel_reprs) CALL para_env%sum(rmom_vel)
384
385 DO iatom = first_atom, first_atom + natom - 1
386 ria = pbc(particle_set(iatom)%r - rcc, cell) + rcc
387 ria = ria - rcc
388 atomic_kind => particle_set(iatom)%atomic_kind
389 CALL get_atomic_kind(atomic_kind, kind_number=akind)
390 CALL get_qs_kind(qs_kind_set(akind), ghost=ghost, floating=floating, &
391 core_charge=charge)
392 IF (ghost .OR. floating) cycle
393 rmom(1, 2) = rmom(1, 2) - charge
394 DO l = 1, nm
395 ix = indco(1, l + 1)
396 iy = indco(2, l + 1)
397 iz = indco(3, l + 1)
398 dd = 1.0_dp
399 IF (ix > 0) dd = dd*ria(1)**ix
400 IF (iy > 0) dd = dd*ria(2)**iy
401 IF (iz > 0) dd = dd*ria(3)**iz
402 rmom(l + 1, 2) = rmom(l + 1, 2) - charge*dd
403 CALL set_label(rlab(l + 1), ix, iy, iz)
404 END DO
405 END DO
406 rmom(:, :) = -rmom(:, :)
407 rmom(:, 3) = rmom(:, 1) + rmom(:, 2)
408
409 IF (com_nl) THEN
410 IF ((nmom >= 1) .AND. vel_reprs) THEN
411 ALLOCATE (nlcom_rv(3))
412 nlcom_rv(:) = 0.0_dp
413 END IF
414 IF ((nmom >= 2) .AND. vel_reprs) THEN
415 ALLOCATE (nlcom_rrv(6), nlcom_rvr(6), nlcom_rrv_vrr(6))
416 nlcom_rrv(:) = 0.0_dp
417 nlcom_rvr(:) = 0.0_dp
418 nlcom_rrv_vrr(:) = 0.0_dp
419 END IF
420 IF (magnetic) THEN
421 ALLOCATE (nlcom_rxrv(3))
422 nlcom_rxrv(:) = 0.0_dp
423 END IF
424 CALL calculate_commutator_nl_terms(qs_env, nlcom_rv, nlcom_rxrv, nlcom_rrv, &
425 nlcom_rvr, nlcom_rrv_vrr, rcc)
426 END IF
427
428 IF (iounit > 0) THEN
429 WRITE (unit=iounit, fmt='(/,T3,A,I6,2X,A)') &
430 "# Molecule:", imol, trim(mol_name)
431 IF (magnetic .AND. vel_reprs) THEN
432 CALL print_moments(iounit, nmom, rmom, rlab, rcc, cell, periodic=.false., &
433 mmom=mmom, rmom_vel=rmom_vel)
434 ELSE IF (magnetic) THEN
435 CALL print_moments(iounit, nmom, rmom, rlab, rcc, cell, periodic=.false., &
436 mmom=mmom)
437 ELSE IF (vel_reprs) THEN
438 CALL print_moments(iounit, nmom, rmom, rlab, rcc, cell, periodic=.false., &
439 rmom_vel=rmom_vel)
440 ELSE
441 CALL print_moments(iounit, nmom, rmom, rlab, rcc, cell, periodic=.false.)
442 END IF
443
444 IF (com_nl) THEN
445 IF (magnetic) mmom(:) = nlcom_rxrv(:)
446 IF (vel_reprs .AND. (nmom >= 1)) rmom_vel(1:3) = nlcom_rv
447 IF (vel_reprs .AND. (nmom >= 2)) THEN
448 rmom_vel(4:9) = nlcom_rrv
449 rmom_vel(10:15) = nlcom_rvr
450 rmom_vel(16:21) = nlcom_rrv_vrr
451 END IF
452 IF (magnetic .AND. vel_reprs) THEN
453 CALL print_moments_nl(iounit, nmom, rlab, mmom=mmom, rmom_vel=rmom_vel)
454 ELSE IF (magnetic) THEN
455 CALL print_moments_nl(iounit, nmom, rlab, mmom=mmom)
456 ELSE IF (vel_reprs) THEN
457 CALL print_moments_nl(iounit, nmom, rlab, rmom_vel=rmom_vel)
458 END IF
459 END IF
460 END IF
461
462 IF (com_nl) THEN
463 IF ((nmom >= 1) .AND. vel_reprs) DEALLOCATE (nlcom_rv)
464 IF ((nmom >= 2) .AND. vel_reprs) DEALLOCATE (nlcom_rrv, nlcom_rvr, nlcom_rrv_vrr)
465 IF (magnetic) DEALLOCATE (nlcom_rxrv)
466 END IF
467 CALL dbcsr_deallocate_matrix_set(moments)
468 IF (vel_reprs .AND. (nmom >= 2)) CALL dbcsr_deallocate_matrix_set(moments_der)
469 IF (magnetic) CALL dbcsr_deallocate_matrix_set(magmom)
470 IF (vel_reprs) CALL dbcsr_deallocate_matrix_set(momentum)
471 END DO
472
473 DEALLOCATE (rmom, rlab)
474 IF (magnetic) DEALLOCATE (mmom)
475 IF (vel_reprs) DEALLOCATE (rmom_vel)
476
477 CALL cp_print_key_finished_output(iounit, logger, loc_print_section, "LOCALIZED_MOMENTS")
478
479 CALL timestop(handle)
480
481 END SUBROUTINE calculate_localized_moments
482
483! **************************************************************************************************
484!> \brief Trace a real dbcsr operator against a complex MO matrix
485!> \param op_dbcsr ...
486!> \param or_fm ...
487!> \param v_cfm ...
488!> \param ov_cfm ...
489!> \param vov_cfm ...
490!> \param o_struct ...
491!> \param ns ...
492!> \param nao ...
493!> \param re_sum ...
494!> \param im_sum ...
495! **************************************************************************************************
496 SUBROUTINE trace_op_in_mo(op_dbcsr, or_fm, v_cfm, ov_cfm, vov_cfm, o_struct, ns, nao, &
497 re_sum, im_sum)
498 TYPE(dbcsr_type), POINTER :: op_dbcsr
499 TYPE(cp_fm_type), INTENT(INOUT) :: or_fm
500 TYPE(cp_cfm_type), INTENT(IN) :: v_cfm
501 TYPE(cp_cfm_type), INTENT(INOUT) :: ov_cfm, vov_cfm
502 TYPE(cp_fm_struct_type), POINTER :: o_struct
503 INTEGER, INTENT(IN) :: ns, nao
504 REAL(dp), INTENT(OUT) :: re_sum, im_sum
505
506 COMPLEX(dp) :: di
507 INTEGER :: j
508 TYPE(cp_cfm_type) :: o_cfm
509
510 CALL copy_dbcsr_to_fm(op_dbcsr, or_fm)
511 CALL cp_cfm_create(o_cfm, o_struct)
512 CALL cp_fm_to_cfm(or_fm, mtarget=o_cfm)
513 CALL cp_cfm_gemm("N", "N", nao, ns, nao, (1._dp, 0._dp), o_cfm, v_cfm, &
514 (0._dp, 0._dp), ov_cfm)
515 CALL cp_cfm_gemm("C", "N", ns, ns, nao, (1._dp, 0._dp), v_cfm, ov_cfm, &
516 (0._dp, 0._dp), vov_cfm)
517 re_sum = 0.0_dp
518 im_sum = 0.0_dp
519 DO j = 1, ns
520 CALL cp_cfm_get_element(vov_cfm, j, j, di)
521 re_sum = re_sum + real(di, kind=dp)
522 im_sum = im_sum + aimag(di)
523 END DO
524 CALL cp_cfm_release(o_cfm)
525
526 END SUBROUTINE trace_op_in_mo
527
528! **************************************************************************************************
529!> \brief Calculates multipole moments per molecule from the Kim-Gordon AO density matrix
530!> \param qs_env ...
531!> \param unit_nr output unit (the open DFT%PRINT%MOMENTS unit from the caller)
532!> \param max_moment ...
533!> \param magnetic ...
534!> \param vel_reprs ...
535!> \param com_nl ...
536! **************************************************************************************************
537 SUBROUTINE calculate_kg_moments(qs_env, unit_nr, max_moment, magnetic, vel_reprs, com_nl)
538 TYPE(qs_environment_type), POINTER :: qs_env
539 INTEGER, INTENT(IN) :: unit_nr, max_moment
540 LOGICAL, INTENT(IN) :: magnetic, vel_reprs, com_nl
541
542 CHARACTER(LEN=*), PARAMETER :: routinen = 'calculate_kg_moments'
543
544 CHARACTER(LEN=8), ALLOCATABLE, DIMENSION(:) :: rlab
545 CHARACTER(LEN=default_string_length) :: mol_name
546 INTEGER :: akind, first_atom, handle, i, iatom, &
547 idir, imol, ispin, ix, iy, iz, jatom, &
548 l, last_atom, natom, nm, nmol, nmom, &
549 nspins, rmom_vel_size
550 INTEGER, DIMENSION(:), POINTER :: atom_to_molecule
551 LOGICAL :: do_rtp, floating, found, ghost
552 REAL(dp) :: charge, dd, factor
553 REAL(dp), ALLOCATABLE, DIMENSION(:) :: mmom, nlcom_rrv, nlcom_rrv_vrr, &
554 nlcom_rv, nlcom_rvr, nlcom_rxrv, &
555 qupole_der, rmom_vel
556 REAL(dp), ALLOCATABLE, DIMENSION(:, :) :: rmom
557 REAL(dp), DIMENSION(3) :: rcc, ria
558 REAL(dp), DIMENSION(:), POINTER :: ref_point
559 REAL(dp), DIMENSION(:, :), POINTER :: oblock, pblock, sblock
560 TYPE(atomic_kind_type), POINTER :: atomic_kind
561 TYPE(cell_type), POINTER :: cell
562 TYPE(dbcsr_iterator_type) :: iter
563 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: magmom, matrix_s, moments, momentum, &
564 rho_ao, rho_ao_im
565 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: moments_der
566 TYPE(dft_control_type), POINTER :: dft_control
567 TYPE(kg_environment_type), POINTER :: kg_env
568 TYPE(molecule_kind_type), POINTER :: molecule_kind
569 TYPE(molecule_type), POINTER :: molecule_set(:)
570 TYPE(mp_para_env_type), POINTER :: para_env
571 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
572 POINTER :: sab_orb
573 TYPE(particle_type), POINTER :: particle_set(:)
574 TYPE(qs_kind_type), POINTER :: qs_kind_set(:)
575 TYPE(qs_rho_type), POINTER :: rho
576
577 CALL timeset(routinen, handle)
578
579 CALL cite_reference(schreder2021)
580 IF (max_moment > 1 .OR. magnetic .OR. vel_reprs .OR. com_nl) THEN
581 CALL cite_reference(schreder2024_1)
582 END IF
583
584 NULLIFY (cell, dft_control, kg_env, matrix_s, para_env, particle_set, &
585 qs_kind_set, rho, sab_orb)
586 CALL get_qs_env(qs_env, &
587 cell=cell, &
588 dft_control=dft_control, &
589 kg_env=kg_env, &
590 matrix_s=matrix_s, &
591 para_env=para_env, &
592 particle_set=particle_set, &
593 qs_kind_set=qs_kind_set, &
594 rho=rho, &
595 sab_orb=sab_orb)
596
597 cpassert(ASSOCIATED(kg_env))
598 molecule_set => kg_env%molecule_set
599 atom_to_molecule => kg_env%atom_to_molecule
600
601 nspins = dft_control%nspins
602 do_rtp = qs_env%run_rtp
603
604 nmom = min(max_moment, current_maxl)
605 nm = (6 + 11*nmom + 6*nmom**2 + nmom**3)/6 - 1
606 nmol = SIZE(molecule_set)
607
608 NULLIFY (rho_ao, rho_ao_im)
609 CALL qs_rho_get(rho, rho_ao=rho_ao)
610 IF (do_rtp) CALL qs_rho_get(rho, rho_ao_im=rho_ao_im)
611
612 ALLOCATE (rmom(nm + 1, 3), rlab(nm + 1))
613 IF (magnetic) ALLOCATE (mmom(3))
614 IF (vel_reprs) THEN
615 IF (com_nl .AND. (nmom >= 2)) THEN
616 rmom_vel_size = 21
617 ELSE
618 rmom_vel_size = max(nm, 9)
619 END IF
620 ALLOCATE (rmom_vel(rmom_vel_size))
621 END IF
622
623 DO imol = 1, nmol
624 molecule_kind => molecule_set(imol)%molecule_kind
625 first_atom = molecule_set(imol)%first_atom
626 last_atom = molecule_set(imol)%last_atom
627 CALL get_molecule_kind(molecule_kind=molecule_kind, natom=natom, name=mol_name)
628 NULLIFY (ref_point)
629 CALL get_reference_point(rcc, qs_env=qs_env, reference=use_mom_ref_com, &
630 ref_point=ref_point, ifirst=first_atom, ilast=last_atom)
631
632 rmom = 0.0_dp
633 rlab = ""
634
635 NULLIFY (moments)
636 CALL dbcsr_allocate_matrix_set(moments, nm)
637 DO i = 1, nm
638 ALLOCATE (moments(i)%matrix)
639 IF (vel_reprs .AND. (nmom >= 2)) THEN
640 CALL dbcsr_create(moments(i)%matrix, template=matrix_s(1)%matrix, &
641 matrix_type=dbcsr_type_symmetric)
642 CALL cp_dbcsr_alloc_block_from_nbl(moments(i)%matrix, sab_orb)
643 ELSE
644 CALL dbcsr_copy(moments(i)%matrix, matrix_s(1)%matrix, "Moments")
645 END IF
646 CALL dbcsr_set(moments(i)%matrix, 0.0_dp)
647 END DO
648 IF (vel_reprs .AND. (nmom >= 2)) THEN
649 NULLIFY (moments_der)
650 CALL dbcsr_allocate_matrix_set(moments_der, 3, 3)
651 DO i = 1, 3
652 DO idir = 1, 3
653 CALL dbcsr_init_p(moments_der(i, idir)%matrix)
654 CALL dbcsr_create(moments_der(i, idir)%matrix, template=matrix_s(1)%matrix, &
655 matrix_type=dbcsr_type_antisymmetric)
656 CALL cp_dbcsr_alloc_block_from_nbl(moments_der(i, idir)%matrix, sab_orb)
657 CALL dbcsr_set(moments_der(i, idir)%matrix, 0.0_dp)
658 END DO
659 END DO
660 CALL build_local_moments_der_matrix(qs_env, moments_der, 1, 2, ref_point=rcc, &
661 moments=moments)
662 ELSE
663 CALL build_local_moment_matrix(qs_env, moments, nmom, ref_point=rcc)
664 END IF
665
666 IF (magnetic) THEN
667 NULLIFY (magmom)
668 CALL dbcsr_allocate_matrix_set(magmom, 3)
669 DO i = 1, 3
670 CALL dbcsr_init_p(magmom(i)%matrix)
671 CALL dbcsr_create(magmom(i)%matrix, template=matrix_s(1)%matrix, &
672 matrix_type=dbcsr_type_antisymmetric)
673 CALL cp_dbcsr_alloc_block_from_nbl(magmom(i)%matrix, sab_orb)
674 CALL dbcsr_set(magmom(i)%matrix, 0.0_dp)
675 END DO
676 CALL build_local_magmom_matrix(qs_env, magmom, nmom, ref_point=rcc)
677 mmom = 0.0_dp
678 END IF
679
680 IF (vel_reprs) THEN
681 NULLIFY (momentum)
682 CALL dbcsr_allocate_matrix_set(momentum, 3)
683 DO i = 1, 3
684 CALL dbcsr_init_p(momentum(i)%matrix)
685 CALL dbcsr_create(momentum(i)%matrix, template=matrix_s(1)%matrix, &
686 matrix_type=dbcsr_type_antisymmetric)
687 CALL cp_dbcsr_alloc_block_from_nbl(momentum(i)%matrix, sab_orb)
688 CALL dbcsr_set(momentum(i)%matrix, 0.0_dp)
689 END DO
690 CALL build_lin_mom_matrix(qs_env, momentum)
691 rmom_vel = 0.0_dp
692 END IF
693
694 IF (vel_reprs .AND. (nmom >= 2)) THEN
695 ALLOCATE (qupole_der(9))
696 qupole_der = 0.0_dp
697 END IF
698
699 DO ispin = 1, nspins
700 CALL dbcsr_iterator_readonly_start(iter, rho_ao(ispin)%matrix)
701 DO WHILE (dbcsr_iterator_blocks_left(iter))
702 CALL dbcsr_iterator_next_block(iter, iatom, jatom, pblock)
703 IF (SIZE(pblock) == 0) cycle
704 IF (atom_to_molecule(iatom) /= imol) cycle
705 IF (atom_to_molecule(jatom) /= imol) cycle
706 factor = merge(2.0_dp, 1.0_dp, iatom /= jatom)
707 CALL dbcsr_get_readonly_block_p(matrix_s(1)%matrix, iatom, jatom, sblock, found)
708 IF (found) rmom(1, 1) = rmom(1, 1) + factor*sum(pblock*sblock)
709 DO i = 1, nm
710 CALL dbcsr_get_readonly_block_p(moments(i)%matrix, iatom, jatom, oblock, found)
711 IF (found) rmom(i + 1, 1) = rmom(i + 1, 1) + factor*sum(pblock*oblock)
712 END DO
713 END DO
714 CALL dbcsr_iterator_stop(iter)
715
716 IF (do_rtp .AND. (magnetic .OR. vel_reprs)) THEN
717 CALL dbcsr_iterator_readonly_start(iter, rho_ao_im(ispin)%matrix)
718 DO WHILE (dbcsr_iterator_blocks_left(iter))
719 CALL dbcsr_iterator_next_block(iter, iatom, jatom, pblock)
720 IF (SIZE(pblock) == 0) cycle
721 IF (atom_to_molecule(iatom) /= imol) cycle
722 IF (atom_to_molecule(jatom) /= imol) cycle
723 factor = merge(2.0_dp, 1.0_dp, iatom /= jatom)
724 IF (magnetic) THEN
725 DO i = 1, 3
726 CALL dbcsr_get_readonly_block_p(magmom(i)%matrix, iatom, jatom, oblock, found)
727 IF (found) mmom(i) = mmom(i) + factor*sum(pblock*oblock)
728 END DO
729 END IF
730 IF (vel_reprs) THEN
731 DO i = 1, 3
732 CALL dbcsr_get_readonly_block_p(momentum(i)%matrix, iatom, jatom, oblock, found)
733 IF (found) rmom_vel(i) = rmom_vel(i) + factor*sum(pblock*oblock)
734 END DO
735 IF (nmom >= 2) THEN
736 DO i = 1, 3
737 DO idir = 1, 3
738 CALL dbcsr_get_readonly_block_p(moments_der(i, idir)%matrix, &
739 iatom, jatom, oblock, found)
740 IF (found) &
741 qupole_der((i - 1)*3 + idir) = &
742 qupole_der((i - 1)*3 + idir) - factor*sum(pblock*oblock)
743 END DO
744 END DO
745 END IF
746 END IF
747 END DO
748 CALL dbcsr_iterator_stop(iter)
749 END IF
750 END DO
751
752 IF (vel_reprs .AND. (nmom >= 2)) THEN
753 rmom_vel(4) = -2.0_dp*qupole_der(1) - rmom(1, 1)
754 rmom_vel(5) = -qupole_der(2) - qupole_der(4)
755 rmom_vel(6) = -qupole_der(3) - qupole_der(7)
756 rmom_vel(7) = -2.0_dp*qupole_der(5) - rmom(1, 1)
757 rmom_vel(8) = -qupole_der(6) - qupole_der(8)
758 rmom_vel(9) = -2.0_dp*qupole_der(9) - rmom(1, 1)
759 DEALLOCATE (qupole_der)
760 END IF
761
762 CALL para_env%sum(rmom(:, 1))
763 IF (magnetic) CALL para_env%sum(mmom)
764 IF (vel_reprs) CALL para_env%sum(rmom_vel)
765
766 DO iatom = first_atom, first_atom + natom - 1
767 ria = pbc(particle_set(iatom)%r - rcc, cell) + rcc
768 ria = ria - rcc
769 atomic_kind => particle_set(iatom)%atomic_kind
770 CALL get_atomic_kind(atomic_kind, kind_number=akind)
771 CALL get_qs_kind(qs_kind_set(akind), ghost=ghost, floating=floating, &
772 core_charge=charge)
773 IF (ghost .OR. floating) cycle
774 rmom(1, 2) = rmom(1, 2) - charge
775 DO l = 1, nm
776 ix = indco(1, l + 1)
777 iy = indco(2, l + 1)
778 iz = indco(3, l + 1)
779 dd = 1.0_dp
780 IF (ix > 0) dd = dd*ria(1)**ix
781 IF (iy > 0) dd = dd*ria(2)**iy
782 IF (iz > 0) dd = dd*ria(3)**iz
783 rmom(l + 1, 2) = rmom(l + 1, 2) - charge*dd
784 CALL set_label(rlab(l + 1), ix, iy, iz)
785 END DO
786 END DO
787 rmom(:, :) = -rmom(:, :)
788 rmom(:, 3) = rmom(:, 1) + rmom(:, 2)
789
790 IF (com_nl) THEN
791 IF ((nmom >= 1) .AND. vel_reprs) THEN
792 ALLOCATE (nlcom_rv(3))
793 nlcom_rv(:) = 0.0_dp
794 END IF
795 IF ((nmom >= 2) .AND. vel_reprs) THEN
796 ALLOCATE (nlcom_rrv(6), nlcom_rvr(6), nlcom_rrv_vrr(6))
797 nlcom_rrv(:) = 0.0_dp
798 nlcom_rvr(:) = 0.0_dp
799 nlcom_rrv_vrr(:) = 0.0_dp
800 END IF
801 IF (magnetic) THEN
802 ALLOCATE (nlcom_rxrv(3))
803 nlcom_rxrv(:) = 0.0_dp
804 END IF
805 CALL calculate_commutator_nl_terms(qs_env, nlcom_rv, nlcom_rxrv, nlcom_rrv, &
806 nlcom_rvr, nlcom_rrv_vrr, rcc)
807 END IF
808
809 IF (unit_nr > 0) THEN
810 WRITE (unit=unit_nr, fmt='(/,T3,A,I6,2X,A)') &
811 "# Molecule:", imol, trim(mol_name)
812 IF (magnetic .AND. vel_reprs) THEN
813 CALL print_moments(unit_nr, nmom, rmom, rlab, rcc, cell, periodic=.false., &
814 mmom=mmom, rmom_vel=rmom_vel)
815 ELSE IF (magnetic) THEN
816 CALL print_moments(unit_nr, nmom, rmom, rlab, rcc, cell, periodic=.false., &
817 mmom=mmom)
818 ELSE IF (vel_reprs) THEN
819 CALL print_moments(unit_nr, nmom, rmom, rlab, rcc, cell, periodic=.false., &
820 rmom_vel=rmom_vel)
821 ELSE
822 CALL print_moments(unit_nr, nmom, rmom, rlab, rcc, cell, periodic=.false.)
823 END IF
824
825 IF (com_nl) THEN
826 IF (magnetic) mmom(:) = nlcom_rxrv(:)
827 IF (vel_reprs .AND. (nmom >= 1)) rmom_vel(1:3) = nlcom_rv
828 IF (vel_reprs .AND. (nmom >= 2)) THEN
829 rmom_vel(4:9) = nlcom_rrv
830 rmom_vel(10:15) = nlcom_rvr
831 rmom_vel(16:21) = nlcom_rrv_vrr
832 END IF
833 IF (magnetic .AND. vel_reprs) THEN
834 CALL print_moments_nl(unit_nr, nmom, rlab, mmom=mmom, rmom_vel=rmom_vel)
835 ELSE IF (magnetic) THEN
836 CALL print_moments_nl(unit_nr, nmom, rlab, mmom=mmom)
837 ELSE IF (vel_reprs) THEN
838 CALL print_moments_nl(unit_nr, nmom, rlab, rmom_vel=rmom_vel)
839 END IF
840 END IF
841 END IF
842
843 IF (com_nl) THEN
844 IF ((nmom >= 1) .AND. vel_reprs) DEALLOCATE (nlcom_rv)
845 IF ((nmom >= 2) .AND. vel_reprs) DEALLOCATE (nlcom_rrv, nlcom_rvr, nlcom_rrv_vrr)
846 IF (magnetic) DEALLOCATE (nlcom_rxrv)
847 END IF
848 CALL dbcsr_deallocate_matrix_set(moments)
849 IF (vel_reprs .AND. (nmom >= 2)) CALL dbcsr_deallocate_matrix_set(moments_der)
850 IF (magnetic) CALL dbcsr_deallocate_matrix_set(magmom)
851 IF (vel_reprs) CALL dbcsr_deallocate_matrix_set(momentum)
852 END DO
853
854 DEALLOCATE (rmom, rlab)
855 IF (magnetic) DEALLOCATE (mmom)
856 IF (vel_reprs) DEALLOCATE (rmom_vel)
857
858 CALL timestop(handle)
859
860 END SUBROUTINE calculate_kg_moments
861
862END MODULE localized_moments
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.
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public schreder2024_1
integer, save, public schreder2021
Handles all functions related to the CELL.
Definition cell_types.F:15
Basic linear algebra operations for complex full matrices.
subroutine, public cp_cfm_gemm(transa, transb, m, n, k, alpha, matrix_a, matrix_b, beta, matrix_c, a_first_col, a_first_row, b_first_col, b_first_row, c_first_col, c_first_row)
Performs one of the matrix-matrix operations: matrix_c = alpha * op1( matrix_a ) * op2( matrix_b ) + ...
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_get_element(matrix, irow_global, icol_global, alpha)
Get the matrix element by its global index.
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
subroutine, public cp_fm_to_cfm(msourcer, msourcei, mtarget)
Construct a complex full matrix by taking its real and imaginary parts from two separate real-value f...
subroutine, public cp_cfm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
Creates a new full matrix with the given structure.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_get_readonly_block_p(matrix, row, col, block, found, row_size, col_size)
Like dbcsr_get_block_p() but with matrix being INTENT(IN). When invoking this routine,...
logical function, public dbcsr_iterator_blocks_left(iterator)
...
subroutine, public dbcsr_iterator_stop(iterator)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_init_p(matrix)
...
subroutine, public dbcsr_iterator_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset, transposed)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_iterator_readonly_start(iterator, matrix, shared, dynamic, dynamic_byrows)
Like dbcsr_iterator_start() but with matrix being INTENT(IN). When invoking this routine,...
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
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_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_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
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 ...
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,...
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public use_mom_ref_com
objects that represent the structure of input sections and the data contained in an input section
Types needed for a Kim-Gordon-like partitioning into molecular subunits.
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
Routines for the calculation of moments from Wannier functions.
subroutine, public calculate_kg_moments(qs_env, unit_nr, max_moment, magnetic, vel_reprs, com_nl)
Calculates multipole moments per molecule from the Kim-Gordon AO density matrix.
subroutine, public calculate_localized_moments(qs_env, qs_loc_env, mo_local, max_moment, magnetic, vel_reprs, com_nl, loc_print_section)
Calculates localized multipole moments per molecule in the Wannier MO basis.
Interface to the message passing library MPI.
Define the molecule kind structure types and the corresponding functionality.
subroutine, public get_molecule_kind(molecule_kind, atom_list, bond_list, bend_list, ub_list, impr_list, opbend_list, colv_list, fixd_list, g3x3_list, g4x6_list, vsite_list, torsion_list, shell_list, name, mass, charge, kind_number, natom, nbend, nbond, nub, nimpr, nopbend, nconstraint, nconstraint_fixd, nfixd, ncolv, ng3x3, ng4x6, nvsite, nfixd_restraint, ng3x3_restraint, ng4x6_restraint, nvsite_restraint, nrestraints, nmolecule, nsgf, nshell, ntorsion, molecule_list, nelectron, nelectron_alpha, nelectron_beta, bond_kind_set, bend_kind_set, ub_kind_set, impr_kind_set, opbend_kind_set, torsion_kind_set, molname_generated)
Get informations about a molecule kind.
Define the data structure for the molecule information.
Calculates the moment integrals <a|r^m|b>
subroutine, public get_reference_point(rpoint, drpoint, qs_env, fist_env, reference, ref_point, ifirst, ilast)
...
Provides Cartesian and spherical orbital pointers and indices.
integer, save, public current_maxl
integer, dimension(:, :), allocatable, public indco
Define the data structure for the particle information.
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, mimic, 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, sab_cneo, 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, xcint_weights, 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, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_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, do_rixs, tb_tblite)
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, cneo_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, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
New version of the module for the localization of the molecular orbitals This should be able to use d...
Calculates the moment integrals <a|r^m|b> and <a|r x d/dr|b>
Definition qs_moments.F:14
subroutine, public build_local_magmom_matrix(qs_env, magmom, nmoments, ref_point, ref_points, basis_type)
...
subroutine, public print_moments_nl(unit_number, nmom, rlab, mmom, rmom_vel)
...
subroutine, public set_label(label, ix, iy, iz)
...
subroutine, public build_local_moment_matrix(qs_env, moments, nmoments, ref_point, ref_points, basis_type)
...
Definition qs_moments.F:593
subroutine, public print_moments(unit_number, nmom, rmom, rlab, rcc, cell, periodic, mmom, rmom_vel)
...
subroutine, public build_local_moments_der_matrix(qs_env, moments_der, nmoments_der, nmoments, ref_point, moments)
Calculate right-hand sided derivatives of multipole moments, e. g. < a | xy d/dz | b > Optionally sto...
Definition qs_moments.F:825
subroutine, public calculate_commutator_nl_terms(qs_env, nlcom_rv, nlcom_rxrv, nlcom_rrv, nlcom_rvr, nlcom_rrv_vrr, ref_point)
Calculate the expectation value of operators related to non-local potential: [r, Vnl],...
Define the neighbor list data types and the corresponding functionality.
subroutine, public build_lin_mom_matrix(qs_env, matrix)
Calculation of the linear momentum matrix <mu|∂|nu> over Cartesian Gaussian functions.
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.
Definition cell_types.F:60
Represent a complex full matrix.
keeps the information about the structure of a full matrix
represent 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 all the info needed for KG runs...
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
contains all the info needed by quickstep to calculate the spread of a selected set of orbitals and i...
keeps the density in various representations, keeping track of which ones are valid.