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

Relax requirement that tricilinic angles must be all acute or all obtuse #34

Open
kbarros opened this issue Nov 16, 2024 · 2 comments
Open

Comments

@kbarros
Copy link
Contributor

kbarros commented Nov 16, 2024

Hi @thchr, thank you for the very nice package. I'm working to integrate it with our Sunny software for magnetic simulations.

There is a check here that triclinic angles must be all-acute or all-obtuse:

elseif bt == "aP"
# SeeK-path only provides paths for all-acute or all-obtuse reciprocal aP cells
# (more precisely, SeeK-path will transform to this setting automatically) so check:
# get reciprocal basis inter-angles angles
Gs = (Rs[2]×Rs[3], Rs[3]×Rs[1], Rs[1]×Rs[2]) # NB: "scale" prefactor omitted here
aᴳ, bᴳ, cᴳ = basisnorms(Gs)
cosαᴳ = dot(Gs[2], Gs[3]) / (bᴳ * cᴳ)
cosβᴳ = dot(Gs[1], Gs[3]) / (aᴳ * cᴳ)
cosγᴳ = dot(Gs[1], Gs[2]) / (aᴳ * bᴳ)
# detect whether all-obtuse or all-acute reciprocal basis
if cosαᴳ 0 && cosβᴳ 0 && cosγᴳ 0 # all-obtuse
return :aP2
elseif cosαᴳ 0 && cosβᴳ 0 && cosγᴳ 0 # all-acute
return :aP3
else
_throw_triclinic_angles(Rs)
end

You commented that SeeK-path automatically transforms to this setting. Is this something that Brillouin.jl might also automate? Otherwise, is there a suggestion for how to implement this in one's own code?

@thchr
Copy link
Owner

thchr commented Nov 16, 2024

Yeah, transforming to this is something I've wanted to implement for a while but haven't yet. I think the main steps are the following: 1. transform to Niggli-reduced cell and 2. transform from Niggli-reduced cell to a standard/conventional cell. I recently added a method to do step 1 (Niggli-reduced cell in Bravais.jl), but haven't gotten around to doing step 2. I think it's probably described in ITA how to do it. Would love to add it to Bravais.jl one day; with that, it'd would be trivial to do this automatically in Brillouin.jl as well.

In the meanwhile, it should be possible to do this via Spglib.jl: see https://thchr.github.io/Brillouin.jl/stable/kpaths/#Treating-unit-cells-in-non-standard-settings.

@kbarros
Copy link
Contributor Author

kbarros commented Nov 16, 2024

Ah, this helps a lot. We already depend on Spglib, but I didn't realize it could standardize the triclinic lattice like this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants