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

Dataset for trigonal spacegroups with multiple settings fails #189

Open
abehersan opened this issue Feb 26, 2024 · 2 comments
Open

Dataset for trigonal spacegroups with multiple settings fails #189

abehersan opened this issue Feb 26, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@abehersan
Copy link

Hi! First, off, thanks for the port to Julia! It is super useful for my research! (:

Describe the bug
For a crystal with trigonal spacegroup symmetry, Spglib fails to reshape the unit cell to accommodate the symmetry equivalent settings of the spacegroup. Case in point, the spacegroup 148 with setting 1. Hall number 436 according to https://yseto.net/sg/sg1

To Reproduce
Steps to reproduce the behavior:

  1. Start Julia REPL

  2. Run:

using Spglib
basis_v = [7 -3.5 0; 0 6.06218 0; 0 0 19]
positions = [[0.0, 0.0, 1/6]]
atoms = [1]
cell = Cell(basis_v, positions, atoms)
ds = get_dataset_with_hall_number(cell, 436, 1e-5)

Note: I have tried relaxing the symmetry precision parameter to no avail.

  1. See error ERROR: SpglibError: spacegroup search failed!

Expected behavior
The ds object should be consistent with what is expected for spacegroup 148 with the rhombohedral setting.

Versions (please complete the following information):

  • OS: Ubuntu 22.04 Jammy under WSL.
  • Julia version: 1.10.1
  • Spglib: v0.9.3
@abehersan abehersan added the bug Something isn't working label Feb 26, 2024
@singularitti
Copy link
Owner

singularitti commented Feb 26, 2024

Hi @abehersan, thank you for supporting this work!

For the question you are asking, I tested it with the official Python version of Spglib:

import spglib
import numpy as np

basis_v = np.array([[7, -3.5, 0], [0, 6.06218, 0], [0, 0, 19]]).T
positions = [[0.0, 0.0, 1/6]]
atoms = [1]
cell = (basis_v, positions, atoms)

>>> spglib.get_symmetry_dataset(cell, 1e-5)
{'number': 191,
 'hall_number': 485,
 'international': 'P6/mmm',
 'hall': '-P 6 2',
 'choice': '',
 'transformation_matrix': array([[1., 0., 0.],
        [0., 1., 0.],
        [0., 0., 1.]]),
 'origin_shift': array([0.        , 0.        , 0.83333333]),
 'rotations': array([[[ 1,  0,  0],
         [ 0,  1,  0],
         [ 0,  0,  1]],
 
        [[-1,  0,  0],
         [ 0, -1,  0],
         [ 0,  0, -1]],
 
        [[ 1, -1,  0],
         [ 1,  0,  0],
         [ 0,  0,  1]],
 
        [[-1,  1,  0],
         [-1,  0,  0],
         [ 0,  0, -1]],
 
        [[ 0, -1,  0],
         [ 1, -1,  0],
         [ 0,  0,  1]],
 
        [[ 0,  1,  0],
         [-1,  1,  0],
         [ 0,  0, -1]],
 
        [[-1,  0,  0],
         [ 0, -1,  0],
         [ 0,  0,  1]],
 
        [[ 1,  0,  0],
         [ 0,  1,  0],
         [ 0,  0, -1]],
 
        [[-1,  1,  0],
         [-1,  0,  0],
         [ 0,  0,  1]],
 
        [[ 1, -1,  0],
         [ 1,  0,  0],
         [ 0,  0, -1]],
 
        [[ 0,  1,  0],
         [-1,  1,  0],
         [ 0,  0,  1]],
 
        [[ 0, -1,  0],
         [ 1, -1,  0],
         [ 0,  0, -1]],
 
        [[ 0, -1,  0],
         [-1,  0,  0],
         [ 0,  0, -1]],
 
        [[ 0,  1,  0],
         [ 1,  0,  0],
         [ 0,  0,  1]],
 
        [[-1,  0,  0],
         [-1,  1,  0],
         [ 0,  0, -1]],
 
        [[ 1,  0,  0],
         [ 1, -1,  0],
         [ 0,  0,  1]],
 
        [[-1,  1,  0],
         [ 0,  1,  0],
         [ 0,  0, -1]],
 
        [[ 1, -1,  0],
         [ 0, -1,  0],
         [ 0,  0,  1]],
 
        [[ 0,  1,  0],
         [ 1,  0,  0],
         [ 0,  0, -1]],
 
        [[ 0, -1,  0],
         [-1,  0,  0],
         [ 0,  0,  1]],
 
        [[ 1,  0,  0],
         [ 1, -1,  0],
         [ 0,  0, -1]],
 
        [[-1,  0,  0],
         [-1,  1,  0],
         [ 0,  0,  1]],
 
        [[ 1, -1,  0],
         [ 0, -1,  0],
         [ 0,  0, -1]],
 
        [[-1,  1,  0],
         [ 0,  1,  0],
         [ 0,  0,  1]]], dtype=int32),
 'translations': array([[0.        , 0.        , 0.        ],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.        ],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.        ],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.        ],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.        ],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.        ],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.        ],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.        ],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.        ],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.        ],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.        ],
        [0.        , 0.        , 0.33333333],
        [0.        , 0.        , 0.        ]]),
 'wyckoffs': ['a'],
 'site_symmetry_symbols': ['6/mmm'],
 'crystallographic_orbits': array([0], dtype=int32),
 'equivalent_atoms': array([0], dtype=int32),
 'primitive_lattice': array([[ 7.     ,  0.     ,  0.     ],
        [-3.5    ,  6.06218,  0.     ],
        [ 0.     ,  0.     , 19.     ]]),
 'mapping_to_primitive': array([0], dtype=int32),
 'std_lattice': array([[ 7.00000094,  0.        ,  0.        ],
        [-3.50000047,  6.06217864,  0.        ],
        [ 0.        ,  0.        , 19.        ]]),
 'std_types': array([1], dtype=int32),
 'std_positions': array([[0., 0., 0.]]),
 'std_rotation_matrix': array([[1., 0., 0.],
        [0., 1., 0.],
        [0., 0., 1.]]),
 'std_mapping_to_primitive': array([0], dtype=int32),
 'pointgroup': '6/mmm'}

>>> basis_v
array([[ 7.     ,  0.     ,  0.     ],
       [-3.5    ,  6.06218,  0.     ],
       [ 0.     ,  0.     , 19.     ]])

It also seems to be 485/191. Is it possible the settings you gave is indeed 485/191? Could you double check? The convention is here: https://singularitti.github.io/Spglib.jl/dev/man/definitions/#Atomic-point-coordinates

@abehersan
Copy link
Author

Thanks for the reply! If I run get_dataset(cell) in Julia I get the same output as the Python implementation. It is not a problem of column vs. row basis vectors thankfully.

The 485/191 spacegroup is incompatible with the cell I try to model, which is 436/148 (trigonal with hexagonal axes chosen).

Ideally there would be some get_cell_from_hall_number() function that returns an uninitialized cell given the setting chosen.

Basically: I know a priori what the structure is -- lattice parameters, space group, atom positions and atom species --. I was aiming to use Spglib to generate the basis vectors and symmetry operations dynamically given the info I have.

Maybe you have a better idea of how this could be done given the current API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants