function calc_nsites_chain(this, length_x, length_y, length_z) result(n_sites)
! i acually do not want to rely on the previous calculated
! length object in the class, since it is easy to recalc from
! here and so i remove some dependencies..
! nah.. i can reuse this here in the set_length routine!
! since the length equal the number of sites in the chain!
class(chain) :: this
integer, intent(in) :: length_x, length_y
integer, intent(in), optional :: length_z
integer :: n_sites
character(*), parameter :: this_routine = "calc_nsites_chain"
unused_var(this)
if (present(length_z)) then
unused_var(length_z)
end if
if (max(length_x, length_y) < 1 .or. min(length_x, length_y) > 1 .or. &
min(length_x, length_y) < 0) then
n_sites = -1
call stop_all(this_routine, "something went wrong in length input!")
else
n_sites = max(length_x, length_y)
end if
end function calc_nsites_chain