Stianpr20 / MaXrd

Symmetry data and utilities related to crystallography and X-ray scattering
MIT License
24 stars 3 forks source link

ToStandardSetting[] issue with "R-3" point group #7

Open sgbaird opened 3 years ago

sgbaird commented 3 years ago
group = "R-3";
ToStandardSetting[group, #] & /@ ReflectionList@4

> {{0, 0, 1}, {0, 1, 0}, {0, 1, 0}, {0, 0, 1}, {0, 1, 0}, {0, 1, 0}, {0,
>    0, 2}, {0, 1, 1}, {0, 2, 0}, {1, 0, 1}, {1, 1, 0}, {0, 2, 0}, {0, 
>   0, 2}, {1, 0, 1}, {0, 1, 1}, {0, 2, 0}, {1, 0, 1}, {0, 1, 0}, {0, 1,
>    1}, {0, 2, 0}, {0, 1, 1}, {0, 1, 0}, {1, 0, 1}, {1, 1, 0}, {0, 0, 
>   3}, {0, 1, 2}, {0, 2, 1}, {0, 3, 0}, {1, 0, 2}, {1, 1, 1}, {1, 2, 
>   0}, {2, 0, 1}, {2, 1, 0}, {0, 3, 0}, {0, 0, 3}, {1, 0, 2}, {2, 0, 
>   1}, {0, 1, 2}, {-1, 2, 1}, {0, 2, 1}, {0, 3, 0}, {2, 0, 1}, {1, 0, 
>   2}, {1, 1, 0}, {0, 1, 1}, {1, 1, 0}, {0, 2, 1}, {0, 1, 2}, {1, 0, 
> ...
>    1, 4}, {4, 0, 3}, {-3, 4, 4}, {-1, 4, 4}, {0, 4, 3}, {1, 3, 
>   4}, {-4, 8, 3}, {-3, 7, 4}, {-4, 7, 4}, {4, 4, 3}, {4, 3, 4}, {3, 4,
>    4}, {4, 4, 4}, {-4, 8, 4}, {0, 4, 4}, {4, 0, 4}, {4, 0, 4}, {0, 4, 
>   4}, {-4, 8, 4}, {4, 4, 4}}

Notice all the indices that are greater than the max HKL index. I assume this is an error? I'm getting occasional errors in my code (which builds off of MaXrd) due to size mismatches and I think the issue stems from this.

sgbaird commented 3 years ago

Seems like maybe one of three places:

sgbaird commented 3 years ago

Not sure if this is helpful, but from another source, I'm seeing these as the rotation symmetry operators for "R-3":

ans =

     1     0     0
     0     1     0
     0     0     1

ans =

   -0.5000   -0.8660         0
    0.8660   -0.5000         0
         0         0    1.0000

ans =

   -0.5000    0.8660         0
   -0.8660   -0.5000         0
         0         0    1.0000
Stianpr20 commented 3 years ago

I believe we have an incomplete implementation of the reflection conditions in the package. What technically happens with for instance space group R-3 and reflection {-4, -4, 4} is that {-4, 8, 4} is chosen as the representative, which is generated from the second symmetry operation listed in the International Tables, vol. A of this space group ({-y, x-y, z}).

However, on the same page in ITA (using hexagonal axes), general reflection conditions are listed, and we can see that this example fails the first «obverse» condition, since -h + k + l ≠ 3n.

Such conditions for general and special reflections have not been included in $SpaceGroup(which they should). I also think ReflectionList should be able to make use of these conditions afterwards.

In the meantime, perhaps you can specify the rhombohedral version instead with R-3:r, which has no extra conditions to consider.

sgbaird commented 3 years ago

Do you know of a good way to probe which point groups are lacking these conditions? Part of me is a bit hesitant to specify a crystal symmetry other than the one listed - I'm operating on a large database of materials which have a variety of crystal structures. Happy to work with you in implementing it if it's just a matter of including extra condition checks like the one you mentioned.

Stianpr20 commented 3 years ago

I do not know how check them programatically, but chapter «1.6.4. Tables of reflection conditions and possible space groups» in the 2016 edition of International Tables for Crystallography, volume A seems to contain them all.

Implementing this is long overdue, and I will start on it tomorrow. Feel free to work on it yourself, of course! I think I will add them manually for each entry in $SpaceGroups, then make use of them in the relevant functions somehow.

sgbaird commented 3 years ago

Thank you! That would be really helpful.

Stianpr20 commented 3 years ago

I have now made some changes in the function SystematicAbsentQ so that it can take reflection conditions for atoms in special positions into account.

I am in the process of storing those conditions in the "SpecialPositions" tables. At the moment, I have done eight space groups, so it only works correctly with them. See the attached notebook.

ReflectionConditionsStart.nb.zip

Stianpr20 commented 3 years ago

The latest commit updates $SpaceGroups with reflection conditions for all the «main entires» as well as the alternative entries listed in the International Tables.

Thus, all «crystals» will now be checked for any atoms occupying special positions which can extinguish certain reflections. For example,

SystematicAbsentQ["Fd-3m:2", {2, 2, 2}] (* False *)
SystematicAbsentQ["Silicon", {2, 2, 2}] (* True *)

will yield different answers even though «Silicon» is stored with that space group, because the atom is in Wyckoff position «8a» (origin choice 2), which requires the digit sum of the indices to be divisible by four, unless h is odd .

To go back to your opening comment, this is how I would make a list of «valid» reflections:

group = "R-3";
hkl = ReflectionList@4;
absentQ = SystematicAbsentQ[group, hkl];
validReflections = Pick[hkl, absentQ, False];
reflections = ToStandardSetting[group, #] & /@ validReflections;
reflections = DeleteDuplicates@reflections
sgbaird commented 2 years ago

It's taken me a while to get back to my project which depends on MaXrd and uses this functionality. I just tried with the latest commit (1dbec6688327):

group = "R-3";
hkl = ReflectionList@4;
absentQ = SystematicAbsentQ[group, hkl];
validReflections = Pick[hkl, absentQ, False];
reflections = ToStandardSetting[group, #] & /@ validReflections;
reflections = DeleteDuplicates@reflections
{{1, 0, 1}, {1, 1, 0}, {0, 0, 3}, {0, 1, 2}, {0, 2, 1}, {0, 3, 0}, {2,
   0, 2}, {2, 1, 1}, {2, 2, 0}, {-2, 3, 1}, {1, 0, 4}, {1, 1, 3}, {1, 
  2, 2}, {1, 3, 1}, {1, 4, 0}, {4, 0, 1}, {4, 1, 0}, {-1, 2, 3}, {-1, 
  3, 2}, {-1, 4, 1}, {0, 2, 4}, {0, 3, 3}, {0, 4, 2}, {3, 0, 3}, {3, 
  1, 2}, {3, 2, 1}, {3, 3, 0}, {-3, 4, 2}, {-3, 5, 1}, {2, 1, 4}, {2, 
  2, 3}, {2, 3, 2}, {2, 4, 1}, {-2, 3, 4}, {-2, 4, 3}, {-2, 5, 
  2}, {-2, 6, 1}, {1, 3, 4}, {1, 4, 3}, {4, 0, 4}, {4, 1, 3}, {4, 2, 
  2}, {4, 3, 1}, {4, 4, 0}, {-4, 5, 3}, {-4, 6, 2}, {-1, 4, 4}, {-4, 
  7, 1}, {-1, 5, 3}, {3, 2, 4}, {3, 3, 3}, {3, 4, 2}, {-3, 5, 4}, {-3,
   6, 3}, {-3, 7, 2}, {2, 4, 4}, {-2, 6, 4}, {4, 3, 4}, {4, 4, 
  3}, {-4, 7, 4}, {-4, 8, 3}}

Also:

MergeSymmetryEquivalentReflections[group, reflections]
{{1, 0, 1}, {1, 1, 0}, {0, 0, 3}, {0, 1, 2}, {0, 2, 1}, {0, 3, 0}, {2,
   0, 2}, {2, 1, 1}, {2, 2, 0}, {-2, 3, 1}, {1, 0, 4}, {1, 1, 3}, {1, 
  2, 2}, {1, 3, 1}, {1, 4, 0}, {4, 0, 1}, {4, 1, 0}, {-1, 2, 3}, {-1, 
  3, 2}, {-1, 4, 1}, {0, 2, 4}, {0, 3, 3}, {0, 4, 2}, {3, 0, 3}, {3, 
  1, 2}, {3, 2, 1}, {3, 3, 0}, {-3, 4, 2}, {-3, 5, 1}, {2, 1, 4}, {2, 
  2, 3}, {2, 3, 2}, {2, 4, 1}, {-2, 3, 4}, {-2, 4, 3}, {-2, 5, 
  2}, {-2, 6, 1}, {1, 3, 4}, {1, 4, 3}, {4, 0, 4}, {4, 1, 3}, {4, 2, 
  2}, {4, 3, 1}, {4, 4, 0}, {-4, 5, 3}, {-4, 6, 2}, {-1, 4, 4}, {-4, 
  7, 1}, {-1, 5, 3}, {3, 2, 4}, {3, 3, 3}, {3, 4, 2}, {-3, 5, 4}, {-3,
   6, 3}, {-3, 7, 2}, {2, 4, 4}, {-2, 6, 4}, {4, 3, 4}, {4, 4, 
  3}, {-4, 7, 4}, {-4, 8, 3}}

I'm still seeing indices greater than the max HKL specified. Is this the same output that you get?

sgbaird commented 2 years ago

I don't know if this is helpful, but I also have the CIF files for the various structures of interest.

Stianpr20 commented 2 years ago

Yes, I get the same output.

Perhaps you want to use:

MergeSymmetryEquivalentReflections[group, validReflections, 
 "ToStandardSetting" -> False]

to disable the automatic conversion to other symmetry equivalent reflections (ToStandardSetting). Then the output should change to:

{{1, 0, 1}, {1, 1, 0}, {0, 0, 3}, {0, 1, 2}, {0, 2, 1}, {0, 3, 0}, {2,
   0, 2}, {2, 1, 1}, {2, 2, 0}, {1, 2, -1}, {1, 0, 4}, {1, 1, 3}, {1, 
  2, 2}, {1, 3, 1}, {1, 4, 0}, {4, 0, 1}, {4, 1, 0}, {1, 1, -3}, {2, 
  1, -2}, {3, 1, -1}, {0, 2, 4}, {0, 3, 3}, {0, 4, 2}, {3, 0, 3}, {3, 
  1, 2}, {3, 2, 1}, {3, 3, 0}, {1, 3, -2}, {2, 3, -1}, {2, 1, 4}, {2, 
  2, 3}, {2, 3, 2}, {2, 4, 1}, {1, 2, -4}, {2, 2, -3}, {3, 2, -2}, {4,
   2, -1}, {1, 3, 4}, {1, 4, 3}, {4, 0, 4}, {4, 1, 3}, {4, 2, 2}, {4, 
  3, 1}, {4, 4, 0}, {1, 4, -3}, {2, 4, -2}, {3, 1, -4}, {3, 
  4, -1}, {4, 1, -3}, {3, 2, 4}, {3, 3, 3}, {3, 4, 2}, {2, 3, -4}, {3,
   3, -3}, {4, 3, -2}, {2, 4, 4}, {4, 2, -4}, {4, 3, 4}, {4, 4, 
  3}, {3, 4, -4}, {4, 4, -3}}