Skip to content

Commit

Permalink
Use fixed number of digits for kpoints
Browse files Browse the repository at this point in the history
Otherwise, the kpoints coordinates can be 0.49999 instead of 0.5
  • Loading branch information
qiaojunfeng committed May 10, 2024
1 parent fb74455 commit e83b86f
Show file tree
Hide file tree
Showing 13 changed files with 116 additions and 161 deletions.
8 changes: 6 additions & 2 deletions src/aiida_wannier90/io/_write_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,12 @@ def _format_kpoint_path(kpoint_path):
for point1, point2 in path:
coord1 = point_coords[point1]
coord2 = point_coords[point2]
path_line = f"{point1} {coord1[0]} {coord1[1]} {coord1[2]} "
path_line += f" {point2} {coord2[0]} {coord2[1]} {coord2[2]}"
path_line = (
f"{point1} {coord1[0]:14.10f} {coord1[1]:14.10f} {coord1[2]:14.10f} "
)
path_line += (
f" {point2} {coord2[0]:14.10f} {coord2[1]:14.10f} {coord2[2]:14.10f}"
)
res.append(path_line)
return res

Expand Down
20 changes: 10 additions & 10 deletions tests/calculations/test_local_input/test_default_None_.win
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ As -1.4200000000 1.4200000000 1.4200000000
end atoms_cart

begin kpoint_path
G 0.0 0.0 0.0 X 0.5 0.0 0.5
X 0.5 0.0 0.5 W 0.5 0.25 0.75
W 0.5 0.25 0.75 K 0.375 0.375 0.75
K 0.375 0.375 0.75 G 0.0 0.0 0.0
G 0.0 0.0 0.0 L 0.5 0.5 0.5
L 0.5 0.5 0.5 U 0.625 0.25 0.625
U 0.625 0.25 0.625 W 0.5 0.25 0.75
W 0.5 0.25 0.75 L 0.5 0.5 0.5
L 0.5 0.5 0.5 K 0.375 0.375 0.75
U 0.625 0.25 0.625 X 0.5 0.0 0.5
G 0.0000000000 0.0000000000 0.0000000000 X 0.5000000000 0.0000000000 0.5000000000
X 0.5000000000 0.0000000000 0.5000000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 K 0.3750000000 0.3750000000 0.7500000000
K 0.3750000000 0.3750000000 0.7500000000 G 0.0000000000 0.0000000000 0.0000000000
G 0.0000000000 0.0000000000 0.0000000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 U 0.6250000000 0.2500000000 0.6250000000
U 0.6250000000 0.2500000000 0.6250000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 K 0.3750000000 0.3750000000 0.7500000000
U 0.6250000000 0.2500000000 0.6250000000 X 0.5000000000 0.0000000000 0.5000000000
end kpoint_path

begin kpoints
Expand Down
20 changes: 10 additions & 10 deletions tests/calculations/test_local_input/test_default_aiida_.win
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ As -1.4200000000 1.4200000000 1.4200000000
end atoms_cart

begin kpoint_path
G 0.0 0.0 0.0 X 0.5 0.0 0.5
X 0.5 0.0 0.5 W 0.5 0.25 0.75
W 0.5 0.25 0.75 K 0.375 0.375 0.75
K 0.375 0.375 0.75 G 0.0 0.0 0.0
G 0.0 0.0 0.0 L 0.5 0.5 0.5
L 0.5 0.5 0.5 U 0.625 0.25 0.625
U 0.625 0.25 0.625 W 0.5 0.25 0.75
W 0.5 0.25 0.75 L 0.5 0.5 0.5
L 0.5 0.5 0.5 K 0.375 0.375 0.75
U 0.625 0.25 0.625 X 0.5 0.0 0.5
G 0.0000000000 0.0000000000 0.0000000000 X 0.5000000000 0.0000000000 0.5000000000
X 0.5000000000 0.0000000000 0.5000000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 K 0.3750000000 0.3750000000 0.7500000000
K 0.3750000000 0.3750000000 0.7500000000 G 0.0000000000 0.0000000000 0.0000000000
G 0.0000000000 0.0000000000 0.0000000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 U 0.6250000000 0.2500000000 0.6250000000
U 0.6250000000 0.2500000000 0.6250000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 K 0.3750000000 0.3750000000 0.7500000000
U 0.6250000000 0.2500000000 0.6250000000 X 0.5000000000 0.0000000000 0.5000000000
end kpoint_path

begin kpoints
Expand Down
20 changes: 10 additions & 10 deletions tests/calculations/test_local_input/test_default_plot.win
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ As -1.4200000000 1.4200000000 1.4200000000
end atoms_cart

begin kpoint_path
G 0.0 0.0 0.0 X 0.5 0.0 0.5
X 0.5 0.0 0.5 W 0.5 0.25 0.75
W 0.5 0.25 0.75 K 0.375 0.375 0.75
K 0.375 0.375 0.75 G 0.0 0.0 0.0
G 0.0 0.0 0.0 L 0.5 0.5 0.5
L 0.5 0.5 0.5 U 0.625 0.25 0.625
U 0.625 0.25 0.625 W 0.5 0.25 0.75
W 0.5 0.25 0.75 L 0.5 0.5 0.5
L 0.5 0.5 0.5 K 0.375 0.375 0.75
U 0.625 0.25 0.625 X 0.5 0.0 0.5
G 0.0000000000 0.0000000000 0.0000000000 X 0.5000000000 0.0000000000 0.5000000000
X 0.5000000000 0.0000000000 0.5000000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 K 0.3750000000 0.3750000000 0.7500000000
K 0.3750000000 0.3750000000 0.7500000000 G 0.0000000000 0.0000000000 0.0000000000
G 0.0000000000 0.0000000000 0.0000000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 U 0.6250000000 0.2500000000 0.6250000000
U 0.6250000000 0.2500000000 0.6250000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 K 0.3750000000 0.3750000000 0.7500000000
U 0.6250000000 0.2500000000 0.6250000000 X 0.5000000000 0.0000000000 0.5000000000
end kpoint_path

begin kpoints
Expand Down
49 changes: 0 additions & 49 deletions tests/calculations/test_local_input/test_default_remote.win

This file was deleted.

20 changes: 10 additions & 10 deletions tests/calculations/test_local_input/test_default_wannier_.win
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ As -1.4200000000 1.4200000000 1.4200000000
end atoms_cart

begin kpoint_path
G 0.0 0.0 0.0 X 0.5 0.0 0.5
X 0.5 0.0 0.5 W 0.5 0.25 0.75
W 0.5 0.25 0.75 K 0.375 0.375 0.75
K 0.375 0.375 0.75 G 0.0 0.0 0.0
G 0.0 0.0 0.0 L 0.5 0.5 0.5
L 0.5 0.5 0.5 U 0.625 0.25 0.625
U 0.625 0.25 0.625 W 0.5 0.25 0.75
W 0.5 0.25 0.75 L 0.5 0.5 0.5
L 0.5 0.5 0.5 K 0.375 0.375 0.75
U 0.625 0.25 0.625 X 0.5 0.0 0.5
G 0.0000000000 0.0000000000 0.0000000000 X 0.5000000000 0.0000000000 0.5000000000
X 0.5000000000 0.0000000000 0.5000000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 K 0.3750000000 0.3750000000 0.7500000000
K 0.3750000000 0.3750000000 0.7500000000 G 0.0000000000 0.0000000000 0.0000000000
G 0.0000000000 0.0000000000 0.0000000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 U 0.6250000000 0.2500000000 0.6250000000
U 0.6250000000 0.2500000000 0.6250000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 K 0.3750000000 0.3750000000 0.7500000000
U 0.6250000000 0.2500000000 0.6250000000 X 0.5000000000 0.0000000000 0.5000000000
end kpoint_path

begin kpoints
Expand Down
20 changes: 10 additions & 10 deletions tests/calculations/test_local_input/test_diffusivity.win
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ As -1.4200000000 1.4200000000 1.4200000000
end atoms_cart

begin kpoint_path
G 0.0 0.0 0.0 X 0.5 0.0 0.5
X 0.5 0.0 0.5 W 0.5 0.25 0.75
W 0.5 0.25 0.75 K 0.375 0.375 0.75
K 0.375 0.375 0.75 G 0.0 0.0 0.0
G 0.0 0.0 0.0 L 0.5 0.5 0.5
L 0.5 0.5 0.5 U 0.625 0.25 0.625
U 0.625 0.25 0.625 W 0.5 0.25 0.75
W 0.5 0.25 0.75 L 0.5 0.5 0.5
L 0.5 0.5 0.5 K 0.375 0.375 0.75
U 0.625 0.25 0.625 X 0.5 0.0 0.5
G 0.0000000000 0.0000000000 0.0000000000 X 0.5000000000 0.0000000000 0.5000000000
X 0.5000000000 0.0000000000 0.5000000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 K 0.3750000000 0.3750000000 0.7500000000
K 0.3750000000 0.3750000000 0.7500000000 G 0.0000000000 0.0000000000 0.0000000000
G 0.0000000000 0.0000000000 0.0000000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 U 0.6250000000 0.2500000000 0.6250000000
U 0.6250000000 0.2500000000 0.6250000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 K 0.3750000000 0.3750000000 0.7500000000
U 0.6250000000 0.2500000000 0.6250000000 X 0.5000000000 0.0000000000 0.5000000000
end kpoint_path

begin kpoints
Expand Down
20 changes: 10 additions & 10 deletions tests/calculations/test_local_input/test_list_projections.win
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ As -1.4200000000 1.4200000000 1.4200000000
end atoms_cart

begin kpoint_path
G 0.0 0.0 0.0 X 0.5 0.0 0.5
X 0.5 0.0 0.5 W 0.5 0.25 0.75
W 0.5 0.25 0.75 K 0.375 0.375 0.75
K 0.375 0.375 0.75 G 0.0 0.0 0.0
G 0.0 0.0 0.0 L 0.5 0.5 0.5
L 0.5 0.5 0.5 U 0.625 0.25 0.625
U 0.625 0.25 0.625 W 0.5 0.25 0.75
W 0.5 0.25 0.75 L 0.5 0.5 0.5
L 0.5 0.5 0.5 K 0.375 0.375 0.75
U 0.625 0.25 0.625 X 0.5 0.0 0.5
G 0.0000000000 0.0000000000 0.0000000000 X 0.5000000000 0.0000000000 0.5000000000
X 0.5000000000 0.0000000000 0.5000000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 K 0.3750000000 0.3750000000 0.7500000000
K 0.3750000000 0.3750000000 0.7500000000 G 0.0000000000 0.0000000000 0.0000000000
G 0.0000000000 0.0000000000 0.0000000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 U 0.6250000000 0.2500000000 0.6250000000
U 0.6250000000 0.2500000000 0.6250000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 K 0.3750000000 0.3750000000 0.7500000000
U 0.6250000000 0.2500000000 0.6250000000 X 0.5000000000 0.0000000000 0.5000000000
end kpoint_path

begin kpoints
Expand Down
20 changes: 10 additions & 10 deletions tests/calculations/test_local_input/test_no_projections.win
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ As -1.4200000000 1.4200000000 1.4200000000
end atoms_cart

begin kpoint_path
G 0.0 0.0 0.0 X 0.5 0.0 0.5
X 0.5 0.0 0.5 W 0.5 0.25 0.75
W 0.5 0.25 0.75 K 0.375 0.375 0.75
K 0.375 0.375 0.75 G 0.0 0.0 0.0
G 0.0 0.0 0.0 L 0.5 0.5 0.5
L 0.5 0.5 0.5 U 0.625 0.25 0.625
U 0.625 0.25 0.625 W 0.5 0.25 0.75
W 0.5 0.25 0.75 L 0.5 0.5 0.5
L 0.5 0.5 0.5 K 0.375 0.375 0.75
U 0.625 0.25 0.625 X 0.5 0.0 0.5
G 0.0000000000 0.0000000000 0.0000000000 X 0.5000000000 0.0000000000 0.5000000000
X 0.5000000000 0.0000000000 0.5000000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 K 0.3750000000 0.3750000000 0.7500000000
K 0.3750000000 0.3750000000 0.7500000000 G 0.0000000000 0.0000000000 0.0000000000
G 0.0000000000 0.0000000000 0.0000000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 U 0.6250000000 0.2500000000 0.6250000000
U 0.6250000000 0.2500000000 0.6250000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 K 0.3750000000 0.3750000000 0.7500000000
U 0.6250000000 0.2500000000 0.6250000000 X 0.5000000000 0.0000000000 0.5000000000
end kpoint_path

begin kpoints
Expand Down
20 changes: 10 additions & 10 deletions tests/calculations/test_local_input/test_spin_projections.win
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ As -1.4200000000 1.4200000000 1.4200000000
end atoms_cart

begin kpoint_path
G 0.0 0.0 0.0 X 0.5 0.0 0.5
X 0.5 0.0 0.5 W 0.5 0.25 0.75
W 0.5 0.25 0.75 K 0.375 0.375 0.75
K 0.375 0.375 0.75 G 0.0 0.0 0.0
G 0.0 0.0 0.0 L 0.5 0.5 0.5
L 0.5 0.5 0.5 U 0.625 0.25 0.625
U 0.625 0.25 0.625 W 0.5 0.25 0.75
W 0.5 0.25 0.75 L 0.5 0.5 0.5
L 0.5 0.5 0.5 K 0.375 0.375 0.75
U 0.625 0.25 0.625 X 0.5 0.0 0.5
G 0.0000000000 0.0000000000 0.0000000000 X 0.5000000000 0.0000000000 0.5000000000
X 0.5000000000 0.0000000000 0.5000000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 K 0.3750000000 0.3750000000 0.7500000000
K 0.3750000000 0.3750000000 0.7500000000 G 0.0000000000 0.0000000000 0.0000000000
G 0.0000000000 0.0000000000 0.0000000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 U 0.6250000000 0.2500000000 0.6250000000
U 0.6250000000 0.2500000000 0.6250000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 K 0.3750000000 0.3750000000 0.7500000000
U 0.6250000000 0.2500000000 0.6250000000 X 0.5000000000 0.0000000000 0.5000000000
end kpoint_path

begin kpoints
Expand Down
20 changes: 10 additions & 10 deletions tests/calculations/test_remote_input/test_default_remote.win
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ As -1.4200000000 1.4200000000 1.4200000000
end atoms_cart

begin kpoint_path
G 0.0 0.0 0.0 X 0.5 0.0 0.5
X 0.5 0.0 0.5 W 0.5 0.25 0.75
W 0.5 0.25 0.75 K 0.375 0.375 0.75
K 0.375 0.375 0.75 G 0.0 0.0 0.0
G 0.0 0.0 0.0 L 0.5 0.5 0.5
L 0.5 0.5 0.5 U 0.625 0.25 0.625
U 0.625 0.25 0.625 W 0.5 0.25 0.75
W 0.5 0.25 0.75 L 0.5 0.5 0.5
L 0.5 0.5 0.5 K 0.375 0.375 0.75
U 0.625 0.25 0.625 X 0.5 0.0 0.5
G 0.0000000000 0.0000000000 0.0000000000 X 0.5000000000 0.0000000000 0.5000000000
X 0.5000000000 0.0000000000 0.5000000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 K 0.3750000000 0.3750000000 0.7500000000
K 0.3750000000 0.3750000000 0.7500000000 G 0.0000000000 0.0000000000 0.0000000000
G 0.0000000000 0.0000000000 0.0000000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 U 0.6250000000 0.2500000000 0.6250000000
U 0.6250000000 0.2500000000 0.6250000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 K 0.3750000000 0.3750000000 0.7500000000
U 0.6250000000 0.2500000000 0.6250000000 X 0.5000000000 0.0000000000 0.5000000000
end kpoint_path

begin kpoints
Expand Down
20 changes: 10 additions & 10 deletions tests/calculations/test_remote_input/test_unk_symlink.win
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ As -1.4200000000 1.4200000000 1.4200000000
end atoms_cart

begin kpoint_path
G 0.0 0.0 0.0 X 0.5 0.0 0.5
X 0.5 0.0 0.5 W 0.5 0.25 0.75
W 0.5 0.25 0.75 K 0.375 0.375 0.75
K 0.375 0.375 0.75 G 0.0 0.0 0.0
G 0.0 0.0 0.0 L 0.5 0.5 0.5
L 0.5 0.5 0.5 U 0.625 0.25 0.625
U 0.625 0.25 0.625 W 0.5 0.25 0.75
W 0.5 0.25 0.75 L 0.5 0.5 0.5
L 0.5 0.5 0.5 K 0.375 0.375 0.75
U 0.625 0.25 0.625 X 0.5 0.0 0.5
G 0.0000000000 0.0000000000 0.0000000000 X 0.5000000000 0.0000000000 0.5000000000
X 0.5000000000 0.0000000000 0.5000000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 K 0.3750000000 0.3750000000 0.7500000000
K 0.3750000000 0.3750000000 0.7500000000 G 0.0000000000 0.0000000000 0.0000000000
G 0.0000000000 0.0000000000 0.0000000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 U 0.6250000000 0.2500000000 0.6250000000
U 0.6250000000 0.2500000000 0.6250000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 K 0.3750000000 0.3750000000 0.7500000000
U 0.6250000000 0.2500000000 0.6250000000 X 0.5000000000 0.0000000000 0.5000000000
end kpoint_path

begin kpoints
Expand Down
20 changes: 10 additions & 10 deletions tests/io/test_win_writer/test_create_win_string.win
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ As -1.4200000000 1.4200000000 1.4200000000
end atoms_cart

begin kpoint_path
G 0.0 0.0 0.0 X 0.5 0.0 0.5
X 0.5 0.0 0.5 W 0.5 0.25 0.75
W 0.5 0.25 0.75 K 0.375 0.375 0.75
K 0.375 0.375 0.75 G 0.0 0.0 0.0
G 0.0 0.0 0.0 L 0.5 0.5 0.5
L 0.5 0.5 0.5 U 0.625 0.25 0.625
U 0.625 0.25 0.625 W 0.5 0.25 0.75
W 0.5 0.25 0.75 L 0.5 0.5 0.5
L 0.5 0.5 0.5 K 0.375 0.375 0.75
U 0.625 0.25 0.625 X 0.5 0.0 0.5
G 0.0000000000 0.0000000000 0.0000000000 X 0.5000000000 0.0000000000 0.5000000000
X 0.5000000000 0.0000000000 0.5000000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 K 0.3750000000 0.3750000000 0.7500000000
K 0.3750000000 0.3750000000 0.7500000000 G 0.0000000000 0.0000000000 0.0000000000
G 0.0000000000 0.0000000000 0.0000000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 U 0.6250000000 0.2500000000 0.6250000000
U 0.6250000000 0.2500000000 0.6250000000 W 0.5000000000 0.2500000000 0.7500000000
W 0.5000000000 0.2500000000 0.7500000000 L 0.5000000000 0.5000000000 0.5000000000
L 0.5000000000 0.5000000000 0.5000000000 K 0.3750000000 0.3750000000 0.7500000000
U 0.6250000000 0.2500000000 0.6250000000 X 0.5000000000 0.0000000000 0.5000000000
end kpoint_path

begin kpoints
Expand Down

0 comments on commit e83b86f

Please sign in to comment.