Last active
May 25, 2021 09:33
-
-
Save singularitti/037baabb3bcadbe85db5f555f91f5904 to your computer and use it in GitHub Desktop.
Spglib helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function compare_with_qe(result, qe_result, alat) | |
result = map(result * alat) do vec | |
map(v -> round(v; digits = 7), vec) | |
end | |
f(result) = sortperm(DataFrame(hcat(result...)', [:x, :y, :z]), [:x, :y, :z]) | |
g(result) = result[sortperm(DataFrame(hcat(result...)', [:x, :y, :z]), [:x, :y, :z])] | |
# result_df = sortperm(DataFrame(hcat(result...)', [:x, :y, :z]), [:x, :y, :z]) | |
# qe_df = sortperm(DataFrame(hcat(qe_result...)', [:x, :y, :z]), [:x, :y, :z]) | |
# result_df, qe_df | |
symdiff(result, qe_result) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See https://spglib.github.io/spglib/python-spglib.html#get-ir-reciprocal-mesh | |
def irr(mesh, cell, shift): | |
mapping, grid = spglib.get_ir_reciprocal_mesh(mesh, cell, is_shift=shift) | |
shift = np.array(shift) / 2 | |
return (grid[np.unique(mapping)] + shift) / np.array(mesh, dtype=float) | |
def allk(mesh, cell, shift): | |
mapping, grid = spglib.get_ir_reciprocal_mesh(mesh, cell, is_shift=shift) | |
shift = np.array(shift) / 2 | |
return (grid + shift) / np.array(mesh, dtype=float) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment