--- trunk/mdtools/md_code/generic_list_functions.i90 2003/01/27 18:28:11 247 +++ trunk/mdtools/md_code/generic_list_functions.i90 2003/01/30 20:03:37 254 @@ -46,18 +46,20 @@ subroutine find_atype(ident,this_list, atype) if (.not. associated(this_list)) return temp => this_list - + do while (associated(temp)) if (temp%atype_ident == ident) then atype => temp exit endif + temp => temp%next end do end subroutine find_atype subroutine create_identPtrList(ident,this_list,identPtrList,status) + use definitions integer, dimension(:) :: ident type(generic_atype), pointer :: this_list type(generic_atype), pointer :: tmpPtr @@ -71,7 +73,7 @@ subroutine create_identPtrList(ident,this_list,identPt status = 0 list_size = size(ident) - write(*,*) "Creating identPtrList for size: ", list_size + !! Allocate space for pointer list. if (.not. associated(identPtrList)) then allocate(identPtrList(list_size),stat=alloc_stat) @@ -79,10 +81,10 @@ subroutine create_identPtrList(ident,this_list,identPt status = -1 return end if - write(*,*) "Successfully allocated new list" + else if ( list_size > size(identPtrList)) then !! We've already allocated this list and need to make it bigger - write(*,*) "Warning reallocating identPointerList" + deallocate(identPtrList) allocate(identPtrList(list_size),stat=alloc_stat) if (alloc_stat /= 0) then @@ -99,12 +101,11 @@ subroutine create_identPtrList(ident,this_list,identPt do i = 1, list_size this_ident = ident(i) - write(*,*) "Finding atype for ident ", this_ident + call find_atype(this_ident,this_list,tmpPtr) !! If we can't find the atype corresponding to the ident, return w/ error. if (.not. associated(tmpPtr)) then status = -1 - write(*,*) "Could not find an atype for ident ", this_ident return end if