@@ -190,7 +190,7 @@ way as to ensure that the sampling is uniform over the joint
190190interval [-1/`lims[1]`, -1] ∪ [1, `lims[2]`].
191191
192192This is useful for ensuring an even sampling of numbers that are
193- either smaller or larger than unity. Eg . for `x = relrand((0.2,5.0))`,
193+ either smaller or larger than unity. E.g . for `x = relrand((0.2,5.0))`,
194194`x` is equally probable to fall in inv(`x`)∈[1,5] or `x`∈[1,5].
195195"""
196196function relrand (lims:: NTuple{2,<:Real} )
@@ -312,18 +312,22 @@ const CRYSTALSYSTEM_ABBREV = (ImmutableDict("linear"=>'l'),
312312"""
313313 $(TYPEDSIGNATURES)
314314
315- Return the Bravais type of `sgnum` in dimension `dim ` as a string (as the concatenation
315+ Return the Bravais type of `sgnum` in dimension `D ` as a string (as the concatenation
316316of the single-character crystal abbreviation and the centering type).
317317
318- ## Note
318+ ## Keyword arguments
319319
320- If the centering type associated with `sgnum` is `'A'`, we chose to "normalize" the
321- centering to `'C'`, since the difference between `A` and `C` centering only amounts to a
322- basis change. This ensures that `unique(bravaistype.(1:230, 3))` creates only 14 Bravais
323- types, rather than 15.
324- This impacts space groups 38-41, whose Bravais types are normalized from `oA` to `oC`.
320+ If the centering type associated with `sgnum` is `'A'`, we can choose (depending on the
321+ keyword argument `normalize`, defaulting to `false`) to "normalize" to the centering type
322+ `'C'`, since the difference between `A` and `C` centering only amounts to a basis change.
323+ With `normalize=true` we then have only the canonical 14 Bravais type, i.e.
324+ `unique(bravaistype.(1:230, 3), normalize=true)` returns only 14 distinct types, rather
325+ than 15.
326+
327+ This only affects space groups 38-41 (normalizing their conventional Bravais types from
328+ `oA` to `oC`).
325329"""
326- @inline function bravaistype (sgnum:: Integer , D:: Integer = 3 )
330+ @inline function bravaistype (sgnum:: Integer , D:: Integer = 3 ; normalize :: Bool = false )
327331 cntr = centering (sgnum, D)
328332 system = crystalsystem (sgnum, D)
329333
@@ -333,10 +337,9 @@ This impacts space groups 38-41, whose Bravais types are normalized from `oA` to
333337 # the same Bravais lattice; there is no significance in trying to
334338 # differentiate them - if we do, we end up with 15 Bravais lattices in
335339 # 3D rather than 14: so we manually fix that here:
336- if cntr == ' A '
337- println (sgnum)
340+ if normalize
341+ cntr = cntr == ' A ' ? ' C ' : cntr
338342 end
339- cntr = cntr == ' A' ? ' C' : cntr
340343
341344 # pick the correct crystal system abbreviation from CRYSTALSYSTEM_ABBREV
342345 # and return its concatenation with the (now-"normalized") centering type
0 commit comments