Skip to content

Commit b15df58

Browse files
committed
also load generators via reference to ROTATIONS_... and TRANSLATIONS_...
1 parent b654a84 commit b15df58

File tree

949 files changed

+1177
-277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

949 files changed

+1177
-277
lines changed

build/crawl_and_write_generators_pgs.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ let D = 3
5959
gens_str = crawl_pg_generators_xyzt(pgnum, D, pgiuc)
6060
end
6161

62-
unmangled_pgiuc = Crystalline.unmangle_pgiuclab(pgiuc)
62+
unmangled_pgiuc = Crystalline._unmangle_pgiuclab(pgiuc)
6363
filename = (@__DIR__)*"/../data/generators/pgs/$(D)d/$(unmangled_pgiuc).csv"
6464
open(filename; write=true, create=true, truncate=true) do io
6565
first = true
@@ -85,7 +85,7 @@ let D = 2
8585
for (pgnum, pgiuc) in enumerate(Crystalline.PG_IUCs[D])
8686
gens_str = crawl_pg_generators_xyzt(pgnum, D)
8787

88-
unmangled_pgiuc = Crystalline.unmangle_pgiuclab(pgiuc)
88+
unmangled_pgiuc = Crystalline._unmangle_pgiuclab(pgiuc)
8989
filename = (@__DIR__)*"/../data/generators/pgs/$(D)d/$(unmangled_pgiuc).csv"
9090
open(filename; write=true, create=true, truncate=true) do io
9191
first = true

build/crawl_and_write_pgs.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function __crawl_and_write_3d_pgirreps()
183183
# "test/data/xyzt-operations/pgs/..."; note that we explicitly checked the
184184
# sorting and # equivalence of operations when pgirs was crawled above (cf. flag
185185
# `consistency_checks=true`)
186-
unmangled_pgiuc = Crystalline.unmangle_pgiuclab(pgiuc) # replace '/'s by '_slash_'s
186+
unmangled_pgiuc = Crystalline._unmangle_pgiuclab(pgiuc) # replace '/'s by '_slash_'s
187187
irreps_file[unmangled_pgiuc*"/matrices"] = matrices
188188
irreps_file[unmangled_pgiuc*"/realities"] = Integer.(realities)
189189
irreps_file[unmangled_pgiuc*"/cdmls"] = cdmls

data/misc/ISOTROPY/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ISOTROPY ISO-IR dataset
2-
These file `CIR_data.txt` and `PIR_data.txt` are sourced from the
2+
The files `CIR_data.txt` and `PIR_data.txt` are sourced from the
33
[ISOTROPY software's ISO-IR dataset](https://stokes.byu.edu/iso/irtables.php)
44
and contain data needed to generate *space group* irreps.
55
In ISOTROPY, the data files are extracted in Fortran using associated files

src/Crystalline.jl

+20-13
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ export SymOperation, # types
5858
SpaceGroup, PointGroup, LittleGroup,
5959
CharacterTable,
6060
# operations on ...
61-
matrix, xyzt, # ::SymOperation
62-
getindex, rotation, translation,
63-
issymmorph,
61+
matrix, xyzt, # ::AbstractOperation
62+
rotation, translation,
63+
issymmorph, # ::SymOperation
6464
num, order, operations, # ::AbstractGroup
6565
klabel, characters, # ::AbstractIrrep
6666
classcharacters,
@@ -83,16 +83,24 @@ include("magnetic/types.jl")
8383
export MSymOperation, MSpaceGroup
8484

8585
include("tables/rotation_translation.jl")
86-
include("tables/pointgroup.jl")
87-
include("tables/spacegroup.jl")
88-
include("tables/subperiodicgroup.jl")
89-
include("tables/mspacegroup.jl")
86+
include("tables/groups/pointgroup.jl")
87+
include("tables/groups/spacegroup.jl")
88+
include("tables/groups/subperiodicgroup.jl")
89+
include("tables/groups/mspacegroup.jl")
90+
include("tables/generators/pointgroup.jl")
91+
include("tables/generators/spacegroup.jl")
92+
include("tables/generators/subperiodicgroup.jl")
93+
94+
include("assembly/groups/pointgroup.jl")
95+
include("assembly/groups/spacegroup.jl")
96+
include("assembly/groups/subperiodicgroup.jl")
97+
include("assembly/groups/mspacegroup.jl")
9098
export pointgroup, spacegroup, subperiodicgroup, mspacegroup
9199

92-
include("group-assembly/assemble_pointgroup.jl")
93-
include("group-assembly/assemble_spacegroup.jl")
94-
include("group-assembly/assemble_subperiodicgroup.jl")
95-
include("group-assembly/assemble_mspacegroup.jl")
100+
include("assembly/generators/pointgroup.jl")
101+
include("assembly/generators/spacegroup.jl")
102+
include("assembly/generators/subperiodicgroup.jl")
103+
export generate, generators
96104

97105
include("show.jl") # custom printing for structs defined in src/types.jl
98106

@@ -102,8 +110,7 @@ include("symops.jl") # symmetry operations for space, plane, and line groups
102110
export @S_str, compose,
103111
issymmorph, littlegroup, orbit,
104112
reduce_ops,
105-
issubgroup, isnormal,
106-
generate, generators
113+
issubgroup, isnormal
107114

108115
include("conjugacy.jl") # construction of conjugacy classes
109116
export classes, is_abelian

src/assembly/generators/pointgroup.jl

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function generators(iuclab::String, ::Type{PointGroup{D}}=PointGroup{3}) where D
2+
@boundscheck _check_valid_pointgroup_label(iuclab, D)
3+
codes = PG_GENS_CODES_Ds[D][iuclab]
4+
5+
# convert `codes` to `SymOperation`s and add to `operations`
6+
operations = Vector{SymOperation{D}}(undef, length(codes))
7+
for (n, code) in enumerate(codes)
8+
op = SymOperation{D}(get_indexed_rotation(code, Val{D}()), zero(SVector{D,Float64}))
9+
operations[n] = op
10+
end
11+
12+
return operations
13+
end
14+
function generators(pgnum::Integer, ::Type{PointGroup{D}}, setting::Integer=1) where D
15+
iuclab = pointgroup_num2iuc(pgnum, Val(D), setting)
16+
return generators(iuclab, PointGroup{D})
17+
end

src/assembly/generators/spacegroup.jl

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
"""
2+
generators(num::Integer, T::Type{AbstractGroup{D}}[, optargs])
3+
generators(pgiuc::String, T::PointGroup{D}}) --> Vector{SymOperation{D}}
4+
5+
Return the generators of the group type `T` which may be a `SpaceGroup{D}` or a
6+
`PointGroup{D}` parameterized by its dimensionality `D`. Depending on `T`, the group is
7+
determined by inputting as the first argument:
8+
9+
- `SpaceGroup{D}`: the space group number `num::Integer`.
10+
- `PointGroup{D}`: the point group IUC label `pgiuc::String` (see also
11+
[`pointgroup(::String)`) or the canonical point group number `num::Integer`, which can
12+
optionally be supplemented by an integer-valued setting choice `setting::Integer` (see
13+
also [`pointgroup(::Integer, ::Integer, ::Integer)`](@ref)]).
14+
- `SubperiodicGroup{D}`: the subperiodic group number `num::Integer`.
15+
16+
Setting choices match those in [`spacegroup`](@ref), [`pointgroup`](@ref), and
17+
[`subperiodicgroup`](@ref).
18+
19+
Iterated composition of the returned symmetry operations will generate all operations of the
20+
associated space or point group (see [`generate`](@ref)).
21+
As an example, `generate(generators(num, `SpaceGroup{D}))` and `spacegroup(num, D)` return
22+
identical operations (with different sorting typically); and similarly so for point and
23+
subperiodic groups.
24+
25+
## Example
26+
27+
Generators of space group 200:
28+
```jldoctest
29+
julia> generators(200, SpaceGroup{3})
30+
4-element Vector{SymOperation{3}}:
31+
2₀₀₁
32+
2₀₁₀
33+
3₁₁₁⁺
34+
-1
35+
```
36+
37+
Generators of point group m-3m:
38+
```jldoctest
39+
julia> generators("2/m", PointGroup{3})
40+
2-element Vector{SymOperation{3}}:
41+
2₀₁₀
42+
-1
43+
```
44+
45+
Generators of the Frieze group 𝓅2mg:
46+
```jldoctest
47+
julia> generators(7, SubperiodicGroup{2, 1})
48+
2-element Vector{SymOperation{2}}:
49+
2
50+
{m₁₀|½,0}
51+
```
52+
53+
## Citing
54+
55+
Please cite the original data sources if used in published work:
56+
57+
- Space groups:
58+
[Aroyo et al., Z. Kristallogr. Cryst. Mater. **221**, 15
59+
(2006)](https://doi.org/10.1524/zkri.2006.221.1.15);
60+
- Point group: Bilbao Crystallographic Server's
61+
[2D and 3D GENPOS](https://www.cryst.ehu.es/cryst/get_point_genpos.html);
62+
- Subperiodic groups: Bilbao Crystallographic Server's
63+
[SUBPERIODIC GENPOS](https://www.cryst.ehu.es/subperiodic/get_sub_gen.html).
64+
65+
## Extended help
66+
67+
Note that the returned generators are not guaranteed to be the smallest possible set of
68+
generators; i.e., there may exist other generators with fewer elements (an example is space
69+
group 168 (P6), for which the returned generators are `[2₀₀₁, 3₀₀₁⁺]` even though the group
70+
could be generated by just `[6₀₀₁⁺]`).
71+
The returned generators, additionally, are not guaranteed to be
72+
[minimal](https://en.wikipedia.org/wiki/Generating_set_of_a_module), i.e., they may include
73+
proper subsets that generate the group themselves (e.g., in space group 75 (P4), the
74+
returned generators are `[2₀₀₁, 4₀₀₁⁺]` although the subset `[4₀₀₁⁺]` is sufficient to
75+
generate the group).
76+
The motivation for this is to expose as similar generators as possible for similar crystal
77+
systems (see e.g. Section 8.3.5 of the International Tables of Crystallography, Vol. A,
78+
Ed. 5 (ITA) for further background).
79+
80+
Note also that, contrary to conventions in ITA, the identity operation is excluded among the
81+
returned generators (except in space group 1) since it composes trivially and adds no
82+
additional context.
83+
"""
84+
function generators(sgnum::Integer, ::Type{SpaceGroup{D}}=SpaceGroup{3}) where D
85+
@boundscheck _check_valid_sgnum_and_dim(sgnum, D)
86+
codes = SG_GENS_CODES_Vs[D][sgnum]
87+
88+
# convert `codes` to `SymOperation`s and add to `operations`
89+
operations = Vector{SymOperation{D}}(undef, length(codes))
90+
_include_symops_from_codes!(operations, codes; add_identity=false)
91+
92+
return operations
93+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
generators(num::Integer, ::Type{SubperiodicGroup{D,P}}) --> ::Vector{SymOperation{D}}
3+
4+
Return a canonical set of generators for the subperiodic group `num` of embedding dimension
5+
`D` and periodicity dimension `P`. See also [`subperiodicgroup`](@ref).
6+
7+
See also [`generators(::Integer, ::Type{SpaceGroup})`](@ref) and information therein.
8+
9+
## Example
10+
11+
```jldoctest
12+
julia> generators(7, SubperiodicGroup{2, 1})
13+
2-element Vector{SymOperation{2}}:
14+
2
15+
{m₁₀|½,0}
16+
```
17+
18+
## Data sources
19+
20+
The generators returned by this function were originally retrieved from the [Bilbao
21+
Crystallographic Database, SUBPERIODIC GENPOS](https://www.cryst.ehu.es/subperiodic/get_sub_gen.html).
22+
"""
23+
function generators(num::Integer, ::Type{SubperiodicGroup{D,P}}) where {D,P}
24+
@boundscheck _check_valid_subperiodic_num_and_dim(num, D, P)
25+
codes = SUBG_GENS_CODES_Vs[(D,P)][num]
26+
27+
# convert `codes` to `SymOperation`s and add to `operations`
28+
operations = Vector{SymOperation{D}}(undef, length(codes))
29+
_include_symops_from_codes!(operations, codes; add_identity=false)
30+
31+
return operations
32+
end
File renamed without changes.

src/group-assembly/assemble_pointgroup.jl src/assembly/groups/pointgroup.jl

+2-4
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ end
3333
end
3434

3535
function _pointgroup(iuclab::String, pgnum::Integer, Dᵛ::Val{D}) where D
36-
codes = D == 3 ? PG_CODES_3D_D[iuclab] :
37-
D == 2 ? PG_CODES_2D_D[iuclab] :
38-
PG_CODES_1D_D[iuclab]
36+
codes = PG_CODES_Ds[D][iuclab]
3937

4038
Nop = (length(codes)+1) # number of operations
4139
operations = Vector{SymOperation{D}}(undef, Nop)
4240
operations[1] = one(SymOperation{D})
4341
for (n, code) in enumerate(codes)
44-
op = SymOperation{D}(get_indexed_rotation(code[1], Dᵛ),
42+
op = SymOperation{D}(get_indexed_rotation(code, Dᵛ),
4543
zero(SVector{D,Float64}))
4644
operations[n+1] = op
4745
end

src/group-assembly/assemble_spacegroup.jl src/assembly/groups/spacegroup.jl

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
"""
42
spacegroup(sgnum::Integer, ::Val{D}=Val(3))
53
spacegroup(sgnum::Integer, D::Integer) --> SpaceGroup{D}
@@ -32,11 +30,7 @@ The associated citation is: ([Aroyo et al., Z. Kristallogr. Cryst. Mater. **221*
3230
"""
3331
function spacegroup(sgnum, Dᵛ::Val{D}=Val(3)) where D
3432
@boundscheck _check_valid_sgnum_and_dim(sgnum, D)
35-
36-
codes = D == 3 ? SG_CODES_3D_V[sgnum] :
37-
D == 2 ? SG_CODES_2D_V[sgnum] :
38-
D == 1 ? SG_CODES_1D_V[sgnum] :
39-
error("unreachable; D is invalid but boundscheck assumed valid")
33+
codes = SG_CODES_Vs[D][sgnum]
4034

4135
cntr = centering(sgnum, D)
4236
Ncntr = centering_volume_fraction(cntr, Dᵛ)
@@ -56,12 +50,16 @@ function spacegroup(sgnum, Dᵛ::Val{D}=Val(3)) where D
5650
end
5751
spacegroup(sgnum::Integer, D::Integer) = spacegroup(sgnum, Val(D))
5852

59-
function _include_symops_from_codes!(operations::Vector{SymOperation{D}}, codes) where D
60-
operations[1] = one(SymOperation{D}) # add trivial identity op separately and manually
53+
function _include_symops_from_codes!(
54+
operations::Vector{SymOperation{D}}, codes;
55+
add_identity::Bool = true) where D
56+
if add_identity # add trivial identity operation separately and manually
57+
operations[1] = one(SymOperation{D})
58+
end
6159
for (n, code) in enumerate(codes)
6260
op = SymOperation{D}(get_indexed_rotation(code[1], Val{D}()),
6361
get_indexed_translation(code[2], Val{D}()))
64-
operations[n+1] = op
62+
operations[n+add_identity] = op
6563
end
6664
return operations
6765
end

src/group-assembly/assemble_subperiodicgroup.jl src/assembly/groups/subperiodicgroup.jl

+1-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ Crystallographic Database, SUBPERIODIC GENPOS](https://www.cryst.ehu.es/subperio
4545
"""
4646
function subperiodicgroup(num::Integer, Dᵛ::Val{D}=Val(3), Pᵛ::Val{P}=Val(2)) where {D, P}
4747
@boundscheck _check_valid_subperiodic_num_and_dim(num, D, P)
48-
49-
codes = D == 3 && P == 2 ? LAYER_CODES_V[num] :
50-
D == 3 && P == 1 ? ROD_CODES_V[num] :
51-
D == 2 && P == 1 ? FRIEZE_CODES_V[num] :
52-
error("unreachable; (D,P) input is invalid but boundscheck assumed valid")
48+
codes = SUBG_CODES_Vs[(D,P)][num]
5349

5450
cntr = centering(num, D, P)
5551
Ncntr = centering_volume_fraction(cntr, Dᵛ, Pᵛ)

0 commit comments

Comments
 (0)