Open abehersan opened 8 months ago
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
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?
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/sg1To Reproduce Steps to reproduce the behavior:
Start Julia REPL
Run:
Note: I have tried relaxing the symmetry precision parameter to no avail.
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):