C  * * * * * * * * * * * * * * * * * * * * * * * * * * * * *            
C     SUBROUTINE FOR NATURAL FREQUENCIES OF LAYERED SOIL                
C  * * * * * * * * * * * * * * * * * * * * * * * * * * * * *            
C                                                                       
C                                      CODED BY Y.OHSAKI                
C                                                                       
      SUBROUTINE NAFR(N,DF,FREQ,AMP,ND1,NMODE,F,ND2)                    
C                                                                       
      DIMENSION FREQ(ND1),AMP(ND1),F(ND2)                               
C                                                                       
      NMODE=0                                                           
      DO 110 K=2,N-1                                                    
      IF(NMODE.EQ.ND2) RETURN                                           
      IF(AMP(K-1).GT.AMP(K).OR.AMP(K).LT.AMP(K+1)) GO TO 110            
      NMODE=NMODE+1                                                     
      F(NMODE)=(AMP(K-1)-AMP(K+1))/(AMP(K-1)-2.*AMP(K)+AMP(K+1))        
     *         *DF/2.+FREQ(K)                                           
  110 CONTINUE                                                          
      RETURN                                                            
      END                                                               
                                                                        
                                                                        
