gap-packages / cryst

Computing with crystallographic groups
https://www.math.uni-bielefeld.de/~gaehler/gap/packages.php#Cryst
Other
3 stars 6 forks source link

Conjugation does not propagate translation into the Wyckoff positions #44

Closed bfield1 closed 10 months ago

bfield1 commented 1 year ago

Calculating Wyckoff positions for a crystallographic group causes those positions to be recorded with the group. When you conjugate (^) the group with an affine matrix, the Wyckoff positions are transformed and recorded with the new conjugated group. However, if the affine matrix represents a translation, then the translation components of the Wyckoff positions are not translated, even when they should be. This is illustrated in the following example code.

S := SpaceGroupIT(2,3);
# Consider a translation/origin shift, which should shift the Wyckoff positions
T := [[1,0,0],[0,1,0],[1/7,0,1]];
# If we calculate the Wyckoff positions of S before translating...
W := WyckoffPositions(S);
Display(W);
# ...then we translate it, the translation component is unchanged.
WT := WyckoffPositions(S^T);
Display(WT);
# This is in contradiction to what happens if we don't pre-calculate the Wyckoff positions
WT2 := WyckoffPositions(SpaceGroupIT(2,3)^T);
Display(WT2);

Which outputs

# Original
[ < Wyckoff position, point group 2, translation := [ 0, 0 ], 
    basis := [ [ 0, 1 ] ] >
    , < Wyckoff position, point group 2, translation := [ 1/2, 0 ], 
    basis := [ [ 0, 1 ] ] >
    , < Wyckoff position, point group 1, translation := [ 0, 0 ], 
    basis := [ [ 1, 0 ], [ 0, 1 ] ] >
     ]
# Wyckoff, conjugation of cached result
[ < Wyckoff position, point group 2, translation := [ 0, 0 ], 
    basis := [ [ 0, 1 ] ] >
    , < Wyckoff position, point group 2, translation := [ 1/2, 0 ], 
    basis := [ [ 0, 1 ] ] >
    , < Wyckoff position, point group 1, translation := [ 0, 0 ], 
    basis := [ [ 1, 0 ], [ 0, 1 ] ] >
     ]
# Wyckoff of conjugated group without cache
[ < Wyckoff position, point group 2, translation := [ 1/7, 0 ], 
    basis := [ [ 0, 1 ] ] >
    , < Wyckoff position, point group 2, translation := [ 9/14, 0 ], 
    basis := [ [ 0, 1 ] ] >
    , < Wyckoff position, point group 1, translation := [ 0, 0 ], 
    basis := [ [ 1, 0 ], [ 0, 1 ] ] >
     ]

I would expect the second Wyckoff group, the one which is cached, to be the same as the latter result.

This appears to be an issue in the following part of the code, where the translation component of the Wyckoff positions is only transformed by the linear part of the transformation and not its translation part. https://github.com/gap-packages/cryst/blob/fbf54fb5aaee274e88f8900415a082a1463f0220/gap/cryst.gi#L283-L295

bfield1 commented 1 year ago

We can modify the routines for conjugation in cryst.gi to fix this. A solution is to add a line which records the translation component. That would be either t := C [d+1]{[1..d]}; for RightAction or t := C {[1..d]}[d+1]; for LeftAction. Then, in recording the new Wyckoff position, we replace the translation entry with translation := w!.translation*c + t,.