Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options for sorting b vectors #539

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/docs/parameters/postw90-global-parameters.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ uHu_formatted,L,"Read a formatted `seedname.uHu` file"
spn_formatted,L,"Read a formatted `seedname.spn` file"
berry_curv_unit,S,"Unit of Berry curvature"
transl_inv,L,"Use Marzari-Vanderbilt formula for wannier centres"
transl_inv_full,L,"Use translationally-invariant formula for position-related matrix elements"
transl_inv_full,L,"Use translationally-invariant formula for position-related matrix elements"
order_b_vectors,L,"Determines whether to sort b vectors or not. Must be true for translation invariance"
1 change: 1 addition & 0 deletions docs/docs/parameters/w90-job-parameters.csv
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ translate_home_cell,L,"To translate final Wannier centres to home unit cell when
write_xyz,L,"To write atomic positions and final centres in xyz file format"
write_vdw_data,L,"To write data for futher processing by w90vdw utility"
write_hr_diag,L,"To write the diagonal elements of the Hamiltonian in the Wannier basis to `seedname.wout` (in eV)"
order_b_vectors,L,"Determines whether to sort b vectors or not. Must be true for Stengel-Spaldin functional"
13 changes: 12 additions & 1 deletion src/library_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,15 @@ subroutine w90_input_reader(common_data, istdout, istderr, ierr)
common_data%gamma_only, common_data%lsitesymmetry, &
common_data%use_bloch_phases, common_data%seedname, &
istdout, error, common_data%comm)

! check
if ((.not. common_data%kmesh_input%order_b_vectors) .and. &
common_data%wann_control%use_ss_functional) then
call set_error_input(error, 'Error: If use_ss_functional is true, &
order_b_vector must be true. ', common_data%comm)
return
endif
Comment on lines +490 to +495
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we need to add this check to the library interface w90_input_setopt as well, i.e. after this line

common_data%comm)

But this will duplicate the same code, pinging @JeromeCCP9 maybe you have a better place of organizing these checks?


if (allocated(error)) then
call prterr(error, ierr, istdout, istderr, common_data%comm)
return
Expand Down Expand Up @@ -870,7 +879,9 @@ subroutine w90_create_kmesh(common_data, istdout, istderr, ierr)
endif

if (.not. common_data%gamma_only) then
call kmesh_sort(common_data%kmesh_info, common_data%num_kpts, error, common_data%comm)
if (common_data%kmesh_input%order_b_vectors) then
call kmesh_sort(common_data%kmesh_info, common_data%num_kpts, error, common_data%comm)
endif
if (allocated(error)) then
call prterr(error, ierr, istdout, istderr, common_data%comm)
return
Expand Down
4 changes: 3 additions & 1 deletion src/postw90/postw90.F90
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ program postw90
num_kpts, gamma_only, stdout, timer, error, comm)
if (allocated(error)) call print_error_halt(error, ierr, stdout, stderr, comm)

call kmesh_sort(kmesh_info, num_kpts, error, comm)
if (kmesh_data%order_b_vectors) then
call kmesh_sort(kmesh_info, num_kpts, error, comm)
endif
if (allocated(error)) call print_error_halt(error, ierr, stdout, stderr, comm)

if (on_root) then
Expand Down
9 changes: 9 additions & 0 deletions src/postw90/postw90_readwrite.F90
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,14 @@ subroutine w90_postw90_readwrite_read(settings, ws_region, w90_system, exclude_b
if (allocated(error)) return
call w90_readwrite_read_atoms(settings, atom_data, real_lattice, bohr, error, comm)
if (allocated(error)) return

! check
if (pw90_berry%transl_inv_full .and. (.not. kmesh_input%order_b_vectors)) then
call set_error_input(error, 'Error: If transl_inv_full is true, &
order_b_vector must be true. ', comm)
return
endif

end subroutine w90_postw90_readwrite_read

subroutine w90_postw90_readwrite_readall(settings, w90_system, dis_manifold, fermi_energy_list, &
Expand Down Expand Up @@ -386,6 +394,7 @@ subroutine w90_postw90_readwrite_readall(settings, w90_system, dis_manifold, fer
pw90_extra_io%global_kmesh_set, &
pw90_extra_io%global_kmesh, error, comm)
if (allocated(error)) return

end subroutine w90_postw90_readwrite_readall

!================================================!
Expand Down
5 changes: 5 additions & 0 deletions src/readwrite.F90
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,10 @@ subroutine w90_readwrite_read_kmesh_data(settings, kmesh_input, error, comm)
kmesh_input%max_shells_aux = 6
endif

call w90_readwrite_get_keyword(settings, 'order_b_vectors', found, error, comm, &
l_value=kmesh_input%order_b_vectors)
if (allocated(error)) return

call w90_readwrite_get_keyword(settings, 'kmesh_tol', found, error, comm, &
r_value=kmesh_input%tol)
if (allocated(error)) return
Expand Down Expand Up @@ -1242,6 +1246,7 @@ subroutine w90_readwrite_clear_keywords(settings, comm)
call w90_readwrite_get_keyword(settings, 'guiding_centres', found, error, comm)
call w90_readwrite_get_keyword(settings, 'higher_order_n', found, error, comm)
call w90_readwrite_get_keyword(settings, 'higher_order_nearest_shells', found, error, comm)
call w90_readwrite_get_keyword(settings, 'order_b_vectors', found, error, comm)
call w90_readwrite_get_keyword(settings, 'hr_cutoff', found, error, comm)
call w90_readwrite_get_keyword(settings, 'hr_plot', found, error, comm)
call w90_readwrite_get_keyword(settings, 'iprint', found, error, comm)
Expand Down
1 change: 1 addition & 0 deletions src/types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ module w90_types
integer :: num_nnmax_h ! 2*n(4n*2 + 15n + 17)/6
integer :: higher_order_n = 1
logical :: higher_order_nearest_shells = .false. ! experimental feature
logical :: order_b_vectors = .false. ! Determines wheter to order the b-vectors
JeromeCCP9 marked this conversation as resolved.
Show resolved Hide resolved
!! A simpler algorithm of determining bvectors
logical :: skip_B1_tests = .false.
!! do not check the B1 condition
Expand Down
Binary file modified test-suite/checkpoints/example02/lead.chk.fmt.bz2
Binary file not shown.
Binary file modified test-suite/checkpoints/fe_postw90/Fe.uHu.bz2
Binary file not shown.
Loading
Loading