generate_table_wf Subroutine

private subroutine generate_table_wf(ps)

Arguments

Type IntentOptional Attributes Name
type(ps_t), intent(inout), target :: ps

Contents

Source Code


Source Code

subroutine generate_table_wf(ps)

  type(ps_t), intent(inout), target :: ps

  type(wfns_t), pointer :: wfp
  type(wf_t), pointer   :: wfpp

  integer :: nwfns

  if (allocated(ps%wf_table)) then
     deallocate(ps%wf_table)
  endif

  nwfns = 0
  wfp => ps%wavefunctions
  do while (associated(wfp))
     wfpp => wfp%wf
     do while (associated(wfpp))
        nwfns = nwfns + 1
        wfpp => wfpp%next
     enddo
     wfp => wfp%next
  enddo

  allocate(ps%wf_table(nwfns))
  
  nwfns = 0
  wfp => ps%wavefunctions
  do while (associated(wfp))
     wfpp => wfp%wf
     do while (associated(wfpp))
        nwfns = nwfns + 1
        ps%wf_table(nwfns)%p => wfpp
        wfpp => wfpp%next
     enddo
     wfp => wfp%next
  enddo

end subroutine generate_table_wf