define_fragments Subroutine

private subroutine define_fragments(this, num_fragments, fragment_definitions)

Arguments

TypeIntentOptionalAttributesName
class(subsystem_type), intent(inout) :: this
integer, intent(in) :: num_fragments
integer, intent(in), dimension(0:num_fragments):: fragment_definitions

Contents

Source Code


Source Code

subroutine define_fragments(this, num_fragments, fragment_definitions)

    class(subsystem_type), intent(inout) :: this
    integer, intent(in) :: num_fragments
    integer, dimension(0:num_fragments), intent(in) :: fragment_definitions

    integer :: i, j, k

    this%num_fragments = num_fragments

    allocate(this%fragments(this%num_fragments))

    do i = 1, this%num_fragments
        j = fragment_definitions(i-1) + 1
        k = fragment_definitions(i)
        call this%fragments(i)%init(i, this%atoms(j:k))
    end do

end subroutine define_fragments