From 5f3bc36082e75c975caee6a92073f395a2af7674 Mon Sep 17 00:00:00 2001 From: Juerg Hutter Date: Mon, 27 Oct 2025 12:37:00 +0100 Subject: [PATCH] UPF files: fix bug for wavefunctions, interoperability with response basis calculation (#4514) --- src/atom_energy.F | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/atom_energy.F b/src/atom_energy.F index 2e743a589a..5ffa908bea 100644 --- a/src/atom_energy.F +++ b/src/atom_energy.F @@ -403,6 +403,14 @@ CONTAINS END IF CALL cp_print_key_finished_output(iw, logger, atom_section, "PRINT%ORBITALS") + ! generate a UPF file + iw = cp_print_key_unit_nr(logger, atom_section, "PRINT%UPF_FILE", extension=".upf", & + file_position="REWIND") + IF (iw > 0) THEN + CALL atom_write_upf(atom_info(in, im)%atom, iw, xcfstr) + END IF + CALL cp_print_key_finished_output(iw, logger, atom_section, "PRINT%UPF_FILE") + ! perform a fit of the total electronic density iw = cp_print_key_unit_nr(logger, atom_section, "PRINT%FIT_DENSITY", extension=".log") IF (iw > 0) THEN @@ -431,13 +439,6 @@ CONTAINS END IF CALL cp_print_key_finished_output(iw, logger, atom_section, "PRINT%RESPONSE_BASIS") - ! generate a UPF file - iw = cp_print_key_unit_nr(logger, atom_section, "PRINT%UPF_FILE", extension=".upf", & - file_position="REWIND") - IF (iw > 0) THEN - CALL atom_write_upf(atom_info(in, im)%atom, iw, xcfstr) - END IF - CALL cp_print_key_finished_output(iw, logger, atom_section, "PRINT%UPF_FILE") END IF END DO @@ -920,9 +921,9 @@ CONTAINS END DO beta(:) = beta*atom%basis%grid%rad IF (up) THEN - WRITE (iw, '(T12,4ES25.12E3)') (beta(j)*atom%basis%grid%rad(j), j=1, nr) + WRITE (iw, '(T12,4ES25.12E3)') (beta(j), j=1, nr) ELSE - WRITE (iw, '(T12,4ES25.12E3)') (beta(j)*atom%basis%grid%rad(j), j=nr, 1, -1) + WRITE (iw, '(T12,4ES25.12E3)') (beta(j), j=nr, 1, -1) END IF CALL compose(string, "'