*DK CMPN4S                                                                         CMPN4S.1         
      SUBROUTINE CMPN4S
CDIR$ BOUNDS                                                                       CMPN4S.3         
      SAVE
C     ****                                                                         CMPN4S.5         
C     ****     ADVANCE N4S COMPOSITION BY ONE TIME STEP                            CMPN4S.6         
C     ****                                                                         CMPN4S.7         
C     ****     COMMON DECKS:                                                       CMPN4S.8         
C     ****       PARAMS, ASAS, CONS, FIELDS, FIELDT, FLUX, INDEX, PHOTO,           CMPN4S.9         
C     ****          PSIB, RATEBLK, VSCR                                            CMPN4S.10        
C     ****                                                                         CMPN4S.11        
      include 'params.h'
      include 'asas2.h'
      include 'cons2.h'
      include 'fields2.h'
      include 'fieldt2.h'
      include 'flux2.h'
      include 'index.h'
      include 'photo2.h'
      include 'psib2.h'
      include 'rateblk2.h'
      include 'vscr.h'
      DIMENSION PHIN4S(3)
      DATA RMN4S,PHIN4S/14.,0.651,0.731,0.741/
C     ****                                                                         CMPN4S.25        
C     ****     UPPER BOUNDARY: DIFFUSIVE EQUILIBRIUM                               CMPN4S.26        
C     ****     LOWER BOUNDARY: PHOTO-CHEMICAL EQUILIBRIUM                          CMPN4S.27        
C     ****                                                                         CMPN4S.28        
      DO 1 I=3,LEN1-2
	T4(I)=0.
	T1(I)=0.
	T2(I)=1.
	T3(I)=-XN4S(I)*RMN4S/(FNO2(1,I)*RMASS(1)+FNO(1,I)*RMASS(2)+
     1    FNN2(1,I)*RMASS(3))
    1   CONTINUE
C     ****                                                                         CMPN4S.36        
C     ****     SOURCES                                                             CMPN4S.37        
C     ****                                                                         CMPN4S.38        
      DO 2 K=1,KMAXP1
	DO 2 I=3,LEN1-2
	  S1(I,K)=-(FK4O2P(K,I)+RBB(1,K,I)*FNO2(K,I)+RBB(3,K,I)*
     1      FNNO(K,I)+RBB(10,K,I)*FNOH(K,I))
	  S2(I,K)=PPN4S(K,I)+RBB(4,K,I)*FNN2D(K,I)*FNO(K,I)+RBB(5,K,I)*
     1      FNN2D(K,I)*FNE(K,I)+RBB(7,K,I)*FNN2D(K,I)+RBB(8,K,I)*
     2      FNNO(K,I)
    2 CONTINUE
C     ****                                                                         CMPN4S.47        
C     ****     PERIODIC POINTS                                                     CMPN4S.48        
C     ****                                                                         CMPN4S.49        
      DO 3 I = 1,2
	T1(I) = T1(I+IMAX)
	T1(I+IMAXP2) = T1(I+2)
	T2(I) = T2(I+IMAX)
	T2(I+IMAXP2) = T2(I+2)
	T3(I) = T3(I+IMAX)
	T3(I+IMAXP2) = T3(I+2)
	T4(I) = T4(I+IMAX)
	T4(I+IMAXP2) = T4(I+2)
	  DO 3 K = 1,KMAXP1
	    S1(I,K) = S1(I+IMAX,K)
	    S1(I+IMAXP2,K) = S1(I+2,K)
	    S2(I,K) = S2(I+IMAX,K)
	    S2(I+IMAXP2,K) = S2(I+2,K)
    3 CONTINUE
      IBND=0
      IBNDB=0
      ALFA=0.
      CALL MINOR(NPN4S,NN4SNM,RMN4S,PHIN4S,ALFA,IBND,IBNDB,PN4SB)
      RETURN
      END
