tran_write_xyz Subroutine

private subroutine tran_write_xyz(atom_data, transport, wannier_centres_translated, tran_sorted_idx, num_wann, seedname, stdout)

Uses

  • proc~~tran_write_xyz~~UsesGraph proc~tran_write_xyz tran_write_xyz module~w90_io w90_io proc~tran_write_xyz->module~w90_io module~w90_types w90_types proc~tran_write_xyz->module~w90_types module~w90_wannier90_types w90_wannier90_types proc~tran_write_xyz->module~w90_wannier90_types module~w90_constants w90_constants module~w90_io->module~w90_constants module~w90_types->module~w90_constants module~w90_wannier90_types->module~w90_constants

Arguments

Type IntentOptional Attributes Name
type(atom_data_type), intent(in) :: atom_data
type(transport_type), intent(inout) :: transport
real(kind=dp), intent(in) :: wannier_centres_translated(:,:)
integer, intent(in) :: tran_sorted_idx(:)
integer, intent(in) :: num_wann
character(len=50), intent(in) :: seedname
integer, intent(in) :: stdout

Calls

proc~~tran_write_xyz~~CallsGraph proc~tran_write_xyz tran_write_xyz proc~io_date io_date proc~tran_write_xyz->proc~io_date

Called by

proc~~tran_write_xyz~~CalledByGraph proc~tran_write_xyz tran_write_xyz proc~check_and_sort_similar_centres check_and_sort_similar_centres proc~check_and_sort_similar_centres->proc~tran_write_xyz proc~tran_lcr_2c2_sort tran_lcr_2c2_sort proc~tran_lcr_2c2_sort->proc~tran_write_xyz proc~tran_lcr_2c2_sort->proc~check_and_sort_similar_centres proc~tran_main tran_main proc~tran_main->proc~tran_write_xyz proc~tran_main->proc~tran_lcr_2c2_sort proc~w90_transport w90_transport proc~w90_transport->proc~tran_main program~wannier wannier program~wannier->proc~w90_transport

Source Code

  subroutine tran_write_xyz(atom_data, transport, wannier_centres_translated, tran_sorted_idx, &
                            num_wann, seedname, stdout)
    !================================================!
    !
    ! Write xyz file with Wannier centres
    ! and atomic positions
    !
    !================================================!

    use w90_io, only: io_date
    use w90_types, only: atom_data_type
    use w90_wannier90_types, only: transport_type

    implicit none

    ! arguments
    type(transport_type), intent(inout) :: transport
    type(atom_data_type), intent(in) :: atom_data

    integer, intent(in) :: tran_sorted_idx(:)
    integer, intent(in) :: num_wann
    integer, intent(in) :: stdout

    real(kind=dp), intent(in) :: wannier_centres_translated(:, :)

    character(len=50), intent(in)  :: seedname

    ! local variables
    integer          :: iw, ind, xyz_unit, nat, nsp
    character(len=9) :: cdate, ctime
    real(kind=dp)    :: wc(3, num_wann)

    if (index(transport%mode, 'bulk') > 0) wc = wannier_centres_translated
    if (index(transport%mode, 'lcr') > 0) then
      do iw = 1, num_wann
        wc(:, iw) = wannier_centres_translated(:, tran_sorted_idx(iw))
      end do
    end if

    open (newunit=xyz_unit, file=trim(seedname)//'_centres.xyz', form='formatted')
    write (xyz_unit, '(i6)') num_wann + atom_data%num_atoms
    call io_date(cdate, ctime)
    write (xyz_unit, '(a84)') 'Wannier centres and atomic positions, written by Wannier90 on '//cdate//' at '//ctime

    do iw = 1, num_wann
      write (xyz_unit, '("X",6x,3(f14.8,3x))') (wc(ind, iw), ind=1, 3)
    end do
    do nsp = 1, atom_data%num_species
      do nat = 1, atom_data%species_num(nsp)
        write (xyz_unit, '(a2,5x,3(f14.8,3x))') atom_data%symbol(nsp), atom_data%pos_cart(:, nat, nsp)
      end do
    end do

    write (stdout, *) ' Wannier centres written to file '//trim(seedname)//'_centres.xyz'

    return

  end subroutine tran_write_xyz