Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ddahlbom committed Sep 19, 2023
1 parent 78288a0 commit 688bbd1
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
docs/build/
docs/src/examples/
docs/src/contributed_examples/
Manifest.toml
profile.pb.gz
.DS_Store
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "Sunny.jl"]
path = Sunny.jl
url = https://github.com/SunnySuite/Sunny.jl
[submodule "SunnyTutorials"]
path = SunnyTutorials
url = https://github.com/SunnySuite/SunnyTutorials
1 change: 1 addition & 0 deletions SunnyTutorials
Submodule SunnyTutorials added at d5a4e8
20 changes: 17 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,28 @@ using Sunny
# Importing these activates package extensions
import GLMakie, WriteVTK

draft = false # set `true` to disable cell evaluation
draft = true # set `true` to disable cell evaluation

# Core, CI-built examples
example_names = ["fei2_tutorial", "out_of_equilibrium", "powder_averaging",
"fei2_classical", "ising2d", "one_dim_chain"] # "binning_tutorial"
example_sources = [joinpath(@__DIR__, "..", "examples", "$name.jl") for name in example_names]
example_destination = joinpath(@__DIR__, "src", "examples")
example_doc_paths = [joinpath("examples", "$name.md") for name in example_names]


# Copy over prebuilt contributed examples so Documenter can find them
contrib_names = ["08_Kagome_AFM", "15_Ba3NbFe3Si2O14"]
contrib_doc_paths = [joinpath("contributed_examples", "$name.md") for name in contrib_names]

contrib_src_dir = joinpath(@__DIR__, "..", "SunnyTutorials", "docstash")
contrib_dst_dir = joinpath(@__DIR__, "src", "contributed_examples")
src_files = readdir(contrib_src_dir)
for file in src_files
cp(joinpath(contrib_src_dir, file), joinpath(contrib_dst_dir, file); force=true)
end


# Run Literate on each `../examples/name.jl` and output `src/examples/name.md`
isdir(example_destination) && rm(example_destination; recursive=true)
for (name, source) in zip(example_names, example_sources)
Expand All @@ -42,6 +55,7 @@ Documenter.makedocs(;
pages = [
"Overview" => "index.md",
"Examples" => example_doc_paths,
"Contributed Examples" => contrib_doc_paths,
"Library API" => "library.md",
"Structure Factor Calculations" => "structure-factor.md",
"Single-Ion Anisotropy" => "anisotropy.md",
Expand All @@ -52,8 +66,8 @@ Documenter.makedocs(;
format = Documenter.HTML(;
prettyurls = get(ENV, "CI", nothing) == "true",
ansicolor = true,
size_threshold_warn = 200*1024, # 200KB -- library.html gets quite large
size_threshold = 300*2024, # 300KB
# size_threshold_warn = 200*1024, # 200KB -- library.html gets quite large
# size_threshold = 300*2024, # 300KB
),
draft
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
## Kagome Antiferromagnet
# # Kagome Antiferromagnet
#
# - Sunny port of the SpinW tutorial authored by Bjorn Fak and Sandor Toth,
# https://spinw.org/tutorials/08tutorial.
# - Authors: Harry Lane
# - Goal: Calculate the linear spin wave theory spectrum for the $\sqrt{3}
# \times \sqrt{3}$ order of a Kagome antiferromagnet.
# - Goal: Calculate the linear spin wave theory spectrum for the ``\sqrt{3}
# \times \sqrt{3}`` order of a Kagome antiferromagnet.

# Load Packages

using Sunny, GLMakie

# Build a [`Crystal`](@ref) with $P\overline{3}$ space group and Cr$^{+}$ ions
# Build a [`Crystal`](@ref) with ``P\overline{3}`` space group and Cr ions
# on each site.

a = b = 6.0 # (Å)
Expand All @@ -35,7 +35,7 @@ set_spiral_order_on_sublattice!(sys, 2; q, axis, S0=[cos(0),sin(0),0])
set_spiral_order_on_sublattice!(sys, 3; q, axis, S0=[cos(2π/3),sin(2π/3),0])
plot_spins(sys; ghost_radius=30, orthographic=true)

# Check energy. Each site participates in 4 bonds with energy J*S^2*cos(2π/3).
# Check energy. Each site participates in 4 bonds with energy ``JS^2\cos(2π/3)``.
# Factor of 1/2 avoids double counting.

@assert energy_per_site(sys) (4/2)*J*S^2*cos(2π/3)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Ba<sub>3</sub>NbFe<sub>3</sub>Si<sub>2</sub>O<sub>14</sub>
# # Ba<sub>3</sub>NbFe<sub>3</sub>Si<sub>2</sub>O<sub>14</sub>
#
# - Sunny port of the SpinW tutorial authored by Toth et al.,
# https://spinw.org/tutorials/15tutorial.
Expand Down

0 comments on commit 688bbd1

Please sign in to comment.