Skip to content

Commit

Permalink
SIRIUS: Fix memory leaks in interface
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Jan 17, 2020
1 parent a5311b6 commit 5481b7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/qs_kind_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ SUBROUTINE deallocate_qs_kind_set(qs_kind_set)
ENDIF
IF (ASSOCIATED(qs_kind_set(ikind)%upf_potential)) THEN
CALL atom_release_upf(qs_kind_set(ikind)%upf_potential)
DEALLOCATE (qs_kind_set(ikind)%upf_potential)
ENDIF
IF (ASSOCIATED(qs_kind_set(ikind)%se_parameter)) THEN
CALL semi_empirical_release(qs_kind_set(ikind)%se_parameter)
Expand Down
11 changes: 4 additions & 7 deletions src/sirius_interface.F
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ MODULE sirius_interface
USE cp_para_types, ONLY: cp_para_env_type
USE external_potential_types, ONLY: gth_potential_type
USE input_constants, ONLY: do_gapw_log
USE input_section_types, ONLY: section_vals_duplicate,&
section_vals_get,&
USE input_section_types, ONLY: section_vals_get,&
section_vals_get_subs_vals,&
section_vals_get_subs_vals2,&
section_vals_type,&
Expand Down Expand Up @@ -154,8 +153,8 @@ SUBROUTINE cp_sirius_create_env(pwdft_env)
TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
TYPE(qs_subsys_type), POINTER :: qs_subsys
TYPE(section_vals_type), POINTER :: libxc_fun, pwdft_section, &
pwdft_sub_section, xc_fun, xc_section
TYPE(section_vals_type), POINTER :: pwdft_section, pwdft_sub_section, &
xc_fun, xc_section

CPASSERT(ASSOCIATED(pwdft_env))
! create context of simulation
Expand All @@ -181,9 +180,7 @@ SUBROUTINE cp_sirius_create_env(pwdft_env)
IF (TRIM(xc_fun%section%name) == "LIBXC") THEN
CALL section_vals_get(xc_fun, n_repetition=n)
DO i = 1, n
NULLIFY (libxc_fun)
CALL section_vals_duplicate(xc_fun, libxc_fun, i_rep_start=i, i_rep_end=i)
CALL section_vals_val_get(libxc_fun, "FUNCTIONAL", c_val=section_name)
CALL section_vals_val_get(xc_fun, "FUNCTIONAL", i_rep_section=i, c_val=section_name)
CALL sirius_option_add_string_to(sctx, string('parameters'), string('xc_functionals'), string(section_name))
END DO
ENDIF
Expand Down

0 comments on commit 5481b7c

Please sign in to comment.