init_perturbation_creation Subroutine

public subroutine init_perturbation_creation(pert)

Arguments

Type IntentOptional Attributes Name
type(perturbation), intent(inout) :: pert

Contents


Source Code

    subroutine init_perturbation_creation(pert)

        ! Create the 'crtn_elems' and 'crtn_bits' components of a perturbation object.
        ! The 'crtn_orbs' components should be allocated and filled in already, as
        ! should the ncreate component.

        type(perturbation), intent(inout) :: pert
        integer :: i

        if (.not. allocated(pert%crtn_elems)) allocate(pert%crtn_elems(pert%ncreate))
        if (.not. allocated(pert%crtn_bits)) allocate(pert%crtn_bits(pert%ncreate))
        do i = 1, pert%ncreate
            pert%crtn_elems(i) = (pert%crtn_orbs(i) - 1) / bits_n_int
            pert%crtn_bits(i) = mod(pert%crtn_orbs(i) - 1, bits_n_int)
        end do

    end subroutine init_perturbation_creation