1C ------------------------------------------------------------
2C INT2SEQ converts integers into the S-sequence
3C int   = integer to be converted
4C nv    = # of S variables
5C INFOS = info for S-var
6C SEQ   = S-sequence
7C IS    = map to c, H, G, etc
8C Developed by A.Rossi, C.Planas and G.Fiorentini
9C
10C Copyright (C) 2010-2014 European Commission
11C
12C This file is part of Program DMM
13C
14C DMM is free software developed at the Joint Research Centre of the
15C European Commission: you can redistribute it and/or modify it under
16C the terms of the GNU General Public License as published by
17C the Free Software Foundation, either version 3 of the License, or
18C (at your option) any later version.
19C
20C DMM is distributed in the hope that it will be useful,
21C but WITHOUT ANY WARRANTY; without even the implied warranty of
22C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23C GNU General Public License for more details.
24C
25C You should have received a copy of the GNU General Public License
26C along with DMM.  If not, see <http://www.gnu.org/licenses/>.
27C -----------------------------------------------------------------------
28	SUBROUTINE INT2SEQ(int,nv,INFOS,SEQ,IS)
29C INPUT
30	INTEGER int,nv,INFOS(9,6)
31C OUTPUT
32	INTEGER SEQ(nv),IS(6)
33C LOCALS
34	INTEGER M,i,j,k,ns(nv)
35
36	IS(:)  = 1
37	SEQ(:) = 1
38	ns(1:nv) = INFOS(8,1:nv)
39	j = int
40	i = nv
41	DO WHILE (i.GT.1)
42        M = PRODUCT(ns(nv-i+2:nv))
43        DO 10 k = 1,ns(nv-i+1)
44         IF (j.LE.k*M) THEN
45           SEQ(nv-i+1) = k
46           GOTO 11
47         ENDIF
4810      CONTINUE
4911      j = j-(k-1)*M
50        i = i - 1
51	ENDDO
52	SEQ(nv) = j
53	DO 20 i = 1,nv
54	 DO 20 j = 1,INFOS(1,i)
5520	 IS(INFOS(j+1,i)) = SEQ(i)
56	RETURN
57	END
58