Skip to content

u_dis.mat format has silently changed between v3.1.0 and develop #608

Description

@jaemolihm

Previously, if some low-energy bands were outside the outer window, u_dis.mat were shifted to start with nonzero entry. Now, they are not shifted and keep the original band index.

For example, if there are 5 bands and only band 2, 3, 4 are inside the outer window and 1 and 5 are outside the window, the u_dis.mat file stores

  • v3.1.0 : [A, B, C, 0, 0]
  • develop: [0, A, B, C, 0]

The relevant code is (note the commented line)

wannier90/src/plot.F90

Lines 2445 to 2460 in 0137a03

open (newunit=matunit, file=trim(seedname)//'_u_dis.mat', form='formatted')
write (matunit, *) header
write (matunit, *) num_kpts, num_wann, num_bands
do nkp = 1, num_kpts
utmp = 0.d0
ioff = dis_manifold%nfirstwin(nkp)
nbw = dis_manifold%ndimwin(nkp)
utmp(ioff:ioff + nbw - 1, :) = u_matrix_opt(1:nbw, :, nkp)
write (matunit, *)
write (matunit, '(f15.10,sp,f15.10,sp,f15.10)') kpt_latt(:, nkp)
!write (matunit, '(f15.10,sp,f15.10)') ((u_matrix_opt(i, j, nkp), i=1, num_bands), j=1, num_wann)
write (matunit, '(f15.10,sp,f15.10)') ((utmp(i, j), i=1, num_bands), j=1, num_wann)
end do
close (matunit)
deallocate (utmp)
endif

See http://github.com/TRIQS/dftkit/issues/1 for details and for an example where this causes a problem in a Wannier90 interface code.

I like the new ordering much better, but since it is a breaking change, I think one should revert to the old behavior.

Instead, I suggest that we create a new output, seedname_v.mat, which writes V = U_dis * U, with the new index ordering. Then we can suggest the interface packages to migrate to v.mat, while keeping the old interface u_dis.mat + u.mat for some time until we deprecate and remove it.

In addition, if the variational disentanglement is implemented in the future, it directly computes V instead of U_dis and U, so writing V is more natural.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions