function aim_lattice_constructor(lat_type, length_x, length_y) result(this)
character(*), intent(in) :: lat_type
integer, intent(in) :: length_x, length_y
class(aim), pointer :: this
character(*), parameter :: this_routine = "aim_lattice_constructor"
select case (lat_type)
case ('chain', 'aim-chain', 'chain-aim')
allocate(aim_chain :: this)
case ('star', 'aim-star', 'star-aim')
allocate(aim_star :: this)
case default
! stop here because a incorrect lattice type was given
call stop_all(this_routine, &
'incorrect lattice type provided in lattice_constructor!')
end select
! the initializer deals with the different types then..
call this%initialize(length_x, length_y, 1, .false., .false., .false.)
end function aim_lattice_constructor