molecule_destroy Subroutine

private subroutine molecule_destroy(this)

Clean up allocated memory in molecule_t

Type Bound

molecule_t

Arguments

Type IntentOptional Attributes Name
class(molecule_t), intent(inout) :: this

Calls

proc~~molecule_destroy~~CallsGraph proc~molecule_destroy molecule_t%molecule_destroy proc~geometry_destroy geometry_type%geometry_destroy proc~molecule_destroy->proc~geometry_destroy

Variables

Type Visibility Attributes Name Initial
integer, private :: i

Source Code

   subroutine molecule_destroy(this)
      !! Clean up allocated memory in molecule_t
      class(molecule_t), intent(inout) :: this
      integer :: i

      if (allocated(this%name)) deallocate (this%name)

      call this%geometry%destroy()

      if (allocated(this%fragments)) then
         do i = 1, size(this%fragments)
            call this%fragments(i)%destroy()
         end do
         deallocate (this%fragments)
      end if

      if (allocated(this%bonds)) deallocate (this%bonds)

   end subroutine molecule_destroy