anchor.diff:              IF(ALLOCATED(Pe_elem)) DEALLOCATE(Pe_elem)
               IF(ALLOCATED(Qe_elem)) DEALLOCATE(Qe_elem)
               IF(ALLOCATED(Se_elem)) DEALLOCATE(Se_elem)
  +            
  +            IF(ALLOCATED(Fi_elem)) DEALLOCATE(Fi_elem)
  +            IF(ALLOCATED(Ki_elem)) DEALLOCATE(Ki_elem)
  +            IF(ALLOCATED(Mi_elem)) DEALLOCATE(Mi_elem)
  +            IF(ALLOCATED(Gi_elem)) DEALLOCATE(Gi_elem)
           ENDIF
   
      END SUBROUTINE ElementMatrix
  
positive.code:    SUBROUTINE ElementMatrix(Nuu0,Nuuu,Nrr0,Nrrr,Next,hhp,Stif0,Jac,&
                              &w,node_elem,nelem,norder,dof_node,elk,elf)
  
     REAL(ReKi),INTENT(IN)::Nuu0(:),Nuuu(:),Nrr0(:),Nrrr(:),Next(:)
     REAL(ReKi),INTENT(IN)::hhp(:,:),Stif0(:,:,:),Jac
     REAL(ReKi),INTENT(IN)::w(:)
     INTEGER(IntKi),INTENT(IN)::node_elem,nelem,norder,dof_node
  
     REAL(ReKi),INTENT(INOUT)::elk(:,:),elf(:)      
  
     REAL(ReKi),ALLOCATABLE::Fc_elem(:,:),Fd_elem(:,:),Oe_elem(:,:,:)
     REAL(ReKi),ALLOCATABLE::Pe_elem(:,:,:),Qe_elem(:,:,:),Se_elem(:,:,:)
     REAL(ReKi)::E10(3),RR0(3,3),kapa(3),E1(3),Stif(6,6),cet
     REAL(ReKi)::Fc(6),Fd(6),Oe(6,6),Pe(6,6),Qe(6,6)
  
     INTEGER(IntKi)::i,j,k,m,n,temp_id1,temp_id2
     INTEGER(IntKi)::allo_stat
        
  
     ALLOCATE(Fi_elem(dof_node,node_elem),STAT = allo_stat)
     IF(allo_stat/=0) GOTO 9999
     Fi_elem = 0.0D0
  
negative.code:    DEALLOCATE(Pe_elem)
     DEALLOCATE(Qe_elem)
     DEALLOCATE(Se_elem)
     
     DEALLOCATE(Fi_elem)
     DEALLOCATE(Ki_elem)
     DEALLOCATE(Mi_elem)
     DEALLOCATE(Gi_elem)
     
     9999 IF(allo_stat/=0) THEN
              IF(ALLOCATED(Fc_elem)) DEALLOCATE(Fc_elem)
  