-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add magnetic space group tooling and improve group operation loading (f…
…ix #39) (#54) Bravais.jl: - bumps Bravais version to v0.1.9 - This makes the canonicalization of subperiodic group centering symbols more meaningful; now always going to the associated symbol in `D` dimensions rather than `P` - this fixes a bug for `all_centeringtranslations` and simplifies the treatment in `primitivebasismatrix` - also introduces and exports `centering_volume_fraction` which gives the ratio between the conventional and primitive unit cell volumes Crystalline: - Bump Crystalline to v0.5.0 - Add magnetic space group functionality (`mspacegroup` and `MSymOperation`) - Now, load all group operation data by reference to a fixed set of operators (in `tables/rotation_translation.jl` via a set of codes (stored in `tables/spacegroup.jl` and similar for point/subperiodic/magnetic groups): this is much faster computationally as it avoids having to load anything from disk and solves #39 - Introduce a new `AbstractOperation` abstract type to fold both `SymOperation` and `MSymOperation` (for magnetic operations) under one umbrella - All assembly of groups is now in `group-assembly/...` - Various minor fixes/code-improvement to subperiodic groups - Add an element type parameter to `AbstractGroup` - Fix various minor things
- Loading branch information
Showing
496 changed files
with
69,368 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "Bravais" | ||
uuid = "ada6cbde-b013-4edf-aa94-f6abe8bd6e6b" | ||
authors = ["Thomas Christensen <[email protected]>"] | ||
version = "0.1.8" | ||
version = "0.1.9" | ||
|
||
[deps] | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "Crystalline" | ||
uuid = "ae5e2be0-a263-11e9-351e-f94dad1eb351" | ||
authors = ["Thomas Christensen <[email protected]>"] | ||
version = "0.4.22" | ||
version = "0.5.0" | ||
|
||
[deps] | ||
Bravais = "ada6cbde-b013-4edf-aa94-f6abe8bd6e6b" | ||
|
@@ -29,7 +29,7 @@ CrystallineGraphMakieExt = "GraphMakie" | |
CrystallinePyPlotExt = "PyPlot" | ||
|
||
[compat] | ||
Bravais = "0.1.8" | ||
Bravais = "0.1.9" | ||
Combinatorics = "1.0" | ||
DelimitedFiles = "1" | ||
DocStringExtensions = "0.8, 0.9" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using Crystalline | ||
using StaticArrays | ||
# --- definitions --- | ||
# to be transferred to Crystalline's definitions | ||
|
||
# --- parsing --- | ||
#cd(@__DIR__) | ||
io = open((@__DIR__)*"/../data/operations/msgs/iso-magnetic_table_bns.txt") | ||
|
||
# --- read dictionary of operations --- | ||
function read_ops!(io, ops_d, stop_string) | ||
while (str=readline(io); str ≠ stop_string) | ||
parts = split(str, isspace; keepempty=false) | ||
code, xyz = parts[1], parts[2] | ||
op = SymOperation(xyz) | ||
ops_d[code] = op | ||
end | ||
return ops_d | ||
end | ||
|
||
readuntil(io, "Non-hexagonal groups:"); readline(io) | ||
nonhex_ops_d = Dict{String, SymOperation{3}}() | ||
read_ops!(io, nonhex_ops_d, "Hexagonal groups:") | ||
hex_ops_d = Dict{String, SymOperation{3}}() | ||
read_ops!(io, hex_ops_d, "----------") | ||
|
||
# --- read individual groups --- | ||
function parse_opstr(str::AbstractString, ops_d) | ||
str′ = strip(str, ['(', ')','\'']) | ||
code, translation_str = split(str′, '|')::Vector{SubString{String}} | ||
translation_parts = split(translation_str, ',') | ||
translation_tup = ntuple(Val(3)) do i | ||
Crystalline.parsefraction(translation_parts[i]) | ||
end | ||
translation = SVector{3, Float64}(translation_tup) | ||
op = SymOperation{3}(ops_d[code].rotation, translation) | ||
tr = last(str) == '\'' | ||
return MSymOperation(op, tr) | ||
end | ||
|
||
function read_group!(io) | ||
# BNS: number & label | ||
readuntil(io, "BNS: ") | ||
num_str = readuntil(io, " ") # numbering in format `sgnum.cnum` | ||
sgnum, cnum = parse.(Int, split(num_str, "."))::Vector{Int} | ||
# `sgnum`: F space-group associated number, `cnum`: crystal-system sequential number | ||
bns_label = replace(readuntil(io, " "), '\''=>'′') # BNS label in IUC-style | ||
|
||
# OG: number and label | ||
readuntil(io, "OG: ") | ||
N₁N₂N₃_str = readuntil(io, " ") # numbering in format `N₁.N₂.N₃` | ||
N₁, N₂, N₃ = parse.(Int, split(N₁N₂N₃_str, "."))::Vector{Int} | ||
og_label = replace(readuntil(io, '\n'), '\''=>'′') # OG label in IUC-style | ||
|
||
# operator strings | ||
is_hex = crystalsystem(sgnum) ∈ ("hexagonal" , "trigonal") | ||
readuntil(io, "Operators") | ||
c = read(io, Char) | ||
if c == ' ' | ||
readuntil(io, "(BNS):") | ||
elseif c ≠ ':' | ||
error("unexpected parsing failure") | ||
end | ||
ops_str = readuntil(io, "Wyckoff") | ||
op_strs = split(ops_str, isspace; keepempty=false) | ||
|
||
# parse operator strings to operations | ||
g = Vector{MSymOperation{3}}(undef, length(op_strs)) | ||
for (i, str) in enumerate(op_strs) | ||
g[i] = parse_opstr(str, is_hex ? hex_ops_d : nonhex_ops_d) | ||
isdone = str[end] == '\n' | ||
isdone && break | ||
end | ||
|
||
return MSpaceGroup{3}((sgnum, cnum), g), bns_label, og_label, (N₁, N₂, N₃) | ||
end | ||
msgs = MSpaceGroup{3}[] | ||
MSG_BNS_LABELs_D = Dict{Tuple{Int, Int}, String}() | ||
MSG_OG_LABELs_D = Dict{Tuple{Int, Int, Int}, String}() | ||
MSG_BNS2OG_NUMs_D = Dict{Tuple{Int, Int}, Tuple{Int, Int, Int}}() | ||
for i in 1:1651 | ||
msg, bns_label, og_label, (N₁, N₂, N₃) = read_group!(io) | ||
push!(msgs, msg) | ||
MSG_BNS_LABELs_D[msg.num] = bns_label | ||
MSG_OG_LABELs_D[(N₁, N₂, N₃)] = og_label | ||
MSG_BNS2OG_NUMs_D[msg.num] = (N₁, N₂, N₃) | ||
end |
Oops, something went wrong.
69a187b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register subdir=Bravais
69a187b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/98699
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: