! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

! Example 6.27. Array of structures.
  program G27
    use Element_M
    implicit none
    integer, parameter :: TABLE_LENGTH = 4
    type (Chem_El_Type_1), dimension(TABLE_LENGTH) :: Periodic_Table
    integer :: Loop
! start program G27
    Periodic_Table = Chem_El_Type_1( "XXX", "X", 9, 9.9 ) ! Assign whole array of structures
    Periodic_Table(1) = Chem_El_Type_1( "HYDROGEN", "H", 1, 1.01 )
    Periodic_Table(2) = Chem_El_Type_1( "HELIUM", "He", 2, 4.00 )
    do Loop = 1, TABLE_LENGTH
      write (unit = *, fmt = *) Periodic_Table(Loop)
    end do
    stop
  end program G27
