Skip to content

Commit 350449b

Browse files
committed
more doc system fixes
1 parent 2d73e30 commit 350449b

File tree

6 files changed

+48
-11
lines changed

6 files changed

+48
-11
lines changed

Bravais/src/Bravais.jl

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export crystal,
2727
reciprocalbasis,
2828
AbstractBasis,
2929
volume,
30+
metricmatrix,
3031
DirectBasis,
3132
ReciprocalBasis,
3233
AbstractPoint,

Bravais/src/types.jl

+15-8
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,39 @@ function angles(Rs::AbstractBasis{3})
5353
end
5454
angles(::AbstractBasis{D}) where D = _throw_invalid_dim(D)
5555

56+
if VERSION < v"1.9.0-DEV.1163"
57+
# since https://github.com/JuliaLang/julia/pull/43334, Julia defines its own `stack`;
58+
# however, it is still much slower than a naive implementation based on `reduce` cf.
59+
# https://github.com/JuliaLang/julia/issues/52590. As such, we extend `Base.stack` even
60+
# on more recent versions; when the issue is fixed, it would be enough to only define
61+
# `stack` on earlier versions of Julia, falling back to `Base.stack` on later versions.
62+
import Base: stack
63+
end
5664
"""
5765
stack(Vs::AbstractBasis)
5866
59-
Return a matrix `[Vs[1] Vs[2] .. Vs[D]]` from `Vs::AbstractBasis{D}`, i.e. the matrix whose
67+
Return a matrix `[Vs[1] Vs[2] .. Vs[D]]` from `Vs::AbstractBasis{D}`, i.e., the matrix whose
6068
columns are the basis vectors of `Vs`.
6169
"""
6270
stack(Vs::AbstractBasis) = reduce(hcat, parent(Vs))
63-
# TODO: At some point, this should hopefully no longer be necessary to do manually (and
64-
# `stack` may end up exported by Base): https://github.com/JuliaLang/julia/issues/21672
6571

6672
"""
6773
volume(Vs::AbstractBasis)
6874
6975
Return the volume ``V`` of the unit cell associated with the basis `Vs::AbstractBasis{D}`.
7076
71-
The volume is computed as ``V = \\sqrt{\\mathrm{det}G}`` with with ``G`` denoting the metric
72-
matrix of `Vs` (cf. the International Tables of Crystallography, Volume A, Section 5.2.2.3).
77+
The volume is computed as ``V = \\sqrt{\\mathrm{det}\\mathbf{G}}`` with with ``\\mathbf{G}``
78+
denoting the metric matrix of `Vs` (cf. the International Tables of Crystallography,
79+
Volume A, Section 5.2.2.3).
7380
74-
See also [`Bravais.metricmatrix`](@ref).
81+
See also [`metricmatrix`](@ref).
7582
"""
76-
volume(Vs::AbstractBasis) = sqrt(det(metricmatrix(Vs))) # TODO: wrong. TODO: export.
83+
volume(Vs::AbstractBasis) = sqrt(det(metricmatrix(Vs)))
7784

7885
"""
7986
metricmatrix(Vs::AbstractBasis)
8087
81-
Return the (real, symmetric) metric matrix of a basis `Vs`, i.e. the matrix with elements
88+
Return the (real, symmetric) metric matrix of a basis `Vs`, i.e., the matrix with elements
8289
``G_{ij} =`` `dot(Vs[i], Vs[j])`, as defined in the International Tables of Crystallography,
8390
Volume A, Section 5.2.2.3.
8491

Bravais/src/utils.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# in here to avoid taking on that dependency (long load time; ~7 s)
33
uniform_rand(low::Real, high::Real) = low + (high - low) * rand()
44

5-
"""
5+
#=
66
relrand(lims::NTuple{2,Real}) --> Float64
77
88
Computes a random number in the range specified by the two-element
@@ -14,7 +14,7 @@ interval [-1/`lims[1]`, -1] ∪ [1, `lims[2]`].
1414
This is useful for ensuring an even sampling of numbers that are
1515
either smaller or larger than unity. E.g. for `x = relrand((0.2,5.0))`,
1616
`x` is equally probable to fall in inv(`x`)∈[1,5] or `x`∈[1,5].
17-
"""
17+
=#
1818
function relrand(lims::NTuple{2,<:Real})
1919
low, high = lims; invlow = inv(low)
2020
lowthres = (invlow - 1.0)/(invlow + high - 2.0)

docs/src/api.md

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ Private = false
2020
Order = [:function]
2121
```
2222

23+
## Exported macros
24+
```@autodocs
25+
Modules = [Crystalline]
26+
Private = false
27+
Order = [:macro]
28+
```
29+
2330
## Exported constants
2431
```@autodocs
2532
Modules = [Crystalline]

docs/src/bravais.md

+13
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ CurrentModule = Bravais
1010

1111
### Types
1212
```@docs
13+
AbstractBasis
1314
DirectBasis
1415
ReciprocalBasis
16+
AbstractPoint
1517
DirectPoint
1618
ReciprocalPoint
1719
```
@@ -47,6 +49,17 @@ conventionalize(::DirectBasis, ::Union{Char, <:Integer})
4749
conventionalize(::ReciprocalBasis, ::Union{Char, <:Integer})
4850
conventionalize(::DirectPoint, ::Union{Char, <:Integer})
4951
conventionalize(::ReciprocalPoint, ::Union{Char, <:Integer})
52+
cartesianize
53+
cartesianize!
54+
latticize
55+
latticize!
56+
```
57+
58+
### Miscellaneous
59+
```@docs
60+
volume
61+
metricmatrix
62+
stack
5063
```
5164

5265
## Crystalline.jl extensions of Bravais.jl functions

src/symops.jl

+10-1
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,16 @@ function littlegroup(ops::AbstractVector{SymOperation{D}}, kv::KVec{D},
606606
end
607607
return idxlist, view(ops, idxlist)
608608
end
609-
function littlegroup(sg::SpaceGroup, kv::KVec)
609+
610+
"""
611+
$(TYPEDSIGNATURES)
612+
613+
Return the little group associated with space group `sg` at the **k**-vector `kv`.
614+
615+
Optionally, an associated **k**-vector label `klab` can be provided; if not provided, the
616+
empty string is used as label.
617+
"""
618+
function littlegroup(sg::SpaceGroup, kv::KVec, klab::String="")
610619
_, lgops = littlegroup(operations(sg), kv, centering(sg))
611620
return LittleGroup{dim(sg)}(num(sg), kv, "", lgops)
612621
end

0 commit comments

Comments
 (0)