Skip to content

Commit

Permalink
Print wannier states coefficients in AO basis
Browse files Browse the repository at this point in the history
* Print Wannier states in AO basis when input section
  "FORCE_EVAL/DFT/LOCALIZE/PRINT/WANNIER_STATES" is used

* Modify behaviour of the above input section so that it is not ignored
  when input section " ... /PRINT/WANNIER_CENTERS" is missing
  • Loading branch information
hossamelgabarty authored Sep 20, 2024
1 parent 47e307d commit c1b10bd
Show file tree
Hide file tree
Showing 3 changed files with 279 additions and 12 deletions.
12 changes: 9 additions & 3 deletions src/input_cp2k_loc.F
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ SUBROUTINE create_molecular_states_section(print_key)

CALL keyword_create( &
keyword, __LOCATION__, name="CUBE_EVAL_RANGE", &
description="only write cubes if the eigenvalues of the corresponding molecular states lie in the given interval. "// &
description="only write cubes if the energies of the corresponding molecular states lie in the given interval. "// &
"Default is all states.", &
usage="CUBE_EVAL_RANGE -1.0 1.0", unit_str="hartree", n_var=2, type_of_var=real_t)
CALL section_add_keyword(print_key, keyword)
Expand Down Expand Up @@ -499,12 +499,12 @@ SUBROUTINE create_wannier_states_section(print_key)
CPASSERT(.NOT. ASSOCIATED(print_key))
NULLIFY (print_key2, keyword)
CALL cp_print_key_section_create(print_key, __LOCATION__, "WANNIER_STATES", &
description="Controls printing of molecular states ", &
description="Controls printing of Wannier states ", &
print_level=high_print_level, filename=" ")

CALL keyword_create( &
keyword, __LOCATION__, name="CUBE_EVAL_RANGE", &
description="only write cubes if the eigenvalues of the corresponding molecular states lie in the given interval. "// &
description="only write cubes if the energies of the corresponding molecular states lie in the given interval. "// &
"Default is all states.", &
usage="CUBE_EVAL_RANGE -1.0 1.0", unit_str="hartree", n_var=2, type_of_var=real_t)
CALL section_add_keyword(print_key, keyword)
Expand All @@ -522,6 +522,12 @@ SUBROUTINE create_wannier_states_section(print_key)
CALL section_add_keyword(print_key, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="CARTESIAN", &
description="Print the Wannier states in the Cartesian basis instead of the default spherical basis.", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(print_key, keyword)
CALL keyword_release(keyword)

CALL cp_print_key_section_create(print_key2, __LOCATION__, "cubes", &
description="Controls the printing of cube files", &
print_level=high_print_level, filename="")
Expand Down
4 changes: 2 additions & 2 deletions src/qs_scf_post_gpw.F
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ SUBROUTINE scf_post_calculation_gpw(qs_env, wf_type, do_mp2)
p_loc = p_loc .OR. BTEST(cp_print_key_should_output(logger%iter_info, print_key), cp_p_file)
print_key => section_vals_get_subs_vals(loc_print_section, "MOLECULAR_MOMENTS")
p_loc = p_loc .OR. BTEST(cp_print_key_should_output(logger%iter_info, print_key), cp_p_file)
print_key => section_vals_get_subs_vals(loc_print_section, "WANNIER_STATES")
p_loc = p_loc .OR. BTEST(cp_print_key_should_output(logger%iter_info, print_key), cp_p_file)
ELSE
p_loc = .FALSE.
END IF
Expand All @@ -422,8 +424,6 @@ SUBROUTINE scf_post_calculation_gpw(qs_env, wf_type, do_mp2)
"therefore localization of unoccupied states will be skipped!")
p_loc_lumo = .FALSE.
END IF
print_key => section_vals_get_subs_vals(loc_print_section, "WANNIER_STATES")
p_loc = p_loc .OR. BTEST(cp_print_key_should_output(logger%iter_info, print_key), cp_p_file)

! Control for STM
stm_section => section_vals_get_subs_vals(input, "DFT%PRINT%STM")
Expand Down
Loading

0 comments on commit c1b10bd

Please sign in to comment.