init_one_rdm_t Subroutine

public subroutine init_one_rdm_t(one_rdm, norbs)

Uses

Arguments

Type IntentOptional Attributes Name
type(one_rdm_t), intent(out) :: one_rdm
integer, intent(in) :: norbs

Contents

Source Code


Source Code

    subroutine init_one_rdm_t(one_rdm, norbs)

        ! Initialise a one_rdm_t object.

        ! Out: one_rdm - one_rdm_t object to be initialised.
        ! In:  norbs - the number of orbitals to be indexed in the 1-RDM.

        use rdm_data, only: one_rdm_t

        type(one_rdm_t), intent(out) :: one_rdm
        integer, intent(in) :: norbs

        integer :: ierr
        character(*), parameter :: t_r = 'init_one_rdm_t'

        allocate(one_rdm%matrix(norbs, norbs), stat=ierr)
        if (ierr /= 0) call stop_all(t_r, 'Problem allocating 1-RDM array.')
        call LogMemAlloc('one_rdm%matrix', norbs**2, 8, t_r, one_rdm%matrix_tag, ierr)
        one_rdm%matrix = 0.0_dp

        allocate(one_rdm%evalues(norbs), stat=ierr)
        if (ierr /= 0) call stop_all(t_r, 'Problem allocating evalues array,')
        call LogMemAlloc('one_rdm%evalues', norbs, 8, t_r, one_rdm%evalues_tag, ierr)
        one_rdm%evalues = 0.0_dp

        allocate(one_rdm%rho_ii(norbs), stat=ierr)
        if (ierr /= 0) call stop_all(t_r, 'Problem allocating 1-RDM diagonal array (rho_ii).')
        call LogMemAlloc('one_rdm%rho_ii', norbs, 8, t_r, one_rdm%rho_ii_tag, ierr)
        one_rdm%rho_ii = 0.0_dp

        allocate(one_rdm%sym_list_no(norbs), stat=ierr)
        if (ierr /= 0) call stop_all(t_r, 'Problem allocating sym_list_no array.')
        allocate(one_rdm%sym_list_inv_no(norbs), stat=ierr)
        if (ierr /= 0) call stop_all(t_r, 'Problem allocating sym_list_inv_no array.')

    end subroutine init_one_rdm_t