tran_write_xyz Subroutine

private subroutine tran_write_xyz()


  • 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_parameters w90_parameters proc~tran_write_xyz->module~w90_parameters module~w90_hamiltonian w90_hamiltonian proc~tran_write_xyz->module~w90_hamiltonian module~w90_constants w90_constants module~w90_io->module~w90_constants module~w90_parameters->module~w90_io module~w90_parameters->module~w90_constants module~w90_hamiltonian->module~w90_constants module~w90_comms w90_comms module~w90_hamiltonian->module~w90_comms module~w90_comms->module~w90_io module~w90_comms->module~w90_constants




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


Source Code

Source Code

  subroutine tran_write_xyz()
    !                                     !
    ! Write xyz file with Wannier centres !
    ! and atomic positions                !
    !                                     !

    use w90_io, only: seedname, io_file_unit, io_date, stdout
    use w90_parameters, only: num_wann, &
      atoms_pos_cart, atoms_symbol, num_species, &
      atoms_species_num, num_atoms, transport_mode
    use w90_hamiltonian, only: wannier_centres_translated

    implicit none

    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))

    xyz_unit = io_file_unit()
    open (xyz_unit, file=trim(seedname)//'', form='formatted')
    write (xyz_unit, '(i6)') num_wann + 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, num_species
      do nat = 1, atoms_species_num(nsp)
        write (xyz_unit, '(a2,5x,3(f14.8,3x))') atoms_symbol(nsp), atoms_pos_cart(:, nat, nsp)
      end do
    end do

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


  end subroutine tran_write_xyz