Skip to content

Commit

Permalink
wfn_mix fixed reverse_index key bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Anyborr authored and oschuett committed Jul 23, 2024
1 parent ca13a2b commit 4e0d974
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/input_cp2k_print_dft.F
Original file line number Diff line number Diff line change
Expand Up @@ -2439,7 +2439,7 @@ SUBROUTINE create_wfn_mix_section(section)

CALL section_create(subsection, __LOCATION__, name="UPDATE", &
description="Update a result MO with with a linear combination of original MOs."// &
" This section can be repeated to build arbitrary linear combinations using repeatedly y=a*y+b*x.\n "// &
" This section can be repeated to build arbitrary linear combinations using repeatedly y=a*y+b*x. "// &
"RESULT is (y), RESULT_SCALE is (a), ORIG is (x), ORIG_SCALE is (b)", &
n_keywords=1, n_subsections=0, repeats=.TRUE.)

Expand Down
8 changes: 4 additions & 4 deletions src/qs_scf_wfn_mix.F
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ SUBROUTINE wfn_mix(mos, particle_set, dft_section, qs_kind_set, para_env, output
CALL section_vals_val_get(update_section, "ORIG_MO_INDEX", i_rep_section=i_rep, i_val=orig_mo_index)
CALL section_vals_val_get(update_section, "ORIG_MARKED_STATE", i_rep_section=i_rep, i_val=mark_number)
CALL section_vals_val_get(update_section, "ORIG_SPIN_INDEX", i_rep_section=i_rep, i_val=orig_spin_index)
! orig_scal is the 'b' coefficient
! orig_scale is the 'b' coefficient
CALL section_vals_val_get(update_section, "ORIG_SCALE", i_rep_section=i_rep, r_val=orig_scale)

IF (orig_type == wfn_mix_orig_virtual) mark_ind = 2
IF (mark_number .GT. 0) orig_mo_index = marked_states(mark_number, orig_spin_index, mark_ind)

CALL section_vals_val_get(wfn_mix_section, "OVERWRITE_MOS", l_val=overwrite_mos)

CALL section_vals_val_get(update_section, "REVERSE_MO_INDEX", l_val=reverse_mo_index)
CALL section_vals_val_get(update_section, "REVERSE_MO_INDEX", i_rep_section=i_rep, l_val=reverse_mo_index)

! First get a copy of the proper orig
! Origin is in the MO matrix
Expand All @@ -174,15 +174,15 @@ SUBROUTINE wfn_mix(mos, particle_set, dft_section, qs_kind_set, para_env, output
CALL cp_fm_to_fm(mos(orig_spin_index)%mo_coeff, matrix_x, 1, &
mos(orig_spin_index)%nmo - orig_mo_index + 1, 1)
END IF
! Orgin is in the virtual matrix
! Origin is in the virtual matrix
ELSE IF (orig_type == wfn_mix_orig_virtual) THEN
IF (.NOT. ASSOCIATED(unoccupied_orbs)) &
CALL cp_abort(__LOCATION__, &
"If ORIG_TYPE is set to VIRTUAL, the array unoccupied_orbs must be associated! "// &
"For instance, ask in the SCF section to compute virtual orbitals after the GS optimization.")
CALL cp_fm_to_fm(unoccupied_orbs(orig_spin_index), matrix_x, 1, orig_mo_index, 1)

! Orgin is to be read from an external .wfn file
! Origin is to be read from an external .wfn file
ELSE IF (orig_type == wfn_mix_orig_external) THEN
CALL section_vals_val_get(update_section, "ORIG_EXT_FILE_NAME", i_rep_section=i_rep, &
c_val=read_file_name)
Expand Down

0 comments on commit 4e0d974

Please sign in to comment.