Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(inout) | :: | eel_obj |
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