anchor.diff:      end do read_number_of_elements
       
       num_elems_2d=number_of_elements
  -    if(.not.allocated(elems_2d)) allocate(elems_2d(num_elems_2d))
  -    if(.not.allocated(elem_nodes_2d)) allocate(elem_nodes_2d(4,num_elems_2d))
  -    if(.not.allocated(elem_versn_2d)) allocate(elem_versn_2d(4,num_elems_2d))
  +    if(allocated(elems_2d))then
  +       deallocate(elems_2d)
  +       deallocate(elem_nodes_2d)
  +       deallocate(elem_versn_2d)
  +    endif
  +    allocate(elems_2d(num_elems_2d))
  +    allocate(elem_nodes_2d(4,num_elems_2d))
  +    allocate(elem_versn_2d(4,num_elems_2d))
       
       ne = 0
       
  
positive.code:     end do read_number_of_nodes
      
  !!!allocate memory to arrays that require node number
      if(.not.allocated(nodes_2d)) allocate(nodes_2d(num_nodes_2d))
      if(.not.allocated(node_xyz_2d)) allocate(node_xyz_2d(4,10,16,num_nodes_2d))
      if(.not.allocated(node_versn_2d)) allocate(node_versn_2d(num_nodes_2d))
      
      !.....read the coordinate, derivative, and version information for each node. 
      np=0
  
negative.code:     allocate(data_weight(3,num_data))
      
  !!! read the data point information
      open(10, file=readfile, status='old')
      read(unit=10, fmt="(a)", iostat=ierror) buffer
      
      !set the counted number of data points to zero
  