diff --git a/src/disentangle.F90 b/src/disentangle.F90 index aa45013c..3bcd9694 100644 --- a/src/disentangle.F90 +++ b/src/disentangle.F90 @@ -136,8 +136,8 @@ subroutine dis_main(dis_control, dis_spheres, dis_manifold, kmesh_info, kpt_latt ! Set up energy windows if (dis_manifold%frozen_proj) then - call dis_windows_proj(dis_manifold, eigval_opt, a_matrix, m_matrix_orig_local, kpt_latt, & - recip_lattice, indxfroz, indxnfroz, ndimfroz, dis_manifold%nfirstwin, & + call dis_windows_proj(dis_manifold, eigval_opt, a_matrix, m_matrix_orig_local, & + indxfroz, indxnfroz, ndimfroz, dis_manifold%nfirstwin, & print_output%iprint, kmesh_info%nnlist, kmesh_info%nntot, num_bands, & num_kpts, num_wann, print_output%timing_level, lfrozen, linner, & on_root, stdout, dist_k, global_k, my_node_id, timer, error, comm) @@ -1182,7 +1182,7 @@ subroutine dis_windows(dis_spheres, dis_manifold, eigval_opt, kpt_latt, recip_la end subroutine dis_windows subroutine dis_windows_proj(dis_manifold, eigval_opt, a_matrix, m_matrix_orig_local, & - kpt_latt, recip_lattice, indxfroz, indxnfroz, ndimfroz, nfirstwin, iprint, nnlist, & + indxfroz, indxnfroz, ndimfroz, nfirstwin, iprint, nnlist, & nntot, num_bands, num_kpts, num_wann, timing_level, lfrozen, & linner, on_root, stdout, dist_k, global_k, my_node_id, timer, error, comm) !==================================================================! @@ -1242,7 +1242,6 @@ subroutine dis_windows_proj(dis_manifold, eigval_opt, a_matrix, m_matrix_orig_lo complex(kind=dp), intent(inout) :: a_matrix(:, :, :) complex(kind=dp), intent(inout) :: m_matrix_orig_local(:, :, :, :) - real(kind=dp), intent(in) :: kpt_latt(3, num_kpts), recip_lattice(3, 3) real(kind=dp), intent(inout) :: eigval_opt(:, :) logical, intent(in) :: on_root @@ -1257,7 +1256,7 @@ subroutine dis_windows_proj(dis_manifold, eigval_opt, a_matrix, m_matrix_orig_lo ! orignal outter window, and to generate a new outter window. ! (equals 1 if it is the bottom of outer window) - integer :: nkp, nn, nkp2, nkp_global, ierr + integer :: nkp, nn, nkp2, nkp_global integer :: i, j, k, l real(kind=dp) :: projs(num_bands) integer :: invindxkeep(num_bands) diff --git a/src/library_extra.F90 b/src/library_extra.F90 index fddd7698..f2f98654 100644 --- a/src/library_extra.F90 +++ b/src/library_extra.F90 @@ -70,7 +70,7 @@ subroutine input_reader_special(common_data, seedname, istdout, istderr, ierr) use w90_error_base, only: w90_error_type use w90_error, only: set_error_input, set_error_fatal, set_error_alloc use w90_readwrite, only: w90_readwrite_in_file, w90_readwrite_clean_infile - use w90_wannier90_readwrite, only: w90_wannier90_readwrite_read_special, w90_extra_io_type + use w90_wannier90_readwrite, only: w90_wannier90_readwrite_read_special implicit none @@ -370,19 +370,15 @@ subroutine write_chkpt(common_data, label, istdout, istderr, ierr) return endif - u(:, :, :) = 0.d0 - uopt(:, :, :) = 0.d0 + u(:, :, :) = common_data%u_matrix + uopt(:, :, :) = common_data%u_opt m(:, :, :, :) = 0.d0 do ikl = 1, nkrank ikg = global_k(ikl) - u(:, :, ikg) = common_data%u_matrix(:, :, ikl) - uopt(:, :, ikg) = common_data%u_opt(:, :, ikl) m(:, :, :, ikg) = common_data%m_matrix_local(1:nw, 1:nw, :, ikl) enddo - call comms_reduce(u(1, 1, 1), nw*nw*nk, 'SUM', error, common_data%comm) - call comms_reduce(uopt(1, 1, 1), nb*nw*nk, 'SUM', error, common_data%comm) call comms_reduce(m(1, 1, 1, 1), nw*nw*nn*nk, 'SUM', error, common_data%comm) if (allocated(error)) then call prterr(error, ierr, istdout, istderr, common_data%comm) diff --git a/src/library_interface.F90 b/src/library_interface.F90 index 898d400c..5378929d 100644 --- a/src/library_interface.F90 +++ b/src/library_interface.F90 @@ -223,7 +223,7 @@ subroutine w90_input_setopt(common_data, seedname, istdout, istderr, ierr) use w90_comms, only: w90_comm_type, valid_communicator use w90_kmesh, only: kmesh_get use w90_wannier90_readwrite, only: w90_wannier90_readwrite_read, & - w90_wannier90_readwrite_read_special, w90_extra_io_type + w90_wannier90_readwrite_read_special implicit none @@ -235,7 +235,6 @@ subroutine w90_input_setopt(common_data, seedname, istdout, istderr, ierr) ! local variables type(w90_error_type), allocatable :: error - type(w90_extra_io_type) :: io_params logical :: cp_pp, disentanglement ierr = 0 @@ -333,7 +332,7 @@ subroutine w90_input_setopt(common_data, seedname, istdout, istderr, ierr) common_data%wvfn_read, common_data%wann_control, & common_data%real_space_ham, common_data%kpoint_path, & common_data%w90_system, common_data%tran, & - common_data%print_output, common_data%wann_plot, io_params, & + common_data%print_output, common_data%wann_plot, & common_data%ws_region, common_data%real_lattice, & common_data%w90_calculation, common_data%physics%bohr, & common_data%sitesym%symmetrize_eps, common_data%num_bands, & @@ -361,7 +360,7 @@ subroutine w90_input_reader(common_data, istdout, istderr, ierr) use w90_error_base, only: w90_error_type use w90_error, only: set_error_input, set_error_fatal, set_error_alloc, code_mpi use w90_readwrite, only: w90_readwrite_in_file, w90_readwrite_clean_infile - use w90_wannier90_readwrite, only: w90_wannier90_readwrite_read, w90_extra_io_type + use w90_wannier90_readwrite, only: w90_wannier90_readwrite_read implicit none @@ -372,7 +371,6 @@ subroutine w90_input_reader(common_data, istdout, istderr, ierr) ! local variables type(w90_error_type), allocatable :: error - type(w90_extra_io_type) :: io_params logical :: cp_pp ierr = 0 @@ -408,7 +406,7 @@ subroutine w90_input_reader(common_data, istdout, istderr, ierr) common_data%wvfn_read, common_data%wann_control, & common_data%real_space_ham, common_data%kpoint_path, & common_data%w90_system, common_data%tran, & - common_data%print_output, common_data%wann_plot, io_params, & + common_data%print_output, common_data%wann_plot, & common_data%ws_region, common_data%real_lattice, & common_data%w90_calculation, common_data%physics%bohr, & common_data%sitesym%symmetrize_eps, common_data%num_bands, & @@ -1157,7 +1155,7 @@ end subroutine w90_set_comm subroutine input_print_details(common_data, istdout, istderr, ierr) use w90_error_base, only: w90_error_type use w90_readwrite, only: w90_readwrite_write_header - use w90_wannier90_readwrite, only: w90_wannier90_readwrite_write, w90_extra_io_type + use w90_wannier90_readwrite, only: w90_wannier90_readwrite_write use w90_comms, only: mpisize, mpirank implicit none @@ -1169,7 +1167,6 @@ subroutine input_print_details(common_data, istdout, istderr, ierr) ! local variables type(w90_error_type), allocatable :: error - type(w90_extra_io_type) :: io_params ! what is this? fixme integer :: mpi_size ierr = 0 @@ -1194,7 +1191,7 @@ subroutine input_print_details(common_data, istdout, istderr, ierr) common_data%select_proj, common_data%kpoint_path, & common_data%tran, common_data%print_output, & common_data%wannier_data, & - common_data%wann_plot, io_params, & + common_data%wann_plot, & common_data%w90_calculation, common_data%real_lattice, & common_data%sitesym%symmetrize_eps, common_data%mp_grid, & common_data%num_bands, common_data%num_kpts, & diff --git a/src/plot.F90 b/src/plot.F90 index 9982810a..ddd31396 100644 --- a/src/plot.F90 +++ b/src/plot.F90 @@ -419,7 +419,7 @@ subroutine plot_interpolate_bands(mp_grid, real_lattice, band_plot, kpoint_path, character(len=20), allocatable :: ctemp(:) ! mpi variables - integer :: my_node_id, num_nodes, size_rdist, size_ndeg + integer :: my_node_id, num_nodes logical :: on_root integer, allocatable :: counts(:) integer, allocatable :: displs(:) diff --git a/src/readwrite.F90 b/src/readwrite.F90 index 4a143b3f..ae88808b 100644 --- a/src/readwrite.F90 +++ b/src/readwrite.F90 @@ -3564,7 +3564,7 @@ subroutine w90_readwrite_get_range_vector(settings, keyword, found, length, lcou return end subroutine w90_readwrite_get_range_vector - subroutine w90_readwrite_get_centre_constraints(settings, ccentres_frac, ccentres_cart, & + subroutine w90_readwrite_get_centre_constraints(settings, ccentres_cart, & proj_site, num_wann, real_lattice, error, comm) !================================================! !! assigns projection centres as default centre constraints and global @@ -3572,10 +3572,12 @@ subroutine w90_readwrite_get_centre_constraints(settings, ccentres_frac, ccentre !! the centre_constraints block for individual centre constraint parameters ! !================================================! - use w90_error, only: w90_error_type, set_error_input + use w90_error, only: w90_error_type, set_error_input, set_error_alloc, set_error_dealloc use w90_utility, only: utility_frac_to_cart implicit none - real(kind=dp), intent(inout) :: ccentres_frac(:, :), ccentres_cart(:, :) + + ! arguments + real(kind=dp), intent(inout) :: ccentres_cart(:, :) real(kind=dp), intent(in) :: proj_site(:, :) integer, intent(in) :: num_wann real(kind=dp), intent(in) :: real_lattice(3, 3) @@ -3583,9 +3585,17 @@ subroutine w90_readwrite_get_centre_constraints(settings, ccentres_frac, ccentre type(w90_comm_type), intent(in) :: comm type(settings_type), intent(inout) :: settings - integer :: loop1, index1, constraint_num, loop2 + ! local variables + integer :: loop1, index1, constraint_num, loop2, ierr integer :: column, start, finish, wann character(len=maxlen) :: dummy + real(kind=dp), allocatable :: ccentres_frac(:, :) + + allocate (ccentres_frac(num_wann, 3), stat=ierr) + if (ierr /= 0) then + call set_error_alloc(error, 'Error allocating ccentres_frac in w90_readwrite_get_centre_constraints', comm) + return + endif do loop1 = 1, num_wann do loop2 = 1, 3 @@ -3655,6 +3665,12 @@ subroutine w90_readwrite_get_centre_constraints(settings, ccentres_frac, ccentre call utility_frac_to_cart(ccentres_frac(loop1, :), & ccentres_cart(loop1, :), real_lattice) end do + + deallocate (ccentres_frac, stat=ierr) + if (ierr /= 0) then + call set_error_dealloc(error, 'Error deallocating ccentres_frac in w90_readwrite_get_centre_constraints', comm) + return + endif end subroutine w90_readwrite_get_centre_constraints !================================================! diff --git a/src/wannier90_readwrite.F90 b/src/wannier90_readwrite.F90 index 5876b650..ef82dd19 100644 --- a/src/wannier90_readwrite.F90 +++ b/src/wannier90_readwrite.F90 @@ -31,13 +31,6 @@ module w90_wannier90_readwrite private - type w90_extra_io_type - character(len=20) :: one_dim_axis = 'none' - real(kind=dp), allocatable :: ccentres_frac(:, :) - !! Constrained centres - end type w90_extra_io_type - - public :: w90_extra_io_type public :: w90_wannier90_readwrite_memory_estimate public :: w90_wannier90_readwrite_read public :: w90_wannier90_readwrite_read_special @@ -52,10 +45,9 @@ subroutine w90_wannier90_readwrite_read_special(settings, atom_data, kmesh_input kpt_latt, wann_control, proj, proj_input, & select_proj, w90_system, w90_calculation, & real_lattice, bohr, mp_grid, num_bands, & - exclude_bands, & - num_kpts, num_proj, num_wann, gamma_only, & - lhasproj, use_bloch_phases, distk, stdout, & - error, comm) + exclude_bands, num_kpts, num_proj, num_wann, & + gamma_only, lhasproj, use_bloch_phases, distk, & + stdout, error, comm) !================================================! ! !! Read parameters and calculate derived values @@ -171,16 +163,14 @@ end subroutine w90_wannier90_readwrite_read_special !================================================! subroutine w90_wannier90_readwrite_read(settings, band_plot, dis_control, dis_spheres, & - dis_manifold, fermi_energy_list, & - fermi_surface_data, & - output_file, wvfn_read, wann_control, & - real_space_ham, kpoint_path, w90_system, & - tran, print_output, wann_plot, w90_extra_io, ws_region, & - real_lattice, w90_calculation, bohr, & - symmetrize_eps, num_bands, num_kpts, & - num_wann, optimisation, calc_only_A, cp_pp, & - gamma_only, lsitesymmetry, use_bloch_phases, & - seedname, stdout, error, comm) + dis_manifold, fermi_energy_list, fermi_surface_data, & + output_file, wvfn_read, wann_control, real_space_ham, & + kpoint_path, w90_system, tran, print_output, wann_plot, & + ws_region, real_lattice, w90_calculation, bohr, & + symmetrize_eps, num_bands, num_kpts, num_wann, & + optimisation, calc_only_A, cp_pp, gamma_only, & + lsitesymmetry, use_bloch_phases, seedname, stdout, & + error, comm) !================================================! ! !! Read parameters and calculate derived values @@ -211,7 +201,6 @@ subroutine w90_wannier90_readwrite_read(settings, band_plot, dis_control, dis_sp type(w90_calculation_type), intent(inout) :: w90_calculation type(w90_comm_type), intent(in) :: comm type(w90_error_type), allocatable, intent(out) :: error - type(w90_extra_io_type), intent(inout) :: w90_extra_io type(w90_system_type), intent(inout) :: w90_system type(wann_control_type), intent(inout) :: wann_control type(wannier_plot_type), intent(inout) :: wann_plot @@ -272,7 +261,7 @@ subroutine w90_wannier90_readwrite_read(settings, band_plot, dis_control, dis_sp if (allocated(error)) return call w90_wannier90_readwrite_read_wannierise(settings, wann_control, num_wann, & - w90_extra_io%ccentres_frac, stdout, error, comm) + stdout, error, comm) if (allocated(error)) return call w90_readwrite_read_gamma_only(settings, gamma_only, num_kpts, error, comm) @@ -320,9 +309,8 @@ subroutine w90_wannier90_readwrite_read(settings, band_plot, dis_control, dis_sp if (allocated(error)) return endif - ! BGS tran/plot related stuff... - call w90_wannier90_readwrite_read_one_dim(settings, w90_calculation, band_plot, & - real_space_ham, w90_extra_io%one_dim_axis, & + + call w90_wannier90_readwrite_read_one_dim(settings, w90_calculation, band_plot, real_space_ham, & tran%read_ht, error, comm) if (allocated(error)) return @@ -345,11 +333,10 @@ subroutine w90_wannier90_readwrite_read(settings, band_plot, dis_control, dis_sp if (allocated(error)) return if (wann_control%constrain%constrain) then - call w90_wannier90_readwrite_read_constrained_centres(settings, w90_extra_io%ccentres_frac, & + call w90_wannier90_readwrite_read_constrained_centres(settings, & wann_control, real_lattice, & num_wann, print_output%iprint, & stdout, error, comm) - !fixme, ccentres_frac is not available for printing later... if (allocated(error)) return endif endif @@ -599,21 +586,22 @@ end subroutine w90_wannier90_readwrite_read_dist_cutoff !================================================! subroutine w90_wannier90_readwrite_read_wannierise(settings, wann_control, num_wann, & - ccentres_frac, stdout, error, comm) + stdout, error, comm) !================================================! ! Wannierise !================================================! use w90_error, only: w90_error_type implicit none + ! arguments integer, intent(in) :: num_wann integer, intent(in) :: stdout - real(kind=dp), allocatable, intent(inout) :: ccentres_frac(:, :) type(settings_type), intent(inout) :: settings type(w90_comm_type), intent(in) :: comm type(w90_error_type), allocatable, intent(out) :: error type(wann_control_type), intent(inout) :: wann_control + ! local variables integer :: ierr logical :: found @@ -752,11 +740,6 @@ subroutine w90_wannier90_readwrite_read_wannierise(settings, wann_control, num_w if (found .and. wann_control%constrain%constrain) then if (wann_control%constrain%selective_loc) then - allocate (ccentres_frac(num_wann, 3), stat=ierr) - if (ierr /= 0) then - call set_error_alloc(error, 'Error allocating ccentres_frac in w90_readwrite_get_centre_constraints', comm) - return - endif allocate (wann_control%constrain%centres(num_wann, 3), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error allocating ccentres_cart in w90_readwrite_get_centre_constraints', comm) @@ -1253,7 +1236,8 @@ subroutine w90_wannier90_readwrite_read_wann_plot(settings, wann_plot, num_wann, end subroutine w90_wannier90_readwrite_read_wann_plot !================================================! - subroutine w90_wannier90_readwrite_read_fermi_surface(settings, fermi_surface_data, fermi_surface_plot, error, comm) + subroutine w90_wannier90_readwrite_read_fermi_surface(settings, fermi_surface_data, & + fermi_surface_plot, error, comm) !================================================! use w90_error, only: w90_error_type implicit none @@ -1287,13 +1271,12 @@ subroutine w90_wannier90_readwrite_read_fermi_surface(settings, fermi_surface_da end subroutine w90_wannier90_readwrite_read_fermi_surface !================================================! - subroutine w90_wannier90_readwrite_read_one_dim(settings, w90_calculation, band_plot, real_space_ham, one_dim_axis, & - tran_read_ht, error, comm) + subroutine w90_wannier90_readwrite_read_one_dim(settings, w90_calculation, band_plot, & + real_space_ham, tran_read_ht, error, comm) !================================================! use w90_error, only: w90_error_type implicit none - character(len=*), intent(inout) :: one_dim_axis logical, intent(in) :: tran_read_ht type(band_plot_type), intent(in) :: band_plot type(real_space_ham_type), intent(inout) :: real_space_ham @@ -1303,6 +1286,7 @@ subroutine w90_wannier90_readwrite_read_one_dim(settings, w90_calculation, band_ type(w90_error_type), allocatable, intent(out) :: error logical :: found + character(len=256) :: one_dim_axis call w90_readwrite_get_keyword(settings, 'one_dim_axis', found, error, comm, c_value=one_dim_axis) if (allocated(error)) return @@ -1352,7 +1336,8 @@ subroutine w90_wannier90_readwrite_read_hamil(settings, hamiltonian, error, comm end subroutine w90_wannier90_readwrite_read_hamil !================================================! - subroutine w90_wannier90_readwrite_read_bloch_phase(settings, use_bloch_phases, disentanglement, error, comm) + subroutine w90_wannier90_readwrite_read_bloch_phase(settings, use_bloch_phases, disentanglement, & + error, comm) !================================================! use w90_error, only: w90_error_type implicit none @@ -1398,7 +1383,6 @@ subroutine w90_wannier90_readwrite_read_explicit_kpts(settings, w90_calculation, integer :: i, k, ierr, rows logical :: found - ! get the nnkpts block -- this is allowed only in postproc-setup mode call w90_readwrite_get_block_length(settings, 'nnkpts', kmesh_info%explicit_nnkpts, rows, error, comm) if (allocated(error)) return @@ -1643,14 +1627,13 @@ subroutine w90_wannier90_readwrite_read_projections(settings, proj, proj_input, end subroutine w90_wannier90_readwrite_read_projections !================================================! - subroutine w90_wannier90_readwrite_read_constrained_centres(settings, ccentres_frac, wann_control, & + subroutine w90_wannier90_readwrite_read_constrained_centres(settings, wann_control, & real_lattice, num_wann, iprint, & stdout, error, comm) !================================================! implicit none integer, intent(in) :: num_wann, iprint, stdout - real(kind=dp), intent(inout) :: ccentres_frac(:, :) real(kind=dp), intent(in) :: real_lattice(3, 3) type(settings_type), intent(inout) :: settings type(w90_comm_type), intent(in) :: comm @@ -1667,7 +1650,7 @@ subroutine w90_wannier90_readwrite_read_constrained_centres(settings, ccentres_f if (found) then if (wann_control%constrain%constrain) then ! Allocate array for constrained centres - call w90_readwrite_get_centre_constraints(settings, ccentres_frac, & + call w90_readwrite_get_centre_constraints(settings, & wann_control%constrain%centres, & wann_control%guiding_centres%centres, & num_wann, real_lattice, error, comm) @@ -1685,7 +1668,7 @@ subroutine w90_wannier90_readwrite_read_constrained_centres(settings, ccentres_f return else ! Allocate array for constrained centres - call w90_readwrite_get_centre_constraints(settings, ccentres_frac, & + call w90_readwrite_get_centre_constraints(settings, & wann_control%constrain%centres, & wann_control%guiding_centres%centres, & num_wann, real_lattice, error, comm) @@ -1711,11 +1694,11 @@ subroutine w90_wannier90_readwrite_write(atom_data, band_plot, dis_control, dis_ fermi_energy_list, fermi_surface_data, kpt_latt, & output_file, wvfn_read, wann_control, proj, proj_input, & real_space_ham, select_proj, kpoint_path, tran, & - print_output, wannier_data, wann_plot, w90_extra_io, & - w90_calculation, real_lattice, symmetrize_eps, mp_grid, & - num_bands, num_kpts, num_proj, num_wann, optimisation, & - cp_pp, gamma_only, lsitesymmetry, spinors, & - use_bloch_phases, stdout) + print_output, wannier_data, wann_plot, w90_calculation, & + real_lattice, symmetrize_eps, mp_grid, num_bands, & + num_kpts, num_proj, num_wann, optimisation, cp_pp, & + gamma_only, lsitesymmetry, spinors, use_bloch_phases, & + stdout) !================================================! ! !! write wannier90 parameters to stdout @@ -1743,7 +1726,6 @@ subroutine w90_wannier90_readwrite_write(atom_data, band_plot, dis_control, dis_ type(select_projection_type), intent(in) :: select_proj type(proj_type), allocatable, intent(in) :: proj_input(:) type(kpoint_path_type), intent(in) :: kpoint_path - type(w90_extra_io_type), intent(in) :: w90_extra_io type(wannier_plot_type), intent(in) :: wann_plot type(proj_type), allocatable, intent(in) :: proj(:) @@ -1767,16 +1749,26 @@ subroutine w90_wannier90_readwrite_write(atom_data, band_plot, dis_control, dis_ logical, intent(in) :: spinors ! local variables - real(kind=dp) :: recip_lattice(3, 3), inv_lattice(3, 3), pos_frac(3), kpt_cart(3), volume + character(len=1) :: one_dim_axis integer :: i, nkp, loop, nat, nsp, bands_num_spec_points - real(kind=dp) :: cell_volume logical :: disentanglement + real(kind=dp) :: ccentres_frac(3) + real(kind=dp) :: cell_volume + real(kind=dp) :: recip_lattice(3, 3), inv_lattice(3, 3), pos_frac(3), kpt_cart(3), volume disentanglement = (num_bands > num_wann) - if (w90_calculation%transport .and. tran%read_ht) goto 401 !really? fixme jj - ! System - if (print_output%iprint > 0) then + if (real_space_ham%one_dim_dir == 1) one_dim_axis = 'x' + if (real_space_ham%one_dim_dir == 2) one_dim_axis = 'y' + if (real_space_ham%one_dim_dir == 3) one_dim_axis = 'z' + + call utility_inverse_mat(real_lattice, inv_lattice) + + ! skip most printout if (w90_calculation%transport .and. tran%read_ht); continues with transport at end + + if (print_output%iprint > 0 .and. .not. (w90_calculation%transport .and. tran%read_ht)) then + + ! System write (stdout, *) write (stdout, '(36x,a6)') '------' write (stdout, '(36x,a6)') 'SYSTEM' @@ -1821,7 +1813,6 @@ subroutine w90_wannier90_readwrite_write(atom_data, band_plot, dis_control, dis_ write (stdout, '(1x,a)') '| Site Fractional Coordinate Cartesian Coordinate (Bohr) |' endif write (stdout, '(1x,a)') '+----------------------------------------------------------------------------+' - call utility_inverse_mat(real_lattice, inv_lattice) do nsp = 1, atom_data%num_species do nat = 1, atom_data%species_num(nsp) call utility_cart_to_frac(atom_data%pos_cart(:, nat, nsp), pos_frac, inv_lattice) @@ -1842,9 +1833,10 @@ subroutine w90_wannier90_readwrite_write(atom_data, band_plot, dis_control, dis_ write (stdout, '(1x,a)') '| Wannier# Original Centres Constrained centres |' write (stdout, '(1x,a)') '+----------------------------------------------------------------------------+' do i = 1, wann_control%constrain%slwf_num -!fixme JJ ccentres_frac is not available (only temporary read) cart is available in control or so -! write (stdout, '(1x,a1,2x,i3,2x,3F10.5,3x,a1,1x,3F10.5,4x,a1)') & -! & '|', i, w90_extra_io%ccentres_frac(i, :), '|', wannier_data%centres(:, i), '|' + call utility_cart_to_frac(wann_control%constrain%centres(i, :), ccentres_frac, inv_lattice) + ! note, this printout is in crystal coordinates; not sure why wannier_centres are printed here?? + write (stdout, '(1x,a1,2x,i3,2x,3F10.5,3x,a1,1x,3F10.5,4x,a1)') & + & '|', i, ccentres_frac(:), '|', wannier_data%centres(:, i), '|' end do write (stdout, '(1x,a)') '*----------------------------------------------------------------------------*' end if @@ -2099,11 +2091,9 @@ subroutine w90_wannier90_readwrite_write(atom_data, band_plot, dis_control, dis_ write (stdout, '(1x,a46,10x,I8,13x,a1)') '| Dimension of the system :', & real_space_ham%system_dim, '|' if (real_space_ham%system_dim .eq. 1) & - write (stdout, '(1x,a46,10x,a8,13x,a1)') '| System extended in :', & - trim(w90_extra_io%one_dim_axis), '|' + write (stdout, '(1x,a46,10x,a8,13x,a1)') '| System extended in :', one_dim_axis, '|' if (real_space_ham%system_dim .eq. 2) & - write (stdout, '(1x,a46,10x,a8,13x,a1)') '| System confined in :', & - trim(w90_extra_io%one_dim_axis), '|' + write (stdout, '(1x,a46,10x,a8,13x,a1)') '| System confined in :', one_dim_axis, '|' write (stdout, '(1x,a46,10x,F8.3,13x,a1)') '| Hamiltonian cut-off value :', & real_space_ham%hr_cutoff, '|' write (stdout, '(1x,a46,10x,F8.3,13x,a1)') '| Hamiltonian cut-off distance :', & @@ -2147,9 +2137,8 @@ subroutine w90_wannier90_readwrite_write(atom_data, band_plot, dis_control, dis_ endif ! endif - endif !iprint > 0 + endif !iprint > 0 and not (transport && read_ht) -401 continue ! ! Transport ! @@ -2166,8 +2155,8 @@ subroutine w90_wannier90_readwrite_write(atom_data, band_plot, dis_control, dis_ else ! write (stdout, '(1x,a46,10x,a8,13x,a1)') '| Hamiltonian from external files :', 'F', '|' - write (stdout, '(1x,a46,10x,a8,13x,a1)') '| System extended in :', & - trim(w90_extra_io%one_dim_axis), '|' + + write (stdout, '(1x,a46,10x,a8,13x,a1)') '| System extended in :', one_dim_axis, '|' ! end if @@ -2196,8 +2185,8 @@ end subroutine w90_wannier90_readwrite_write subroutine w90_wannier90_readwrite_w90_dealloc(atom_data, band_plot, dis_spheres, dis_manifold, & exclude_bands, kmesh_input, kpt_latt, & wann_control, proj, proj_input, select_proj, & - kpoint_path, wannier_data, wann_plot, & - w90_extra_io, eigval, error, comm) + kpoint_path, wannier_data, wann_plot, eigval, & + error, comm) !================================================! use w90_error, only: w90_error_type @@ -2213,7 +2202,6 @@ subroutine w90_wannier90_readwrite_w90_dealloc(atom_data, band_plot, dis_spheres type(atom_data_type), intent(inout) :: atom_data type(kpoint_path_type), intent(inout) :: kpoint_path type(select_projection_type), intent(inout) :: select_proj - type(w90_extra_io_type), intent(inout) :: w90_extra_io type(wannier_plot_type), intent(inout) :: wann_plot type(proj_type), allocatable, intent(inout) :: proj(:) type(proj_type), allocatable, intent(inout) :: proj_input(:) @@ -2246,13 +2234,6 @@ subroutine w90_wannier90_readwrite_w90_dealloc(atom_data, band_plot, dis_spheres return endif endif - if (allocated(w90_extra_io%ccentres_frac)) then - deallocate (w90_extra_io%ccentres_frac, stat=ierr) - if (ierr /= 0) then - call set_error_dealloc(error, 'Error deallocating ccentres_frac in w90_wannier90_readwrite_w90_dealloc', comm) - return - endif - endif if (allocated(wann_control%guiding_centres%centres)) then deallocate (wann_control%guiding_centres%centres, stat=ierr) if (ierr /= 0) then @@ -2389,8 +2370,9 @@ subroutine w90_wannier90_readwrite_write_chkpt(chkpt, exclude_bands, wannier_dat end subroutine w90_wannier90_readwrite_write_chkpt !================================================! - subroutine w90_wannier90_readwrite_memory_estimate(atom_data, kmesh_info, wann_control, proj_input, print_output, & - num_bands, num_kpts, num_proj, num_wann, optimisation, & + subroutine w90_wannier90_readwrite_memory_estimate(atom_data, kmesh_info, wann_control, & + proj_input, print_output, num_bands, & + num_kpts, num_proj, num_wann, optimisation, & gamma_only, stdout) !================================================! ! diff --git a/src/wannierise.F90 b/src/wannierise.F90 index 2a386aec..2f6b164c 100644 --- a/src/wannierise.F90 +++ b/src/wannierise.F90 @@ -470,7 +470,6 @@ subroutine wann_main(ham_logical, kmesh_info, kpt_latt, wann_control, omega, sit wannier_data%centres = rave wannier_data%spreads = r2ave - rave2 - ! JJ checkme, where is lquad intitialised? should it be persistent between invocations? if (wann_control%lfixstep) lquad = .false. ncg = 0 @@ -1742,11 +1741,16 @@ subroutine internal_new_u_and_m(cdq, cmtmp, tmp_cdq, cwork, rwork, evals, cwschu do nn = 1, kmesh_info%nntot nkp2 = kmesh_info%nnlist(nkp, nn) ! tmp_cdq = cdq^{dagger} . M - call utility_zgemm(tmp_cdq, cdq(:, :, nkp), 'C', m_matrix_loc(1:num_wann, 1:num_wann, nn, nkp_loc), 'N', & !jj fixme + + ! note: m_matrix_loc is dimensioned larger than block copied here + ! the striding used here likely incurs some overhead; ideally we should avoid it + ! Jerome Jackson Jun 24 + call utility_zgemm(tmp_cdq, cdq(:, :, nkp), 'C', m_matrix_loc(1:num_wann, 1:num_wann, nn, nkp_loc), 'N', & num_wann) ! cmtmp = tmp_cdq . cdq call utility_zgemm(cmtmp, tmp_cdq, 'N', cdq(:, :, nkp2), 'N', num_wann) - m_matrix_loc(1:num_wann, 1:num_wann, nn, nkp_loc) = cmtmp(:, :) !jj fixme + ! note striding + m_matrix_loc(1:num_wann, 1:num_wann, nn, nkp_loc) = cmtmp(:, :) enddo enddo @@ -3068,9 +3072,8 @@ subroutine wann_main_gamma(kmesh_info, wann_control, omega, print_output, wannie !~ endif u0 = u_matrix -!~ lguide = .false. ! guiding centres are not neede for orthorhombic systems - if (kmesh_info%nntot .eq. 3) wann_control%guiding_centres%enable = .false. ! fixme, this requires explanation... + if (kmesh_info%nntot .eq. 3) wann_control%guiding_centres%enable = .false. if (wann_control%guiding_centres%enable) then do n = 1, num_wann @@ -3099,18 +3102,13 @@ subroutine wann_main_gamma(kmesh_info, wann_control, omega, print_output, wannie irguide = 1 endif - ! weight m_matrix first to reduce number of operations - ! m_w : weighted real matrix - ! m_matrix is only avbl on root, but no mpi here - ! jj cleanup this documentation/notes - !if (on_root) then + ! weight m_matrix first to reduce number of operations + ! m_w : weighted real matrix do nn = 1, kmesh_info%nntot sqwb = sqrt(kmesh_info%wb(nn)) m_w(:, :, 2*nn - 1) = sqwb*real(m_matrix(1:num_wann, 1:num_wann, nn, 1), dp) m_w(:, :, 2*nn) = sqwb*aimag(m_matrix(1:num_wann, 1:num_wann, nn, 1)) end do - !endif - !call comms_bcast(m_w, num_wann*num_wann*tnntot, error, comm) ! calculate initial centers and spread call wann_omega_gamma(m_w, csheet, sheet, rave, r2ave, rave2, wann_spread, num_wann, & @@ -3157,7 +3155,6 @@ subroutine wann_main_gamma(kmesh_info, wann_control, omega, print_output, wannie end do ! main iteration loop - do iter = 1, wann_control%num_iter lprint = .false. @@ -3170,17 +3167,6 @@ subroutine wann_main_gamma(kmesh_info, wann_control, omega, print_output, wannie if (lprint .and. print_output%iprint > 0) write (stdout, '(1x,a,i6)') 'Cycle: ', iter -!~ ! initialize rguide as rave for use_bloch_phases -!~ if ( (iter.gt.num_no_guide_iter) .and. lguide ) then -!~ rguide(:,:) = rave(:,:) -!~ lguide = .false. -!~ endif -!~ if ( guiding_centres.and.(iter.gt.num_no_guide_iter) & -!~ .and.(mod(iter,num_guide_cycles).eq.0) ) then -!~ if(nntot.gt.3) call wann_phases(csheet,sheet,rguide,irguide) -!~ irguide=1 -!~ endif - if (wann_control%guiding_centres%enable .and. & (iter .gt. wann_control%guiding_centres%num_no_guide_iter) & .and. (mod(iter, wann_control%guiding_centres%num_guide_cycles) .eq. 0)) then @@ -3234,7 +3220,8 @@ subroutine wann_main_gamma(kmesh_info, wann_control, omega, print_output, wannie omega%total = wann_spread%om_tot omega%tilde = wann_spread%om_d + wann_spread%om_od -!JJ if (ldump) then +! (Jerome Jackson) Removing checkpoint from WF optimisation loop because benefit is limited +! if (ldump) then ! uc_rot(:, :) = cmplx(ur_rot(:, :), 0.0_dp, dp) ! call utility_zgemm(u_matrix, u0, 'N', uc_rot, 'N', num_wann) ! call w90_wannier90_readwrite_write_chkpt('postdis', exclude_bands, wannier_data, & @@ -3266,6 +3253,7 @@ subroutine wann_main_gamma(kmesh_info, wann_control, omega, print_output, wannie sqwb = 1.0_dp/sqrt(kmesh_info%wb(nn)) m_matrix(1:num_wann, 1:num_wann, nn, 1) = sqwb*cmplx(m_w(:, :, 2*nn - 1), m_w(:, :, 2*nn), dp) end do + ! update U uc_rot(:, :) = cmplx(ur_rot(:, :), 0.0_dp, dp) call utility_zgemm(u_matrix, u0, 'N', uc_rot, 'N', num_wann) @@ -3288,12 +3276,6 @@ subroutine wann_main_gamma(kmesh_info, wann_control, omega, print_output, wannie ' Omega Total = ', wann_spread%om_tot*print_output%lenconfac**2 write (stdout, '(1x,a78)') repeat('-', 78) -! if (output_file%write_xyz) then -! call wann_write_xyz(translate_home_cell, num_wann, wannier_data%centres, & -! real_lattice, atom_data, print_output, error, comm, stdout, seedname) -! if (allocated(error)) return -! endif - if (wann_control%guiding_centres%enable) then call wann_phases(csheet, sheet, rguide, irguide, num_wann, kmesh_info, num_kpts, & wann_control%use_ss_functional, m_matrix, rnkb, print_output%timing_level, & @@ -3306,33 +3288,6 @@ subroutine wann_main_gamma(kmesh_info, wann_control, omega, print_output, wannie print_output%iprint, stdout, timer, error, comm) if (allocated(error)) return - !JJ - ! write extra info regarding omega_invariant - !if (print_output%iprint > 2) then - ! call wann_svd_omega_i(num_wann, num_kpts, kmesh_info, m_matrix, print_output, timer, & - ! error, comm, stdout) - ! if (allocated(error)) return - !endif - ! write matrix elements to file - !if (output_file%write_r2mn) then - ! call wann_write_r2mn(num_kpts, num_wann, kmesh_info, m_matrix, error, comm, seedname) - ! if (allocated(error)) return - !endif - - ! calculate and write projection of WFs on original bands in outer window - !if (have_disentangled .and. output_file%write_proj) then - ! call wann_calc_projection(num_bands, num_wann, num_kpts, u_matrix_opt, eigval, & - ! dis_manifold%lwindow, print_output%timing_level, & - ! print_output%iprint, stdout, timer) - !endif - - ! aam: write data required for vdW utility - !if (output_file%write_vdw_data) then - ! call wann_write_vdw_data(num_wann, wannier_data, real_lattice, u_matrix, u_matrix_opt, & - ! have_disentangled, w90_system, error, comm, stdout, seedname) - ! if (allocated(error)) return - !endif - ! deallocate sub vars not passed into other subs deallocate (cz, stat=ierr) if (ierr /= 0) then @@ -3409,11 +3364,8 @@ subroutine wann_main_gamma(kmesh_info, wann_control, omega, print_output, wannie return -1000 format(2x, 'WF centre and spread', & -& i5, 2x, '(', f10.6, ',', f10.6, ',', f10.6, ' )', f15.8) - -1001 format(2x, 'Sum of centres and spreads', & -& 1x, '(', f10.6, ',', f10.6, ',', f10.6, ' )', f15.8) +1000 format(2x, 'WF centre and spread', i5, 2x, '(', f10.6, ',', f10.6, ',', f10.6, ' )', f15.8) +1001 format(2x, 'Sum of centres and spreads', 1x, '(', f10.6, ',', f10.6, ',', f10.6, ' )', f15.8) contains