SunnySuite / Sunny.jl

Spin dynamics and generalization to SU(N) coherent states
Other
86 stars 19 forks source link

Fix issue with ambiguous crystal setting #43

Closed kbarros closed 2 years ago

kbarros commented 2 years ago

Ovi Garlea reported that he was not getting the expected crystal with this code:

using Sunny
lat_vecs = lattice_vectors(13.261, 7.718, 6.278, 90.0, 90.0, 90.0);
types = ["Yb1","Yb2"];
basis_vecs = [[0,0,0], [0.266,0.25,0.997]]; # Locations of atoms as multiples of lattice vectors
Crystal(lat_vecs, basis_vecs,62;types,symprec=0.001)

The problem is that space group 62 could have multiple interpretations. For example, it could be any of 6 possible Hall numbers, 292...297 ( "Setos page" has the full list). These can be disambiguated with an approprate "setting" parameter. To add to the confusion, each of these settings has a different HM symbol, and Sunny was not prepared to handle it.

This PR fixes the bug, and the above code now outputs:

The spacegroup '62' allows for multiple settings!
Returning a list of the possible crystals:
    1. "P n m a", setting="", with  8 atoms
    2. "P m n b", setting="ba-c", with 12 atoms
    3. "P b n m", setting="cab", with 12 atoms
    4. "P c m n", setting="-cba", with  8 atoms
    5. "P m c n", setting="bca", with 12 atoms
    6. "P n a m", setting="a-cb", with 12 atoms

Note: To disambiguate, you may pass a named parameter, setting="...".

This should make it easier to understand what's going on, and to select the desired crystal.