end_trial_wf Subroutine

public subroutine end_trial_wf()

Arguments

None

Contents

Source Code


Source Code

    subroutine end_trial_wf()

        use FciMCData, only: trial_space, con_space, con_space_vecs, TrialTag, ConTag
        use FciMCData, only: TrialWFTag, ConVecTag, CurrentTrialTag, ConTempTag, OccTrialTag
        use FciMCData, only: OccConTag, TrialTempTag, current_trial_amps
        use FciMCData, only: trial_wfs, trial_energies
        use MemoryManager, only: LogMemDealloc
        use sparse_arrays, only: deallocate_trial_hashtable

        character(len=*), parameter :: t_r = "end_trial_wf"
        integer :: ierr

        call deallocate_trial_hashtable(trial_ht)
        call deallocate_trial_hashtable(con_ht)

        if (allocated(trial_space)) then
            deallocate(trial_space, stat=ierr)
            call LogMemDealloc(t_r, TrialTag, ierr)
        end if
        if (allocated(trial_wfs)) then
            deallocate(trial_wfs, stat=ierr)
            call LogMemDealloc(t_r, TrialWFTag, ierr)
        end if
        if (allocated(trial_energies)) then
            deallocate(trial_energies, stat=ierr)
            if (ierr /= 0) write(stdout, '("Error when deallocating trial_energies:",1X,i8)') ierr
        end if
        if (allocated(con_space)) then
            deallocate(con_space, stat=ierr)
            call LogMemDealloc(t_r, ConTag, ierr)
        end if
        if (allocated(con_space_vecs)) then
            deallocate(con_space_vecs, stat=ierr)
            call LogMemDealloc(t_r, ConVecTag, ierr)
        end if
        if (allocated(current_trial_amps)) then
            deallocate(current_trial_amps, stat=ierr)
            call LogMemDealloc(t_r, CurrentTrialTag, ierr)
        end if
        if (allocated(con_send_buf)) deallocate(con_send_buf)

    end subroutine end_trial_wf