electrostatics_terminate Subroutine

public subroutine electrostatics_terminate(eel_obj)

Uses

  • proc~~electrostatics_terminate~~UsesGraph proc~electrostatics_terminate electrostatics_terminate module~mod_adjacency_mat mod_adjacency_mat proc~electrostatics_terminate->module~mod_adjacency_mat module~mod_memory mod_memory proc~electrostatics_terminate->module~mod_memory module~mod_adjacency_mat->module~mod_memory module~mod_io mod_io module~mod_memory->module~mod_io module~mod_constants mod_constants module~mod_memory->module~mod_constants iso_c_binding iso_c_binding module~mod_memory->iso_c_binding module~mod_io->module~mod_constants module~mod_constants->iso_c_binding

Arguments

Type IntentOptional Attributes Name
type(ommp_electrostatics_type), intent(inout) :: eel_obj

Calls

proc~~electrostatics_terminate~~CallsGraph proc~electrostatics_terminate electrostatics_terminate interface~mfree mfree proc~electrostatics_terminate->interface~mfree proc~free_yale_sparse free_yale_sparse proc~electrostatics_terminate->proc~free_yale_sparse proc~free_fmm free_fmm proc~electrostatics_terminate->proc~free_fmm proc~free_tree free_tree proc~electrostatics_terminate->proc~free_tree proc~r_free1 r_free1 interface~mfree->proc~r_free1 proc~i_free2 i_free2 interface~mfree->proc~i_free2 proc~i_free1 i_free1 interface~mfree->proc~i_free1 proc~r_free2 r_free2 interface~mfree->proc~r_free2 proc~r_free3 r_free3 interface~mfree->proc~r_free3 proc~i_free3 i_free3 interface~mfree->proc~i_free3 proc~l_free1 l_free1 interface~mfree->proc~l_free1 proc~l_free2 l_free2 interface~mfree->proc~l_free2 proc~free_tree->proc~free_yale_sparse proc~chk_free chk_free proc~r_free1->proc~chk_free proc~i_free2->proc~chk_free proc~i_free1->proc~chk_free proc~r_free2->proc~chk_free proc~r_free3->proc~chk_free proc~i_free3->proc~chk_free proc~l_free1->proc~chk_free proc~l_free2->proc~chk_free proc~fatal_error fatal_error proc~chk_free->proc~fatal_error proc~ommp_message ommp_message proc~fatal_error->proc~ommp_message proc~close_output close_output proc~fatal_error->proc~close_output proc~close_output->proc~ommp_message

Called by

proc~~electrostatics_terminate~~CalledByGraph proc~electrostatics_terminate electrostatics_terminate proc~mmpol_terminate mmpol_terminate proc~mmpol_terminate->proc~electrostatics_terminate proc~ommp_terminate ommp_terminate proc~ommp_terminate->proc~mmpol_terminate proc~c_ommp_terminate C_ommp_terminate proc~c_ommp_terminate->proc~ommp_terminate

Contents


Source Code

    subroutine electrostatics_terminate(eel_obj)
        use mod_memory, only: mfree
        use mod_adjacency_mat, only: free_yale_sparse

        implicit none

        type(ommp_electrostatics_type), intent(inout) :: eel_obj
        integer(ip) :: i

        call mfree('electrostatics_terminate [q]', eel_obj%q)
        call mfree('electrostatics_terminate [pol]', eel_obj%pol)
        call mfree('electrostatics_terminate [cpol]', eel_obj%cpol)
        call mfree('electrostatics_terminate [polar_mm]', eel_obj%polar_mm)
        call mfree('electrostatics_terminate [mm_polar]', eel_obj%mm_polar)
        call mfree('electrostatics_terminate [thole]', eel_obj%thole)
        call mfree('electrostatics_terminate [idp]', eel_obj%ipd) 

        if (eel_obj%amoeba) then
            call mfree('electrostatics_terminate [q0]', eel_obj%q0)
            call mfree('electrostatics_terminate [mmat_polgrp]', &
                       eel_obj%mmat_polgrp)
            if(allocated(eel_obj%pg_conn)) then
                do i=1, size(eel_obj%pg_conn)
                    call free_yale_sparse(eel_obj%pg_conn(i))
                end do
                deallocate(eel_obj%pg_conn)
            end if
            
            call free_yale_sparse(eel_obj%polgrp_mmat)
            call mfree('electrostatics_terminate [mol_frame]', &
                       eel_obj%mol_frame)
            call mfree('electrostatics_terminate [ix]', eel_obj%ix)
            call mfree('electrostatics_terminate [iy]', eel_obj%iy)
            call mfree('electrostatics_terminate [iz]', eel_obj%iz)
        end if
        
        call mfree('electrostatics_terminate [E_M2D]', eel_obj%E_M2D)
        call mfree('electrostatics_terminate [V_M2M]', eel_obj%V_M2M)
        call mfree('electrostatics_terminate [E_M2M]', eel_obj%E_M2M)
        call mfree('electrostatics_terminate [Egrd_M2M]', eel_obj%Egrd_M2M)

        if(allocated(eel_obj%todo_S_S)) deallocate(eel_obj%todo_S_S)
        if(allocated(eel_obj%todo_P_P)) deallocate(eel_obj%todo_P_P)
        call mfree('electrostatics_terminate [scalef_S_S]', eel_obj%scalef_S_S)
        call mfree('electrostatics_terminate [scalef_P_P]', eel_obj%scalef_P_P)
        if(allocated(eel_obj%list_S_S)) then
            call free_yale_sparse(eel_obj%list_S_S)
            deallocate(eel_obj%list_S_S)
        end if
        if(allocated(eel_obj%list_P_P)) then
            call free_yale_sparse(eel_obj%list_P_P)
            deallocate(eel_obj%list_P_P)
        end if

        if(eel_obj%use_fmm) then
            call free_fmm(eel_obj%fmm_static)
            do i=1, eel_obj%n_ipd
                call free_fmm(eel_obj%fmm_ipd(i))
            end do
            call free_tree(eel_obj%tree)
            deallocate(eel_obj%fmm_static, eel_obj%fmm_ipd, eel_obj%tree)
            call free_yale_sparse(eel_obj%fmm_near_field_list)
        end if

    end subroutine electrostatics_terminate