qzhu2017 / PyXtal

A code to generate atomic structure with symmetry
MIT License
234 stars 59 forks source link

Incorrect output from pyxtal.symmetry.Wyckoff_position.get_all_positions() #230

Closed rees-c closed 10 months ago

rees-c commented 10 months ago

Hi, thanks for writing this package. I am trying to use pyxtal.symmetry.Wyckoff_position.get_all_positions() but am getting incorrect output. Below is the code snippet. I have installed pyxtal=0.5.1.

from pyxtal.symmetry import Group as PyxtalGroup
import numpy as np

space_group_number = 225
asu_frac_coord = np.array([0.1058, 0.0773, 0.0000])
wyckoff_letter = 'j'
pyxtal_space_group = PyxtalGroup(space_group_number, style='spglib')
wyckoff_position = pyxtal_space_group[wyckoff_letter]
orbit = wyckoff_position.get_all_positions(asu_frac_coord)
print(wyckoff_position)
print(orbit)

Output:

Wyckoff position 96j in space group 225 with site symmetry m . .
0, y, z
0, -y, z
0, y, -z
0, -y, -z
z, 0, y
z, 0, -y
-z, 0, y
-z, 0, -y
y, z, 0
...
[[0.  0.  0. ]
 [0.  0.  0. ]
 [0.  0.  0. ]
 [0.  0.  0. ]
 [0.  0.  0. ]
 [0.  0.  0. ]
 [0.  0.  0. ]
 [0.  0.  0. ]
 [0.  0.  0. ]
 [0.  0.  0. ]
...]

Expected output:

Wyckoff position 96j in space group 225 with site symmetry m . .
0, y, z
0, -y, z
0, y, -z
0, -y, -z
z, 0, y
z, 0, -y
-z, 0, y
-z, 0, -y
y, z, 0
...
[[0.  0.1058  0.0773 ]
 [0.  -0.1058  0.0773 ]
 [0.  0.1058  -0.0773 ]
 [0.  -0.1058  -0.0773 ]
 [0.0773  0.  0.1058 ]
 [0.0773  0.  -0.1058 ]
 [-0.0773  0.  0.1058 ]
 [-0.0773  0.  -0.1058 ]
 [0.1058  0.0773  0. ]
...]

I have not verified every space group/Wyckoff position, so I don't know what other cases might exist. Any help on fixing this would be greatly appreciated.

qzhu2017 commented 10 months ago

@rees-c Thanks for your interest in PyXtal. You may try the following code

from pyxtal.symmetry import Group
g = Group(225)
wp = g[2] # letter 'j'
generator = wp.search_generator([0.1058, 0.0773, 0.0000])
wp.get_all_positions(generator)

For the special wyckoff site, you are recommended to find the generator first and then get all positions.

rees-c commented 10 months ago

Thanks @qzhu2017 , that seems to work. What is the recommended method for orbiting a general position?

qzhu2017 commented 10 months ago

@rees-c For general position, any position can be the generator. So you previous code should be fine.

rees-c commented 10 months ago

Got it, thanks very much!