anchor.diff: -MODULE growtree
  +module growtree
     !
     !*Brief Description:* This module generates a volume-filling tree within a bounding surface.
     !
  
positive.code:   ! they are not co-linear with parent. One branch is checked for its angle, and then
    ! the other is made to be in-plane with the parent and sibling branch.
    !
    SUBROUTINE limit_branch_angles(ne,ne_parent,np,&
         np_prnt_start,np_start,angle_max,angle_min)
      !DEC$ ATTRIBUTES DLLEXPORT,ALIAS:"SO_LIMIT_BRANCH_ANGLES" :: LIMIT_BRANCH_ANGLES
  
      USE diagnostics, ONLY: enter_exit
      IMPLICIT NONE
  
      INTEGER,INTENT(in) :: ne,ne_parent,np,np_prnt_start,np_start
      REAL(dp) :: angle_max,angle_min
  
      !Local variables
      INTEGER :: elem_check,elem_in_plane,node_check,node_in_plane
      REAL(dp),DIMENSION(3) :: B,NRML,U,V,W
      REAL(dp),DIMENSION(3,3) :: A
      REAL(dp) :: angle_uw,angle_uv,angle_vw,length,length_w
  
      CHARACTER(len=60) :: sub_name
  
      sub_name = 'limit_branch_angles'
      CALL enter_exit(sub_name,1)
  
      elem_check = ne-1  ! the default element to check angle for is the '1st' branch
      node_check = np-1  ! node associated with ne-1
  
negative.code:   !*calculate_seed_cofm:* calculates centre of mass of a list of seed
    ! points by averaging their coordinates and returns result in 'cofm'
    !
    subroutine calculate_seed_cofm(map_seed_to_elem,nen,COFM)
      !DEC$ ATTRIBUTES DLLEXPORT,ALIAS:"SO_CALCULATE_SEED_COFM" :: CALCULATE_SEED_COFM
  
      use diagnostics, only: enter_exit
      implicit none
  
      integer :: map_seed_to_elem(*),nen
      real(dp) :: COFM(3)
  
      !Local variables
      integer :: DAT,nd,nsp
  
      character(len=60) :: sub_name
  
      sub_name = 'calculate_seed_cofm'
      call enter_exit(sub_name,1)
  
      DAT = 0
      cofm = 0.0_dp
  
      do nd=1,num_data
         nsp=map_seed_to_elem(nd) !the space # for the nd-th data point
         if(nsp.eq.nen)then
            DAT=DAT+1
            COFM(1:3)=COFM(1:3)+data_xyz(1:3,nd)
         endif
      enddo !nd
      if(DAT.ne.0) COFM(1:3) = COFM(1:3)/DAT !centre of mass
  
      call enter_exit(sub_name,2)
  
    end subroutine calculate_seed_cofm
  
  
    !###############################################################
  