*DECK EDIJOU
      SUBROUTINE EDIJOU(IPMAC2,IPTRK1,IPFLUX,IPRINT,NGCOND,IGCOND)
*
*-----------------------------------------------------------------------
*
*Purpose:
* recover ALBS information from last component of unknown array for use
* with SPH equivalence techniques. Currently, only SYBILF routine has
* capability to fill the last component of unknown array. SYBILF is
* activated with ARM keyword in ASM: module.
*
*Copyright:
* Copyright (C) 2015 Ecole Polytechnique de Montreal
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version
*
*Author(s): A. Hebert
*
*Parameters: input
* IPMAC2  pointer to condensed macrolib information (L_MACROLIB
*         signature) built by EDI:.
* IPTRK1  pointer to the reference tracking object.
* IPFLUX  pointer to the reference solution (L_FLUX signature).
* IPRINT  print index.
* NGCOND  number of condensed groups.
* IGCOND  limit of condensed groups.
*
*-----------------------------------------------------------------------
*
      USE GANLIB
*----
*  SUBROUTINE ARGUMENTS
*----
      TYPE(C_PTR) IPMAC2,IPTRK1,IPFLUX
      INTEGER IPRINT,NGCOND,IGCOND(NGCOND)
*----
*  LOCAL VARIABLES
*----
      PARAMETER (NSTATE=40)
      TYPE(C_PTR) JPFLUX
      INTEGER ISTATE(NSTATE)
      REAL, ALLOCATABLE, DIMENSION(:) :: COURIN,WORKD
      CHARACTER CDOOR*12,HSMG*131
*----
*  CHECK AVAILABILITY OF EXTRA COMPONENT
*----
      CALL LCMGTC(IPTRK1,'TRACK-TYPE',12,1,CDOOR)
      IF(CDOOR.NE.'SYBIL') THEN
         WRITE(HSMG,'(45HEDIJOU: INCOMPATIBLE SOLUTION TYPE. SYBIL EXP,
     1   7HECTED. ,A12,6HFOUND.)') CDOOR
         CALL XABORT(HSMG)
      ENDIF
      CALL LCMGET(IPTRK1,'STATE-VECTOR',ISTATE)
      NUNKNO=ISTATE(2)+ISTATE(9)+1
*----
*  COMPUTE THE OUTGOING CURRENT
*----
      ALLOCATE(COURIN(NGCOND))
      IGRFIN=0
      CALL LCMSIX(IPMAC2,'ADF',1)
      DO 100 IGRCD=1,NGCOND
      COURIN(IGRCD)=0.0
      IGRDEB=IGRFIN+1
      IGRFIN=IGCOND(IGRCD)
      CALL LCMLEN(IPFLUX,'FLUX',ILON,ITYLCM)
      IF(ILON.EQ.0) CALL XABORT('EDIJOU: MISSING FLUX INFO(1).')
      JPFLUX=LCMGID(IPFLUX,'FLUX')
      DO 100 IGR=IGRDEB,IGRFIN
      CALL LCMLEL(JPFLUX,IGR,ILCMLN,ITYLCM)
      IF(ILCMLN.EQ.0) CALL XABORT('EDIJOU: MISSING FLUX INFO(2).')
      IF(ILCMLN.NE.NUNKNO) CALL XABORT('EDIJOU: ARM KEYWORD MUST BE SE'
     1 //'T IN ASM: MODULE.')
      ALLOCATE(WORKD(NUNKNO))
      CALL LCMGDL(JPFLUX,IGR,WORKD)
      COURIN(IGRCD)=COURIN(IGRCD)+WORKD(NUNKNO)
      DEALLOCATE(WORKD)
  100 CONTINUE
      CALL LCMPUT(IPMAC2,'ALBS00',NGCOND,2,COURIN)
      IF(IPRINT.GT.3) THEN
         WRITE(6,900) (COURIN(IGR),IGR=1,NGCOND)
         WRITE(6,'(/)')
      ENDIF
      CALL LCMSIX(IPMAC2,' ',2)
      DEALLOCATE(COURIN)
      RETURN
*
  900 FORMAT(/49H EDIJOU: OUT-CURRENTS (4J-/S) PER MACRO-GROUP ARE/
     > (1X,1P,10E13.5))
      END
