MaterSim / PyXtal

A code to generate atomic structure with symmetry
MIT License
246 stars 65 forks source link

pyxtal().from_random fails to generate a crystal from Materials Project #235

Closed kazeevn closed 10 months ago

kazeevn commented 11 months ago

Hello! I'm trying to generate a crystal according to the following Materials Project entry: Nd(Al2Cu)4, space group I4/mmm [139]. However, PyXtal declares the space group and composition incomparable:

my_crystal = pyxtal()
my_crystal.from_random(dim=3, group="I4/mmm", species=['Nd', 'Al', 'Cu'], numIons=[1, 8, 4])
...
Comp_CompatibilityError: Compoisition [1 8 4] not compatible with symmetry 139

I've also tried to pass the sites:

sites = [
        {'1a': [0., 0., 0.]},
        {'4j': [0.721222, 0.778778, 0.778778],
        '4i': [0.34894, 0.65106, 0.65106]},
        {'4f': [0.5, 0.5, 0. ]}
]
my_crystal.from_random(dim=3, group="I4/mmm", species=['Nd', 'Al', 'Cu'], numIons=[1, 8, 4], sites=sites)

It didn't help with a similar message. Is there some nuance in PyXtal's definition of symmetries I'm not aware of? Any advice would be much appreciated!

PyXtal version is 0.6.1

kazeevn commented 11 months ago

Here is an experiment. I doubled the number of atoms, and PyXtal successfully generated the structure Nd2Cu16Al8. Then I used pymatgen to get the primitive cell, and it returned Nd1Cu8Al4:

my_crystal = pyxtal()
my_crystal.from_random(dim=3, group="I4/mmm", species=['Nd', 'Al', 'Cu'], numIons=[2, 16, 8])
my_crystal_pymatgen = my_crystal.to_pymatgen()
analyzer = SpacegroupAnalyzer(my_crystal_pymatgen)
analyzer.get_symmetrized_structure()
SymmetrizedStructure
Full Formula (Nd2 Al16 Cu8)
Reduced Formula: Nd(Al2Cu)4
Spacegroup: I4/mmm (139)
abc   :   6.471440   6.471440  11.870218
angles:  90.000000  90.000000  90.000000
Sites (26)
  #  SP           a         b          c  Wyckoff
---  ----  --------  --------  ---------  ---------
  0  Al    0         0.5       -0         4c
  1  Al    0         0          0.149988  4e
  2  Al    0.25      0.25       0.25      8f
  3  Cu    0.668589  0.668589  -0         8h
  4  Nd    0         0          0         2a

Naively this suggests that there is no substantial disagreement between the libraries (good!), just some convention difference.

qzhu2017 commented 10 months ago

Thanks. It is difference between Primitive unit cell and I/A/B/C/F centered cell.