cctbx / cctbx_project

Computational Crystallography Toolbox
https://cci.lbl.gov/docs/cctbx
Other
218 stars 116 forks source link

Spacegroup generators #968

Closed spc93 closed 7 months ago

spc93 commented 7 months ago

Does anyone know if it is possible to obtain a set of generators for a spacegroup in cctbx, along the lines of the 'Generators selected' entry in the International Tables? Thanks!

Baharis commented 7 months ago

I would also love to know. I was trying to find it some time ago, but got lost in C++ at the time.

bkpoon commented 7 months ago

Is there an example of the output that you want to see?

spc93 commented 7 months ago

Hi, Thanks for replying! There are lots of ways to do this but one might be to get a list of spacegroup operators (e.g. in the form of general positions xyz) (see below) and provide a set of indices of operators in the list that can be used as group generators. Ideally this would be consistent with the International Tables but probably not necessary.

Perhaps: sgi.generators_selected() would return [0, 16, 1, 2, 4, 8] or something that is actually a set of generators.

import cctbx.sgtbx as sg sgNum = 142

sgi = sg.space_group_info(sgNum) spaceGroup = sgi.group() symxyz = [str(s.as_xyz()) for s in spaceGroup.all_ops()]

['x,y,z', '-y+1/4,x+3/4,z+1/4', 'y+1/4,-x+1/4,z+3/4', 'x,-y,-z+1/2', '-x+1/2,y,-z', '-x,-y+1/2,z', 'y+1/4,x+3/4,-z+3/4', '-y+1/4,-x+1/4,-z+1/4', '-x,-y,-z', 'y-1/4,-x-3/4,-z-1/4', '-y-1/4,x-1/4,-z-3/4', '-x,y,z-1/2', 'x-1/2,-y,z', 'x,y-1/2,-z', '-y-1/4,-x-3/4,z-3/4', 'y-1/4,x-1/4,z-1/4', 'x+1/2,y+1/2,z+1/2', '-y+3/4,x+5/4,z+3/4', 'y+3/4,-x+3/4,z+5/4', 'x+1/2,-y+1/2,-z+1', '-x+1,y+1/2,-z+1/2', '-x+1/2,-y+1,z+1/2', 'y+3/4,x+5/4,-z+5/4', '-y+3/4,-x+3/4,-z+3/4', '-x+1/2,-y+1/2,-z+1/2', 'y+1/4,-x-1/4,-z+1/4', '-y+1/4,x+1/4,-z-1/4', '-x+1/2,y+1/2,z', 'x,-y+1/2,z+1/2', 'x+1/2,y,-z+1/2', '-y+1/4,-x-1/4,z-1/4', 'y+1/4,x+1/4,z+1/4']

Baharis commented 7 months ago

@spc93 I took your question today and came to some interesting conclusions. Firstly, I found the function that yields "the generators". For space group #142 (I41/acd) this would be:

[g.as_xyz() for g in sgtbx.space_group_info('I41/acd').any_generator_set().non_primitive_generators]

This returns the following generators:

This already does not align with the ITC table, which does not list 21. I guess from the name "any generator set" we could not really expect consistency with ITC. Additionally, ITC A lists the following generators (taken from Bilbao server):

ITC does not explicitly list as a numbered symmetry operation, but Bilbao does:

So this function does not return translation generators. In other words, it does not return all mathematically necessary operations to produce the full infinite space group. Rather, it returns the smallest possible set of generator operations that are not pure translations which can be used to re-generate space group after you add translation operations based on the lattice yourself. So for the full set take into account translations i.e. standard unit lattice translation along x, y, and z, as well as centering translations. If you're fine with this then this approach will give you a full set of generators, albeit different one than suggested by the non-minimal ITC suggestion.

spc93 commented 7 months ago

Ah brilliant! I'll look at this in more detail. I agree there is no reason for consistency with ITC as the choice is arbitrary. It would be good to include the centring translations, although it would not be hard to get these from the full group. Thanks!

Baharis commented 7 months ago

Personally, I am a bit disappointed that I still don't fully understand how the groups are created, but I think I've got a fairly good idea of where to look now. I'll close this issue for the time being since it looks like the question is anwsered; @spc93 feel free to reopen it if you have any further questions, comments, or suggestions!

spc93 commented 7 months ago

I think this gives me what I need, although including the centring translations would be ideal. Creating the full groups is then very easy as each generator forms a small group. Multiplying out these groups forms the complete group. There is then no need to go through every permutation to make sure the group is complete. My interest is in symmetry properties, which can be calculated from the generators rather than the full group. Thanks @Baharis for your help!