*DK CMPN2D                                                                         CMPN2D.1         
      SUBROUTINE CMPN2D
      SAVE
C     ****                                                                         CMPN2D.4         
C     ****     CALCULATE N(N2D) ASSUMING PHOTOCHEMICAL EQUILIBRIUM                 CMPN2D.5         
C     ****                                                                         CMPN2D.6         
C     ****     COMMON BLOCKS NEEDED:                                               CMPN2D.7         
C     ****       PARAMS, CONS, FIELDS, FIELDT, FLUX, OPION, RATEBLK                CMPN2D.8         
C     ****                                                                         CMPN2D.9         
      include 'params.h'
      include 'cons2.h'
      include 'fields2.h'
      include 'fieldt2.h'
      include 'flux2.h'
      include 'noznoz2.h'
      include 'opion2.h'
      include 'rateblk2.h'
      DO 1 K=1,KMAXP1
	DO 1 I=3,LEN1-2
	  FNN2D(K,I)=PPN2D(K,I)/(RBB(2,K,I)*FNO2(K,I)+RBB(4,K,I)*
     1      FNO(K,I)+RBB(5,K,I)*FNE(K,I)+RBB(6,K,I)*FNNO(K,I)+RBB(7,K,I)
     2      +FIOP(K,I))
	  FNNOZ(K,I)=FNNO(K,I)+FNNO2(K,I)
	  SNO2NO(K,I)=(RBB(12,K,I)*FNHO2(K,I)+RBB(11,K,I)*FNO3(K,I))
     1      /(RBB(14,K,I)+RBB(13,K,I)*FNO(K,I)+RBB(15,K,I)*FNO3(K,I))
	  RNONOZ(K,I)=1./(1.+SNO2NO(K,I))
    1 CONTINUE
C     ****                                                                         CMPN2D.28        
C     ****     PERIODIC POINTS                                                     CMPN2D.29        
C     ****                                                                         CMPN2D.30        
      DO 2 I = 1,2
	DO 2 K = 1,KMAXP1
	  FNN2D(K,I) = FNN2D(K,I+IMAX)
	  FNN2D(K,I+IMAXP2) = FNN2D(K,I+2)
	  FNNOZ(K,I) = FNNOZ(K,I+IMAX)
	  FNNOZ(K,I+IMAXP2) = FNNOZ(K,I+2)
	  SNO2NO(K,I) = SNO2NO(K,I+IMAX)
	  SNO2NO(K,I+IMAXP2) = SNO2NO(K,I+2)
	  RNONOZ(K,I) = RNONOZ(K,I+IMAX)
	  RNONOZ(K,I+IMAXP2) = RNONOZ(K,I+2)
    2 CONTINUE
      RETURN
      END
