53 USE dbcsr_api,
ONLY: &
54 dbcsr_add, dbcsr_copy, dbcsr_create, dbcsr_deallocate_matrix, dbcsr_get_info, &
55 dbcsr_init_p, dbcsr_p_type, dbcsr_set, dbcsr_type, dbcsr_type_antisymmetric, &
83 #include "../base/base_uses.f90"
89 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'rt_delta_pulse'
104 TYPE(qs_environment_type),
POINTER :: qs_env
105 TYPE(rt_prop_type),
POINTER :: rtp
106 TYPE(rtp_control_type),
POINTER :: rtp_control
108 CHARACTER(LEN=3),
DIMENSION(3) :: rlab
109 INTEGER :: i, output_unit
110 LOGICAL :: my_apply_pulse, periodic_cell
111 REAL(kind=
dp),
DIMENSION(3) :: kvec
112 TYPE(cell_type),
POINTER :: cell
113 TYPE(cp_fm_type),
DIMENSION(:),
POINTER :: mos_new, mos_old
114 TYPE(cp_logger_type),
POINTER :: logger
115 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s
116 TYPE(dft_control_type),
POINTER :: dft_control
117 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
118 TYPE(section_vals_type),
POINTER :: input, rtp_section
120 NULLIFY (logger, input, rtp_section)
126 dft_control=dft_control, &
131 rlab = [
CHARACTER(LEN=3) ::
"X",
"Y",
"Z"]
132 periodic_cell = any(cell%perd > 0)
133 my_apply_pulse = .true.
136 IF (rtp%linear_scaling)
THEN
137 IF (.NOT.
ASSOCIATED(mos))
THEN
138 CALL cp_warn(__location__,
"Delta Pulse not implemented for Linear-Scaling based ground "// &
139 "state calculation. If you want to perform a Linear-Scaling RTP from a "// &
140 "Linear-Scaling GS calculation you can do the following: (i) LSCF froms "// &
141 "scratch, (ii) MO-based SCF (for 1 SCF loop for instance) with the LSCF "// &
142 "result as a restart and (iii) linear scaling RTP + delta kick (for 1 "// &
143 "SCF loop for instance).")
144 my_apply_pulse = .false.
148 init_mos_old=.true., init_mos_new=.true., &
149 init_mos_next=.false., init_mos_admn=.false.)
153 IF (my_apply_pulse)
THEN
155 kvec(:) = cell%h_inv(1, :)*rtp_control%delta_pulse_direction(1) + &
156 cell%h_inv(2, :)*rtp_control%delta_pulse_direction(2) + &
157 cell%h_inv(3, :)*rtp_control%delta_pulse_direction(3)
158 kvec = kvec*
twopi*rtp_control%delta_pulse_scale
160 CALL get_rtp(rtp=rtp, mos_old=mos_old, mos_new=mos_new)
161 IF (rtp_control%apply_delta_pulse)
THEN
162 IF (dft_control%qs_control%dftb) &
164 IF (rtp_control%periodic)
THEN
165 IF (output_unit > 0)
THEN
166 WRITE (unit=output_unit, fmt=
"(/,(T3,A,T40))") &
167 "An Electric Delta Kick within periodic condition is applied before running RTP. "// &
168 "Its amplitude in atomic unit is:"
169 WRITE (output_unit,
"(T3,3(A,A,E16.8,1X))") &
170 (trim(rlab(i)),
"=", -kvec(i), i=1, 3)
172 CALL apply_delta_pulse_electric_periodic(qs_env, mos_old, mos_new, -kvec)
174 IF (periodic_cell)
THEN
175 cpwarn(
"This application of the delta pulse is not compatible with PBC!")
177 IF (output_unit > 0)
THEN
178 WRITE (unit=output_unit, fmt=
"(/,(T3,A,T40))") &
179 "An Electric Delta Kick within the length gauge is applied before running RTP. "// &
180 "Its amplitude in atomic unit is:"
181 WRITE (output_unit,
"(T3,3(A,A,E16.8,1X))") &
182 (trim(rlab(i)),
"=", -kvec(i), i=1, 3)
184 CALL apply_delta_pulse_electric(qs_env, mos_old, mos_new, -kvec)
186 ELSE IF (rtp_control%apply_delta_pulse_mag)
THEN
187 IF (periodic_cell)
THEN
188 cpwarn(
"This application of the delta pulse is not compatible with PBC!")
191 IF (output_unit > 0)
THEN
192 WRITE (unit=output_unit, fmt=
"(/,(T3,A,T40))") &
193 "A Magnetic Delta Kick is applied before running RTP. "// &
194 "Its amplitude in atomic unit is:"
195 WRITE (output_unit,
"(T3,3(A,A,E16.8,1X))") &
196 (trim(rlab(i)),
"=", -kvec(i)/2, i=1, 3)
198 CALL apply_delta_pulse_mag(qs_env, mos_old, mos_new, -kvec(:)/2)
200 cpabort(
"Code error: this case should not happen!")
216 SUBROUTINE apply_delta_pulse_electric_periodic(qs_env, mos_old, mos_new, kvec)
217 TYPE(qs_environment_type),
POINTER :: qs_env
218 TYPE(cp_fm_type),
DIMENSION(:),
POINTER :: mos_old, mos_new
219 REAL(kind=
dp),
DIMENSION(3) :: kvec
221 CHARACTER(len=*),
PARAMETER :: routinen =
'apply_delta_pulse_electric_periodic'
223 INTEGER :: handle, icol, idir, irow, ispin, nao, &
224 ncol_local, nmo, nrow_local, nvirt, &
226 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
227 LOGICAL :: com_nl, len_rep, periodic_cell
228 REAL(kind=
dp) :: eps_ppnl, factor
229 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :), &
230 POINTER :: local_data
231 REAL(kind=
dp),
DIMENSION(3) :: rcc
232 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eigenvalues, ref_point
233 TYPE(cell_type),
POINTER :: cell
234 TYPE(cp_fm_struct_type),
POINTER :: fm_struct, fm_struct_tmp
235 TYPE(cp_fm_type) :: eigenvectors, mat_ks, mat_tmp, momentum, &
237 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks, matrix_r, matrix_rv, matrix_s
238 TYPE(dft_control_type),
POINTER :: dft_control
239 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
240 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
241 POINTER :: sab_orb, sap_ppnl
242 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
243 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
244 TYPE(rt_prop_type),
POINTER :: rtp
245 TYPE(rtp_control_type),
POINTER :: rtp_control
246 TYPE(section_vals_type),
POINTER :: input
248 CALL timeset(routinen, handle)
250 NULLIFY (cell, mos, rtp, matrix_s, matrix_ks, input, dft_control, particle_set, fm_struct)
257 matrix_ks=matrix_ks, &
258 dft_control=dft_control, &
260 particle_set=particle_set)
262 rtp_control => dft_control%rtp_control
263 periodic_cell = any(cell%perd > 0)
266 com_nl =
section_get_lval(section_vals=input, keyword_name=
"DFT%REAL_TIME_PROPAGATION%COM_NL")
267 len_rep =
section_get_lval(section_vals=input, keyword_name=
"DFT%REAL_TIME_PROPAGATION%LEN_REP")
272 NULLIFY (qs_kind_set, sab_orb, sap_ppnl)
276 qs_kind_set=qs_kind_set)
277 eps_ppnl = dft_control%qs_control%eps_ppnl
282 CALL dbcsr_init_p(matrix_rv(idir)%matrix)
283 CALL dbcsr_create(matrix_rv(idir)%matrix, template=matrix_s(1)%matrix, &
284 matrix_type=dbcsr_type_antisymmetric)
286 CALL dbcsr_set(matrix_rv(idir)%matrix, 0._dp)
288 CALL build_com_mom_nl(qs_kind_set, sab_orb, sap_ppnl, eps_ppnl, particle_set, cell, matrix_rv=matrix_rv)
294 IF (periodic_cell)
THEN
295 cpwarn(
"This application of the delta pulse is not compatible with PBC!")
299 keyword_name=
"DFT%PRINT%MOMENTS%REFERENCE")
310 CALL dbcsr_init_p(matrix_r(idir)%matrix)
311 CALL dbcsr_create(matrix_r(idir)%matrix, template=matrix_s(1)%matrix, matrix_type=dbcsr_type_symmetric)
313 CALL dbcsr_set(matrix_r(idir)%matrix, 0._dp)
318 IF (rtp_control%velocity_gauge)
THEN
319 rtp_control%vec_pot = rtp_control%vec_pot + kvec
323 fm_struct => rtp%ao_ao_fmstruct
326 CALL cp_fm_create(mat_ks, matrix_struct=fm_struct, name=
"mat_ks")
327 CALL cp_fm_create(eigenvectors, matrix_struct=fm_struct, name=
"eigenvectors")
328 CALL cp_fm_create(s_chol, matrix_struct=fm_struct, name=
"S_chol")
333 CALL dbcsr_get_info(matrix_s(1)%matrix, nfullrows_total=nao)
335 DO ispin = 1,
SIZE(matrix_ks)
337 ALLOCATE (eigenvalues(nao))
338 CALL cp_fm_create(mat_tmp, matrix_struct=fm_struct, name=
"mat_tmp")
347 CALL cp_fm_struct_create(fm_struct_tmp, para_env=fm_struct%para_env, context=fm_struct%context, &
348 nrow_global=nao, ncol_global=nvirt)
349 CALL cp_fm_create(virtuals, matrix_struct=fm_struct_tmp, name=
"virtuals")
351 CALL cp_fm_to_fm(eigenvectors, virtuals, nvirt, nmo + 1, 1)
354 CALL cp_fm_to_fm(eigenvectors, mos_old(2*ispin - 1), nmo, 1, 1)
356 CALL cp_fm_struct_create(fm_struct_tmp, para_env=fm_struct%para_env, context=fm_struct%context, &
357 nrow_global=nvirt, ncol_global=nmo)
358 CALL cp_fm_create(momentum, matrix_struct=fm_struct_tmp, name=
"momentum")
366 IF (factor .NE. 0.0_dp)
THEN
367 IF (.NOT. len_rep)
THEN
369 mos_old(2*ispin), ncol=nmo)
372 mos_old(2*ispin), ncol=nmo)
379 mos_old(2*ispin), ncol=nmo)
385 CALL parallel_gemm(
'T',
'N', nvirt, nmo, nao, 1.0_dp, virtuals, mos_new(2*ispin - 1), 0.0_dp, momentum)
388 IF (.NOT. len_rep)
THEN
389 CALL cp_fm_get_info(momentum, nrow_local=nrow_local, ncol_local=ncol_local, &
390 row_indices=row_indices, col_indices=col_indices, local_data=local_data)
391 DO icol = 1, ncol_local
392 DO irow = 1, nrow_local
393 factor = 1/(eigenvalues(col_indices(icol)) - eigenvalues(nmo + row_indices(irow)))
394 local_data(irow, icol) = factor*local_data(irow, icol)
398 CALL cp_fm_release(mat_tmp)
399 DEALLOCATE (eigenvalues)
402 CALL cp_fm_to_fm(eigenvectors, mos_old(2*ispin - 1), nmo, 1, 1)
403 CALL parallel_gemm(
"N",
"N", nao, nmo, nvirt, 1.0_dp, virtuals, momentum, 0.0_dp, mos_old(2*ispin))
405 CALL cp_fm_release(virtuals)
406 CALL cp_fm_release(momentum)
410 CALL cp_fm_release(s_chol)
411 CALL cp_fm_release(mat_ks)
412 CALL cp_fm_release(eigenvectors)
417 CALL orthonormalize_complex_mos(qs_env, mos_old)
419 CALL timestop(handle)
421 END SUBROUTINE apply_delta_pulse_electric_periodic
432 SUBROUTINE apply_delta_pulse_electric(qs_env, mos_old, mos_new, kvec)
433 TYPE(qs_environment_type),
POINTER :: qs_env
434 TYPE(cp_fm_type),
DIMENSION(:),
POINTER :: mos_old, mos_new
435 REAL(kind=
dp),
DIMENSION(3) :: kvec
437 CHARACTER(len=*),
PARAMETER :: routinen =
'apply_delta_pulse_electric'
439 INTEGER :: handle, i, nao, nmo
440 TYPE(cell_type),
POINTER :: cell
441 TYPE(cp_fm_type) :: s_inv_fm, tmp
442 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s
443 TYPE(dbcsr_type),
POINTER :: cosmat, sinmat
444 TYPE(dft_control_type),
POINTER :: dft_control
445 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
446 TYPE(rt_prop_type),
POINTER :: rtp
447 TYPE(rtp_control_type),
POINTER :: rtp_control
449 CALL timeset(routinen, handle)
450 NULLIFY (cell, dft_control, matrix_s, mos, rtp, rtp_control)
453 dft_control=dft_control, &
457 rtp_control => dft_control%rtp_control
459 IF (rtp_control%velocity_gauge)
THEN
460 rtp_control%vec_pot = rtp_control%vec_pot + kvec
464 NULLIFY (cosmat, sinmat)
465 ALLOCATE (cosmat, sinmat)
466 CALL dbcsr_copy(cosmat, matrix_s(1)%matrix,
'COS MOM')
467 CALL dbcsr_copy(sinmat, matrix_s(1)%matrix,
'SIN MOM')
471 CALL cp_fm_create(s_inv_fm, matrix_struct=rtp%ao_ao_fmstruct, name=
"S_inv_fm")
472 CALL cp_fm_create(tmp, matrix_struct=rtp%ao_ao_fmstruct, name=
"tmp_mat")
477 CALL cp_fm_release(tmp)
485 CALL parallel_gemm(
"N",
"N", nao, nmo, nao, 1.0_dp, s_inv_fm, mos_new(2*i - 1), 0.0_dp, mos_old(2*i - 1))
486 CALL parallel_gemm(
"N",
"N", nao, nmo, nao, 1.0_dp, s_inv_fm, mos_new(2*i), 0.0_dp, mos_old(2*i))
489 CALL cp_fm_release(s_inv_fm)
490 CALL dbcsr_deallocate_matrix(cosmat)
491 CALL dbcsr_deallocate_matrix(sinmat)
494 CALL orthonormalize_complex_mos(qs_env, mos_old)
496 CALL timestop(handle)
498 END SUBROUTINE apply_delta_pulse_electric
507 SUBROUTINE apply_delta_pulse_mag(qs_env, mos_old, mos_new, kvec)
508 TYPE(qs_environment_type),
POINTER :: qs_env
509 TYPE(cp_fm_type),
DIMENSION(:),
POINTER :: mos_old, mos_new
510 REAL(kind=
dp),
DIMENSION(3) :: kvec
512 CHARACTER(len=*),
PARAMETER :: routinen =
'apply_delta_pulse_mag'
514 INTEGER :: gauge_orig, handle, idir, ispin, nao, &
515 nmo, nrow_global, nvirt
516 REAL(kind=
dp) :: eps_ppnl, factor
517 REAL(kind=
dp),
DIMENSION(3) :: rcc
518 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eigenvalues, ref_point
519 TYPE(cell_type),
POINTER :: cell
520 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_tmp
521 TYPE(cp_fm_type) :: eigenvectors, mat_ks, perturbation, &
523 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks, matrix_mag, matrix_nl, &
525 TYPE(dft_control_type),
POINTER :: dft_control
526 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
527 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
528 POINTER :: sab_all, sab_orb, sap_ppnl
529 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
530 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
531 TYPE(rt_prop_type),
POINTER :: rtp
532 TYPE(section_vals_type),
POINTER :: input
534 CALL timeset(routinen, handle)
538 NULLIFY (rtp, dft_control, matrix_ks, matrix_s, input, mos, cell, sab_orb, sab_all, sap_ppnl, &
539 qs_kind_set, particle_set)
543 dft_control=dft_control, &
545 matrix_ks=matrix_ks, &
554 keyword_name=
"DFT%REAL_TIME_PROPAGATION%GAUGE_ORIG")
556 CALL section_vals_val_get(input,
"DFT%REAL_TIME_PROPAGATION%GAUGE_ORIG_MANUAL", r_vals=ref_point)
560 CALL cp_fm_create(s_chol, matrix_struct=rtp%ao_ao_fmstruct, name=
'Cholesky S')
561 CALL cp_fm_create(eigenvectors, matrix_struct=rtp%ao_ao_fmstruct, name=
"gs evecs fm")
562 CALL cp_fm_create(mat_ks, matrix_struct=rtp%ao_ao_fmstruct, name=
'KS matrix')
575 CALL dbcsr_init_p(matrix_mag(idir)%matrix)
576 CALL dbcsr_create(matrix_mag(idir)%matrix, template=matrix_s(1)%matrix, &
577 matrix_type=dbcsr_type_antisymmetric)
579 CALL dbcsr_set(matrix_mag(idir)%matrix, 0._dp)
586 IF (
ASSOCIATED(sap_ppnl))
THEN
589 CALL dbcsr_init_p(matrix_nl(idir)%matrix)
590 CALL dbcsr_create(matrix_nl(idir)%matrix, template=matrix_s(1)%matrix, &
591 matrix_type=dbcsr_type_antisymmetric)
593 CALL dbcsr_set(matrix_nl(idir)%matrix, 0._dp)
597 qs_kind_set=qs_kind_set, &
598 particle_set=particle_set)
599 eps_ppnl = dft_control%qs_control%eps_ppnl
601 CALL build_com_nl_mag(qs_kind_set, sab_orb, sap_ppnl, eps_ppnl, particle_set, matrix_nl, rcc, cell)
604 CALL dbcsr_add(matrix_mag(idir)%matrix, matrix_nl(idir)%matrix, -
one,
one)
610 DO ispin = 1, dft_control%nspins
612 NULLIFY (eigenvalues)
613 ALLOCATE (eigenvalues(nrow_global))
617 CALL cp_fm_syevd(mat_ks, eigenvectors, eigenvalues)
621 CALL get_mo_set(mo_set=mos(ispin), nao=nao, nmo=nmo)
623 CALL cp_fm_struct_create(fm_struct_tmp, para_env=rtp%ao_ao_fmstruct%para_env, context=rtp%ao_ao_fmstruct%context, &
624 nrow_global=nrow_global, ncol_global=nvirt)
625 CALL cp_fm_create(virtuals, matrix_struct=fm_struct_tmp, name=
"virtuals")
627 CALL cp_fm_to_fm(eigenvectors, virtuals, nvirt, nmo + 1, 1)
630 CALL cp_fm_to_fm(eigenvectors, mos_old(2*ispin - 1), nmo, 1, 1)
632 CALL cp_fm_struct_create(fm_struct_tmp, para_env=rtp%ao_ao_fmstruct%para_env, context=rtp%ao_ao_fmstruct%context, &
633 nrow_global=nvirt, ncol_global=nmo)
634 CALL cp_fm_create(perturbation, matrix_struct=fm_struct_tmp, name=
"perturbation")
642 IF (factor .NE. 0.0_dp)
THEN
644 mos_old(2*ispin), ncol=nmo)
649 CALL parallel_gemm(
'T',
'N', nvirt, nmo, nao, 1.0_dp, virtuals, mos_new(2*ispin - 1), 0.0_dp, perturbation)
651 DEALLOCATE (eigenvalues)
654 CALL cp_fm_to_fm(eigenvectors, mos_old(2*ispin - 1), nmo, 1, 1)
655 CALL parallel_gemm(
"N",
"N", nao, nmo, nvirt, 1.0_dp, virtuals, perturbation, 0.0_dp, mos_old(2*ispin))
657 CALL cp_fm_release(virtuals)
658 CALL cp_fm_release(perturbation)
662 CALL cp_fm_release(s_chol)
663 CALL cp_fm_release(mat_ks)
664 CALL cp_fm_release(eigenvectors)
668 CALL orthonormalize_complex_mos(qs_env, mos_old)
670 CALL timestop(handle)
672 END SUBROUTINE apply_delta_pulse_mag
679 SUBROUTINE orthonormalize_complex_mos(qs_env, coeffs)
680 TYPE(qs_environment_type),
POINTER :: qs_env
681 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(INOUT), &
684 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:) :: eigenvalues_sqrt
685 INTEGER :: im, ispin, j, nao, nmo, nspins, re
686 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigenvalues
687 TYPE(cp_blacs_env_type),
POINTER :: blacs_env
688 TYPE(cp_cfm_type) :: oo_c, oo_v, oo_vt
689 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_tmp
690 TYPE(cp_fm_type) :: oo_1, oo_2, s_fm, tmp
691 TYPE(cp_fm_type),
DIMENSION(2) :: coeffs_tmp
692 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s
693 TYPE(dft_control_type),
POINTER :: dft_control
694 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
695 TYPE(mp_para_env_type),
POINTER :: para_env
697 NULLIFY (para_env, blacs_env, dft_control, matrix_s, mos)
699 blacs_env=blacs_env, &
700 dft_control=dft_control, &
704 nspins = dft_control%nspins
709 context=blacs_env, para_env=para_env)
710 CALL cp_fm_create(s_fm, matrix_struct=fm_struct_tmp, name=
"overlap fm")
718 nrow_global=nmo, ncol_global=nmo)
719 CALL cp_fm_create(oo_1, matrix_struct=fm_struct_tmp, name=
"oo_1")
720 CALL cp_fm_create(oo_2, matrix_struct=fm_struct_tmp, name=
"oo_2")
723 CALL cp_fm_create(tmp, matrix_struct=coeffs(2*ispin - 1)%matrix_struct, name=
"tmp_mat")
726 CALL parallel_gemm(
"N",
"N", nao, nmo, nao, 1.0_dp, s_fm, coeffs(2*ispin - 1), 0.0_dp, tmp)
727 CALL parallel_gemm(
"T",
"N", nmo, nmo, nao, 1.0_dp, coeffs(2*ispin - 1), tmp, 0.0_dp, oo_1)
728 CALL parallel_gemm(
"T",
"N", nmo, nmo, nao, -1.0_dp, coeffs(2*ispin), tmp, 0.0_dp, oo_2)
730 CALL parallel_gemm(
"N",
"N", nao, nmo, nao, 1.0_dp, s_fm, coeffs(2*ispin), 0.0_dp, tmp)
731 CALL parallel_gemm(
"T",
"N", nmo, nmo, nao, 1.0_dp, coeffs(2*ispin), tmp, 1.0_dp, oo_1)
732 CALL parallel_gemm(
"T",
"N", nmo, nmo, nao, 1.0_dp, coeffs(2*ispin - 1), tmp, 1.0_dp, oo_2)
733 CALL cp_fm_release(tmp)
739 oo_c%local_data = cmplx(oo_1%local_data, oo_2%local_data, kind=
dp)
741 ALLOCATE (eigenvalues(nmo))
742 ALLOCATE (eigenvalues_sqrt(nmo))
744 eigenvalues_sqrt(:) = cmplx(
one/sqrt(eigenvalues(:)),
zero,
dp)
745 CALL cp_cfm_to_cfm(oo_v, oo_vt)
747 DEALLOCATE (eigenvalues)
748 DEALLOCATE (eigenvalues_sqrt)
749 CALL parallel_gemm(
'N',
'C', nmo, nmo, nmo, (1.0_dp, 0.0_dp), &
750 oo_v, oo_vt, (0.0_dp, 0.0_dp), oo_c)
751 oo_1%local_data = real(oo_c%local_data, kind=
dp)
752 oo_2%local_data = aimag(oo_c%local_data)
759 CALL cp_fm_create(coeffs_tmp(j), matrix_struct=coeffs(2*(ispin - 1) + j)%matrix_struct)
765 CALL parallel_gemm(
"N",
"N", nao, nmo, nmo,
one, coeffs(2*ispin - 1), oo_1,
zero, coeffs_tmp(re))
766 CALL parallel_gemm(
"N",
"N", nao, nmo, nmo,
one, coeffs(2*ispin - 1), oo_2,
zero, coeffs_tmp(im))
768 CALL parallel_gemm(
"N",
"N", nao, nmo, nmo, -
one, coeffs(2*ispin), oo_2,
zero, coeffs(2*ispin - 1))
771 CALL parallel_gemm(
"N",
"N", nao, nmo, nmo,
one, coeffs(2*ispin), oo_1,
one, coeffs_tmp(im))
772 CALL cp_fm_to_fm(coeffs_tmp(im), coeffs(2*ispin))
775 CALL cp_fm_release(coeffs_tmp(j))
777 CALL cp_fm_release(oo_1)
778 CALL cp_fm_release(oo_2)
780 CALL cp_fm_release(s_fm)
782 END SUBROUTINE orthonormalize_complex_mos
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public mattiat2022
integer, save, public mattiat2019
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_mom_nl(qs_kind_set, sab_all, sap_ppnl, eps_ppnl, particle_set, cell, matrix_rv, matrix_rxrv, matrix_rrv, matrix_rvr, matrix_rrv_vrr, matrix_r_rxvr, matrix_rxvr_r, matrix_r_doublecom, pseudoatom, ref_point)
Calculate [r,Vnl] (matrix_rv), r x [r,Vnl] (matrix_rxrv) or [rr,Vnl] (matrix_rrv) in AO basis....
subroutine, public build_com_nl_mag(qs_kind_set, sab_all, sap_ppnl, eps_ppnl, particle_set, matrix_mag_nl, refpoint, cell)
calculate \sum_R_ps (R_ps - R_nu) x [V_nl, r] summing over all pseudized atoms R
methods related to the blacs parallel environment
Basic linear algebra operations for complex full matrices.
subroutine, public cp_cfm_column_scale(matrix_a, scaling)
Scales columns of the full matrix by corresponding factors.
used for collecting diagonalization schemes available for cp_cfm_type
subroutine, public cp_cfm_heevd(matrix, eigenvectors, eigenvalues)
Perform a diagonalisation of a complex matrix.
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_create(matrix, matrix_struct, name)
Creates a new full matrix with the given structure.
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Routines that link DBCSR and CP2K concepts together.
subroutine, public cp_dbcsr_alloc_block_from_nbl(matrix, sab_orb, desymmetrize)
allocate the blocks of a dbcsr based on the neighbor list
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
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
basic linear algebra operations for full matrices
subroutine, public cp_fm_upper_to_full(matrix, work)
given an upper triangular matrix computes the corresponding full matrix
subroutine, public cp_fm_scale_and_add(alpha, matrix_a, beta, matrix_b)
calc A <- alpha*A + beta*B optimized for alpha == 1.0 (just add beta*B) and beta == 0....
subroutine, public cp_fm_triangular_multiply(triangular_matrix, matrix_b, side, transpose_tr, invert_tr, uplo_tr, unit_diag_tr, n_rows, n_cols, alpha)
multiplies in place by a triangular matrix: matrix_b = alpha op(triangular_matrix) matrix_b or (if si...
various cholesky decomposition related routines
subroutine, public cp_fm_cholesky_invert(matrix, n, info_out)
used to replace the cholesky decomposition by the inverse
subroutine, public cp_fm_cholesky_decompose(matrix, n, info_out)
used to replace a symmetric positive def. matrix M with its cholesky decomposition U: M = U^T * U,...
subroutine, public cp_fm_cholesky_reduce(matrix, matrixb, itype)
reduce a matrix pencil A,B to normal form B has to be cholesky decomposed with cp_fm_cholesky_decompo...
subroutine, public cp_fm_cholesky_restore(matrix, neig, matrixb, matrixout, op, pos, transa)
...
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
subroutine, public cp_fm_syevd(matrix, eigenvectors, eigenvalues, info)
Computes all eigenvalues and vectors of a real symmetric matrix significantly faster than syevx,...
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
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, 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)
...
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
real(kind=dp), parameter, public one
real(kind=dp), parameter, public twopi
real(kind=dp), parameter, public zero
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)
...
basic linear algebra operations for full matrixes
Define the data structure for the particle information.
Calculation of Overlap and Hamiltonian matrices in DFTB.
subroutine, public build_dftb_overlap(qs_env, nderivative, matrix_s)
...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_RI_aux_kp, matrix_s, matrix_s_RI_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, WannierCentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
Definition and initialisation of the mo data type.
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kTS, mu, flexible_electron_count)
Get the components of a MO set data structure.
Calculates the moment integrals <a|r^m|b> and <a|r x d/dr|b>
subroutine, public build_local_magmom_matrix(qs_env, magmom, nmoments, ref_point, ref_points, basis_type)
...
subroutine, public build_local_moment_matrix(qs_env, moments, nmoments, ref_point, ref_points, basis_type)
...
subroutine, public build_berry_moment_matrix(qs_env, cosmat, sinmat, kvec, sab_orb_external, basis_type)
...
Define the neighbor list data types and the corresponding functionality.
Routines to apply a delta pulse for RTP and EMD.
subroutine, public apply_delta_pulse(qs_env, rtp, rtp_control)
Interface to call the delta pulse depending on the type of calculation.
Types and set_get for real time propagation depending on runtype and diagonalization method different...
subroutine, public rt_prop_create_mos(rtp, mos, mpools, dft_control, mos_aux, init_mos_old, init_mos_new, init_mos_next, init_mos_admn)
Initialize the mos for rtp.
subroutine, public get_rtp(rtp, exp_H_old, exp_H_new, H_last_iter, rho_old, rho_next, rho_new, mos, mos_new, mos_old, mos_next, S_inv, S_half, S_minus_half, B_mat, C_mat, propagator_matrix, mixing, mixing_factor, S_der, dt, nsteps, SinvH, SinvH_imag, SinvB, admm_mos)
...