Main transport subroutine
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(atom_data_type), | intent(in) | :: | atom_data | |||
| type(dis_manifold_type), | intent(in) | :: | dis_manifold | |||
| real(kind=dp), | intent(in), | allocatable | :: | fermi_energy_list(:) | ||
| type(ham_logical_type), | intent(inout) | :: | ham_logical | |||
| real(kind=dp), | intent(in) | :: | kpt_latt(:,:) | |||
| type(output_file_type), | intent(in) | :: | output_file | |||
| type(real_space_ham_type), | intent(inout) | :: | real_space_ham | |||
| type(transport_type), | intent(inout) | :: | transport | |||
| type(print_output_type), | intent(in) | :: | print_output | |||
| type(wannier_data_type), | intent(in) | :: | wannier_data | |||
| type(ws_region_type), | intent(inout) | :: | ws_region | |||
| type(w90_calculation_type), | intent(in) | :: | w90_calculation | |||
| complex(kind=dp), | intent(inout), | allocatable | :: | ham_k(:,:,:) | ||
| complex(kind=dp), | intent(inout), | allocatable | :: | ham_r(:,:,:) | ||
| complex(kind=dp), | intent(in) | :: | u_matrix(:,:,:) | |||
| complex(kind=dp), | intent(in) | :: | u_matrix_opt(:,:,:) | |||
| real(kind=dp), | intent(in) | :: | eigval(:,:) | |||
| real(kind=dp), | intent(in) | :: | real_lattice(3,3) | |||
| real(kind=dp), | intent(inout), | allocatable | :: | wannier_centres_translated(:,:) | ||
| integer, | intent(inout), | allocatable | :: | irvec(:,:) | ||
| integer, | intent(in) | :: | mp_grid(3) | |||
| integer, | intent(inout), | allocatable | :: | ndegen(:) | ||
| integer, | intent(inout), | allocatable | :: | shift_vec(:,:) | ||
| integer, | intent(inout) | :: | nrpts | |||
| integer, | intent(in) | :: | num_bands | |||
| integer, | intent(in) | :: | num_kpts | |||
| integer, | intent(in) | :: | num_wann | |||
| integer, | intent(inout) | :: | rpt_origin | |||
| character(len=*), | intent(in) | :: | bands_plot_mode | |||
| logical, | intent(in) | :: | have_disentangled | |||
| logical, | intent(in) | :: | lsitesymmetry | |||
| character(len=50), | intent(in) | :: | seedname | |||
| integer, | intent(in) | :: | stdout | |||
| type(timer_list_type), | intent(inout) | :: | timer | |||
| type(w90_error_type), | intent(out), | allocatable | :: | error | ||
| type(w90_comm_type), | intent(in) | :: | comm |
subroutine tran_main(atom_data, dis_manifold, fermi_energy_list, ham_logical, kpt_latt, & output_file, real_space_ham, transport, print_output, wannier_data, & ws_region, w90_calculation, ham_k, ham_r, u_matrix, u_matrix_opt, eigval, & real_lattice, wannier_centres_translated, irvec, mp_grid, ndegen, & shift_vec, nrpts, num_bands, num_kpts, num_wann, rpt_origin, & bands_plot_mode, have_disentangled, lsitesymmetry, seedname, stdout, & timer, error, comm) !================================================! ! !! Main transport subroutine ! !================================================! use w90_io, only: io_stopwatch_start, io_stopwatch_stop use w90_error, only: w90_error_type, set_error_dealloc use w90_hamiltonian, only: hamiltonian_get_hr, hamiltonian_write_hr, hamiltonian_setup use w90_types, only: wannier_data_type, print_output_type, ws_region_type, & atom_data_type, dis_manifold_type, timer_list_type use w90_wannier90_types, only: w90_calculation_type, transport_type, output_file_type, & real_space_ham_type, ham_logical_type implicit none ! arguments type(transport_type), intent(inout) :: transport type(real_space_ham_type), intent(inout) :: real_space_ham type(ws_region_type), intent(inout) :: ws_region type(print_output_type), intent(in) :: print_output type(w90_calculation_type), intent(in) :: w90_calculation type(output_file_type), intent(in) :: output_file type(wannier_data_type), intent(in) :: wannier_data type(atom_data_type), intent(in) :: atom_data type(dis_manifold_type), intent(in) :: dis_manifold real(kind=dp), intent(in) :: kpt_latt(:, :) real(kind=dp), allocatable, intent(in) :: fermi_energy_list(:) type(ham_logical_type), intent(inout) :: ham_logical type(timer_list_type), intent(inout) :: timer type(w90_error_type), allocatable, intent(out) :: error type(w90_comm_type), intent(in) :: comm integer, intent(inout) :: rpt_origin integer, intent(inout) :: nrpts integer, intent(inout), allocatable :: ndegen(:) integer, intent(inout), allocatable :: shift_vec(:, :) integer, intent(inout), allocatable :: irvec(:, :) integer, intent(in) :: num_wann integer, intent(in) :: num_bands integer, intent(in) :: num_kpts integer, intent(in) :: stdout integer, intent(in) :: mp_grid(3) real(kind=dp), intent(inout), allocatable :: wannier_centres_translated(:, :) real(kind=dp), intent(in) :: real_lattice(3, 3) real(kind=dp), intent(in) :: eigval(:, :) complex(kind=dp), intent(in) :: u_matrix(:, :, :) complex(kind=dp), intent(in) :: u_matrix_opt(:, :, :) complex(kind=dp), allocatable, intent(inout) :: ham_k(:, :, :) complex(kind=dp), intent(inout), allocatable :: ham_r(:, :, :) character(len=*), intent(in) :: bands_plot_mode character(len=50), intent(in) :: seedname logical, intent(in) :: have_disentangled logical, intent(in) :: lsitesymmetry !YN: ! local variables integer :: one_dim_vec !! cartesian axis to which real_lattice(:,one_dim_vec) is parallel integer :: nrpts_one_dim integer :: num_pl !! number of unit cell in a principal layer integer :: coord(3) !! coord : coord(1) defines the conduction direction according to !1=x,2=y,3=z !! coord(2),coord(3) define the other directions during sorting routines integer, allocatable :: tran_sorted_idx(:) !! index of sorted WF centres to unsorted integer :: num_G integer :: irvec_max ! size of hr_one_dim's last dimension (:, :, -irvec_max:irvec_max) integer :: ierr real(kind=dp), allocatable :: hr_one_dim(:, :, :) real(kind=dp), allocatable :: signatures(:, :) real(kind=dp), allocatable :: hB0(:, :) real(kind=dp), allocatable :: hB1(:, :) real(kind=dp), allocatable :: hC(:, :) real(kind=dp), allocatable :: hCR(:, :) real(kind=dp), allocatable :: hL0(:, :) real(kind=dp), allocatable :: hL1(:, :) real(kind=dp), allocatable :: hLC(:, :) real(kind=dp), allocatable :: hR0(:, :) real(kind=dp), allocatable :: hR1(:, :) logical :: pl_warning ! fixme printout guards as elsewhere please (even if not yet parallel) if (print_output%timing_level > 0) call io_stopwatch_start('tran: main', timer) write (stdout, '(/1x,a)') '*---------------------------------------------------------------------------*' write (stdout, '(1x,a)') '| TRANSPORT |' write (stdout, '(1x,a)') '*---------------------------------------------------------------------------*' write (stdout, *) if (index(transport%mode, 'bulk') > 0) then write (stdout, '(/1x,a/)') 'Calculation of Quantum Conductance and DoS: bulk mode' if (.not. transport%read_ht) then call hamiltonian_setup(ham_logical, print_output, ws_region, w90_calculation, ham_k, & ham_r, real_lattice, wannier_centres_translated, irvec, mp_grid, & ndegen, num_kpts, num_wann, nrpts, rpt_origin, bands_plot_mode, & stdout, timer, error, transport%mode, comm) if (allocated(error)) return call hamiltonian_get_hr(atom_data, dis_manifold, ham_logical, real_space_ham, & print_output, ham_k, ham_r, u_matrix, u_matrix_opt, eigval, & kpt_latt, real_lattice, wannier_data%centres, & wannier_centres_translated, irvec, shift_vec, nrpts, num_bands, & num_kpts, num_wann, have_disentangled, stdout, timer, error, & lsitesymmetry, comm) if (allocated(error)) return if (output_file%write_hr) then ! is this redundant after the plot call? call hamiltonian_write_hr(ham_r, irvec, ndegen, nrpts, num_wann, & print_output%timing_level, seedname, timer, error, comm) end if if (allocated(error)) return call tran_reduce_hr(real_space_ham, ham_r, hr_one_dim, real_lattice, irvec, mp_grid, & irvec_max, nrpts, nrpts_one_dim, num_wann, one_dim_vec, & print_output%timing_level, stdout, timer, error, comm) if (allocated(error)) return call tran_cut_hr_one_dim(real_space_ham, transport, print_output, hr_one_dim, & real_lattice, wannier_centres_translated, mp_grid, irvec_max, & num_pl, num_wann, one_dim_vec, stdout, timer) call tran_get_ht(fermi_energy_list, transport, hB0, hB1, hr_one_dim, irvec_max, num_pl, & num_wann, print_output%timing_level, seedname, timer, error, comm) if (allocated(error)) return if (output_file%write_xyz) then call tran_write_xyz(atom_data, transport, wannier_centres_translated, tran_sorted_idx, & num_wann, seedname, stdout) end if end if call tran_bulk(transport, hB0, hB1, print_output%timing_level, stdout, seedname, timer, error, comm) if (allocated(error)) return end if if (index(transport%mode, 'lcr') > 0) then write (stdout, '(/1x,a/)') 'Calculation of Quantum Conductance and DoS: lead-conductor-lead mode' if (.not. transport%read_ht) then call hamiltonian_setup(ham_logical, print_output, ws_region, w90_calculation, ham_k, & ham_r, real_lattice, wannier_centres_translated, irvec, mp_grid, & ndegen, num_kpts, num_wann, nrpts, rpt_origin, bands_plot_mode, & stdout, timer, error, transport%mode, comm) if (allocated(error)) return call hamiltonian_get_hr(atom_data, dis_manifold, ham_logical, real_space_ham, & print_output, ham_k, ham_r, u_matrix, u_matrix_opt, eigval, & kpt_latt, real_lattice, wannier_data%centres, & wannier_centres_translated, irvec, shift_vec, nrpts, num_bands, & num_kpts, num_wann, have_disentangled, stdout, timer, error, & lsitesymmetry, comm) if (allocated(error)) return if (output_file%write_hr) then call hamiltonian_write_hr(ham_r, irvec, ndegen, nrpts, num_wann, & print_output%timing_level, seedname, timer, error, comm) if (allocated(error)) return end if call tran_reduce_hr(real_space_ham, ham_r, hr_one_dim, real_lattice, irvec, mp_grid, & irvec_max, nrpts, nrpts_one_dim, num_wann, one_dim_vec, & print_output%timing_level, stdout, timer, error, comm) if (allocated(error)) return call tran_cut_hr_one_dim(real_space_ham, transport, print_output, hr_one_dim, & real_lattice, wannier_centres_translated, mp_grid, irvec_max, & num_pl, num_wann, one_dim_vec, stdout, timer) write (stdout, *) '------------------------- 2c2 Calculation Type: ------------------------------' write (stdout, *) ' ' call tran_find_integral_signatures(signatures, num_G, print_output, real_lattice, & u_matrix_opt, u_matrix, num_bands, num_wann, & have_disentangled, wannier_centres_translated, stdout, & seedname, timer, error, comm) if (allocated(error)) return call tran_lcr_2c2_sort(signatures, num_G, pl_warning, transport, atom_data, wannier_data, & real_space_ham, print_output, real_lattice, num_wann, mp_grid, & ham_r, irvec, nrpts, wannier_centres_translated, one_dim_vec, & nrpts_one_dim, num_pl, coord, tran_sorted_idx, hr_one_dim, & irvec_max, output_file%write_xyz, stdout, seedname, timer, error, comm) if (allocated(error)) return if (output_file%write_xyz) call tran_write_xyz(atom_data, transport, & wannier_centres_translated, & tran_sorted_idx, num_wann, seedname, stdout) call tran_parity_enforce(signatures, print_output, transport, num_wann, tran_sorted_idx, & hr_one_dim, irvec_max, stdout, timer) call tran_lcr_2c2_build_ham(pl_warning, real_space_ham, fermi_energy_list, kpt_latt, & num_wann, transport, print_output, real_lattice, mp_grid, & ham_r, irvec, nrpts, wannier_centres_translated, one_dim_vec, & nrpts_one_dim, num_pl, coord, tran_sorted_idx, hC, hCR, hL0, & hL1, hLC, hR0, hR1, hr_one_dim, irvec_max, stdout, seedname, & timer, error, comm) if (allocated(error)) return end if call tran_lcr(transport, hC, hCR, hL0, hL1, hLC, hR0, hR1, print_output%timing_level, & stdout, seedname, timer, error, comm) if (allocated(error)) return end if if (print_output%timing_level > 0) call io_stopwatch_stop('tran: main', timer) if (allocated(hR1)) then deallocate (hR1, stat=ierr) if (ierr /= 0) then call set_error_dealloc(error, 'Error in deallocating hR1 in tran_main', comm) return end if end if if (allocated(hR0)) then deallocate (hR0, stat=ierr) if (ierr /= 0) then call set_error_dealloc(error, 'Error in deallocating hR0 in tran_main', comm) return end if end if if (allocated(hL1)) then deallocate (hL1, stat=ierr) if (ierr /= 0) then call set_error_dealloc(error, 'Error in deallocating hL1 in tran_main', comm) return end if end if if (allocated(hB1)) then deallocate (hB1, stat=ierr) if (ierr /= 0) then call set_error_dealloc(error, 'Error in deallocating hB1 in tran_main', comm) return end if end if if (allocated(hB0)) then deallocate (hB0, stat=ierr) if (ierr /= 0) then call set_error_dealloc(error, 'Error in deallocating hB0 in tran_main', comm) return end if end if if (allocated(hr_one_dim)) then deallocate (hr_one_dim, stat=ierr) if (ierr /= 0) then call set_error_dealloc(error, 'Error in deallocating hr_one_dim in tran_main', comm) return end if end if end subroutine tran_main