-
Notifications
You must be signed in to change notification settings - Fork 69
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
space group #171
Comments
@pcpatfire import ase
NaCl_ase = ase.Atoms(
symbols=['Na', 'Na', 'Na', 'Na', 'Cl', 'Cl', 'Cl', 'Cl'],
cell=[
(5.62, 0, 0),
( 0, 5.62, 0),
( 0, 0, 5.62)],
scaled_positions=[
(0.000000, 0.000000, 0.000000),
(0.000000, 0.500000, 0.500000),
(0.500000, 0.000000, 0.500000),
(0.500000, 0.500000, 0.000000),
(0.500000, 0.500000, 0.500000),
(0.500000, 0.000000, 0.000000),
(0.000000, 0.500000, 0.000000),
(0.000000, 0.000000, 0.500000)],
pbc=True)
print(NaCl_ase)
NaCl_ase = ase.Atoms(
symbols=['Na', 'Cl'],
cell=[
(5.62, 0, 0),
( 0, 5.62, 0),
( 0, 0, 5.62) ],
scaled_positions=[
(0.000000, 0.000000, 0.000000),
(0.000000, 0.500000, 0.500000)],
pbc=True)
print(NaCl_ase) They correspond to two different structures. You probably need to do something when you call
|
Of course the two structures are different. The first one, with all the atoms and their positions, has a P1 space group. The second one needs a space group to be explicitely specified to apply the proper symmetry operations, otherwise there is no way, with such a basic cell, to identify automatically the space group by ase (or any other software). |
Well, PyXtal is not really designed for that. That said, below is a possible solution to work around: >>> from pyxtal import pyxtal
>>> from pyxtal.lattice import Lattice
>>> c = pyxtal()
>>> l = Lattice.from_para(5.62, 5.62, 5.62, 90, 90, 90, l_type='cubic')
>>> c.from_random(3, 225, ['Na', 'Cl'], [4,4], lattice=l, sites=[["4a"], ["4b"]])
>>> c
------Crystal from random------
Dimension: 3
Composition: Cl4Na4
Group: Fm-3m (225)
triclinic lattice: 5.6200 5.6200 5.6200 90.0000 90.0000 90.0000
Wyckoff sites:
Na @ [ 0.0000 0.0000 0.0000], WP [4a] Site [4/m-32/m]
Cl @ [ 0.5000 0.5000 0.5000], WP [4b] Site [4/m-32/m]
>>> xrd=c.get_XRD(thetas=(1,90)) In future, I will probably change |
Thanks for your answer. It's an interesting work around. In my app I have a P1-like description of the crystal (atoms and their positions - I am using a diffy.structure |
What do you mean by basic_cell? Do you mean the primitive cell? If you input a P1 ASE structure, pyxtal will automatically detect the symmetry and standardize the cell according to the symmetry if you use |
Yes, I mean the primitive cell. I was already using this method too (see my first example). Is there a way to 're-set' the space group manually in pyxtal, after the |
When you reset the space group from P1 to Fm-3m, you also increase the number of atoms by 4 times. This doesn't seem like a reasonable structure manipulation. I don't understand why you need this function. Maybe you can explain a bit more about your motivation. |
If you start from the primitive cell when you reset the space group you don't multiply the atoms.
|
Can you give a concrete example in which the symmetry detection does not work well?
Setting an arbitrary space group symmetry for a primitive cell can be very tricky! |
I have a real case in which the automatic detection seems not working. I derived an ase P1 structure from the CIF file of a calcite (taken from COD database, COD #1010962).
This is the corresponding ase
When I call the
The problem is that the CIF does not contain the usual definition of the structure, as it can be found, for instance, in a calcite from the American Mineralogist database (code 0008879):
Here the lattice is defined in the usual way, with
In this case the One note concerning your 'work around' to solve my problem. As you said you would change the
allowing to avoid the use of the Wyckoff positions, and making it possible to set no random numbers for the Wyckoff positions defined as (x,0,0), for instance, where the Last note is about the fact that in some cases, if the structure can have different origins and the space group is non-standard, it is changed to the standard one without any warning. I don't know if it possible to warn the user in some ways, but it would be useful. Sorry for this long comment and thanks for your help. |
@pcpatfire check #172 first. I will probably deal with your other issues later. |
Ok. Thanks |
Why don't you just download the cif file and load it from pyxtal? >>> from pyxtal import pyxtal
>>> c = pyxtal()
>>> c.from_seed('1010962.cif')
>>> c
------Crystal from Seed------
Dimension: 3
Composition: C6O18Ca6
Group: R-3c (167)
hexagonal lattice: 4.9803 4.9803 17.0187 90.0000 90.0000 120.0000
Wyckoff sites:
Ca @ [ 0.0000 0.0000 0.0000], WP [6b] Site [-3..]
C @ [ 0.0000 0.0000 0.2500], WP [6a] Site [32.]
O @ [ 0.7500 0.0000 0.2500], WP [18e] Site [.2.]
>>> ase_obj = c.to_ase()
>>> ase_obj
Atoms(symbols='C6O18Ca6', pbc=True, cell=[[4.3130801187158605, -2.490157967577024, 3.049563984364482e-16], [0.0, 4.980315935154049, 3.049563984364482e-16], [0.0, 0.0, 17.01868853813807]]) |
Based on your description, I think you can directly call our XRD module with the ASE-P1 structure. There is no need to transform it to the PyXtal object. PyXtal object is really designed for symmetry analysis. from pyxtal.XRD import XRD
import ase
NaCl_ase = ase.Atoms(
symbols=['Na', 'Na', 'Na', 'Na', 'Cl', 'Cl', 'Cl', 'Cl'],
cell=[
(5.62, 0, 0),
( 0, 5.62, 0),
( 0, 0, 5.62)],
scaled_positions=[
(0.000000, 0.000000, 0.000000),
(0.000000, 0.500000, 0.500000),
(0.500000, 0.000000, 0.500000),
(0.500000, 0.500000, 0.000000),
(0.500000, 0.500000, 0.500000),
(0.500000, 0.000000, 0.000000),
(0.000000, 0.500000, 0.000000),
(0.000000, 0.000000, 0.500000)],
pbc=True)
myxrd = XRD(NaCl_ase, thetas=[0,90])
print(myxrd.pxrd) |
Yes, it is a possibility, but for the calcite from COD I can't recreate the original group and cell. If pyxtal is designed for symmetry analysis, why in the case of the calcite from the American Mineralogist database it can find the space group, while it raises an error with the one from COD? Maybe for the "strange" structures it is needed to take into account more information. It is the same problem with the structures that have more than one possible description - one of my other issues - as for instance some structures with space group 62. In this case, if I load the olivine cif with COD number 1011090 (space group # 62, Pbnm):
pyxtal transforms the space group into # 62, Pnma, which is the same group with modified lattice axis: a->c, c->b, b->a:
It is another possible description of the same crystal (the volume and the xrd pattern are the same). Why not ask the user the "preferred" one? |
A crystal structure can have multiple representations. For the 2nd structure, there exist 530 settings for the entire 230 space groups. It is possible to describe the structure with the customized setting, however, this will require some extra work. I still don't understand why you care about the change of setting (if the structure does not change). If you really want this feature, I encourage you to implement it by yourself. PyXtal is an open source code. I am trying to make it easier to let newcomers join the development. |
Ok. Thanks |
I am trying to use your library to calculate the XRD pattern of crystal structure.
I am entering the basic cell using ase, as for instance:
Then I calculate the xrd pattern using:
And everything works just fine and the xrd pattern looks correct.
The problem is when I want to use the basic crystal cell defined as:
In this case I should be able to add the correct spacegroup number (225) to
struc
, otherwise the xrd pattern is not correct.Is it correct to use
struc.group = Group(225)
?I tried, but the xrd calculation does not seem to take into account the space group number I was setting. Is there a way to make it working?
Thanks
The text was updated successfully, but these errors were encountered: