109#include "./base/base_uses.f90"
115 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_tddfpt2_properties'
118 INTEGER,
PARAMETER,
PRIVATE :: nderivs = 3
119 INTEGER,
PARAMETER,
PRIVATE :: maxspins = 2
152 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :), &
153 INTENT(inout) :: dipole_op_mos_occ
159 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tddfpt_dipole_operator'
161 INTEGER :: handle, i_cos_sin, icol, ideriv, irow, &
162 ispin, jderiv, nao, ncols_local, &
163 ndim_periodic, nrows_local, nspins
164 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
165 INTEGER,
DIMENSION(maxspins) :: nmo_occ, nmo_virt
166 REAL(kind=
dp) :: eval_occ
167 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :), &
168 POINTER :: local_data_ediff, local_data_wfm
169 REAL(kind=
dp),
DIMENSION(3) :: kvec, reference_point
172 TYPE(
cp_cfm_type),
ALLOCATABLE,
DIMENSION(:) :: gamma_00, gamma_inv_00
174 TYPE(
cp_fm_type) :: ediff_inv, rrc_mos_occ, wfm_ao_ao, &
176 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: s_mos_virt
177 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: dberry_mos_occ, gamma_real_imag, opvec
178 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: berry_cossin_xyz, matrix_s, rrc_xyz, scrm
186 CALL timeset(routinen, handle)
188 NULLIFY (blacs_env, cell, matrix_s, pw_env)
189 CALL get_qs_env(qs_env, blacs_env=blacs_env, cell=cell, matrix_s=matrix_s, pw_env=pw_env)
191 nspins =
SIZE(gs_mos)
194 nmo_occ(ispin) =
SIZE(gs_mos(ispin)%evals_occ)
195 nmo_virt(ispin) =
SIZE(gs_mos(ispin)%evals_virt)
199 ALLOCATE (dipole_op_mos_occ(nderivs, nspins))
201 CALL cp_fm_get_info(gs_mos(ispin)%mos_occ, matrix_struct=fm_struct)
203 DO ideriv = 1, nderivs
204 CALL cp_fm_create(dipole_op_mos_occ(ideriv, ispin), fm_struct)
209 ALLOCATE (s_mos_virt(nspins))
211 CALL cp_fm_get_info(gs_mos(ispin)%mos_virt, matrix_struct=fm_struct)
214 gs_mos(ispin)%mos_virt, &
216 ncol=nmo_virt(ispin), alpha=1.0_dp, beta=0.0_dp)
220 CALL pw_env_get(pw_env, poisson_env=poisson_env)
221 ndim_periodic = count(poisson_env%parameters%periodic == 1)
224 IF (tddfpt_control%dipole_form == 0)
THEN
225 CALL get_qs_env(qs_env, dft_control=dft_control)
226 IF (dft_control%qs_control%xtb)
THEN
227 IF (ndim_periodic == 0)
THEN
237 SELECT CASE (tddfpt_control%dipole_form)
239 IF (ndim_periodic /= 3)
THEN
240 CALL cp_warn(__location__, &
241 "Fully periodic Poisson solver (PERIODIC xyz) is needed "// &
242 "for oscillator strengths based on the Berry phase formula")
245 NULLIFY (berry_cossin_xyz)
253 CALL dbcsr_copy(berry_cossin_xyz(i_cos_sin)%matrix, matrix_s(1)%matrix)
257 ALLOCATE (gamma_00(nspins), gamma_inv_00(nspins), gamma_real_imag(2, nspins), opvec(2, nspins))
258 ALLOCATE (dberry_mos_occ(nderivs, nspins))
262 ncol_global=nmo_occ(ispin), context=blacs_env)
268 CALL cp_fm_create(gamma_real_imag(i_cos_sin, ispin), fm_struct)
273 CALL cp_fm_get_info(gs_mos(ispin)%mos_occ, matrix_struct=fm_struct)
279 DO ideriv = 1, nderivs
280 CALL cp_fm_create(dberry_mos_occ(ideriv, ispin), fm_struct)
285 DO ideriv = 1, nderivs
286 kvec(:) =
twopi*cell%h_inv(ideriv, :)
288 CALL dbcsr_set(berry_cossin_xyz(i_cos_sin)%matrix, 0.0_dp)
291 berry_cossin_xyz(2)%matrix, kvec)
298 gs_mos(ispin)%mos_occ, &
299 opvec(i_cos_sin, ispin), &
300 ncol=nmo_occ(ispin), alpha=1.0_dp, beta=0.0_dp)
303 CALL parallel_gemm(
'T',
'N', nmo_occ(ispin), nmo_occ(ispin), nao, &
304 1.0_dp, gs_mos(ispin)%mos_occ, opvec(1, ispin), &
305 0.0_dp, gamma_real_imag(1, ispin))
307 CALL parallel_gemm(
'T',
'N', nmo_occ(ispin), nmo_occ(ispin), nao, &
308 -1.0_dp, gs_mos(ispin)%mos_occ, opvec(2, ispin), &
309 0.0_dp, gamma_real_imag(2, ispin))
312 msourcei=gamma_real_imag(2, ispin), &
313 mtarget=gamma_00(ispin))
320 mtargetr=gamma_real_imag(1, ispin), &
321 mtargeti=gamma_real_imag(2, ispin))
324 CALL parallel_gemm(
"N",
"N", nao, nmo_occ(ispin), nmo_occ(ispin), &
325 1.0_dp, opvec(1, ispin), gamma_real_imag(2, ispin), &
326 0.0_dp, dipole_op_mos_occ(1, ispin))
327 CALL parallel_gemm(
"N",
"N", nao, nmo_occ(ispin), nmo_occ(ispin), &
328 -1.0_dp, opvec(2, ispin), gamma_real_imag(1, ispin), &
329 1.0_dp, dipole_op_mos_occ(1, ispin))
331 DO jderiv = 1, nderivs
333 cell%hmat(jderiv, ideriv), dipole_op_mos_occ(1, ispin))
341 DO ispin = nspins, 1, -1
345 DEALLOCATE (gamma_00, gamma_inv_00)
364 1.0_dp/
twopi, s_mos_virt(ispin), gs_mos(ispin)%mos_virt, &
367 DO ideriv = 1, nderivs
369 1.0_dp, wfm_ao_ao, dberry_mos_occ(ideriv, ispin), &
370 0.0_dp, dipole_op_mos_occ(ideriv, ispin))
378 IF (ndim_periodic /= 0)
THEN
379 CALL cp_warn(__location__, &
380 "Non-periodic Poisson solver (PERIODIC none) is needed "// &
381 "for oscillator strengths based on the length operator")
388 DO ideriv = 1, nderivs
390 CALL dbcsr_copy(rrc_xyz(ideriv)%matrix, matrix_s(1)%matrix)
394 reference=tddfpt_control%dipole_reference, &
395 ref_point=tddfpt_control%dipole_ref_point)
397 CALL rrc_xyz_ao(op=rrc_xyz, qs_env=qs_env, rc=reference_point, order=1, &
398 minimum_image=.false., soft=.false.)
406 CALL cp_fm_get_info(gs_mos(ispin)%mos_occ, matrix_struct=fm_struct)
411 1.0_dp, s_mos_virt(ispin), gs_mos(ispin)%mos_virt, &
414 DO ideriv = 1, nderivs
416 gs_mos(ispin)%mos_occ, &
418 ncol=nmo_occ(ispin), alpha=1.0_dp, beta=0.0_dp)
421 1.0_dp, wfm_ao_ao, rrc_mos_occ, &
422 0.0_dp, dipole_op_mos_occ(ideriv, ispin))
433 CALL get_qs_env(qs_env, ks_env=ks_env, sab_orb=sab_orb)
436 basis_type_a=
"ORB", basis_type_b=
"ORB", &
442 ncol_global=nmo_occ(ispin), context=blacs_env)
447 CALL cp_fm_get_info(ediff_inv, nrow_local=nrows_local, ncol_local=ncols_local, &
448 row_indices=row_indices, col_indices=col_indices, local_data=local_data_ediff)
449 CALL cp_fm_get_info(wfm_mo_virt_mo_occ, local_data=local_data_wfm)
454 DO icol = 1, ncols_local
456 eval_occ = gs_mos(ispin)%evals_occ(col_indices(icol))
458 DO irow = 1, nrows_local
461 local_data_ediff(irow, icol) = 1.0_dp/(gs_mos(ispin)%evals_virt(row_indices(irow)) - eval_occ)
466 DO ideriv = 1, nderivs
468 gs_mos(ispin)%mos_occ, &
469 dipole_op_mos_occ(ideriv, ispin), &
470 ncol=nmo_occ(ispin), alpha=1.0_dp, beta=0.0_dp)
472 CALL parallel_gemm(
'T',
'N', nmo_virt(ispin), nmo_occ(ispin), nao, &
473 1.0_dp, gs_mos(ispin)%mos_virt, dipole_op_mos_occ(ideriv, ispin), &
474 0.0_dp, wfm_mo_virt_mo_occ)
483 DO icol = 1, ncols_local
484 DO irow = 1, nrows_local
485 local_data_wfm(irow, icol) = local_data_wfm(irow, icol)*local_data_ediff(irow, icol)
490 CALL parallel_gemm(
'N',
'N', nao, nmo_occ(ispin), nmo_virt(ispin), &
491 1.0_dp, s_mos_virt(ispin), wfm_mo_virt_mo_occ, &
492 0.0_dp, dipole_op_mos_occ(ideriv, ispin))
501 cpabort(
"Unimplemented form of the dipole operator")
507 CALL timestop(handle)
535 dipole_op_mos_occ, dipole_form)
536 INTEGER,
INTENT(in) :: log_unit
537 TYPE(
cp_fm_type),
DIMENSION(:, :),
INTENT(in) :: evects
538 REAL(kind=
dp),
DIMENSION(:),
INTENT(in) :: evals
539 REAL(kind=
dp),
DIMENSION(:),
INTENT(inout) :: ostrength
540 INTEGER,
INTENT(in) :: mult
541 TYPE(
cp_fm_type),
DIMENSION(:, :),
INTENT(in) :: dipole_op_mos_occ
542 INTEGER,
INTENT(in) :: dipole_form
544 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tddfpt_print_summary'
546 CHARACTER(len=1) :: lsd_str
547 CHARACTER(len=20) :: mult_str
548 INTEGER :: handle, ideriv, ispin, istate, nspins, &
550 REAL(kind=
dp) :: osc_strength
551 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: trans_dipoles
553 CALL timeset(routinen, handle)
555 nspins =
SIZE(evects, 1)
556 nstates =
SIZE(evects, 2)
565 IF (log_unit > 0)
THEN
567 WRITE (log_unit,
'(/,1X,A1,A,1X,A)') lsd_str,
"-TDDFPT states of multiplicity", trim(mult_str)
568 SELECT CASE (dipole_form)
570 WRITE (log_unit,
'(1X,A,/)')
"Transition dipoles calculated using Berry operator formulation"
572 WRITE (log_unit,
'(1X,A,/)')
"Transition dipoles calculated using length formulation"
574 WRITE (log_unit,
'(1X,A,/)')
"Transition dipoles calculated using velocity formulation"
576 cpabort(
"Unimplemented form of the dipole operator")
579 WRITE (log_unit,
'(T10,A,T19,A,T37,A,T69,A)')
"State",
"Excitation", &
580 "Transition dipole (a.u.)",
"Oscillator"
581 WRITE (log_unit,
'(T10,A,T19,A,T37,A,T49,A,T61,A,T67,A)')
"number",
"energy (eV)", &
582 "x",
"y",
"z",
"strength (a.u.)"
583 WRITE (log_unit,
'(T10,72("-"))')
587 ALLOCATE (trans_dipoles(nstates, nderivs, nspins))
588 trans_dipoles(:, :, :) = 0.0_dp
591 IF (nspins > 1 .OR. mult == 1)
THEN
593 DO ideriv = 1, nderivs
594 CALL cp_fm_trace(evects(ispin, :), dipole_op_mos_occ(ideriv, ispin), &
595 trans_dipoles(:, ideriv, ispin))
599 IF (nspins == 1)
THEN
600 trans_dipoles(:, :, 1) = sqrt(2.0_dp)*trans_dipoles(:, :, 1)
602 trans_dipoles(:, :, 1) = sqrt(trans_dipoles(:, :, 1)**2 + trans_dipoles(:, :, 2)**2)
607 DO istate = 1, nstates
608 osc_strength = 2.0_dp/3.0_dp*evals(istate)* &
610 ostrength(istate) = osc_strength
611 IF (log_unit > 0)
THEN
612 WRITE (log_unit,
'(1X,A,T9,I7,T19,F11.5,T31,3(1X,ES11.4E2),T69,ES12.5E2)') &
613 "TDDFPT|", istate, evals(istate)*
evolt, trans_dipoles(istate, 1:nderivs, 1), osc_strength
618 IF (log_unit > 0)
THEN
619 WRITE (log_unit,
'(/,T2,A,E14.6)')
'TDDFPT : CheckSum =', sqrt(sum(evals**2))
622 DEALLOCATE (trans_dipoles)
624 CALL timestop(handle)
641 INTEGER,
INTENT(in) :: log_unit
642 TYPE(
cp_fm_type),
DIMENSION(:, :),
INTENT(in) :: evects
643 REAL(kind=
dp),
DIMENSION(:),
INTENT(in) :: evals
647 REAL(kind=
dp),
INTENT(in) :: min_amplitude
649 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tddfpt_print_excitation_analysis'
651 CHARACTER(len=5) :: spin_label
652 INTEGER :: handle, icol, iproc, irow, ispin, &
653 istate, nao, ncols_local, nrows_local, &
654 nspins, nstates, state_spin
655 INTEGER(kind=int_8) :: iexc, imo_occ, imo_virt, ind, nexcs, &
656 nexcs_local, nexcs_max_local, &
657 nmo_virt_occ, nmo_virt_occ_alpha
658 INTEGER(kind=int_8),
ALLOCATABLE,
DIMENSION(:) :: inds_local, inds_recv, nexcs_recv
659 INTEGER(kind=int_8),
DIMENSION(1) :: nexcs_send
660 INTEGER(kind=int_8),
DIMENSION(maxspins) :: nmo_occ8, nmo_virt8
661 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: inds
662 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
663 INTEGER,
DIMENSION(maxspins) :: nmo_occ, nmo_virt
664 LOGICAL :: do_exc_analysis
665 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: weights_local, weights_neg_abs_recv, &
667 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :), &
668 POINTER :: local_data
671 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: s_mos_virt, weights_fm
674 TYPE(
mp_request_type),
ALLOCATABLE,
DIMENSION(:) :: recv_handlers, recv_handlers2
676 CALL timeset(routinen, handle)
678 nspins =
SIZE(evects, 1)
679 nstates =
SIZE(evects, 2)
680 do_exc_analysis = min_amplitude < 1.0_dp
682 CALL cp_fm_get_info(gs_mos(1)%mos_occ, context=blacs_env, para_env=para_env)
686 nmo_occ(ispin) =
SIZE(gs_mos(ispin)%evals_occ)
687 nmo_virt(ispin) =
SIZE(gs_mos(ispin)%evals_virt)
688 nmo_occ8(ispin) =
SIZE(gs_mos(ispin)%evals_occ, kind=
int_8)
689 nmo_virt8(ispin) =
SIZE(gs_mos(ispin)%evals_virt, kind=
int_8)
693 IF (do_exc_analysis)
THEN
694 cpassert(log_unit <= 0 .OR. para_env%is_source())
695 nmo_virt_occ_alpha = int(nmo_virt(1),
int_8)*int(nmo_occ(1),
int_8)
697 IF (log_unit > 0)
THEN
698 WRITE (log_unit,
"(1X,A)")
"", &
699 "-------------------------------------------------------------------------------", &
700 "- Excitation analysis -", &
701 "-------------------------------------------------------------------------------"
702 WRITE (log_unit,
'(8X,A,T27,A,T49,A,T69,A)')
"State",
"Occupied",
"Virtual",
"Excitation"
703 WRITE (log_unit,
'(8X,A,T28,A,T49,A,T69,A)')
"number",
"orbital",
"orbital",
"amplitude"
704 WRITE (log_unit,
'(1X,79("-"))')
706 IF (nspins == 1)
THEN
712 ALLOCATE (s_mos_virt(nspins), weights_fm(nspins))
714 CALL cp_fm_get_info(gs_mos(ispin)%mos_virt, matrix_struct=fm_struct)
717 gs_mos(ispin)%mos_virt, &
719 ncol=nmo_virt(ispin), alpha=1.0_dp, beta=0.0_dp)
722 CALL cp_fm_struct_create(fm_struct, nrow_global=nmo_virt(ispin), ncol_global=nmo_occ(ispin), &
730 CALL cp_fm_get_info(weights_fm(ispin), nrow_local=nrows_local, ncol_local=ncols_local)
731 nexcs_max_local = nexcs_max_local + int(nrows_local,
int_8)*int(ncols_local,
int_8)
734 ALLOCATE (weights_local(nexcs_max_local), inds_local(nexcs_max_local))
736 DO istate = 1, nstates
744 CALL parallel_gemm(
'T',
'N', nmo_virt(ispin), nmo_occ(ispin), nao, 1.0_dp, s_mos_virt(ispin), &
745 evects(ispin, istate), 0.0_dp, weights_fm(ispin))
747 CALL cp_fm_get_info(weights_fm(ispin), nrow_local=nrows_local, ncol_local=ncols_local, &
748 row_indices=row_indices, col_indices=col_indices, local_data=local_data)
751 DO icol = 1, ncols_local
752 DO irow = 1, nrows_local
753 IF (abs(local_data(irow, icol)) >= min_amplitude)
THEN
755 nexcs_local = nexcs_local + 1
757 weights_local(nexcs_local) = local_data(irow, icol)
759 inds_local(nexcs_local) = nmo_virt_occ + int(row_indices(irow),
int_8) + &
760 int(col_indices(icol) - 1,
int_8)*nmo_virt8(ispin)
765 nmo_virt_occ = nmo_virt_occ + nmo_virt8(ispin)*nmo_occ8(ispin)
768 IF (para_env%is_source())
THEN
770 ALLOCATE (nexcs_recv(para_env%num_pe), recv_handlers(para_env%num_pe), recv_handlers2(para_env%num_pe))
773 DO iproc = 1, para_env%num_pe
774 IF (iproc - 1 /= para_env%mepos)
THEN
775 CALL para_env%irecv(nexcs_recv(iproc:iproc), iproc - 1, recv_handlers(iproc), 0)
777 nexcs_recv(iproc) = nexcs_local
781 DO iproc = 1, para_env%num_pe
782 IF (iproc - 1 /= para_env%mepos) &
783 CALL recv_handlers(iproc)%wait()
788 DO iproc = 1, para_env%num_pe
789 nexcs = nexcs + nexcs_recv(iproc)
793 ALLOCATE (weights_recv(nexcs), weights_neg_abs_recv(nexcs))
794 ALLOCATE (inds_recv(nexcs), inds(nexcs))
797 DO iproc = 1, para_env%num_pe
798 IF (nexcs_recv(iproc) > 0)
THEN
799 IF (iproc - 1 /= para_env%mepos)
THEN
801 CALL para_env%irecv(weights_recv(nmo_virt_occ + 1:nmo_virt_occ + nexcs_recv(iproc)), &
802 iproc - 1, recv_handlers(iproc), 1)
804 CALL para_env%irecv(inds_recv(nmo_virt_occ + 1:nmo_virt_occ + nexcs_recv(iproc)), &
805 iproc - 1, recv_handlers2(iproc), 2)
808 weights_recv(nmo_virt_occ + 1:nmo_virt_occ + nexcs_recv(iproc)) = weights_local(1:nexcs_recv(iproc))
809 inds_recv(nmo_virt_occ + 1:nmo_virt_occ + nexcs_recv(iproc)) = inds_local(1:nexcs_recv(iproc))
812 nmo_virt_occ = nmo_virt_occ + nexcs_recv(iproc)
816 DO iproc = 1, para_env%num_pe
817 IF (iproc - 1 /= para_env%mepos .AND. nexcs_recv(iproc) > 0)
THEN
818 CALL recv_handlers(iproc)%wait()
819 CALL recv_handlers2(iproc)%wait()
823 DEALLOCATE (nexcs_recv, recv_handlers, recv_handlers2)
826 nexcs_send(1) = nexcs_local
827 CALL para_env%isend(nexcs_send, para_env%source, send_handler, 0)
828 CALL send_handler%wait()
830 IF (nexcs_local > 0)
THEN
832 CALL para_env%isend(weights_local(1:nexcs_local), para_env%source, send_handler, 1)
834 CALL para_env%isend(inds_local(1:nexcs_local), para_env%source, send_handler2, 2)
836 CALL send_handler%wait()
837 CALL send_handler2%wait()
843 IF (para_env%is_source() .AND. log_unit > 0)
THEN
844 weights_neg_abs_recv(:) = -abs(weights_recv)
845 CALL sort(weights_neg_abs_recv, int(nexcs), inds)
847 WRITE (log_unit,
'(T7,I8,F10.5,A)') istate, evals(istate)*
evolt,
" eV"
850 ind = inds_recv(inds(iexc)) - 1
852 IF (ind < nmo_virt_occ_alpha)
THEN
857 ind = ind - nmo_virt_occ_alpha
862 imo_occ = ind/nmo_virt8(state_spin) + 1
863 imo_virt = mod(ind, nmo_virt8(state_spin)) + 1
865 WRITE (log_unit,
'(T27,I8,1X,A5,T48,I8,1X,A5,T70,F9.6)') imo_occ, spin_label, &
866 nmo_occ8(state_spin) + imo_virt, spin_label, weights_recv(inds(iexc))
871 IF (para_env%is_source()) &
872 DEALLOCATE (weights_recv, weights_neg_abs_recv, inds_recv, inds)
875 DEALLOCATE (weights_local, inds_local)
876 IF (log_unit > 0)
THEN
877 WRITE (log_unit,
"(1X,A)") &
878 "-------------------------------------------------------------------------------"
885 CALL timestop(handle)
904 TYPE(
cp_fm_type),
DIMENSION(:, :),
INTENT(in) :: evects
905 REAL(kind=
dp),
DIMENSION(:),
INTENT(in) :: evals, ostrength
911 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tddfpt_print_nto_analysis'
912 INTEGER,
PARAMETER :: ntomax = 10
914 CHARACTER(LEN=20),
DIMENSION(2) :: nto_name
915 INTEGER :: handle, i, ia, icg, iounit, ispin, &
916 istate, j, nao, nlist, nmax, nmo, &
917 nnto, nspins, nstates
918 INTEGER,
DIMENSION(2) :: iv
919 INTEGER,
DIMENSION(2, ntomax) :: ia_index
920 INTEGER,
DIMENSION(:),
POINTER :: slist, stride
921 LOGICAL :: append_cube, cube_file, explicit
922 REAL(kind=
dp) :: os_threshold, sume, threshold
923 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigvals
924 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: eigenvalues
925 REAL(kind=
dp),
DIMENSION(ntomax) :: ia_eval
927 TYPE(
cp_fm_type) :: sev, smat, tmat, wmat, work, wvec
928 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: teig
930 TYPE(
mo_set_type),
ALLOCATABLE,
DIMENSION(:) :: nto_set
932 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
935 CALL timeset(routinen, handle)
946 CALL section_vals_val_get(print_section,
"NTO_ANALYSIS%INTENSITY_THRESHOLD", r_val=os_threshold)
957 WRITE (iounit,
"(1X,A)")
"", &
958 "-------------------------------------------------------------------------------", &
959 "- Natural Orbital analysis -", &
960 "-------------------------------------------------------------------------------"
963 nspins =
SIZE(evects, 1)
964 nstates =
SIZE(evects, 2)
967 DO istate = 1, nstates
968 IF (os_threshold > ostrength(istate))
THEN
970 WRITE (iounit,
"(1X,A,I6)")
" Skipping state ", istate
975 IF (.NOT. any(slist == istate))
THEN
977 WRITE (iounit,
"(1X,A,I6)")
" Skipping state ", istate
983 WRITE (iounit,
"(1X,A,I6,T30,F10.5,A)")
" STATE NR. ", istate, evals(istate)*
evolt,
" eV"
987 CALL cp_fm_get_info(evects(ispin, istate), matrix_struct=fm_struct, ncol_global=nmo)
988 nmax = max(nmax, nmo)
990 ALLOCATE (eigenvalues(nmax, nspins))
994 nto_name(1) =
'Hole_states'
995 nto_name(2) =
'Particle_states'
996 ALLOCATE (nto_set(2))
998 CALL allocate_mo_set(nto_set(i), nao, ntomax, 0, 0.0_dp, 1.0_dp, 0.0_dp)
1003 CALL init_mo_set(nto_set(i), fm_ref=tmat, name=nto_name(i))
1008 ALLOCATE (teig(nspins))
1011 DO ispin = 1, nspins
1012 associate(ev => evects(ispin, istate))
1013 CALL cp_fm_get_info(ev, matrix_struct=fm_struct, ncol_global=nmo)
1016 nrow_global=nmo, ncol_global=nmo)
1020 CALL parallel_gemm(
'T',
'N', nmo, nmo, nao, 1.0_dp, ev, sev, 0.0_dp, tmat)
1034 iv = maxloc(eigenvalues)
1035 ia_eval(i) = eigenvalues(iv(1), iv(2))
1036 ia_index(1:2, i) = iv(1:2)
1037 sume = sume + ia_eval(i)
1038 eigenvalues(iv(1), iv(2)) = 0.0_dp
1040 IF (sume > threshold)
EXIT
1046 ispin = ia_index(2, i)
1050 nrow_global=nmo, ncol_global=1)
1059 CALL parallel_gemm(
'N',
'N', nao, 1, nmo, 1.0_dp, gs_mos(ispin)%mos_occ, &
1061 CALL cp_fm_to_fm(wvec, nto_set(1)%mo_coeff, 1, 1, i)
1068 DO ispin = 1, nspins
1069 associate(ev => evects(ispin, istate))
1070 CALL cp_fm_get_info(ev, matrix_struct=fm_struct, nrow_global=nao, ncol_global=nmo)
1071 ALLOCATE (eigvals(nao))
1076 CALL cp_fm_struct_create(fmstruct=fm_mo_struct, template_fmstruct=fm_struct, &
1077 nrow_global=nao, ncol_global=nao)
1078 CALL cp_fm_create(tmat, fm_mo_struct)
1079 CALL cp_fm_create(smat, fm_mo_struct)
1080 CALL cp_fm_create(wmat, fm_mo_struct)
1081 CALL cp_fm_create(work, fm_mo_struct)
1082 CALL cp_fm_struct_release(fm_mo_struct)
1083 CALL copy_dbcsr_to_fm(matrix_s, smat)
1084 CALL parallel_gemm(
'N',
'T', nao, nao, nmo, 1.0_dp, sev, sev, 0.0_dp, tmat)
1085 CALL cp_fm_geeig(tmat, smat, wmat, eigvals, work)
1087 IF (ispin == ia_index(2, i))
THEN
1090 IF (abs(eigvals(j) - ia_eval(i)) < 1.e-6_dp)
THEN
1096 CALL cp_warn(__location__, &
1097 "Could not locate particle state associated with hole state.")
1099 CALL cp_fm_to_fm(wmat, nto_set(2)%mo_coeff, 1, icg, i)
1103 DEALLOCATE (eigvals)
1104 CALL cp_fm_release(sev)
1105 CALL cp_fm_release(tmat)
1106 CALL cp_fm_release(smat)
1107 CALL cp_fm_release(wmat)
1108 CALL cp_fm_release(work)
1111 IF (iounit > 0)
THEN
1114 sume = sume + ia_eval(i)
1115 WRITE (iounit,
"(T6,A,i2,T30,A,i1,T42,A,F8.5,T63,A,F8.5)") &
1116 "Particle-Hole state:", i,
" Spin:", ia_index(2, i), &
1117 "Eigenvalue:", ia_eval(i),
" Sum Eigv:", sume
1121 nto_section => section_vals_get_subs_vals(print_section,
"NTO_ANALYSIS")
1122 CALL section_vals_val_get(nto_section,
"CUBE_FILES", l_val=cube_file)
1123 CALL section_vals_val_get(nto_section,
"STRIDE", i_vals=stride)
1124 CALL section_vals_val_get(nto_section,
"APPEND", l_val=append_cube)
1126 CALL print_nto_cubes(qs_env, nto_set, istate, stride, append_cube, nto_section)
1128 CALL get_qs_env(qs_env, qs_kind_set=qs_kind_set, particle_set=particle_set)
1129 molden_section => section_vals_get_subs_vals(print_section,
"MOS_MOLDEN")
1130 CALL write_mos_molden(nto_set, qs_kind_set, particle_set, molden_section)
1132 DEALLOCATE (eigenvalues)
1133 CALL cp_fm_release(teig)
1136 CALL deallocate_mo_set(nto_set(i))
1138 DEALLOCATE (nto_set)
1141 IF (iounit > 0)
THEN
1142 WRITE (iounit,
"(1X,A)") &
1143 "-------------------------------------------------------------------------------"
1148 CALL timestop(handle)
1165 do_directional_exciton_descriptors, qs_env)
1166 INTEGER,
INTENT(in) :: log_unit
1167 TYPE(cp_fm_type),
DIMENSION(:, :),
INTENT(in) :: evects
1168 TYPE(tddfpt_ground_state_mos),
DIMENSION(:), &
1169 INTENT(in) :: gs_mos
1170 TYPE(dbcsr_type),
POINTER :: matrix_s
1171 LOGICAL,
INTENT(IN) :: do_directional_exciton_descriptors
1172 TYPE(qs_environment_type),
INTENT(IN),
POINTER :: qs_env
1174 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tddfpt_print_exciton_descriptors'
1176 CHARACTER(LEN=4) :: prefix_output
1177 INTEGER :: handle, ispin, istate, n_moments_quad, &
1178 nao, nspins, nstates
1179 INTEGER,
DIMENSION(maxspins) :: nmo_occ, nmo_virt
1180 LOGICAL :: print_checkvalue
1181 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:) :: ref_point_multipole
1182 TYPE(cp_blacs_env_type),
POINTER :: blacs_env
1183 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_mo_coeff, &
1184 fm_struct_s_mos_virt, fm_struct_x_ia_n
1185 TYPE(cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: eigvec_x_ia_n, fm_multipole_ab, &
1186 fm_multipole_ai, fm_multipole_ij, &
1188 TYPE(cp_fm_type),
DIMENSION(:),
POINTER :: mo_coeff
1189 TYPE(exciton_descr_type),
ALLOCATABLE, &
1190 DIMENSION(:) :: exc_descr
1192 CALL timeset(routinen, handle)
1194 nspins =
SIZE(evects, 1)
1195 nstates =
SIZE(evects, 2)
1197 cpassert(nspins == 1)
1199 CALL cp_fm_get_info(gs_mos(1)%mos_occ, context=blacs_env)
1200 CALL dbcsr_get_info(matrix_s, nfullrows_total=nao)
1202 DO ispin = 1, nspins
1203 nmo_occ(ispin) =
SIZE(gs_mos(ispin)%evals_occ)
1204 nmo_virt(ispin) =
SIZE(gs_mos(ispin)%evals_virt)
1208 ALLOCATE (mo_coeff(nspins))
1209 CALL cp_fm_struct_create(fm_struct_mo_coeff, nrow_global=nao, ncol_global=nao, &
1211 DO ispin = 1, nspins
1212 CALL cp_fm_create(mo_coeff(ispin), fm_struct_mo_coeff)
1213 CALL cp_fm_to_fm_submat_general(gs_mos(ispin)%mos_occ, &
1222 CALL cp_fm_to_fm_submat_general(gs_mos(ispin)%mos_virt, &
1229 nmo_occ(ispin) + 1, &
1232 CALL cp_fm_struct_release(fm_struct_mo_coeff)
1237 ALLOCATE (ref_point_multipole(3))
1238 ALLOCATE (fm_multipole_ij(n_moments_quad))
1239 ALLOCATE (fm_multipole_ab(n_moments_quad))
1240 ALLOCATE (fm_multipole_ai(n_moments_quad))
1242 CALL get_multipoles_mo(fm_multipole_ai, fm_multipole_ij, fm_multipole_ab, &
1243 qs_env, mo_coeff, ref_point_multipole, 2, &
1244 nmo_occ(1), nmo_virt(1), blacs_env)
1246 CALL cp_fm_release(mo_coeff)
1249 ALLOCATE (s_mos_virt(nspins), eigvec_x_ia_n(nspins))
1250 DO ispin = 1, nspins
1251 CALL cp_fm_get_info(gs_mos(ispin)%mos_virt, matrix_struct=fm_struct_s_mos_virt)
1252 CALL cp_fm_create(s_mos_virt(ispin), fm_struct_s_mos_virt)
1253 NULLIFY (fm_struct_s_mos_virt)
1254 CALL cp_dbcsr_sm_fm_multiply(matrix_s, &
1255 gs_mos(ispin)%mos_virt, &
1256 s_mos_virt(ispin), &
1257 ncol=nmo_virt(ispin), alpha=1.0_dp, beta=0.0_dp)
1259 CALL cp_fm_struct_create(fm_struct_x_ia_n, nrow_global=nmo_occ(ispin), ncol_global=nmo_virt(ispin), &
1261 CALL cp_fm_create(eigvec_x_ia_n(ispin), fm_struct_x_ia_n)
1262 CALL cp_fm_struct_release(fm_struct_x_ia_n)
1264 ALLOCATE (exc_descr(nstates))
1265 DO istate = 1, nstates
1266 DO ispin = 1, nspins
1267 CALL cp_fm_set_all(eigvec_x_ia_n(ispin), 0.0_dp)
1274 CALL parallel_gemm(
'T',
'N', nmo_occ(ispin), nmo_virt(ispin), nao, 1.0_dp, &
1275 evects(ispin, istate), s_mos_virt(ispin), 0.0_dp, eigvec_x_ia_n(ispin))
1277 CALL get_exciton_descriptors(exc_descr, eigvec_x_ia_n(ispin), &
1278 fm_multipole_ij, fm_multipole_ab, &
1280 istate, nmo_occ(ispin), nmo_virt(ispin))
1284 CALL cp_fm_release(eigvec_x_ia_n)
1285 CALL cp_fm_release(s_mos_virt)
1286 CALL cp_fm_release(fm_multipole_ai)
1287 CALL cp_fm_release(fm_multipole_ij)
1288 CALL cp_fm_release(fm_multipole_ab)
1291 print_checkvalue = .true.
1293 CALL print_exciton_descriptors(exc_descr, ref_point_multipole, log_unit, &
1294 nstates, print_checkvalue, do_directional_exciton_descriptors, &
1295 prefix_output, qs_env)
1297 DEALLOCATE (ref_point_multipole)
1298 DEALLOCATE (exc_descr)
1300 CALL timestop(handle)
1311 SUBROUTINE project_vector(vin, vout, mos_occ, matrix_s)
1312 TYPE(dbcsr_type) :: vin, vout
1313 TYPE(cp_fm_type),
INTENT(IN) :: mos_occ
1314 TYPE(dbcsr_type),
POINTER :: matrix_s
1316 CHARACTER(LEN=*),
PARAMETER :: routinen =
'project_vector'
1318 INTEGER :: handle, nao, nmo
1319 REAL(kind=dp) :: norm(1)
1320 TYPE(cp_fm_struct_type),
POINTER :: fm_struct, fm_vec_struct
1321 TYPE(cp_fm_type) :: csvec, svec, vec
1323 CALL timeset(routinen, handle)
1325 CALL cp_fm_get_info(mos_occ, matrix_struct=fm_struct, nrow_global=nao, ncol_global=nmo)
1326 CALL cp_fm_struct_create(fmstruct=fm_vec_struct, template_fmstruct=fm_struct, &
1327 nrow_global=nao, ncol_global=1)
1328 CALL cp_fm_create(vec, fm_vec_struct)
1329 CALL cp_fm_create(svec, fm_vec_struct)
1330 CALL cp_fm_struct_release(fm_vec_struct)
1331 CALL cp_fm_struct_create(fmstruct=fm_vec_struct, template_fmstruct=fm_struct, &
1332 nrow_global=nmo, ncol_global=1)
1333 CALL cp_fm_create(csvec, fm_vec_struct)
1334 CALL cp_fm_struct_release(fm_vec_struct)
1336 CALL copy_dbcsr_to_fm(vin, vec)
1337 CALL cp_dbcsr_sm_fm_multiply(matrix_s, vec, svec, ncol=1, alpha=1.0_dp, beta=0.0_dp)
1338 CALL parallel_gemm(
'T',
'N', nmo, 1, nao, 1.0_dp, mos_occ, svec, 0.0_dp, csvec)
1339 CALL parallel_gemm(
'N',
'N', nao, 1, nmo, -1.0_dp, mos_occ, csvec, 1.0_dp, vec)
1340 CALL cp_fm_vectorsnorm(vec, norm)
1341 cpassert(norm(1) > 1.e-14_dp)
1342 norm(1) = sqrt(1._dp/norm(1))
1343 CALL cp_fm_scale(norm(1), vec)
1344 CALL copy_fm_to_dbcsr(vec, vout, keep_sparsity=.false.)
1346 CALL cp_fm_release(csvec)
1347 CALL cp_fm_release(svec)
1348 CALL cp_fm_release(vec)
1350 CALL timestop(handle)
1352 END SUBROUTINE project_vector
1360 SUBROUTINE vec_product(va, vb, res)
1361 TYPE(dbcsr_type) :: va, vb
1362 REAL(kind=dp),
INTENT(OUT) :: res
1364 CHARACTER(LEN=*),
PARAMETER :: routinen =
'vec_product'
1366 INTEGER :: handle, icol, irow
1368 REAL(kind=dp),
DIMENSION(:, :),
POINTER :: vba, vbb
1369 TYPE(dbcsr_iterator_type) :: iter
1370 TYPE(mp_comm_type) :: group
1372 CALL timeset(routinen, handle)
1376 CALL dbcsr_get_info(va, group=group)
1377 CALL dbcsr_iterator_start(iter, va)
1378 DO WHILE (dbcsr_iterator_blocks_left(iter))
1379 CALL dbcsr_iterator_next_block(iter, irow, icol, vba)
1380 CALL dbcsr_get_block_p(vb, row=irow, col=icol, block=vbb, found=found)
1381 res = res + sum(vba*vbb)
1384 CALL dbcsr_iterator_stop(iter)
1387 CALL timestop(handle)
1389 END SUBROUTINE vec_product
1400 SUBROUTINE print_nto_cubes(qs_env, mos, istate, stride, append_cube, print_section)
1402 TYPE(qs_environment_type),
POINTER :: qs_env
1403 TYPE(mo_set_type),
DIMENSION(:),
INTENT(IN) :: mos
1404 INTEGER,
INTENT(IN) :: istate
1405 INTEGER,
DIMENSION(:),
POINTER :: stride
1406 LOGICAL,
INTENT(IN) :: append_cube
1407 TYPE(section_vals_type),
POINTER :: print_section
1409 CHARACTER(LEN=default_path_length) :: filename, my_pos_cube, title
1410 INTEGER :: i, iset, nmo, unit_nr
1412 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
1413 TYPE(cell_type),
POINTER :: cell
1414 TYPE(cp_fm_type),
POINTER :: mo_coeff
1415 TYPE(cp_logger_type),
POINTER :: logger
1416 TYPE(dft_control_type),
POINTER :: dft_control
1417 TYPE(particle_list_type),
POINTER :: particles
1418 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1419 TYPE(pw_c1d_gs_type) :: wf_g
1420 TYPE(pw_env_type),
POINTER :: pw_env
1421 TYPE(pw_pool_p_type),
DIMENSION(:),
POINTER :: pw_pools
1422 TYPE(pw_pool_type),
POINTER :: auxbas_pw_pool
1423 TYPE(pw_r3d_rs_type) :: wf_r
1424 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1425 TYPE(qs_subsys_type),
POINTER :: subsys
1427 logger => cp_get_default_logger()
1429 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control, pw_env=pw_env)
1430 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, pw_pools=pw_pools)
1431 CALL auxbas_pw_pool%create_pw(wf_r)
1432 CALL auxbas_pw_pool%create_pw(wf_g)
1434 CALL get_qs_env(qs_env, subsys=subsys)
1435 CALL qs_subsys_get(subsys, particles=particles)
1437 my_pos_cube =
"REWIND"
1438 IF (append_cube)
THEN
1439 my_pos_cube =
"APPEND"
1442 CALL get_qs_env(qs_env=qs_env, &
1443 atomic_kind_set=atomic_kind_set, &
1444 qs_kind_set=qs_kind_set, &
1446 particle_set=particle_set)
1449 CALL get_mo_set(mo_set=mos(iset), mo_coeff=mo_coeff, nmo=nmo)
1451 CALL calculate_wavefunction(mo_coeff, i, wf_r, wf_g, atomic_kind_set, qs_kind_set, &
1452 cell, dft_control, particle_set, pw_env)
1454 WRITE (filename,
'(a4,I3.3,I2.2,a11)')
"NTO_STATE", istate, i,
"_Hole_State"
1455 ELSEIF (iset == 2)
THEN
1456 WRITE (filename,
'(a4,I3.3,I2.2,a15)')
"NTO_STATE", istate, i,
"_Particle_State"
1459 unit_nr = cp_print_key_unit_nr(logger, print_section,
'', extension=
".cube", &
1460 middle_name=trim(filename), file_position=my_pos_cube, &
1461 log_filename=.false., ignore_should_output=.true., mpi_io=mpi_io)
1463 WRITE (title, *)
"Natural Transition Orbital Hole State", i
1464 ELSEIF (iset == 2)
THEN
1465 WRITE (title, *)
"Natural Transition Orbital Particle State", i
1467 CALL cp_pw_to_cube(wf_r, unit_nr, title, particles=particles, stride=stride, mpi_io=mpi_io)
1468 CALL cp_print_key_finished_output(unit_nr, logger, print_section,
'', &
1469 ignore_should_output=.true., mpi_io=mpi_io)
1473 CALL auxbas_pw_pool%give_back_pw(wf_g)
1474 CALL auxbas_pw_pool%give_back_pw(wf_r)
1476 END SUBROUTINE print_nto_cubes
Define the atomic kind types and their sub types.
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public martin2003
Routines for printing information in context of the BSE calculation.
subroutine, public print_exciton_descriptors(exc_descr, ref_point_multipole, unit_nr, num_print_exc_descr, print_checkvalue, print_directional_exc_descr, prefix_output, qs_env)
Prints exciton descriptors, cf. Mewes et al., JCTC 14, 710-725 (2018)
Routines for computing excitonic properties, e.g. exciton diameter, from the BSE.
subroutine, public get_exciton_descriptors(exc_descr, fm_x_ia, fm_multipole_ij_trunc, fm_multipole_ab_trunc, fm_multipole_ai_trunc, i_exc, homo, virtual, fm_y_ia)
...
Auxiliary routines for GW + Bethe-Salpeter for computing electronic excitations.
subroutine, public get_multipoles_mo(fm_multipole_ai_trunc, fm_multipole_ij_trunc, fm_multipole_ab_trunc, qs_env, mo_coeff, rpoint, n_moments, homo_red, virtual_red, context_bse)
...
Handles all functions related to the CELL.
methods related to the blacs parallel environment
Basic linear algebra operations for complex full matrices.
subroutine, public cp_cfm_solve(matrix_a, general_a, determinant)
Solve the system of linear equations A*b=A_general using LU decomposition. Pay attention that both ma...
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.
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_set_all(matrix, alpha, beta)
Set all elements of the full matrix to alpha. Besides, set all diagonal matrix elements to beta (if g...
subroutine, public cp_cfm_to_fm(msource, mtargetr, mtargeti)
Copy real and imaginary parts of a complex full matrix into separate real-value full matrices.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_iterator_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset)
...
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_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
subroutine, public dbcsr_init_p(matrix)
...
subroutine, public dbcsr_iterator_start(iterator, matrix, shared, dynamic, dynamic_byrows)
...
subroutine, public dbcsr_set(matrix, alpha)
...
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.
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr matrix.
basic linear algebra operations for full matrices
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_scale(alpha, matrix_a)
scales a matrix matrix_a = alpha * matrix_b
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
subroutine, public cp_fm_geeig(amatrix, bmatrix, eigenvectors, eigenvalues, work)
General Eigenvalue Problem AX = BXE Single option version: Cholesky decomposition of B.
subroutine, public choose_eigv_solver(matrix, eigenvectors, eigenvalues, info)
Choose the Eigensolver depending on which library is available ELPA seems to be unstable for small sy...
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_vectorsnorm(matrix, norm_array)
find the inorm of each column norm_{j}= sqrt( \sum_{i} A_{ij}*A_{ij} )
subroutine, public cp_fm_to_fm_submat_general(source, destination, nrows, ncols, s_firstrow, s_firstcol, d_firstrow, d_firstcol, global_context)
General copy of a submatrix of fm matrix to a submatrix of another fm matrix. The two matrices can ha...
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 ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
A wrapper around pw_to_cube() which accepts particle_list_type.
subroutine, public cp_pw_to_cube(pw, unit_nr, title, particles, stride, zero_tails, silent, mpi_io)
...
sums arrays of real/complex numbers with much reduced round-off as compared to a naive implementation...
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
integer, parameter, public default_path_length
Definition of mathematical constants and functions.
complex(kind=dp), parameter, public z_one
real(kind=dp), parameter, public twopi
complex(kind=dp), parameter, public z_zero
Interface to the message passing library MPI.
Functions handling the MOLDEN format. Split from mode_selective.
subroutine, public write_mos_molden(mos, qs_kind_set, particle_set, print_section)
Write out the MOs in molden format for visualisation.
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
represent a simple array based list of the given type
Define the data structure for the particle information.
Definition of physical constants:
real(kind=dp), parameter, public evolt
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
functions related to the poisson solver on regular grids
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Calculate the plane wave density by collocating the primitive Gaussian functions (pgf).
subroutine, public calculate_wavefunction(mo_vectors, ivector, rho, rho_gspace, atomic_kind_set, qs_kind_set, cell, dft_control, particle_set, pw_env, basis_type)
maps a given wavefunction on the grid
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
Definition and initialisation of the mo data type.
subroutine, public set_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, uniform_occupation, kts, mu, flexible_electron_count)
Set the components of a MO set data structure.
subroutine, public allocate_mo_set(mo_set, nao, nmo, nelectron, n_el_f, maxocc, flexible_electron_count)
Allocates a mo set and partially initializes it (nao,nmo,nelectron, and flexible_electron_count are v...
subroutine, public deallocate_mo_set(mo_set)
Deallocate a wavefunction data structure.
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.
subroutine, public init_mo_set(mo_set, fm_pool, fm_ref, fm_struct, name)
initializes an allocated mo_set. eigenvalues, mo_coeff, occupation_numbers are valid only after this ...
Calculates the moment integrals <a|r^m|b> and <a|r x d/dr|b>
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.
subroutine, public rrc_xyz_ao(op, qs_env, rc, order, minimum_image, soft)
Calculation of the components of the dipole operator in the length form by taking the relative positi...
Calculation of overlap matrix, its derivatives and forces.
subroutine, public build_overlap_matrix(ks_env, matrix_s, matrixkp_s, matrix_name, nderivative, basis_type_a, basis_type_b, sab_nl, calculate_forces, matrix_p, matrixkp_p)
Calculation of the overlap matrix over Cartesian Gaussian functions.
types that represent a quickstep subsys
subroutine, public qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
...
subroutine, public tddfpt_print_excitation_analysis(log_unit, evects, evals, gs_mos, matrix_s, min_amplitude)
Print excitation analysis.
subroutine, public tddfpt_dipole_operator(dipole_op_mos_occ, tddfpt_control, gs_mos, qs_env)
Compute the action of the dipole operator on the ground state wave function.
subroutine, public tddfpt_print_nto_analysis(qs_env, evects, evals, ostrength, gs_mos, matrix_s, print_section)
Print natural transition orbital analysis.
subroutine, public tddfpt_print_summary(log_unit, evects, evals, ostrength, mult, dipole_op_mos_occ, dipole_form)
Print final TDDFPT excitation energies and oscillator strengths.
subroutine, public tddfpt_print_exciton_descriptors(log_unit, evects, gs_mos, matrix_s, do_directional_exciton_descriptors, qs_env)
Print exciton descriptors, cf. Mewes et al., JCTC 14, 710-725 (2018)
Utilities for string manipulations.
subroutine, public integer_to_string(inumber, string)
Converts an integer number to a string. The WRITE statement will return an error message,...
All kind of helpful little routines.
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
Represent a complex full matrix.
keeps the information about the structure of a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
represent a list of objects
contained for different pw related things
environment for the poisson solver
to create arrays of pools
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
Ground state molecular orbitals.