Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
Debug Splittings

Debug reslase Evects

Debug memory leak

Debug memory leak

debug
  • Loading branch information
Tarandin committed Jul 14, 2023
1 parent 07a2353 commit d858cd1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 26 deletions.
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,9 @@ list(
qs_tddfpt2_operators.F
qs_tddfpt2_properties.F
qs_tddfpt2_restart.F
qs_tddfpt2_soc.F
qs_tddfpt2_soc_utils.F
qs_tddfpt2_soc_types.F
qs_tddfpt2_stda_types.F
qs_tddfpt2_stda_utils.F
qs_tddfpt2_subgroups.F
Expand Down
4 changes: 2 additions & 2 deletions src/qs_tddfpt2_methods.F
Original file line number Diff line number Diff line change
Expand Up @@ -1226,8 +1226,8 @@ SUBROUTINE tddfpt_soc_energies(qs_env, nstates, work_matrices, &
END IF

! deallocate the additional multiplicity
DO istate = 1, SIZE(evects_mult, 1)
DO ispin = 1, SIZE(evects_mult, 2)
DO ispin = 1, SIZE(evects_mult, 1)
DO istate = 1, SIZE(evects_mult, 2)
CALL cp_fm_release(evects_mult(ispin, istate))
END DO
END DO
Expand Down
40 changes: 20 additions & 20 deletions src/qs_tddfpt2_soc.F
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ SUBROUTINE tddfpt_soc_rcs(qs_env, evals_sing, evals_trip, evects_sing, evects_tr
CALL section_vals_val_get(soc_section, "EPS_FILTER", r_val=eps_filter)

nsg = SIZE(evals_sing) ! Number of excited singlet states
ntp = SIZE(evals_trip) ! Number of excited triplett states
ntp = SIZE(evals_trip) ! Number of excited triplet states
nex = nsg ! Number of excited states of each multiplicity
ntot = 1 + nsg + 3*ntp ! Number of (GS + S + T^-1 + T^0 + T^1)

! Initzialize Working envirment
! Initzialize Working environment
CALL inititialize_soc(qs_env, soc_atom_env, soc_env, &
evects_sing, evects_trip, dipole_form)

Expand Down Expand Up @@ -394,7 +394,7 @@ SUBROUTINE tddfpt_soc_rcs(qs_env, evals_sing, evals_trip, evects_sing, evects_tr
!! Prefactor due to rcs.
!! The excitation is presented as a linear combination of
!! alpha and beta, where dalpha=-dbeta for triplet exc.
!! and dalpha=dbeta for the singlett case
!! and dalpha=dbeta for the singlet case
sqrt2 = SQRT(2.0_dp)

!! Precompute the <phi_i^0|H^SOC|phi_j^0> matrix elements
Expand Down Expand Up @@ -1026,7 +1026,17 @@ SUBROUTINE tddfpt_soc_rcs(qs_env, evals_sing, evals_trip, evects_sing, evects_tr
END IF
WRITE (log_unit, '(A)') "------------------------------------------------------------------------"
DO WHILE (iex <= SIZE(soc_env%soc_evals))
IF (evals_sing(isg) < evals_trip(itp) .OR. itp > SIZE(evals_trip)) THEN
IF (itp < SIZE(evals_trip) .AND. isg < SIZE(evals_sing)) THEN
IF (evals_sing(isg) < evals_trip(itp)) THEN
tmp = soc_env%soc_evals(iex) - evals_sing(isg)
mult = "S"
isg = isg + 1
ELSE
tmp = soc_env%soc_evals(iex) - evals_trip(itp)
mult = "T"
itp = itp + 1
END IF
ELSE IF (itp > SIZE(evals_trip)) THEN
tmp = soc_env%soc_evals(iex) - evals_sing(isg)
mult = "S"
isg = isg + 1
Expand Down Expand Up @@ -1075,18 +1085,6 @@ SUBROUTINE tddfpt_soc_rcs(qs_env, evals_sing, evals_trip, evects_sing, evects_tr

END SUBROUTINE tddfpt_soc_rcs

!******************************************************************************
! \brief: This routine will be handling some nessesary initalizations for the
! soc calcualtions
! \param qs_env: ...
! \param soc_atom_env: This type will contain information to calculate the
! ZORA-operator within the atomic grid
! \param soc_env: this structure will transfer different matrices realted to
! the SOC-calculation
! \param evects_a: Eigenvector of the singlet or spin-conserving excitation
! \param evects_b: Eigenvector of the triplet or spin-flip excitation
!******************************************************************************

! **************************************************************************************************
!> \brief Some additional initalizations
!> \param qs_env Quickstep environment
Expand All @@ -1109,9 +1107,9 @@ SUBROUTINE inititialize_soc(qs_env, soc_atom_env, soc_env, &
CHARACTER(LEN=*), PARAMETER :: routineN = 'inititialize_soc'

CHARACTER(len=default_string_length), &
DIMENSION(:), POINTER :: k_list
ALLOCATABLE, DIMENSION(:, :) :: grid_info
CHARACTER(len=default_string_length), &
DIMENSION(:, :), POINTER :: grid_info
DIMENSION(:), POINTER :: k_list
INTEGER :: handle, i, ikind, irep, ispin, nactive, &
nao, natom, nkind, nrep, nspins, &
nstates
Expand All @@ -1131,7 +1129,7 @@ SUBROUTINE inititialize_soc(qs_env, soc_atom_env, soc_env, &
CALL timeset(routineN, handle)

NULLIFY (qs_kind_set, particle_set, blacs_env, para_env, &
a_coeff, b_coeff, grid_info, tddfpt_control)
a_coeff, b_coeff, tddfpt_control)

!! Open_shell is not implemented yet
do_os = .FALSE.
Expand Down Expand Up @@ -1214,6 +1212,8 @@ SUBROUTINE inititialize_soc(qs_env, soc_atom_env, soc_env, &
CALL compute_sphi_so(ikind, "ORB", soc_atom_env%orb_sphi_so(ikind)%array, qs_env)
END DO !ikind

DEALLOCATE (grid_info)

CALL timestop(handle)

END SUBROUTINE inititialize_soc
Expand All @@ -1229,7 +1229,7 @@ SUBROUTINE init_atom_grid(soc_atom_env, grid_info, qs_env)

TYPE(soc_atom_env_type) :: soc_atom_env
CHARACTER(len=default_string_length), &
DIMENSION(:, :), POINTER :: grid_info
ALLOCATABLE, DIMENSION(:, :) :: grid_info
TYPE(qs_environment_type) :: qs_env

CHARACTER(LEN=*), PARAMETER :: routineN = 'init_atom_grid'
Expand Down
6 changes: 3 additions & 3 deletions src/qs_tddfpt2_soc_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ MODULE qs_tddfpt2_soc_types
! \param soc_osc: ozillatorstrength of soc-corrected excitations
!*************************************************************************************************
TYPE soc_env_type
!! a :: singlett or spin-conservm b :: triplett or spin flip
!! a :: singlet or spin-conserving b :: triplet or spin flip
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: orb_soc
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: dipmat
REAL(dp), POINTER, DIMENSION(:) :: evals_a, &
Expand Down Expand Up @@ -84,9 +84,9 @@ SUBROUTINE soc_env_create(soc_env)
TYPE(soc_env_type), TARGET :: soc_env

NULLIFY (soc_env%orb_soc)
NULLIFY (soc_env%dipmat)
NULLIFY (soc_env%evals_a)
NULLIFY (soc_env%evals_b)
NULLIFY (soc_env%dipmat)

END SUBROUTINE soc_env_create

Expand Down Expand Up @@ -116,7 +116,7 @@ SUBROUTINE soc_env_release(soc_env)
CALL dbcsr_release(soc_env%dipmat(i)%matrix)
DEALLOCATE (soc_env%dipmat(i)%matrix)
END DO
NULLIFY (soc_env%dipmat)
DEALLOCATE(soc_env%dipmat)
END IF
IF (ALLOCATED(soc_env%soc_evals)) DEALLOCATE (soc_env%soc_evals)
IF (ALLOCATED(soc_env%soc_osc)) DEALLOCATE (soc_env%soc_osc)
Expand Down
2 changes: 1 addition & 1 deletion src/qs_tddfpt2_soc_utils.F
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ SUBROUTINE soc_dipole_operator(dipmat, tddfpt_control, qs_env)
CALL get_qs_env(qs_env, matrix_s=matrix_s)
CALL dbcsr_get_info(matrix_s(1)%matrix, nfullrows_total=nao)

NULLIFY (dipmat)
!NULLIFY (dipmat)
ALLOCATE (dipmat(dim_op))
DO i_dim = 1, dim_op
ALLOCATE (dipmat(i_dim)%matrix)
Expand Down

0 comments on commit d858cd1

Please sign in to comment.