142#include "./base/base_uses.f90"
148 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_scf_post_tb'
168 CHARACTER(LEN=*) :: tb_type
169 LOGICAL,
INTENT(IN) :: no_mos
171 CHARACTER(len=*),
PARAMETER :: routinen =
'scf_post_calculation_tb'
173 CHARACTER(LEN=6) :: ana
174 CHARACTER(LEN=default_string_length) :: aname
175 INTEGER :: after, gfn_type, handle, homo, iat, iatom, ikind, img, ispin, iw, nat, natom, &
176 nkind, nlumo_stm, nlumos, nspins, print_level, unit_nr
177 LOGICAL :: do_cube, do_kpoints, explicit, gfn0, &
178 has_homo, omit_headers, print_it, &
180 REAL(kind=
dp) :: zeff
181 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: mcharge
182 REAL(kind=
dp),
DIMENSION(2, 2) :: homo_lumo
183 REAL(kind=
dp),
DIMENSION(:),
POINTER :: echarge, mo_eigenvalues
184 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: charges
186 TYPE(
cp_1d_r_p_type),
DIMENSION(:),
POINTER :: unoccupied_evals_stm
187 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: unoccupied_orbs_stm
190 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: ks_rmpv, mo_derivs
191 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_ks, matrix_p, matrix_s
200 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
206 print_section, sprint_section, &
210 CALL timeset(routinen, handle)
216 CALL get_qs_env(qs_env, dft_control=dft_control)
217 SELECT CASE (trim(tb_type))
220 gfn_type = dft_control%qs_control%xtb_control%gfn_type
221 gfn0 = (gfn_type == 0)
222 vdip = dft_control%qs_control%xtb_control%var_dipole
224 cpabort(
"unknown TB type")
227 cpassert(
ASSOCIATED(qs_env))
228 NULLIFY (rho, para_env, matrix_s, matrix_p)
229 CALL get_qs_env(qs_env, scf_env=scf_env, atomic_kind_set=atomic_kind_set, qs_kind_set=qs_kind_set, &
230 rho=rho, natom=natom, para_env=para_env, &
231 particle_set=particle_set, do_kpoints=do_kpoints, matrix_s_kp=matrix_s)
232 nspins = dft_control%nspins
235 ALLOCATE (charges(natom, nspins), mcharge(natom))
239 nkind =
SIZE(atomic_kind_set)
242 SELECT CASE (trim(tb_type))
244 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
247 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
250 cpabort(
"unknown TB type")
253 iat = atomic_kind_set(ikind)%atom_list(iatom)
254 mcharge(iat) = zeff - sum(charges(iat, 1:nspins))
265 extension=
".mulliken", log_filename=.false.)
266 IF (unit_nr > 0)
THEN
267 WRITE (unit=unit_nr, fmt=
"(/,/,T2,A)")
"MULLIKEN POPULATION ANALYSIS"
268 IF (nspins == 1)
THEN
269 WRITE (unit=unit_nr, fmt=
"(/,T2,A,T70,A)") &
270 " # Atom Element Kind Atomic population",
" Net charge"
274 SELECT CASE (tb_type)
276 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
279 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
282 cpabort(
"unknown TB type")
284 ana = adjustr(trim(adjustl(aname)))
286 iat = atomic_kind_set(ikind)%atom_list(iatom)
287 WRITE (unit=unit_nr, &
288 fmt=
"(T2,I7,5X,A6,I6,T39,F12.6,T69,F12.6)") &
289 iat, adjustl(ana), ikind, charges(iat, 1), mcharge(iat)
292 WRITE (unit=unit_nr, &
293 fmt=
"(T2,A,T39,F12.6,T69,F12.6,/)") &
294 "# Total charge", sum(charges(:, 1)), sum(mcharge(:))
296 WRITE (unit=unit_nr, fmt=
"(/,T2,A)") &
297 "# Atom Element Kind Atomic population (alpha,beta) Net charge Spin moment"
301 SELECT CASE (tb_type)
303 CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_kind)
306 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
309 cpabort(
"unknown TB type")
311 ana = adjustr(trim(adjustl(aname)))
313 iat = atomic_kind_set(ikind)%atom_list(iatom)
314 WRITE (unit=unit_nr, &
315 fmt=
"(T2,I6,3X,A6,I6,T29,4(1X,F12.6))") &
316 iat, adjustl(ana), ikind, charges(iat, 1:2), mcharge(iat), &
317 charges(iat, 1) - charges(iat, 2)
320 WRITE (unit=unit_nr, &
321 fmt=
"(T2,A,T29,4(1X,F12.6),/)") &
322 "# Total charge and spin", sum(charges(:, 1)), sum(charges(:, 2)), sum(mcharge(:))
332 SELECT CASE (tb_type)
334 cpwarn(
"Lowdin population analysis not implemented for DFTB method.")
337 log_filename=.false.)
340 IF (print_it) print_level = 2
342 IF (print_it) print_level = 3
344 cpwarn(
"Lowdin charges not implemented for k-point calculations!")
350 cpabort(
"unknown TB type")
358 extension=
".eeq", log_filename=.false.)
359 CALL eeq_print(qs_env, unit_nr, print_level, ext=gfn0)
368 cpwarn(
"Hirshfeld charges not available for TB methods.")
377 cpwarn(
"MAO analysis not available for TB methods.")
386 cpwarn(
"ED analysis not available for TB methods.")
394 extension=
".data", middle_name=
"tb_dipole", log_filename=.false.)
399 cpassert(
ASSOCIATED(echarge))
402 mcharge(1:natom) = echarge(1:natom) - mcharge(1:natom)
404 CALL tb_dipole(qs_env, moments_section, unit_nr, mcharge)
406 CALL tb_dipole(qs_env, moments_section, unit_nr, mcharge)
411 DEALLOCATE (charges, mcharge)
414 IF (.NOT. no_mos)
THEN
418 IF (.NOT. do_kpoints)
THEN
419 SELECT CASE (tb_type)
426 cpabort(
"Unknown TB type")
433 IF (.NOT. no_mos)
THEN
436 IF (explicit .AND. .NOT. qs_env%run_rtp)
CALL wfn_mix_tb(qs_env, dft_section, scf_env)
439 IF (.NOT. no_mos)
THEN
443 CALL get_qs_env(qs_env=qs_env, kpoints=kpoints)
453 IF (.NOT. no_mos)
THEN
457 cpwarn(
"Projected density of states not implemented for k-points.")
459 CALL get_qs_env(qs_env, mos=mos, matrix_ks=ks_rmpv)
460 DO ispin = 1, dft_control%nspins
462 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, &
463 eigenvalues=mo_eigenvalues)
464 IF (
ASSOCIATED(qs_env%mo_derivs))
THEN
465 mo_coeff_deriv => qs_env%mo_derivs(ispin)%matrix
467 mo_coeff_deriv => null()
470 do_rotation=.true., &
471 co_rotate_dbcsr=mo_coeff_deriv)
474 IF (dft_control%nspins == 2)
THEN
476 qs_kind_set, particle_set, qs_env, dft_section, ispin=ispin)
479 qs_kind_set, particle_set, qs_env, dft_section)
487 SELECT CASE (tb_type)
495 cpabort(
"unknown TB type")
503 cpwarn(
"Energy Windows not implemented for k-points.")
506 CALL rebuild_pw_env(qs_env)
512 cpwarn(
"Energy Windows not implemented for TB methods.")
521 CALL rebuild_pw_env(qs_env)
524 CALL print_e_density(qs_env, print_key)
526 cpwarn(
"Electronic density cube file not implemented for TB methods.")
535 CALL rebuild_pw_env(qs_env)
538 CALL print_density_cubes(qs_env, print_key, total_density=.true.)
540 cpwarn(
"Total density cube file not implemented for TB methods.")
549 CALL rebuild_pw_env(qs_env)
552 CALL print_density_cubes(qs_env, print_key, v_hartree=.true.)
554 cpwarn(
"Hartree potential cube file not implemented for TB methods.")
563 CALL rebuild_pw_env(qs_env)
566 CALL print_density_cubes(qs_env, print_key, efield=.true.)
568 cpwarn(
"Efield cube file not implemented for TB methods.")
577 CALL rebuild_pw_env(qs_env)
580 CALL print_elf(qs_env, print_key)
582 cpwarn(
"ELF not implemented for TB methods.")
587 IF (.NOT. no_mos)
THEN
592 CALL rebuild_pw_env(qs_env)
595 CALL print_mo_cubes(qs_env, print_key)
597 cpwarn(
"Printing of MO cube files not implemented for TB methods.")
603 IF (.NOT. no_mos)
THEN
608 CALL rebuild_pw_env(qs_env)
612 cpwarn(
"STM not implemented for k-point calculations!")
615 cpassert(.NOT. dft_control%restricted)
616 CALL get_qs_env(qs_env, mos=mos, mo_derivs=mo_derivs, &
617 scf_control=scf_control, matrix_ks=ks_rmpv)
618 CALL make_mo_eig(mos, dft_control%nspins, ks_rmpv, scf_control, mo_derivs)
619 DO ispin = 1, dft_control%nspins
620 CALL get_mo_set(mo_set=mos(ispin), eigenvalues=mo_eigenvalues, homo=homo)
621 homo_lumo(ispin, 1) = mo_eigenvalues(homo)
624 NULLIFY (unoccupied_orbs_stm, unoccupied_evals_stm)
625 IF (nlumo_stm > 0)
THEN
626 ALLOCATE (unoccupied_orbs_stm(dft_control%nspins))
627 ALLOCATE (unoccupied_evals_stm(dft_control%nspins))
628 CALL make_lumo_tb(qs_env, scf_env, unoccupied_orbs_stm, unoccupied_evals_stm, &
634 CALL th_stm_image(qs_env, print_key, particles, unoccupied_orbs_stm, &
635 unoccupied_evals_stm)
637 IF (nlumo_stm > 0)
THEN
638 DO ispin = 1, dft_control%nspins
639 DEALLOCATE (unoccupied_evals_stm(ispin)%array)
641 DEALLOCATE (unoccupied_evals_stm)
650 CALL get_qs_env(qs_env, matrix_ks_kp=matrix_ks)
657 after = min(max(after, 1), 16)
658 DO ispin = 1, dft_control%nspins
659 DO img = 1,
SIZE(matrix_p, 2)
661 para_env, output_unit=iw, omit_headers=omit_headers)
669 "AO_MATRICES/KOHN_SHAM_MATRIX"),
cp_p_file))
THEN
673 after = min(max(after, 1), 16)
674 DO ispin = 1, dft_control%nspins
675 DO img = 1,
SIZE(matrix_ks, 2)
677 output_unit=iw, omit_headers=omit_headers)
690 cpwarn(
"XC potential cube file not available for TB methods.")
699 cpwarn(
"Electric field gradient not implemented for TB methods.")
708 cpwarn(
"Kinetic energy not available for TB methods.")
717 cpwarn(
"Xray diffraction spectrum not implemented for TB methods.")
726 cpwarn(
"Hyperfine Coupling not implemented for TB methods.")
735 cpwarn(
"DFT+U method not implemented for TB methods.")
742 CALL timestop(handle)
753 SUBROUTINE tb_dipole(qs_env, input, unit_nr, charges)
757 INTEGER,
INTENT(in) :: unit_nr
758 REAL(kind=
dp),
DIMENSION(:),
INTENT(in) :: charges
760 CHARACTER(LEN=default_string_length) :: description, dipole_type
761 COMPLEX(KIND=dp) :: dzeta, dzphase(3), zeta, zphase(3)
762 COMPLEX(KIND=dp),
DIMENSION(3) :: dggamma, ggamma
763 INTEGER :: i, iat, ikind, j, nat, reference
765 REAL(kind=
dp) :: charge_tot, ci(3), dci(3), dipole(3), dipole_deriv(3), drcc(3), dria(3), &
766 dtheta, gvec(3), q, rcc(3), ria(3), theta, tmp(3), via(3)
767 REAL(kind=
dp),
DIMENSION(:),
POINTER :: ref_point
773 NULLIFY (atomic_kind_set, cell, results)
774 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, &
775 particle_set=particle_set, cell=cell, results=results)
780 description =
'[DIPOLE]'
784 CALL get_reference_point(rcc, drcc, qs_env=qs_env, reference=reference, ref_point=ref_point)
787 dipole_deriv = 0.0_dp
790 dipole_type =
"periodic (Berry phase)"
793 charge_tot = sum(charges)
794 ria =
twopi*matmul(cell%h_inv, rcc)
795 zphase = cmplx(cos(ria), sin(ria),
dp)**charge_tot
797 dria =
twopi*matmul(cell%h_inv, drcc)
798 dzphase = charge_tot*cmplx(-sin(ria), cos(ria),
dp)**(charge_tot - 1.0_dp)*dria
800 ggamma = cmplx(1.0_dp, 0.0_dp, kind=
dp)
801 dggamma = cmplx(0.0_dp, 0.0_dp, kind=
dp)
802 DO ikind = 1,
SIZE(atomic_kind_set)
805 iat = atomic_kind_set(ikind)%atom_list(i)
806 ria = particle_set(iat)%r(:)
808 via = particle_set(iat)%v(:)
811 gvec =
twopi*cell%h_inv(j, :)
812 theta = sum(ria(:)*gvec(:))
813 dtheta = sum(via(:)*gvec(:))
814 zeta = cmplx(cos(theta), sin(theta), kind=
dp)**(-q)
815 dzeta = -q*cmplx(-sin(theta), cos(theta), kind=
dp)**(-q - 1.0_dp)*dtheta
816 dggamma(j) = dggamma(j)*zeta + ggamma(j)*dzeta
817 ggamma(j) = ggamma(j)*zeta
821 dggamma = dggamma*zphase + ggamma*dzphase
822 ggamma = ggamma*zphase
823 IF (all(real(ggamma, kind=
dp) /= 0.0_dp))
THEN
824 tmp = aimag(ggamma)/real(ggamma, kind=
dp)
826 dci = -(1.0_dp/(1.0_dp + tmp**2))* &
827 (aimag(dggamma)*real(ggamma, kind=
dp) - aimag(ggamma)*real(dggamma, kind=
dp))/(real(ggamma, kind=
dp))**2
828 dipole = matmul(cell%hmat, ci)/
twopi
829 dipole_deriv = matmul(cell%hmat, dci)/
twopi
832 dipole_type =
"non-periodic"
833 DO i = 1,
SIZE(particle_set)
835 ria = particle_set(i)%r(:)
837 dipole = dipole + q*(ria - rcc)
838 dipole_deriv(:) = dipole_deriv(:) + q*(particle_set(i)%v(:) - drcc)
842 CALL put_results(results=results, description=description, &
844 IF (unit_nr > 0)
THEN
845 WRITE (unit_nr,
'(/,T2,A,T31,A50)') &
846 'TB_DIPOLE| Dipole type', adjustr(trim(dipole_type))
847 WRITE (unit_nr,
"(T2,A,T30,3(1X,F16.8))")
"TB_DIPOLE| Ref. Point [Bohr]", rcc
848 WRITE (unit_nr,
'(T2,A,T30,3(1X,F16.8))') &
849 'TB_DIPOLE| Moment [a.u.]', dipole(1:3)
850 WRITE (unit_nr,
'(T2,A,T30,3(1X,F16.8))') &
851 'TB_DIPOLE| Moment [Debye]', dipole(1:3)*
debye
852 WRITE (unit_nr,
'(T2,A,T30,3(1X,F16.8))') &
853 'TB_DIPOLE| Derivative [a.u.]', dipole_deriv(1:3)
856 END SUBROUTINE tb_dipole
867 SUBROUTINE wfn_mix_tb(qs_env, dft_section, scf_env)
873 INTEGER :: ispin, nao, nmo, output_unit
874 REAL(
dp),
DIMENSION(:),
POINTER :: mo_eigenvalues
877 TYPE(
cp_fm_type) :: ks_tmp, mo_tmp, s_tmp, work
878 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: lumos
881 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks, matrix_s
885 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
889 CALL get_qs_env(qs_env=qs_env, matrix_s=matrix_s, matrix_ks=matrix_ks, &
890 particle_set=particle_set, atomic_kind_set=atomic_kind_set, &
891 qs_kind_set=qs_kind_set, mos=mos, para_env=para_env)
895 CALL get_mo_set(mos(1), mo_coeff=mo_coeff, nao=nao)
898 template_fmstruct=mo_coeff%matrix_struct)
903 ALLOCATE (lumos(
SIZE(mos)))
908 DO ispin = 1,
SIZE(mos)
909 CALL get_mo_set(mos(ispin), mo_coeff=mo_coeff, eigenvalues=mo_eigenvalues, nmo=nmo)
910 CALL cp_fm_struct_create(fmstruct=ao_lumo_struct, nrow_global=nao, ncol_global=nao - nmo, &
911 template_fmstruct=mo_coeff%matrix_struct)
913 CALL cp_fm_create(lumos(ispin), matrix_struct=ao_lumo_struct)
925 CALL wfn_mix(mos, particle_set, dft_section, qs_kind_set, para_env, output_unit, &
926 unoccupied_orbs=lumos, scf_env=scf_env, matrix_s=matrix_s)
935 END SUBROUTINE wfn_mix_tb
946 SUBROUTINE make_lumo_tb(qs_env, scf_env, unoccupied_orbs, unoccupied_evals, nlumo, nlumos)
950 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: unoccupied_orbs
951 TYPE(
cp_1d_r_p_type),
DIMENSION(:),
INTENT(INOUT) :: unoccupied_evals
953 INTEGER,
INTENT(OUT) :: nlumos
955 INTEGER :: homo, iounit, ispin, n, nao, nmo
960 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: ks_rmpv, matrix_s
967 NULLIFY (mos, ks_rmpv, scf_control, dft_control, para_env, blacs_env)
971 scf_control=scf_control, &
972 dft_control=dft_control, &
980 DO ispin = 1, dft_control%nspins
981 NULLIFY (unoccupied_evals(ispin)%array)
983 IF (iounit > 0)
WRITE (iounit, *)
" "
984 IF (iounit > 0)
WRITE (iounit, *)
" Lowest Eigenvalues of the unoccupied subspace spin ", ispin
985 IF (iounit > 0)
WRITE (iounit, fmt=
'(1X,A)')
"-----------------------------------------------------"
986 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, homo=homo, nao=nao, nmo=nmo)
988 nlumos = max(1, min(nlumo, nao - nmo))
989 IF (nlumo == -1) nlumos = nao - nmo
990 ALLOCATE (unoccupied_evals(ispin)%array(nlumos))
992 nrow_global=n, ncol_global=nlumos)
993 CALL cp_fm_create(unoccupied_orbs(ispin), fm_struct_tmp, name=
"lumos")
998 NULLIFY (local_preconditioner)
999 IF (
ASSOCIATED(scf_env%ot_preconditioner))
THEN
1000 local_preconditioner => scf_env%ot_preconditioner(1)%preconditioner
1003 NULLIFY (local_preconditioner)
1007 CALL ot_eigensolver(matrix_h=ks_rmpv(ispin)%matrix, matrix_s=matrix_s(1)%matrix, &
1008 matrix_c_fm=unoccupied_orbs(ispin), &
1009 matrix_orthogonal_space_fm=mo_coeff, &
1010 eps_gradient=scf_control%eps_lumos, &
1012 iter_max=scf_control%max_iter_lumos, &
1013 size_ortho_space=nmo)
1016 unoccupied_evals(ispin)%array, scr=iounit, &
1027 SUBROUTINE rebuild_pw_env(qs_env)
1031 LOGICAL :: skip_load_balance_distributed
1039 CALL get_qs_env(qs_env, ks_env=ks_env, dft_control=dft_control, pw_env=new_pw_env)
1040 IF (.NOT.
ASSOCIATED(new_pw_env))
THEN
1045 CALL get_qs_env(qs_env, pw_env=new_pw_env, dft_control=dft_control, cell=cell)
1047 new_pw_env%cell_hmat = cell%hmat
1052 IF (.NOT.
ASSOCIATED(task_list))
THEN
1056 skip_load_balance_distributed = dft_control%qs_control%skip_load_balance_distributed
1058 reorder_rs_grid_ranks=.true., soft_valid=.false., &
1059 skip_load_balance_distributed=skip_load_balance_distributed)
1061 CALL qs_rho_rebuild(rho, qs_env=qs_env, rebuild_ao=.false., rebuild_grids=.true.)
1063 END SUBROUTINE rebuild_pw_env
1070 SUBROUTINE print_e_density(qs_env, cube_section)
1075 CHARACTER(LEN=default_path_length) :: filename, mpi_filename, my_pos_cube
1076 INTEGER :: iounit, ispin, unit_nr
1077 LOGICAL :: append_cube, mpi_io
1078 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_r
1081 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp
1093 CALL get_qs_env(qs_env, dft_control=dft_control)
1096 my_pos_cube =
"REWIND"
1097 IF (append_cube) my_pos_cube =
"APPEND"
1103 CALL get_qs_env(qs_env, ks_env=ks_env, rho=rho)
1104 NULLIFY (rho_r, rho_g, tot_rho_r)
1106 rho_r=rho_r, rho_g=rho_g, tot_rho_r=tot_rho_r)
1107 DO ispin = 1, dft_control%nspins
1108 rho_ao => rho_ao_kp(ispin, :)
1111 rho_gspace=rho_g(ispin), &
1112 total_rho=tot_rho_r(ispin), &
1115 CALL qs_rho_set(rho, rho_r_valid=.true., rho_g_valid=.true.)
1120 IF (dft_control%nspins > 1)
THEN
1121 IF (iounit > 0)
THEN
1122 WRITE (unit=iounit, fmt=
"(/,T2,A,T51,2F15.6)") &
1123 "Integrated alpha and beta electronic density:", tot_rho_r(1:2)
1125 CALL get_qs_env(qs_env=qs_env, pw_env=pw_env)
1126 CALL pw_env_get(pw_env=pw_env, auxbas_pw_pool=auxbas_pw_pool, pw_pools=pw_pools)
1129 CALL auxbas_pw_pool%create_pw(pw=rho_elec_rspace)
1130 CALL pw_copy(rho_r(1), rho_elec_rspace)
1131 CALL pw_axpy(rho_r(2), rho_elec_rspace)
1132 filename =
"ELECTRON_DENSITY"
1135 extension=
".cube", middle_name=trim(filename), &
1136 file_position=my_pos_cube, log_filename=.false., mpi_io=mpi_io, &
1138 IF (iounit > 0)
THEN
1139 IF (.NOT. mpi_io)
THEN
1140 INQUIRE (unit=unit_nr, name=filename)
1142 filename = mpi_filename
1144 WRITE (unit=iounit, fmt=
"(T2,A,/,T2,A79)") &
1145 "The sum of alpha and beta density is written in cube file format to the file:", adjustr(trim(filename))
1147 CALL cp_pw_to_cube(rho_elec_rspace, unit_nr,
"SUM OF ALPHA AND BETA DENSITY", &
1151 CALL pw_copy(rho_r(1), rho_elec_rspace)
1152 CALL pw_axpy(rho_r(2), rho_elec_rspace, alpha=-1.0_dp)
1153 filename =
"SPIN_DENSITY"
1156 extension=
".cube", middle_name=trim(filename), &
1157 file_position=my_pos_cube, log_filename=.false., mpi_io=mpi_io, &
1159 IF (iounit > 0)
THEN
1160 IF (.NOT. mpi_io)
THEN
1161 INQUIRE (unit=unit_nr, name=filename)
1163 filename = mpi_filename
1165 WRITE (unit=iounit, fmt=
"(T2,A,/,T2,A79)") &
1166 "The spin density is written in cube file format to the file:", adjustr(trim(filename))
1168 CALL cp_pw_to_cube(rho_elec_rspace, unit_nr,
"SPIN DENSITY", &
1169 particles=particles, &
1172 CALL auxbas_pw_pool%give_back_pw(rho_elec_rspace)
1175 IF (iounit > 0)
THEN
1176 WRITE (unit=iounit, fmt=
"(/,T2,A,T66,F15.6)") &
1177 "Integrated electronic density:", tot_rho_r(1)
1179 filename =
"ELECTRON_DENSITY"
1182 extension=
".cube", middle_name=trim(filename), &
1183 file_position=my_pos_cube, log_filename=.false., mpi_io=mpi_io, &
1185 IF (iounit > 0)
THEN
1186 IF (.NOT. mpi_io)
THEN
1187 INQUIRE (unit=unit_nr, name=filename)
1189 filename = mpi_filename
1191 WRITE (unit=iounit, fmt=
"(T2,A,/,T2,A79)") &
1192 "The electron density is written in cube file format to the file:", adjustr(trim(filename))
1195 particles=particles, &
1200 END SUBROUTINE print_e_density
1209 SUBROUTINE print_density_cubes(qs_env, cube_section, total_density, v_hartree, efield)
1211 TYPE(qs_environment_type),
POINTER :: qs_env
1212 TYPE(section_vals_type),
POINTER :: cube_section
1213 LOGICAL,
INTENT(IN),
OPTIONAL :: total_density, v_hartree, efield
1215 CHARACTER(len=1),
DIMENSION(3),
PARAMETER :: cdir = (/
"x",
"y",
"z"/)
1217 CHARACTER(LEN=default_path_length) :: filename, mpi_filename, my_pos_cube
1218 INTEGER :: id, iounit, ispin, nd(3), unit_nr
1219 LOGICAL :: append_cube, mpi_io, my_efield, &
1220 my_total_density, my_v_hartree
1221 REAL(kind=dp) :: total_rho_core_rspace, udvol
1222 REAL(kind=dp),
DIMENSION(:),
POINTER :: tot_rho_r
1223 TYPE(cell_type),
POINTER :: cell
1224 TYPE(cp_logger_type),
POINTER :: logger
1225 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao
1226 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp
1227 TYPE(dft_control_type),
POINTER :: dft_control
1228 TYPE(particle_list_type),
POINTER :: particles
1229 TYPE(pw_c1d_gs_type) :: rho_core
1230 TYPE(pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g
1231 TYPE(pw_env_type),
POINTER :: pw_env
1232 TYPE(pw_poisson_parameter_type) :: poisson_params
1233 TYPE(pw_pool_p_type),
DIMENSION(:),
POINTER :: pw_pools
1234 TYPE(pw_pool_type),
POINTER :: auxbas_pw_pool
1235 TYPE(pw_r3d_rs_type) :: rho_tot_rspace
1236 TYPE(pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r
1237 TYPE(qs_ks_env_type),
POINTER :: ks_env
1238 TYPE(qs_rho_type),
POINTER :: rho
1239 TYPE(qs_subsys_type),
POINTER :: subsys
1241 CALL get_qs_env(qs_env, cell=cell, dft_control=dft_control)
1243 append_cube = section_get_lval(cube_section,
"APPEND")
1244 my_pos_cube =
"REWIND"
1245 IF (append_cube) my_pos_cube =
"APPEND"
1247 IF (
PRESENT(total_density))
THEN
1248 my_total_density = total_density
1250 my_total_density = .false.
1252 IF (
PRESENT(v_hartree))
THEN
1253 my_v_hartree = v_hartree
1255 my_v_hartree = .false.
1257 IF (
PRESENT(efield))
THEN
1263 logger => cp_get_default_logger()
1264 iounit = cp_logger_get_default_io_unit(logger)
1267 CALL get_qs_env(qs_env, ks_env=ks_env, rho=rho)
1268 NULLIFY (rho_r, rho_g, tot_rho_r)
1269 CALL qs_rho_get(rho, rho_ao_kp=rho_ao_kp, &
1270 rho_r=rho_r, rho_g=rho_g, tot_rho_r=tot_rho_r)
1271 DO ispin = 1, dft_control%nspins
1272 rho_ao => rho_ao_kp(ispin, :)
1273 CALL calculate_rho_elec(matrix_p_kp=rho_ao, &
1275 rho_gspace=rho_g(ispin), &
1276 total_rho=tot_rho_r(ispin), &
1279 CALL qs_rho_set(rho, rho_r_valid=.true., rho_g_valid=.true.)
1281 CALL get_qs_env(qs_env, subsys=subsys)
1282 CALL qs_subsys_get(subsys, particles=particles)
1284 CALL get_qs_env(qs_env=qs_env, pw_env=pw_env)
1285 CALL pw_env_get(pw_env=pw_env, auxbas_pw_pool=auxbas_pw_pool, pw_pools=pw_pools)
1286 CALL auxbas_pw_pool%create_pw(pw=rho_core)
1287 CALL calculate_rho_core(rho_core, total_rho_core_rspace, qs_env)
1289 IF (iounit > 0)
THEN
1290 WRITE (unit=iounit, fmt=
"(/,T2,A,T66,F15.6)") &
1291 "Integrated electronic density:", sum(tot_rho_r(:))
1292 WRITE (unit=iounit, fmt=
"(T2,A,T66,F15.6)") &
1293 "Integrated core density:", total_rho_core_rspace
1296 CALL auxbas_pw_pool%create_pw(pw=rho_tot_rspace)
1297 CALL pw_transfer(rho_core, rho_tot_rspace)
1298 DO ispin = 1, dft_control%nspins
1299 CALL pw_axpy(rho_r(ispin), rho_tot_rspace)
1302 IF (my_total_density)
THEN
1303 filename =
"TOTAL_DENSITY"
1305 unit_nr = cp_print_key_unit_nr(logger, cube_section,
'', &
1306 extension=
".cube", middle_name=trim(filename), file_position=my_pos_cube, &
1307 log_filename=.false., mpi_io=mpi_io, fout=mpi_filename)
1308 IF (iounit > 0)
THEN
1309 IF (.NOT. mpi_io)
THEN
1310 INQUIRE (unit=unit_nr, name=filename)
1312 filename = mpi_filename
1314 WRITE (unit=iounit, fmt=
"(T2,A,/,T2,A79)") &
1315 "The total density is written in cube file format to the file:", adjustr(trim(filename))
1317 CALL cp_pw_to_cube(rho_tot_rspace, unit_nr,
"TOTAL DENSITY", &
1318 particles=particles, &
1319 stride=section_get_ivals(cube_section,
"STRIDE"), mpi_io=mpi_io)
1320 CALL cp_print_key_finished_output(unit_nr, logger, cube_section,
'', mpi_io=mpi_io)
1322 IF (my_v_hartree .OR. my_efield)
THEN
1324 TYPE(pw_c1d_gs_type) :: rho_tot_gspace
1325 CALL auxbas_pw_pool%create_pw(pw=rho_tot_gspace)
1326 CALL pw_transfer(rho_tot_rspace, rho_tot_gspace)
1327 poisson_params%solver = pw_poisson_analytic
1328 poisson_params%periodic = cell%perd
1329 poisson_params%ewald_type = do_ewald_none
1331 TYPE(greens_fn_type) :: green_fft
1332 TYPE(pw_grid_type),
POINTER :: pwdummy
1334 CALL pw_green_create(green_fft, poisson_params, cell%hmat, auxbas_pw_pool, pwdummy, pwdummy)
1335 rho_tot_gspace%array(:) = rho_tot_gspace%array(:)*green_fft%influence_fn%array(:)
1336 CALL pw_green_release(green_fft, auxbas_pw_pool)
1338 IF (my_v_hartree)
THEN
1340 TYPE(pw_r3d_rs_type) :: vhartree
1341 CALL auxbas_pw_pool%create_pw(pw=vhartree)
1342 CALL pw_transfer(rho_tot_gspace, vhartree)
1343 filename =
"V_HARTREE"
1345 unit_nr = cp_print_key_unit_nr(logger, cube_section,
'', &
1346 extension=
".cube", middle_name=trim(filename), file_position=my_pos_cube, &
1347 log_filename=.false., mpi_io=mpi_io, fout=mpi_filename)
1348 IF (iounit > 0)
THEN
1349 IF (.NOT. mpi_io)
THEN
1350 INQUIRE (unit=unit_nr, name=filename)
1352 filename = mpi_filename
1354 WRITE (unit=iounit, fmt=
"(T2,A,/,T2,A79)") &
1355 "The Hartree potential is written in cube file format to the file:", adjustr(trim(filename))
1357 CALL cp_pw_to_cube(vhartree, unit_nr,
"Hartree Potential", &
1358 particles=particles, &
1359 stride=section_get_ivals(cube_section,
"STRIDE"), mpi_io=mpi_io)
1360 CALL cp_print_key_finished_output(unit_nr, logger, cube_section,
'', mpi_io=mpi_io)
1361 CALL auxbas_pw_pool%give_back_pw(vhartree)
1366 TYPE(pw_c1d_gs_type) :: vhartree
1367 CALL auxbas_pw_pool%create_pw(pw=vhartree)
1368 udvol = 1.0_dp/rho_tot_rspace%pw_grid%dvol
1370 CALL pw_transfer(rho_tot_gspace, vhartree)
1373 CALL pw_derive(vhartree, nd)
1374 CALL pw_transfer(vhartree, rho_tot_rspace)
1375 CALL pw_scale(rho_tot_rspace, udvol)
1377 filename =
"EFIELD_"//cdir(id)
1379 unit_nr = cp_print_key_unit_nr(logger, cube_section,
'', &
1380 extension=
".cube", middle_name=trim(filename), file_position=my_pos_cube, &
1381 log_filename=.false., mpi_io=mpi_io, fout=mpi_filename)
1382 IF (iounit > 0)
THEN
1383 IF (.NOT. mpi_io)
THEN
1384 INQUIRE (unit=unit_nr, name=filename)
1386 filename = mpi_filename
1388 WRITE (unit=iounit, fmt=
"(T2,A,/,T2,A79)") &
1389 "The Efield is written in cube file format to the file:", adjustr(trim(filename))
1391 CALL cp_pw_to_cube(rho_tot_rspace, unit_nr,
"EFIELD "//cdir(id), &
1392 particles=particles, &
1393 stride=section_get_ivals(cube_section,
"STRIDE"), mpi_io=mpi_io)
1394 CALL cp_print_key_finished_output(unit_nr, logger, cube_section,
'', mpi_io=mpi_io)
1396 CALL auxbas_pw_pool%give_back_pw(vhartree)
1399 CALL auxbas_pw_pool%give_back_pw(rho_tot_gspace)
1403 CALL auxbas_pw_pool%give_back_pw(rho_tot_rspace)
1404 CALL auxbas_pw_pool%give_back_pw(rho_core)
1406 END SUBROUTINE print_density_cubes
1413 SUBROUTINE print_elf(qs_env, elf_section)
1415 TYPE(qs_environment_type),
POINTER :: qs_env
1416 TYPE(section_vals_type),
POINTER :: elf_section
1418 CHARACTER(LEN=default_path_length) :: filename, mpi_filename, my_pos_cube, &
1420 INTEGER :: iounit, ispin, unit_nr
1421 LOGICAL :: append_cube, mpi_io
1422 REAL(kind=dp) :: rho_cutoff
1423 REAL(kind=dp),
DIMENSION(:),
POINTER :: tot_rho_r
1424 TYPE(cp_logger_type),
POINTER :: logger
1425 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao
1426 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp
1427 TYPE(dft_control_type),
POINTER :: dft_control
1428 TYPE(particle_list_type),
POINTER :: particles
1429 TYPE(pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g
1430 TYPE(pw_env_type),
POINTER :: pw_env
1431 TYPE(pw_pool_p_type),
DIMENSION(:),
POINTER :: pw_pools
1432 TYPE(pw_pool_type),
POINTER :: auxbas_pw_pool
1433 TYPE(pw_r3d_rs_type),
ALLOCATABLE,
DIMENSION(:) :: elf_r
1434 TYPE(pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r
1435 TYPE(qs_ks_env_type),
POINTER :: ks_env
1436 TYPE(qs_rho_type),
POINTER :: rho
1437 TYPE(qs_subsys_type),
POINTER :: subsys
1439 logger => cp_get_default_logger()
1440 iounit = cp_logger_get_default_io_unit(logger)
1443 CALL get_qs_env(qs_env, dft_control=dft_control, ks_env=ks_env, rho=rho)
1444 NULLIFY (rho_r, rho_g, tot_rho_r)
1445 CALL qs_rho_get(rho, rho_ao_kp=rho_ao_kp, &
1446 rho_r=rho_r, rho_g=rho_g, tot_rho_r=tot_rho_r)
1447 DO ispin = 1, dft_control%nspins
1448 rho_ao => rho_ao_kp(ispin, :)
1449 CALL calculate_rho_elec(matrix_p_kp=rho_ao, &
1451 rho_gspace=rho_g(ispin), &
1452 total_rho=tot_rho_r(ispin), &
1455 CALL qs_rho_set(rho, rho_r_valid=.true., rho_g_valid=.true.)
1457 CALL get_qs_env(qs_env, subsys=subsys)
1458 CALL qs_subsys_get(subsys, particles=particles)
1460 ALLOCATE (elf_r(dft_control%nspins))
1461 CALL get_qs_env(qs_env=qs_env, pw_env=pw_env)
1462 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, pw_pools=pw_pools)
1463 DO ispin = 1, dft_control%nspins
1464 CALL auxbas_pw_pool%create_pw(elf_r(ispin))
1465 CALL pw_zero(elf_r(ispin))
1468 IF (iounit > 0)
THEN
1469 WRITE (unit=iounit, fmt=
"(/,T2,A)") &
1470 "ELF is computed on the real space grid -----"
1472 rho_cutoff = section_get_rval(elf_section,
"density_cutoff")
1473 CALL qs_elf_calc(qs_env, elf_r, rho_cutoff)
1476 append_cube = section_get_lval(elf_section,
"APPEND")
1477 my_pos_cube =
"REWIND"
1478 IF (append_cube) my_pos_cube =
"APPEND"
1479 DO ispin = 1, dft_control%nspins
1480 WRITE (filename,
'(a5,I1.1)')
"ELF_S", ispin
1481 WRITE (title, *)
"ELF spin ", ispin
1483 unit_nr = cp_print_key_unit_nr(logger, elf_section,
'', extension=
".cube", &
1484 middle_name=trim(filename), file_position=my_pos_cube, &
1485 log_filename=.false., mpi_io=mpi_io, fout=mpi_filename)
1486 IF (iounit > 0)
THEN
1487 IF (.NOT. mpi_io)
THEN
1488 INQUIRE (unit=unit_nr, name=filename)
1490 filename = mpi_filename
1492 WRITE (unit=iounit, fmt=
"(T2,A,/,T2,A79)") &
1493 "ELF is written in cube file format to the file:", adjustr(trim(filename))
1496 CALL cp_pw_to_cube(elf_r(ispin), unit_nr, title, particles=particles, &
1497 stride=section_get_ivals(elf_section,
"STRIDE"), mpi_io=mpi_io)
1498 CALL cp_print_key_finished_output(unit_nr, logger, elf_section,
'', mpi_io=mpi_io)
1500 CALL auxbas_pw_pool%give_back_pw(elf_r(ispin))
1505 END SUBROUTINE print_elf
1511 SUBROUTINE print_mo_cubes(qs_env, cube_section)
1513 TYPE(qs_environment_type),
POINTER :: qs_env
1514 TYPE(section_vals_type),
POINTER :: cube_section
1516 CHARACTER(LEN=default_path_length) :: filename, my_pos_cube, title
1517 INTEGER :: homo, i, ifirst, ilast, iounit, ir, &
1518 ispin, ivector, n_rep, nhomo, nlist, &
1519 nlumo, nmo, shomo, unit_nr
1520 INTEGER,
DIMENSION(:),
POINTER ::
list, list_index
1521 LOGICAL :: append_cube, mpi_io, write_cube
1522 REAL(kind=dp) :: homo_lumo(2, 2)
1523 REAL(kind=dp),
DIMENSION(:),
POINTER :: mo_eigenvalues
1524 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
1525 TYPE(cell_type),
POINTER :: cell
1526 TYPE(cp_fm_type),
POINTER :: mo_coeff
1527 TYPE(cp_logger_type),
POINTER :: logger
1528 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: ks_rmpv, mo_derivs
1529 TYPE(dft_control_type),
POINTER :: dft_control
1530 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
1531 TYPE(particle_list_type),
POINTER :: particles
1532 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1533 TYPE(pw_c1d_gs_type) :: wf_g
1534 TYPE(pw_env_type),
POINTER :: pw_env
1535 TYPE(pw_pool_p_type),
DIMENSION(:),
POINTER :: pw_pools
1536 TYPE(pw_pool_type),
POINTER :: auxbas_pw_pool
1537 TYPE(pw_r3d_rs_type) :: wf_r
1538 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1539 TYPE(qs_subsys_type),
POINTER :: subsys
1540 TYPE(scf_control_type),
POINTER :: scf_control
1542 logger => cp_get_default_logger()
1543 iounit = cp_logger_get_default_io_unit(logger)
1545 CALL get_qs_env(qs_env, mos=mos, matrix_ks=ks_rmpv, scf_control=scf_control)
1546 CALL get_qs_env(qs_env, dft_control=dft_control, mo_derivs=mo_derivs)
1547 CALL make_mo_eig(mos, dft_control%nspins, ks_rmpv, scf_control, mo_derivs)
1548 NULLIFY (mo_eigenvalues)
1550 DO ispin = 1, dft_control%nspins
1551 CALL get_mo_set(mo_set=mos(ispin), eigenvalues=mo_eigenvalues, homo=shomo)
1552 homo_lumo(ispin, 1) = mo_eigenvalues(shomo)
1553 homo = max(homo, shomo)
1555 write_cube = section_get_lval(cube_section,
"WRITE_CUBE")
1556 nlumo = section_get_ival(cube_section,
"NLUMO")
1557 nhomo = section_get_ival(cube_section,
"NHOMO")
1558 NULLIFY (list_index)
1559 CALL section_vals_val_get(cube_section,
"HOMO_LIST", n_rep_val=n_rep)
1564 CALL section_vals_val_get(cube_section,
"HOMO_LIST", i_rep_val=ir, i_vals=
list)
1565 IF (
ASSOCIATED(
list))
THEN
1566 CALL reallocate(list_index, 1, nlist +
SIZE(
list))
1567 DO i = 1,
SIZE(
list)
1568 list_index(i + nlist) =
list(i)
1570 nlist = nlist +
SIZE(
list)
1573 nhomo = maxval(list_index)
1575 IF (nhomo == -1) nhomo = homo
1576 nlist = homo - max(1, homo - nhomo + 1) + 1
1577 ALLOCATE (list_index(nlist))
1579 list_index(i) = max(1, homo - nhomo + 1) + i - 1
1583 CALL get_qs_env(qs_env=qs_env, pw_env=pw_env)
1584 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, pw_pools=pw_pools)
1585 CALL auxbas_pw_pool%create_pw(wf_r)
1586 CALL auxbas_pw_pool%create_pw(wf_g)
1588 CALL get_qs_env(qs_env, subsys=subsys)
1589 CALL qs_subsys_get(subsys, particles=particles)
1591 append_cube = section_get_lval(cube_section,
"APPEND")
1592 my_pos_cube =
"REWIND"
1593 IF (append_cube)
THEN
1594 my_pos_cube =
"APPEND"
1597 CALL get_qs_env(qs_env=qs_env, &
1598 atomic_kind_set=atomic_kind_set, &
1599 qs_kind_set=qs_kind_set, &
1601 particle_set=particle_set)
1603 IF (nhomo >= 0)
THEN
1604 DO ispin = 1, dft_control%nspins
1606 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, &
1607 eigenvalues=mo_eigenvalues, homo=homo, nmo=nmo)
1608 IF (write_cube)
THEN
1610 ivector = list_index(i)
1611 IF (ivector > homo) cycle
1612 CALL calculate_wavefunction(mo_coeff, ivector, wf_r, wf_g, atomic_kind_set, qs_kind_set, &
1613 cell, dft_control, particle_set, pw_env)
1614 WRITE (filename,
'(a4,I5.5,a1,I1.1)')
"WFN_", ivector,
"_", ispin
1616 unit_nr = cp_print_key_unit_nr(logger, cube_section,
'', extension=
".cube", &
1617 middle_name=trim(filename), file_position=my_pos_cube, &
1618 log_filename=.false., mpi_io=mpi_io)
1619 WRITE (title, *)
"WAVEFUNCTION ", ivector,
" spin ", ispin,
" i.e. HOMO - ", ivector - homo
1620 CALL cp_pw_to_cube(wf_r, unit_nr, title, particles=particles, &
1621 stride=section_get_ivals(cube_section,
"STRIDE"), mpi_io=mpi_io)
1622 CALL cp_print_key_finished_output(unit_nr, logger, cube_section,
'', mpi_io=mpi_io)
1628 IF (nlumo /= 0)
THEN
1629 DO ispin = 1, dft_control%nspins
1631 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, &
1632 eigenvalues=mo_eigenvalues, homo=homo, nmo=nmo)
1633 IF (write_cube)
THEN
1635 IF (nlumo == -1)
THEN
1638 ilast = ifirst + nlumo - 1
1639 ilast = min(nmo, ilast)
1641 DO ivector = ifirst, ilast
1642 CALL calculate_wavefunction(mo_coeff, ivector, wf_r, wf_g, atomic_kind_set, &
1643 qs_kind_set, cell, dft_control, particle_set, pw_env)
1644 WRITE (filename,
'(a4,I5.5,a1,I1.1)')
"WFN_", ivector,
"_", ispin
1646 unit_nr = cp_print_key_unit_nr(logger, cube_section,
'', extension=
".cube", &
1647 middle_name=trim(filename), file_position=my_pos_cube, &
1648 log_filename=.false., mpi_io=mpi_io)
1649 WRITE (title, *)
"WAVEFUNCTION ", ivector,
" spin ", ispin,
" i.e. LUMO + ", ivector - ifirst
1650 CALL cp_pw_to_cube(wf_r, unit_nr, title, particles=particles, &
1651 stride=section_get_ivals(cube_section,
"STRIDE"), mpi_io=mpi_io)
1652 CALL cp_print_key_finished_output(unit_nr, logger, cube_section,
'', mpi_io=mpi_io)
1658 CALL auxbas_pw_pool%give_back_pw(wf_g)
1659 CALL auxbas_pw_pool%give_back_pw(wf_r)
1660 IF (
ASSOCIATED(list_index))
DEALLOCATE (list_index)
1662 END SUBROUTINE print_mo_cubes
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.
various utilities that regard array of different kinds: output, allocation,... maybe it is not a good...
methods related to the blacs parallel environment
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public cp_dbcsr_write_sparse_matrix(sparse_matrix, before, after, qs_env, para_env, first_row, last_row, first_col, last_col, scale, output_unit, omit_headers)
...
various cholesky decomposition related routines
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 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_to_fm_submat(msource, mtarget, nrow, ncol, s_firstrow, s_firstcol, t_firstrow, t_firstcol)
copy just a part ot the matrix
subroutine, public cp_fm_init_random(matrix, ncol, start_col)
fills a matrix with random numbers
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)
...
set of type/routines to handle the storage of results in force_envs
subroutine, public cp_results_erase(results, description, nval)
erase a part of result_list
set of type/routines to handle the storage of results in force_envs
Calculation of charge equilibration method.
subroutine, public eeq_print(qs_env, iounit, print_level, ext)
...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Types and basic routines needed for a kpoint calculation.
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition of mathematical constants and functions.
real(kind=dp), parameter, public twopi
Utility routines for the memory handling.
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)
...
compute mulliken charges we (currently) define them as c_i = 1/2 [ (PS)_{ii} + (SP)_{ii} ]
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 debye
Provide various population analyses and print the requested output information.
subroutine, public lowdin_population_analysis(qs_env, output_unit, print_level)
Perform a Lowdin population analysis based on a symmetric orthogonalisation of the density matrix usi...
computes preconditioners, and implements methods to apply them currently used in qs_ot
methods of pw_env that have dependence on qs_env
subroutine, public pw_env_rebuild(pw_env, qs_env, external_para_env)
rebuilds the pw_env data (necessary if cell or cutoffs change)
subroutine, public pw_env_create(pw_env)
creates a pw_env, if qs_env is given calls pw_env_rebuild
container for various plainwaves related things
subroutine, public pw_env_release(pw_env, para_env)
releases the given pw_env (see doc/ReferenceCounting.html)
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
subroutine, public pw_derive(pw, n)
Calculate the derivative of a plane wave vector.
functions related to the poisson solver on regular grids
subroutine, public pw_green_create(green, poisson_params, cell_hmat, pw_pool, mt_super_ref_pw_grid, dct_pw_grid)
Allocates and sets up the green functions for the fft based poisson solvers.
subroutine, public pw_green_release(gftype, pw_pool)
destroys the type (deallocates data)
integer, parameter, public do_ewald_none
integer, parameter, public pw_poisson_analytic
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_rho_elec(matrix_p, matrix_p_kp, rho, rho_gspace, total_rho, ks_env, soft_valid, compute_tau, compute_grad, basis_type, der_type, idir, task_list_external, pw_env_external)
computes the density corresponding to a given density matrix on the grid
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
Definition of the DFTB parameter types.
Working with the DFTB parameter types.
subroutine, public get_dftb_atom_param(dftb_parameter, name, typ, defined, z, zeff, natorb, lmax, skself, occupation, eta, energy, cutoff, xi, di, rcdisp, dudq)
...
Calculation and writing of density of states.
subroutine, public calculate_dos_kp(kpoints, qs_env, dft_section)
Compute and write density of states (kpoints)
subroutine, public calculate_dos(mos, dft_section)
Compute and write density of states.
Does all kind of post scf calculations for GPW/GAPW.
subroutine, public qs_elf_calc(qs_env, elf_r, rho_cutoff)
...
Does all kind of post scf calculations for GPW/GAPW.
subroutine, public energy_windows(qs_env)
...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
subroutine, public get_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, rho, rho_xc, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, task_list, task_list_soft, kpoints, do_kpoints, atomic_kind_set, qs_kind_set, cell, cell_ref, use_ref_cell, particle_set, energy, force, local_particles, local_molecules, molecule_kind_set, molecule_set, subsys, cp_subsys, virial, results, atprop, nkind, natom, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env, nelectron_total, nelectron_spin)
...
collects routines that perform operations directly related to MOs
subroutine, public make_mo_eig(mos, nspins, ks_rmpv, scf_control, mo_derivs, admm_env)
Calculate KS eigenvalues starting from OF MOS.
Set occupation of molecular orbitals.
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.
an eigen-space solver for the generalised symmetric eigenvalue problem for sparse matrices,...
subroutine, public ot_eigensolver(matrix_h, matrix_s, matrix_orthogonal_space_fm, matrix_c_fm, preconditioner, eps_gradient, iter_max, size_ortho_space, silent, ot_settings)
...
Calculation and writing of projected density of states The DOS is computed per angular momentum and p...
subroutine, public calculate_projected_dos(mo_set, atomic_kind_set, qs_kind_set, particle_set, qs_env, dft_section, ispin, xas_mittle, external_matrix_shalf)
Compute and write projected density of states.
methods of the rho structure (defined in qs_rho_types)
subroutine, public qs_rho_rebuild(rho, qs_env, rebuild_ao, rebuild_grids, admm, pw_env_external)
rebuilds rho (if necessary allocating and initializing it)
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_set(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
...
subroutine, public qs_rho_get(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
returns info about the density described by this object. If some representation is not available an e...
Functions to print the KS and S matrix in the CSR format to file.
subroutine, public write_s_matrix_csr(qs_env, input)
writing the overlap matrix in csr format into a file
subroutine, public write_ks_matrix_csr(qs_env, input)
writing the KS matrix in csr format into a file
subroutine, public qs_scf_write_mos(qs_env, scf_env, final_mos)
Write the MO eigenvector, eigenvalues, and occupation numbers to the output unit.
Does all kind of post scf calculations for DFTB.
subroutine, public scf_post_calculation_tb(qs_env, tb_type, no_mos)
collects possible post - scf calculations and prints info / computes properties.
subroutine, public make_lumo_tb(qs_env, scf_env, unoccupied_orbs, unoccupied_evals, nlumo, nlumos)
Gets the lumos, and eigenvalues for the lumos.
module that contains the definitions of the scf types
integer, parameter, public ot_method_nr
Does all kind of post scf calculations for GPW/GAPW.
subroutine, public wfn_mix(mos, particle_set, dft_section, qs_kind_set, para_env, output_unit, unoccupied_orbs, scf_env, matrix_s, marked_states, for_rtp)
writes a new 'mixed' set of mos to restart file, without touching the current MOs
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)
...
parameters that control an scf iteration
Calculation of STM image as post processing of an electronic structure calculation,...
subroutine, public th_stm_image(qs_env, stm_section, particles, unoccupied_orbs, unoccupied_evals)
Driver for the calculation of STM image, as post processing of a ground-state electronic structure ca...
generate the tasks lists used by collocate and integrate routines
subroutine, public generate_qs_task_list(ks_env, task_list, reorder_rs_grid_ranks, skip_load_balance_distributed, soft_valid, basis_type, pw_env_external, sab_orb_external)
...
subroutine, public allocate_task_list(task_list)
allocates and initialised the components of the task_list_type
Calculation of charge response in xTB (EEQ only) Reference: Stefan Grimme, Christoph Bannwarth,...
subroutine, public build_xtb_qresp(qs_env, qresp)
...
Definition of the xTB parameter types.
subroutine, public get_xtb_atom_param(xtb_parameter, symbol, aname, typ, defined, z, zeff, natorb, lmax, nao, lao, rcut, rcov, kx, eta, xgamma, alpha, zneff, nshell, nval, lval, kpoly, kappa, hen, zeta, xi, kappa0, alpg, occupation, electronegativity, chmax, en, kqat2, kcn, kq)
...
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
represent a pointer to a 1d array
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
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...
contains arbitrary information which need to be stored
Contains information about kpoints.
stores all the informations relevant to an mpi environment
represent a list of objects
contained for different pw related things
contains all the informations needed by the fft based poisson solvers
parameters for the poisson solver independet of input_section
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 ...
keeps the density in various representations, keeping track of which ones are valid.