25 USE dbcsr_api,
ONLY: dbcsr_add,&
51 neighbor_list_iterator_p_type,&
53 neighbor_list_set_p_type
63 #include "./base/base_uses.f90"
74 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_mfp'
76 REAL(dp),
DIMENSION(3, 3, 3),
PARAMETER :: Levi_Civita = reshape((/ &
77 0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, -1.0_dp, 0.0_dp, 1.0_dp, 0.0_dp, &
78 0.0_dp, 0.0_dp, 1.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, -1.0_dp, 0.0_dp, 0.0_dp, &
79 0.0_dp, -1.0_dp, 0.0_dp, 1.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp/), &
90 TYPE(vcd_env_type) :: vcd_env
91 TYPE(qs_environment_type),
POINTER :: qs_env
93 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mfp_aat'
94 INTEGER,
PARAMETER :: ispin = 1
95 REAL(dp),
DIMENSION(3),
PARAMETER :: gauge_origin = 0._dp
96 REAL(dp),
PARAMETER :: f_spin = 2._dp
98 INTEGER :: alpha, delta,
gamma, handle, ikind, nao, &
101 REAL(dp) :: aat_linmom, aat_moment, aat_moment_der, &
102 aat_overlap, aat_tmp, charge, lc_tmp, &
104 TYPE(cp_fm_type) :: buf, buf2, matrix_dsdb_mo
105 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
107 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
108 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
110 CALL timeset(routinen, handle)
113 nmo = vcd_env%dcdr_env%nmo(ispin)
114 nao = vcd_env%dcdr_env%nao
116 associate(mo_coeff => vcd_env%dcdr_env%mo_coeff(ispin), aat_atom => vcd_env%aat_atom_mfp)
120 qs_kind_set=qs_kind_set, &
121 particle_set=particle_set)
124 CALL cp_fm_create(buf, vcd_env%dcdr_env%likemos_fm_struct(ispin)%struct)
125 CALL cp_fm_create(buf2, vcd_env%dcdr_env%likemos_fm_struct(ispin)%struct)
126 CALL cp_fm_create(matrix_dsdb_mo, vcd_env%dcdr_env%momo_fm_struct(ispin)%struct)
134 buf, ncol=nmo, alpha=1._dp, beta=0._dp)
135 CALL parallel_gemm(
"T",
"N", nmo, nmo, nao, &
136 1.0_dp, mo_coeff, buf, &
137 0.0_dp, matrix_dsdb_mo)
139 CALL parallel_gemm(
"N",
"N", nao, nmo, nmo, &
140 -0.5_dp, mo_coeff, matrix_dsdb_mo, &
141 0.0_dp, vcd_env%dCB_prime(alpha))
159 aat_moment_der = 0._dp
163 lc_tmp = levi_civita(alpha,
gamma, delta)
164 IF (lc_tmp == 0._dp) cycle
166 CALL dbcsr_copy(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, &
167 vcd_env%moments_der_right(delta, vcd_env%dcdr_env%beta)%matrix)
169 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
170 gauge_origin=gauge_origin)
173 CALL cp_fm_trace(buf, mo_coeff, tmp_trace)
175 aat_moment_der = aat_moment_der - lc_tmp*tmp_trace
179 aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) &
180 = aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) + aat_moment_der
192 lc_tmp = levi_civita(alpha,
gamma, delta)
193 IF (lc_tmp == 0._dp) cycle
199 mo_coeff, buf, ncol=nmo)
200 CALL cp_fm_trace(buf, mo_coeff, tmp_trace)
201 aat_tmp = aat_tmp + lc_tmp*tmp_trace*vcd_env%magnetic_origin_atom(
gamma)
206 CALL dbcsr_copy(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, vcd_env%dipvel_ao(vcd_env%dcdr_env%beta)%matrix)
208 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false.)
209 CALL hr_mult_by_delta_1d(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, qs_kind_set,
"ORB", &
210 sab_all, direction_or=.true., lambda=vcd_env%dcdr_env%lambda)
213 ncol=nmo, alpha=1._dp, beta=0._dp)
214 CALL cp_fm_trace(buf, mo_coeff, tmp_trace)
215 aat_tmp = aat_tmp - lc_tmp*tmp_trace*vcd_env%spatial_origin_atom(delta)
220 CALL dbcsr_copy(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, vcd_env%dipvel_ao(vcd_env%dcdr_env%beta)%matrix)
221 CALL hr_mult_by_delta_1d(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, qs_kind_set,
"ORB", &
222 sab_all, direction_or=.true., lambda=vcd_env%dcdr_env%lambda)
224 ncol=nmo, alpha=1._dp, beta=0._dp)
225 CALL cp_fm_trace(buf, mo_coeff, tmp_trace)
226 aat_tmp = aat_tmp + lc_tmp*tmp_trace &
227 *vcd_env%spatial_origin_atom(delta)*vcd_env%magnetic_origin_atom(
gamma)
232 aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) &
233 = aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) + aat_tmp
240 CALL dbcsr_desymmetrize(vcd_env%dipvel_ao(vcd_env%dcdr_env%beta)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
241 CALL hr_mult_by_delta_1d(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, qs_kind_set,
"ORB", &
242 sab_all, direction_or=.true., lambda=vcd_env%dcdr_env%lambda)
249 mo_coeff, buf, ncol=nmo, alpha=1._dp, beta=0._dp)
250 CALL cp_fm_trace(buf, vcd_env%dCB(alpha), aat_linmom)
254 aat_linmom = -f_spin*aat_linmom
256 aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) &
257 = aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) + aat_linmom
265 CALL cp_fm_trace(buf, vcd_env%dCB_prime(alpha), aat_linmom)
269 aat_linmom = -f_spin*aat_linmom
271 aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) &
272 = aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) + aat_linmom
278 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(3)%matrix, 0._dp)
282 lc_tmp = levi_civita(alpha,
gamma, delta)
283 IF (lc_tmp == 0._dp) cycle
284 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, 0._dp)
285 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix, 0._dp)
286 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix)
287 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix)
291 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
292 gauge_origin=gauge_origin)
296 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.true., &
297 gauge_origin=gauge_origin)
300 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, &
301 vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix, -1._dp, +1._dp)
304 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp2(3)%matrix, &
305 vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, &
306 1._dp, vcd_env%spatial_origin_atom(delta)*lc_tmp/2._dp)
313 buf, ncol=nmo, alpha=1._dp, beta=0._dp)
314 CALL parallel_gemm(
"T",
"N", nmo, nmo, nao, &
315 1.0_dp, mo_coeff, buf, &
316 0.0_dp, matrix_dsdb_mo)
318 CALL parallel_gemm(
"N",
"N", nao, nmo, nmo, &
319 -0.5_dp, mo_coeff, matrix_dsdb_mo, &
324 CALL cp_fm_trace(buf, buf2, aat_linmom)
326 aat_linmom = -f_spin*aat_linmom
328 aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) &
329 = aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) + aat_linmom
339 lc_tmp = levi_civita(alpha,
gamma, delta)
340 IF (lc_tmp == 0._dp) cycle
342 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%moments(delta)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
344 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
345 gauge_origin=gauge_origin)
348 CALL cp_fm_trace(buf, vcd_env%dcdr_env%dCR_prime(ispin), tmp_trace)
350 aat_moment = aat_moment - lc_tmp*tmp_trace
354 aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) &
355 = aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) + aat_moment
368 lc_tmp = levi_civita(alpha,
gamma, delta)
369 IF (lc_tmp == 0._dp) cycle
372 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%moments(delta)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
374 CALL cp_fm_trace(buf, vcd_env%dcdr_env%dCR_prime(ispin), tmp_trace)
376 aat_moment = aat_moment + lc_tmp*tmp_trace*vcd_env%magnetic_origin_atom(
gamma)
379 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
381 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false.)
383 CALL cp_fm_trace(buf, vcd_env%dcdr_env%dCR_prime(ispin), tmp_trace)
385 aat_moment = aat_moment + lc_tmp*tmp_trace*vcd_env%spatial_origin_atom(delta)
389 CALL cp_fm_trace(buf, vcd_env%dcdr_env%dCR_prime(ispin), tmp_trace)
391 aat_moment = aat_moment + lc_tmp*tmp_trace &
392 *vcd_env%magnetic_origin_atom(
gamma)*vcd_env%spatial_origin_atom(delta)
396 aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) &
397 = aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) + aat_moment
406 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%dCR_prime(ispin), buf, ncol=nmo)
407 CALL cp_fm_trace(buf, vcd_env%dCB(alpha), aat_overlap)
409 aat_overlap = f_spin*aat_overlap
412 aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) &
413 = aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) + aat_overlap
420 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%dCR_prime(ispin), buf, ncol=nmo)
421 CALL cp_fm_trace(buf, vcd_env%dCB_prime(alpha), aat_overlap)
423 aat_overlap = f_spin*aat_overlap
426 aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) &
427 = aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) + aat_overlap
433 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(3)%matrix, 0._dp)
437 lc_tmp = levi_civita(alpha,
gamma, delta)
438 IF (lc_tmp == 0._dp) cycle
439 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, 0._dp)
440 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix, 0._dp)
441 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix)
442 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix)
446 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
447 gauge_origin=gauge_origin)
451 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.true., &
452 gauge_origin=gauge_origin)
456 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, &
457 vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix, -1._dp, +1._dp)
460 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp2(3)%matrix, vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, &
461 1._dp, -vcd_env%spatial_origin_atom(delta)*lc_tmp/2._dp)
468 buf, ncol=nmo, alpha=1._dp, beta=0._dp)
469 CALL parallel_gemm(
"T",
"N", nmo, nmo, nao, &
470 1.0_dp, mo_coeff, buf, &
471 0.0_dp, matrix_dsdb_mo)
473 CALL parallel_gemm(
"N",
"N", nao, nmo, nmo, &
474 -0.5_dp, mo_coeff, matrix_dsdb_mo, &
477 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%dCR_prime(ispin), buf, ncol=nmo)
478 CALL cp_fm_trace(buf, buf2, aat_overlap)
480 aat_overlap = f_spin*aat_overlap
483 aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) &
484 = aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) + aat_overlap
488 CALL get_atomic_kind(particle_set(vcd_env%dcdr_env%lambda)%atomic_kind, kind_number=ikind)
489 CALL get_qs_kind(qs_kind_set(ikind), core_charge=charge, ghost=ghost)
490 IF (.NOT. ghost)
THEN
494 IF (levi_civita(alpha,
gamma, vcd_env%dcdr_env%beta) == 0._dp) cycle
495 aat_tmp = aat_tmp + charge &
496 *levi_civita(alpha,
gamma, vcd_env%dcdr_env%beta) &
497 *(particle_set(vcd_env%dcdr_env%lambda)%r(
gamma) - vcd_env%magnetic_origin_atom(
gamma))
499 aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) &
500 = aat_atom(vcd_env%dcdr_env%beta, alpha, vcd_env%dcdr_env%lambda) + aat_tmp/4.
507 CALL cp_fm_release(buf)
508 CALL cp_fm_release(buf2)
509 CALL cp_fm_release(matrix_dsdb_mo)
511 CALL timestop(handle)
522 TYPE(vcd_env_type) :: vcd_env
523 TYPE(qs_environment_type),
POINTER :: qs_env
526 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mfp_build_operator_gauge_dependent'
527 INTEGER,
PARAMETER :: ispin = 1
529 INTEGER :: delta,
gamma, handle, nao, nmo
530 REAL(dp) :: eps_ppnl, lc_tmp
531 REAL(dp),
DIMENSION(3) :: gauge_origin
532 TYPE(cell_type),
POINTER :: cell
533 TYPE(cp_fm_type) :: buf
534 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks
535 TYPE(dft_control_type),
POINTER :: dft_control
536 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
537 POINTER :: sab_all, sap_ppnl
538 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
539 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
551 CALL timeset(routinen, handle)
554 nmo = vcd_env%dcdr_env%nmo(ispin)
555 nao = vcd_env%dcdr_env%nao
556 associate(mo_coeff => vcd_env%dcdr_env%mo_coeff(ispin))
558 CALL get_qs_env(qs_env=qs_env, &
560 qs_kind_set=qs_kind_set, &
561 particle_set=particle_set, &
564 dft_control=dft_control, &
567 gauge_origin(:) = vcd_env%magnetic_origin_atom
569 eps_ppnl = dft_control%qs_control%eps_ppnl
571 CALL cp_fm_create(buf, vcd_env%dcdr_env%likemos_fm_struct(ispin)%struct)
572 CALL cp_fm_set_all(vcd_env%op_dB(ispin), 0._dp)
573 CALL cp_fm_set_all(buf, 0._dp)
585 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, 0._dp)
588 lc_tmp = levi_civita(alpha,
gamma, delta)
589 IF (lc_tmp == 0._dp) cycle
594 CALL dbcsr_copy(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, vcd_env%matrix_rh(ispin, delta)%matrix)
596 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
597 gauge_origin=gauge_origin)
600 CALL dbcsr_copy(vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, vcd_env%matrix_hr(ispin, delta)%matrix)
602 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.true., &
603 gauge_origin=gauge_origin)
605 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, &
606 vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, 1._dp, -1._dp)
609 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, &
610 vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, 1._dp, lc_tmp/2._dp)
614 CALL dbcsr_copy(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, vcd_env%matrix_rh(ispin, delta)%matrix)
615 CALL dbcsr_copy(vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, vcd_env%matrix_hr(ispin, delta)%matrix)
616 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, &
617 vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, 1._dp, -1._dp)
618 CALL dbcsr_scale(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, -vcd_env%magnetic_origin_atom(
gamma))
621 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, &
622 vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, 1._dp, lc_tmp/2._dp)
626 CALL dbcsr_desymmetrize(matrix_ks(ispin)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
627 CALL dbcsr_desymmetrize(matrix_ks(ispin)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix)
629 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
630 gauge_origin=gauge_origin)
632 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.true., &
633 gauge_origin=gauge_origin)
635 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, &
637 CALL dbcsr_scale(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, -vcd_env%spatial_origin_atom(delta))
639 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, &
640 vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, 1._dp, lc_tmp/2._dp)
645 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, mo_coeff, &
646 vcd_env%op_dB(ispin), ncol=nmo, alpha=1._dp, beta=1.0_dp)
658 CALL dbcsr_set(vcd_env%matrix_nosym_temp_33(
gamma, delta)%matrix, 0._dp)
659 CALL dbcsr_set(vcd_env%matrix_nosym_temp2_33(
gamma, delta)%matrix, 0._dp)
663 CALL build_com_vnl_giao(qs_kind_set=qs_kind_set, sab_all=sab_all, sap_ppnl=sap_ppnl, &
664 eps_ppnl=dft_control%qs_control%eps_ppnl, &
665 particle_set=particle_set, matrix_rv=vcd_env%matrix_nosym_temp_33, &
666 ref_point=[0._dp, 0._dp, 0._dp], cell=cell, direction_or=.true.)
669 CALL build_com_vnl_giao(qs_kind_set=qs_kind_set, sab_all=sab_all, sap_ppnl=sap_ppnl, &
670 eps_ppnl=dft_control%qs_control%eps_ppnl, &
671 particle_set=particle_set, matrix_rv=vcd_env%matrix_nosym_temp2_33, &
672 ref_point=[0._dp, 0._dp, 0._dp], cell=cell, direction_or=.false.)
674 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, 0._dp)
677 lc_tmp = levi_civita(alpha,
gamma, delta)
678 IF (lc_tmp == 0._dp) cycle
681 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, vcd_env%matrix_nosym_temp_33(
gamma, delta)%matrix, &
685 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, vcd_env%matrix_nosym_temp2_33(
gamma, delta)%matrix, &
691 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, mo_coeff, &
692 vcd_env%op_dB(ispin), ncol=nmo, alpha=1._dp/2._dp, beta=1.0_dp)
696 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, 0._dp)
699 lc_tmp = levi_civita(alpha,
gamma, delta)
700 IF (lc_tmp == 0._dp) cycle
703 CALL dbcsr_desymmetrize(vcd_env%hcom(delta)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
704 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, &
705 1._dp, vcd_env%magnetic_origin_atom(
gamma)*lc_tmp/(2._dp))
708 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, mo_coeff, &
709 vcd_env%op_dB(ispin), ncol=nmo, alpha=1.0_dp, beta=1.0_dp)
717 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, 0._dp)
720 lc_tmp = levi_civita(alpha,
gamma, delta)
721 IF (lc_tmp == 0._dp) cycle
724 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, vcd_env%moments_der(
gamma, delta)%matrix, &
725 1._dp, lc_tmp/(2._dp))
729 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, mo_coeff, &
730 vcd_env%op_dB(ispin), ncol=nmo, alpha=1.0_dp, beta=1.0_dp)
735 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, 0._dp)
738 lc_tmp = levi_civita(alpha,
gamma, delta)
739 IF (lc_tmp == 0._dp) cycle
742 CALL dbcsr_desymmetrize(vcd_env%dipvel_ao(delta)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
743 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, &
744 1._dp, vcd_env%magnetic_origin_atom(
gamma)*lc_tmp/(2._dp))
747 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, mo_coeff, &
748 vcd_env%op_dB(ispin), ncol=nmo, alpha=1.0_dp, beta=1.0_dp)
754 CALL dbcsr_set(vcd_env%matrix_dSdB(alpha)%matrix, 0._dp)
758 lc_tmp = levi_civita(alpha,
gamma, delta)
759 IF (lc_tmp == 0._dp) cycle
760 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, 0._dp)
761 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, 0._dp)
762 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%moments(delta)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
763 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%moments(delta)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix)
767 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
768 gauge_origin=gauge_origin)
772 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.true., &
773 gauge_origin=gauge_origin)
775 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, &
776 vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, 1._dp, -1._dp)
779 CALL dbcsr_add(vcd_env%matrix_dSdB(alpha)%matrix, &
780 vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, 1._dp, lc_tmp/2._dp)
785 CALL cp_dbcsr_sm_fm_multiply(vcd_env%matrix_dSdB(alpha)%matrix, mo_coeff, &
786 buf, ncol=nmo, alpha=1.0_dp, beta=0.0_dp)
787 CALL parallel_gemm(
'N',
'N', nao, nmo, nmo, &
788 -1.0_dp, buf, vcd_env%dcdr_env%chc(ispin), &
789 1.0_dp, vcd_env%op_dB(ispin))
792 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(3)%matrix, 0._dp)
795 lc_tmp = levi_civita(alpha,
gamma, delta)
796 IF (lc_tmp == 0._dp) cycle
797 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, 0._dp)
798 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix, 0._dp)
799 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix)
800 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix)
804 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
805 gauge_origin=gauge_origin)
809 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.true., &
810 gauge_origin=gauge_origin)
814 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, &
815 vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix, -1._dp, +1._dp)
818 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp2(3)%matrix, vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, &
819 1._dp, vcd_env%spatial_origin_atom(delta)*lc_tmp/2._dp)
823 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_nosym_temp2(3)%matrix, mo_coeff, &
824 buf, ncol=nmo, alpha=1.0_dp, beta=0.0_dp)
825 CALL parallel_gemm(
'N',
'N', nao, nmo, nmo, &
826 -1.0_dp, buf, vcd_env%dcdr_env%chc(ispin), &
827 1.0_dp, vcd_env%op_dB(ispin))
830 CALL cp_fm_release(buf)
837 CALL timestop(handle)
848 TYPE(vcd_env_type) :: vcd_env
849 TYPE(qs_environment_type),
POINTER :: qs_env
852 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mfp_build_operator_gauge_independent'
853 INTEGER,
PARAMETER :: ispin = 1
855 INTEGER :: delta,
gamma, handle, nao, nmo
856 REAL(dp) :: eps_ppnl, lc_tmp
857 REAL(dp),
DIMENSION(3) :: gauge_origin
858 TYPE(cell_type),
POINTER :: cell
859 TYPE(cp_fm_type) :: buf
860 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks
861 TYPE(dft_control_type),
POINTER :: dft_control
862 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
863 POINTER :: sab_all, sap_ppnl
864 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
865 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
876 CALL timeset(routinen, handle)
879 nmo = vcd_env%dcdr_env%nmo(ispin)
880 nao = vcd_env%dcdr_env%nao
881 associate(mo_coeff => vcd_env%dcdr_env%mo_coeff(ispin))
883 CALL get_qs_env(qs_env=qs_env, &
885 qs_kind_set=qs_kind_set, &
886 particle_set=particle_set, &
889 dft_control=dft_control, &
892 gauge_origin(:) = 0._dp
894 eps_ppnl = dft_control%qs_control%eps_ppnl
896 CALL cp_fm_create(buf, vcd_env%dcdr_env%likemos_fm_struct(ispin)%struct)
897 CALL cp_fm_set_all(vcd_env%op_dB(ispin), 0._dp)
898 CALL cp_fm_set_all(buf, 0._dp)
910 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, 0._dp)
913 lc_tmp = levi_civita(alpha,
gamma, delta)
914 IF (lc_tmp == 0._dp) cycle
918 CALL dbcsr_copy(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, vcd_env%matrix_rh(ispin, delta)%matrix)
920 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
921 gauge_origin=gauge_origin)
924 CALL dbcsr_copy(vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, vcd_env%matrix_rh(ispin, delta)%matrix)
926 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.true., &
927 gauge_origin=gauge_origin)
929 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, &
930 vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, 1._dp, -1._dp)
933 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, &
934 vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, 1._dp, lc_tmp/2._dp)
938 CALL dbcsr_desymmetrize(matrix_ks(ispin)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
939 CALL dbcsr_desymmetrize(matrix_ks(ispin)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix)
941 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
942 gauge_origin=gauge_origin)
944 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.true., &
945 gauge_origin=gauge_origin)
947 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, &
949 CALL dbcsr_scale(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, -vcd_env%spatial_origin_atom(delta))
950 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, &
951 vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, 1._dp, lc_tmp/2._dp)
956 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, mo_coeff, &
957 vcd_env%op_dB(ispin), ncol=nmo, alpha=1._dp, beta=1.0_dp)
969 CALL dbcsr_set(vcd_env%matrix_nosym_temp_33(
gamma, delta)%matrix, 0._dp)
970 CALL dbcsr_set(vcd_env%matrix_nosym_temp2_33(
gamma, delta)%matrix, 0._dp)
974 CALL build_com_vnl_giao(qs_kind_set=qs_kind_set, sab_all=sab_all, sap_ppnl=sap_ppnl, &
975 eps_ppnl=dft_control%qs_control%eps_ppnl, &
976 particle_set=particle_set, matrix_rv=vcd_env%matrix_nosym_temp_33, &
977 ref_point=[0._dp, 0._dp, 0._dp], cell=cell, direction_or=.true.)
980 CALL build_com_vnl_giao(qs_kind_set=qs_kind_set, sab_all=sab_all, sap_ppnl=sap_ppnl, &
981 eps_ppnl=dft_control%qs_control%eps_ppnl, &
982 particle_set=particle_set, matrix_rv=vcd_env%matrix_nosym_temp2_33, &
983 ref_point=[0._dp, 0._dp, 0._dp], cell=cell, direction_or=.false.)
985 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, 0._dp)
988 lc_tmp = levi_civita(alpha,
gamma, delta)
989 IF (lc_tmp == 0._dp) cycle
992 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, &
993 vcd_env%matrix_nosym_temp_33(
gamma, delta)%matrix, &
997 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, &
998 vcd_env%matrix_nosym_temp2_33(
gamma, delta)%matrix, &
1004 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, mo_coeff, &
1005 vcd_env%op_dB(ispin), ncol=nmo, alpha=1._dp/2._dp, beta=1.0_dp)
1013 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, 0._dp)
1016 lc_tmp = levi_civita(alpha,
gamma, delta)
1017 IF (lc_tmp == 0._dp) cycle
1020 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, vcd_env%moments_der(
gamma, delta)%matrix, &
1021 1._dp, lc_tmp/(2._dp))
1025 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, mo_coeff, &
1026 vcd_env%op_dB(ispin), ncol=nmo, alpha=1.0_dp, beta=1.0_dp)
1031 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, 0._dp)
1034 lc_tmp = levi_civita(alpha,
gamma, delta)
1035 IF (lc_tmp == 0._dp) cycle
1038 CALL dbcsr_desymmetrize(vcd_env%dipvel_ao(delta)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
1040 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.true., &
1041 gauge_origin=gauge_origin)
1043 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, &
1044 1._dp, lc_tmp/(2._dp))
1047 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_nosym_temp(3)%matrix, mo_coeff, &
1048 vcd_env%op_dB(ispin), ncol=nmo, alpha=1.0_dp, beta=1.0_dp)
1054 CALL dbcsr_set(vcd_env%matrix_dSdB(alpha)%matrix, 0._dp)
1058 lc_tmp = levi_civita(alpha,
gamma, delta)
1059 IF (lc_tmp == 0._dp) cycle
1060 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, 0._dp)
1061 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, 0._dp)
1062 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%moments(delta)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
1063 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%moments(delta)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix)
1067 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
1068 gauge_origin=gauge_origin)
1072 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.true., &
1073 gauge_origin=gauge_origin)
1076 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, &
1077 vcd_env%dcdr_env%matrix_nosym_temp(2)%matrix, 1._dp, -1._dp)
1080 CALL dbcsr_add(vcd_env%matrix_dSdB(alpha)%matrix, &
1081 vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix, 1._dp, lc_tmp/2._dp)
1086 CALL cp_dbcsr_sm_fm_multiply(vcd_env%matrix_dSdB(alpha)%matrix, mo_coeff, &
1087 buf, ncol=nmo, alpha=1.0_dp, beta=0.0_dp)
1088 CALL parallel_gemm(
'N',
'N', nao, nmo, nmo, &
1089 -1.0_dp, buf, vcd_env%dcdr_env%chc(ispin), &
1090 1.0_dp, vcd_env%op_dB(ispin))
1093 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(3)%matrix, 0._dp)
1096 lc_tmp = levi_civita(alpha,
gamma, delta)
1097 IF (lc_tmp == 0._dp) cycle
1098 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, 0._dp)
1099 CALL dbcsr_set(vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix, 0._dp)
1100 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix)
1101 CALL dbcsr_desymmetrize(vcd_env%dcdr_env%matrix_s(1)%matrix, vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix)
1105 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.false., &
1106 gauge_origin=gauge_origin)
1110 qs_kind_set, particle_set,
"ORB", sab_all,
gamma, basis_function_nu=.true., &
1111 gauge_origin=gauge_origin)
1115 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, &
1116 vcd_env%dcdr_env%matrix_nosym_temp2(2)%matrix, -1._dp, +1._dp)
1119 CALL dbcsr_add(vcd_env%dcdr_env%matrix_nosym_temp2(3)%matrix, vcd_env%dcdr_env%matrix_nosym_temp2(1)%matrix, &
1120 1._dp, vcd_env%spatial_origin_atom(delta)*lc_tmp/2._dp)
1124 CALL cp_dbcsr_sm_fm_multiply(vcd_env%dcdr_env%matrix_nosym_temp2(3)%matrix, mo_coeff, &
1125 buf, ncol=nmo, alpha=1.0_dp, beta=0.0_dp)
1126 CALL parallel_gemm(
'N',
'N', nao, nmo, nmo, &
1127 -1.0_dp, buf, vcd_env%dcdr_env%chc(ispin), &
1128 1.0_dp, vcd_env%op_dB(ispin))
1131 CALL cp_fm_release(buf)
1138 CALL timestop(handle)
1151 TYPE(vcd_env_type) :: vcd_env
1152 TYPE(qs_p_env_type) :: p_env
1153 TYPE(qs_environment_type),
POINTER :: qs_env
1154 INTEGER,
INTENT(IN) :: alpha
1156 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mfp_response'
1158 INTEGER :: handle, output_unit
1159 LOGICAL :: failure, should_stop
1160 TYPE(cp_fm_type),
DIMENSION(1) :: h1_psi0, psi1
1161 TYPE(cp_logger_type),
POINTER :: logger
1162 TYPE(dft_control_type),
POINTER :: dft_control
1163 TYPE(linres_control_type),
POINTER :: linres_control
1164 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
1165 TYPE(section_vals_type),
POINTER :: lr_section, vcd_section
1167 CALL timeset(routinen, handle)
1170 NULLIFY (linres_control, lr_section, logger)
1172 CALL get_qs_env(qs_env=qs_env, &
1173 dft_control=dft_control, &
1174 linres_control=linres_control, &
1177 logger => cp_get_default_logger()
1178 lr_section => section_vals_get_subs_vals(qs_env%input,
"PROPERTIES%LINRES")
1179 vcd_section => section_vals_get_subs_vals(qs_env%input, &
1180 "PROPERTIES%LINRES%VCD")
1182 output_unit = cp_print_key_unit_nr(logger, lr_section,
"PRINT%PROGRAM_RUN_INFO", &
1183 extension=
".linresLog")
1184 IF (output_unit > 0)
THEN
1185 WRITE (unit=output_unit, fmt=
"(T10,A,/)") &
1186 "*** Self consistent optimization of the magnetic response wavefunction ***"
1190 associate(psi0_order => vcd_env%dcdr_env%mo_coeff)
1191 CALL cp_fm_create(psi1(1), vcd_env%dcdr_env%likemos_fm_struct(1)%struct)
1192 CALL cp_fm_create(h1_psi0(1), vcd_env%dcdr_env%likemos_fm_struct(1)%struct)
1195 IF (linres_control%linres_restart)
THEN
1196 CALL vcd_read_restart(qs_env, lr_section, psi1, vcd_env%dcdr_env%lambda, alpha,
"dCdB")
1198 CALL cp_fm_set_all(psi1(1), 0.0_dp)
1201 IF (output_unit > 0)
THEN
1202 WRITE (output_unit, *) &
1203 "Response to the perturbation operator referring to the magnetic field in "//achar(alpha + 119)
1212 CALL cp_fm_set_all(vcd_env%dCB(alpha), 0.0_dp)
1213 CALL cp_fm_set_all(h1_psi0(1), 0.0_dp)
1214 CALL cp_fm_to_fm(vcd_env%op_dB(1), h1_psi0(1))
1216 linres_control%lr_triplet = .false.
1217 linres_control%do_kernel = .false.
1218 linres_control%converged = .false.
1219 CALL linres_solver(p_env, qs_env, psi1, h1_psi0, psi0_order, &
1220 output_unit, should_stop)
1221 CALL cp_fm_to_fm(psi1(1), vcd_env%dCB(alpha))
1224 IF (linres_control%linres_restart)
THEN
1225 CALL vcd_write_restart(qs_env, lr_section, psi1, vcd_env%dcdr_env%lambda, alpha,
"dCdB")
1229 CALL cp_fm_release(psi1(1))
1230 CALL cp_fm_release(h1_psi0(1))
1233 CALL cp_print_key_finished_output(output_unit, logger, lr_section, &
1234 "PRINT%PROGRAM_RUN_INFO")
1236 CALL timestop(handle)
1255 direction, basis_function_nu, gauge_origin)
1257 TYPE(dbcsr_type) :: matrix
1258 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1259 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1260 CHARACTER(LEN=*),
INTENT(IN) :: basis_type
1261 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
1263 INTEGER :: direction
1264 LOGICAL :: basis_function_nu
1265 REAL(dp),
DIMENSION(3),
OPTIONAL :: gauge_origin
1267 CHARACTER(len=*),
PARAMETER :: routinen =
'multiply_by_position'
1269 INTEGER :: handle, iatom, icol, ikind, inode, irow, &
1270 jatom, jkind, last_jatom, mepos, &
1271 nkind, nseta, nsetb, nthread
1272 INTEGER,
DIMENSION(3) :: cell
1273 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
1275 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
1276 LOGICAL :: do_symmetric, found
1277 REAL(kind=dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
1278 REAL(kind=dp),
DIMENSION(:, :),
POINTER :: matrix_block, rpgfa, rpgfb, scon_a, &
1280 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set_list
1281 TYPE(gto_basis_set_type),
POINTER :: basis_set_a, basis_set_b
1282 TYPE(neighbor_list_iterator_p_type), &
1283 DIMENSION(:),
POINTER :: nl_iterator
1285 CALL timeset(routinen, handle)
1288 cpassert(
SIZE(sab_nl) > 0)
1289 CALL get_neighbor_list_set_p(neighbor_list_sets=sab_nl, symmetric=do_symmetric)
1292 nkind =
SIZE(qs_kind_set)
1293 ALLOCATE (basis_set_list(nkind))
1294 CALL basis_set_list_setup(basis_set_list, basis_type, qs_kind_set)
1299 CALL neighbor_list_iterator_create(nl_iterator, sab_nl, nthread=nthread)
1313 DO WHILE (neighbor_list_iterate(nl_iterator, mepos=mepos) == 0)
1314 CALL get_iterator_info(nl_iterator, mepos=mepos, ikind=ikind, jkind=jkind, &
1315 iatom=iatom, jatom=jatom, inode=inode)
1316 basis_set_a => basis_set_list(ikind)%gto_basis_set
1317 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
1318 basis_set_b => basis_set_list(jkind)%gto_basis_set
1319 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
1322 first_sgfa => basis_set_a%first_sgf
1323 la_max => basis_set_a%lmax
1324 la_min => basis_set_a%lmin
1325 npgfa => basis_set_a%npgf
1326 nseta = basis_set_a%nset
1327 nsgfa => basis_set_a%nsgf_set
1328 rpgfa => basis_set_a%pgf_radius
1329 set_radius_a => basis_set_a%set_radius
1330 scon_a => basis_set_a%scon
1331 zeta => basis_set_a%zet
1333 first_sgfb => basis_set_b%first_sgf
1334 lb_max => basis_set_b%lmax
1335 lb_min => basis_set_b%lmin
1336 npgfb => basis_set_b%npgf
1337 nsetb = basis_set_b%nset
1338 nsgfb => basis_set_b%nsgf_set
1339 rpgfb => basis_set_b%pgf_radius
1340 set_radius_b => basis_set_b%set_radius
1341 scon_b => basis_set_b%scon
1342 zetb => basis_set_b%zet
1344 IF (inode == 1) last_jatom = 0
1348 IF (jatom == last_jatom)
THEN
1354 IF (do_symmetric)
THEN
1355 IF (iatom <= jatom)
THEN
1367 NULLIFY (matrix_block)
1368 CALL dbcsr_get_block_p(matrix, irow, icol, matrix_block, found)
1371 IF (
PRESENT(gauge_origin))
THEN
1372 IF (basis_function_nu)
THEN
1374 matrix_block(:, :) = matrix_block(:, :)*(particle_set(jatom)%r(direction) - gauge_origin(direction))
1378 matrix_block(:, :) = matrix_block(:, :)*(particle_set(iatom)%r(direction) - gauge_origin(direction))
1381 ELSE IF (.NOT.
PRESENT(gauge_origin))
THEN
1382 IF (basis_function_nu)
THEN
1384 matrix_block(:, :) = matrix_block(:, :)*particle_set(jatom)%r(direction)
1388 matrix_block(:, :) = matrix_block(:, :)*particle_set(iatom)%r(direction)
1394 CALL neighbor_list_iterator_release(nl_iterator)
1397 DEALLOCATE (basis_set_list)
1399 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.
Calculation of the non-local pseudopotential contribution to the core Hamiltonian <a|V(non-local)|b> ...
subroutine, public build_com_vnl_giao(qs_kind_set, sab_all, sap_ppnl, eps_ppnl, particle_set, matrix_rv, ref_point, cell, direction_Or)
Calculate matrix_rv(gamma, delta) = < R^eta_gamma * Vnl * r_delta > for GIAOs.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
basic linear algebra operations for full matrices
represent a full matrix distributed on many processors
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, 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 ...
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,...
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
Defines the basic variable types.
integer, parameter, public dp
basic linear algebra operations for full matrixes
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, 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.
Some utility functions for the calculation of integrals.
subroutine, public basis_set_list_setup(basis_set_list, basis_type, qs_kind_set)
Set up an easy accessible list of the basis sets for all kinds.
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, 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_r3d_rs_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_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
localize wavefunctions linear response scf
subroutine, public linres_solver(p_env, qs_env, psi1, h1_psi0, psi0_order, iounit, should_stop)
scf loop to optimize the first order wavefunctions (psi1) given a perturbation as an operator applied...
Type definitiona for linear response calculations.
subroutine, public multiply_by_position(matrix, qs_kind_set, particle_set, basis_type, sab_nl, direction, basis_function_nu, gauge_origin)
Take matrix < mu | ^O^ | nu > and multiply the blocks with the positions of the basis functions....
subroutine, public mfp_build_operator_gauge_independent(vcd_env, qs_env, alpha)
...
subroutine, public mfp_response(vcd_env, p_env, qs_env, alpha)
Get the dC/dB using the vcd_envop_dB.
subroutine, public mfp_build_operator_gauge_dependent(vcd_env, qs_env, alpha)
...
subroutine, public mfp_aat(vcd_env, qs_env)
...
Definition and initialisation of the mo data type.
Define the neighbor list data types and the corresponding functionality.
subroutine, public neighbor_list_iterator_create(iterator_set, nl, search, nthread)
Neighbor list iterator functions.
subroutine, public neighbor_list_iterator_release(iterator_set)
...
subroutine, public get_neighbor_list_set_p(neighbor_list_sets, nlist, symmetric)
Return the components of the first neighbor list set.
integer function, public neighbor_list_iterate(iterator_set, mepos)
...
subroutine, public get_iterator_info(iterator_set, mepos, ikind, jkind, nkind, ilist, nlist, inode, nnode, iatom, jatom, r, cell)
...
basis types for the calculation of the perturbation of density theory.
subroutine, public hr_mult_by_delta_1d(matrix, qs_kind_set, basis_type, sab_nl, lambda, direction_Or)
Apply the operator \delta_\mu^\lambda to zero out all elements of the matrix which don't fulfill the ...
subroutine, public vcd_write_restart(qs_env, linres_section, vec, lambda, beta, tag)
Copied from linres_write_restart.
subroutine, public vcd_read_restart(qs_env, linres_section, vec, lambda, beta, tag)
Copied from linres_read_restart.