       !************************************************************************
       !   A Subroutine of Main, Estimate the total sequence length            *
       !************************************************************************
       
       Subroutine SitePDB(PDBid, MinModel, MaxModel, MinChain, MaxChain, MinResidue, MaxResidue, MinAtom, MaxAtom, ATM, AANm, vd, Site)
       
       Implicit None
       
! ---- Variables : -------------------------------------------------------------- !       
       Character*4 PDBid
       
       Integer    MinModel, MinChain, MinResidue, MinAtom  ! The initial Min value is set to an extreme big value
       Integer    MaxModel, MaxChain, MaxResidue, MaxAtom  ! The initial Max value is set to an extreme small value
       
! ---- Variables : -------------------------------------------------------------- !       
       Character   ATM(   MinModel:MaxModel, MinChain:MaxChain, MinResidue:MaxResidue, MinAtom:MaxAtom )*4    ! The Name of atom
       Character   AANm(  MinModel:MaxModel, MinChain:MaxChain, MinResidue:MaxResidue, MinAtom:MaxAtom )*3    ! The Name of residue
       
       Integer     vd(  MinModel:MaxModel, MinChain:MaxChain, MinResidue:MaxResidue, MinAtom:MaxAtom )        ! Record the existence of the ATOM :
                                                                                                              ! Amino Acids Atom   : vd=1
                                                                                                              ! Nucleic Acids Atom : vd=2
! ---- Variables : -------------------------------------------------------------- !      
       Integer      Site
       Character*4  ATNAME
       
       Integer      i, j, k, s, ct
       
! ---- Variables : -------------------------------------------------------------- !      
       Logical      NodeExist
       Character*4  NodeAtom(MaxAtom)
       Integer      m, MaxNode
       
! ------------------------------------------------------------------------------- !

! ------------------------------------------------------- Read in the 'PDB Nodes Atoms.inp' File
       INQUIRE (FILE='PDB Nodes Atoms.inp', EXIST=NodeExist) 
       If(NodeExist==.False.) Then
            Write(*,*) PDBid, '  Error! Can not find the [PDB Nodes Atoms.inp] file. '
            Write(9,*) PDBid, '  Error! Can not find the [PDB Nodes Atoms.inp] file. '
            Stop
       EndIf
       
       Open (111, FILE='PDB Nodes Atoms.inp')
       
       m=0
       Read(111,'(A4)')  ATNAME
       Do While(ATNAME.NE.'====')
          m=m+1
          NodeAtom(m) = ATNAME
          Read(111,'(A4)')  ATNAME
       Enddo
       MaxNode=m
       
       Close(111) ! FILE='PDB Nodes Atoms.inp'
            

! ------------------------------------------------------------------------------- !
       
       ct=0  ! ===================================== Estimate the total sequence length 
       Do k=MinModel, MaxModel
          Do j=MinChain, MaxChain
            Do i=MinResidue, MaxResidue
              Do s=MinAtom, Maxatom                
              
                 IF(vd(k,j,i,s)>0) Then
                 
                    ATNAME=ATM(k,j,i,s)           
                    Do m=1, MaxNode
                       If( ATNAME==NodeAtom(m) ) ct=ct+1
                    Enddo                                                                                
                                     
                 EndIF  ! IF(vd(k,j,i,s)>0)
                 
              Enddo  ! s
            Enddo  ! i
          Enddo  ! j       
       Enddo ! k ! ===================================== Estimate the total sequence length 
           
       Site=ct
       
       Write(*,*) '   '
       Write(9,*) '   '
       Write(*,'(A,I)') 'The total nodes numbe is : ', Site 
       Write(9,'(A,I)') 'The total nodes numbe is : ', Site 
       
       
       
! =====E==N===D================================================================== !
       Return
       End           
        
                                                                                                                     