Skip to content

Instantly share code, notes, and snippets.

@singularitti
Last active May 25, 2021 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save singularitti/037baabb3bcadbe85db5f555f91f5904 to your computer and use it in GitHub Desktop.
Save singularitti/037baabb3bcadbe85db5f555f91f5904 to your computer and use it in GitHub Desktop.
Spglib helper
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
# 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