Skip to content
Permalink
Browse files

XAS_TDP| Enabled printing of PDOS and CUBES for LR-orbitals, also from a

restart file
  • Loading branch information...
abussy authored and pseewald committed Sep 19, 2019
1 parent f1cd4a3 commit b5f1812ff64e2d831d959a6a928024e9e27e8531
Showing with 723 additions and 109 deletions.
  1. +67 −8 src/input_cp2k_dft.F
  2. +22 −13 src/qs_pdos.F
  3. +627 −81 src/xas_tdp_methods.F
  4. +7 −7 src/xas_tdp_types.F
@@ -7885,7 +7885,7 @@ SUBROUTINE create_xas_tdp_section(section)
description="XAS simulations using TDDFPT. Excitation from specified "//&
"core orbitals are considered one at a time. In case of high symmetry "//&
"structures, donor core orbitals should be localized.", &
n_keywords=11, n_subsections=4, repeats=.FALSE.)
n_keywords=12, n_subsections=4, repeats=.FALSE.)

NULLIFY (keyword, subsection, print_key)

@@ -7912,6 +7912,18 @@ SUBROUTINE create_xas_tdp_section(section)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="RESTART_FROM_FILE", &
variants=s2a("RESTART_FILENAME", "RST_FILENAME", "RESTART_FILE", "RST_FILE"), &
description="By providing a RESTART file containing the linear-response "//&
"orbitals and excitations energies from a previous calculation, "//&
"all computations are skipped except for the corresponding "//&
"PDOS and/or CUBE file printing as defined in the PRINT "// &
"subsection. Basis sets and geometry need to be consistent.",&
usage="RESTART_FROM_FILE <FILENAME>", &
type_of_var=char_t, n_var=-1)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="EXCITATIONS", &
variants=(/"EXCITATION"/), &
description="Specify the type of excitation to consider. In case of a "//&
@@ -8240,7 +8252,7 @@ SUBROUTINE create_xas_tdp_section(section)
"are kept for contraction, as the latter operation can be "//&
"expensive (especially for large basis sets )." //&
"If |(ab|c)| < EPS_SCREENNING, it is discarded.", &
default_r_val=1.0E-10_dp, &
default_r_val=0.0_dp, &
repeats=.FALSE.)
CALL section_add_keyword(subsubsection, keyword)
CALL keyword_release(keyword)
@@ -8260,19 +8272,66 @@ SUBROUTINE create_xas_tdp_section(section)

CALL section_create(subsection, __LOCATION__, "PRINT", "Controls the printing of information during "//&
"XAS TDP calculations", repeats=.FALSE.)
CALL cp_print_key_section_create(print_key, __LOCATION__, name="PROGRAM_RUN_INFO",&
description="Controls the printing of basic programm steps information",&
print_level=low_print_level, add_last=add_last_numeric,&
filename="__STD_OUT__")
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)

CALL cp_print_key_section_create(print_key, __LOCATION__, name="SPECTRUM", &
description="Controles the dumping of the XAS TDP spectrum in ouput files", &
print_level=low_print_level, filename="", common_iter_levels=3)
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)

CALL create_pdos_section(print_key)
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)

CALL cp_print_key_section_create(print_key, __LOCATION__, "CUBES", &
description="Controls the printing of the linear-response orbitals "//&
"as *.cube files.", &
print_level=high_print_level, common_iter_levels=1, &
add_last=add_last_numeric, filename="")

CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
description="The stride (X,Y,Z) used to write the cube file "// &
"(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
" 1 number valid for all components.", &
usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
CALL section_add_keyword(print_key, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="CUBES_LU_BOUNDS", &
variants=(/"CUBES_LU"/), &
description="The lower and upper index of the excited states to be printed as cube", &
usage="CUBES_LU_BOUNDS integer integer", &
n_var=2, default_i_vals=(/1, 0/), type_of_var=integer_t)
CALL section_add_keyword(print_key, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="CUBES_LIST", &
description="Indexes of the excited states to be printed as cube files"// &
"This keyword can be repeated several times"// &
"(useful if you have to specify many indexes).", &
usage="CUBES_LIST 1 2", &
n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
CALL section_add_keyword(print_key, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
description="append the cube files when they already exist", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(print_key, keyword)
CALL keyword_release(keyword)

CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)

CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
description="Controls the dumping of LR-orbitals coefficients "// &
"and corresponding excitation energies such that "// &
"the program can be restarted for PDOS or CUBE "// &
"printing without the heavy computing.", &
print_level=medium_print_level, filename="", common_iter_levels=3)
CALL section_add_subsection(subsection, print_key)
CALL section_release(print_key)

CALL section_add_subsection(section, subsection)
CALL section_release(subsection)

@@ -128,17 +128,18 @@ MODULE qs_pdos
!> \param dft_section ...
!> \param ispin ...
!> \param xas_mittle ...
!> \param external_matrix_shalf
!> \date 26.02.2008
!> \par History:
!> -
!> - Added optional external matrix_shalf to avoid recomputing it (A. Bussy, 09.2019)
!> \par Variables
!> -
!> -
!> \author MI
!> \version 1.0
! **************************************************************************************************
SUBROUTINE calculate_projected_dos(mo_set, atomic_kind_set, qs_kind_set, particle_set, qs_env, &
dft_section, ispin, xas_mittle)
dft_section, ispin, xas_mittle, external_matrix_shalf)

TYPE(mo_set_type), POINTER :: mo_set
TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
@@ -149,6 +150,7 @@ SUBROUTINE calculate_projected_dos(mo_set, atomic_kind_set, qs_kind_set, particl
INTEGER, INTENT(IN), OPTIONAL :: ispin
CHARACTER(LEN=default_string_length), INTENT(IN), &
OPTIONAL :: xas_mittle
TYPE(cp_fm_type), POINTER, OPTIONAL :: external_matrix_shalf

CHARACTER(len=*), PARAMETER :: routineN = 'calculate_projected_dos', &
routineP = moduleN//':'//routineN
@@ -169,7 +171,7 @@ SUBROUTINE calculate_projected_dos(mo_set, atomic_kind_set, qs_kind_set, particl
INTEGER, DIMENSION(:, :), POINTER :: bo, l
LOGICAL :: append, do_ldos, do_r_ldos, do_virt, &
ionode, separate_components, &
should_output
should_output, calc_matsh
LOGICAL, DIMENSION(:, :), POINTER :: read_r
REAL(KIND=dp) :: dh(3, 3), dvol, e_fermi, r(3), r_vec(3), &
ratom(3)
@@ -250,15 +252,22 @@ SUBROUTINE calculate_projected_dos(mo_set, atomic_kind_set, qs_kind_set, particl
nvirt = 0
END IF

! Create S^1/2 : from sparse to full matrix
CALL cp_fm_struct_create(fm_struct_tmp, para_env=para_env, context=context, &
nrow_global=nrow_global, ncol_global=nrow_global)
CALL cp_fm_create(matrix_shalf, fm_struct_tmp, name="matrix_shalf")
CALL cp_fm_create(matrix_work, fm_struct_tmp, name="matrix_work")
CALL cp_fm_struct_release(fm_struct_tmp)
CALL copy_dbcsr_to_fm(s_matrix(1)%matrix, matrix_shalf)
CALL cp_fm_power(matrix_shalf, matrix_work, 0.5_dp, EPSILON(0.0_dp), n_dependent)
CALL cp_fm_release(matrix_work)
calc_matsh = .TRUE.
IF (PRESENT(external_matrix_shalf)) calc_matsh = .FALSE.

! Create S^1/2 : from sparse to full matrix, if no external available
IF (calc_matsh) THEN
CALL cp_fm_struct_create(fm_struct_tmp, para_env=para_env, context=context, &
nrow_global=nrow_global, ncol_global=nrow_global)
CALL cp_fm_create(matrix_shalf, fm_struct_tmp, name="matrix_shalf")
CALL cp_fm_create(matrix_work, fm_struct_tmp, name="matrix_work")
CALL cp_fm_struct_release(fm_struct_tmp)
CALL copy_dbcsr_to_fm(s_matrix(1)%matrix, matrix_shalf)
CALL cp_fm_power(matrix_shalf, matrix_work, 0.5_dp, EPSILON(0.0_dp), n_dependent)
CALL cp_fm_release(matrix_work)
ELSE
matrix_shalf => external_matrix_shalf
END IF

! Multiply S^(1/2) time the mOS coefficients to get orthonormalized MOS
CALL cp_fm_struct_create(fm_struct_tmp, para_env=para_env, context=context, &
@@ -279,7 +288,7 @@ SUBROUTINE calculate_projected_dos(mo_set, atomic_kind_set, qs_kind_set, particl
CALL cp_fm_struct_release(fm_struct_tmp)
END IF

CALL cp_fm_release(matrix_shalf)
IF (calc_matsh) CALL cp_fm_release(matrix_shalf)
! Array to store the PDOS per kind and angular momentum
do_ldos = .FALSE.
ldos_section => section_vals_get_subs_vals(dft_section, "PRINT%PDOS%LDOS")

0 comments on commit b5f1812

Please sign in to comment.
You can’t perform that action at this time.