Skip to content

Commit

Permalink
New documentation sections.
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuellujan committed Jun 18, 2024
1 parent ecdcdfe commit 407bdcf
Showing 1 changed file with 33 additions and 15 deletions.
48 changes: 33 additions & 15 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,50 @@ DocMeta.setdocmeta!(
recursive = true,
)

# Citations ####################################################################

bib = CitationBibliography(joinpath(@__DIR__, "citation.bib"))

# Generate examples
# Generate examples ############################################################

const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples")
const OUTPUT_DIR = joinpath(@__DIR__, "src/generated")

function create_examples(examples, EXAMPLES_DIR, OUTPUT_DIR)
for (_, example_path) in examples
s = split(example_path, "/")
sub_path, file_name = string(s[1:end-1]...), s[end]
example_filepath = joinpath(EXAMPLES_DIR, example_path)
Literate.markdown(example_filepath,
joinpath(OUTPUT_DIR, sub_path),
documenter = true)
end
examples = [title => joinpath("generated", replace(example_path, ".jl" => ".md"))
for (title, example_path) in examples]
end

# Basic examples
examples = [
"Fit a-HfO2 dataset with ACE" => "ACE-aHfO2/fit-ace-aHfO2.jl",
"Load Ar+Lennard-Jones dataset and postprocess" => "LJ-Ar/lennard-jones-ar.jl"
]
basic_examples = create_examples(examples, EXAMPLES_DIR, OUTPUT_DIR)

# Subsampling examples
examples = [
"Subsample a-HfO2 dataset with DPP and fit with ACE" => "DPP-ACE-aHfO2-1/fit-dpp-ace-ahfo2.jl",
"Subsample Na dataset with DPP and fit with ACE" => "DPP-ACE-Na/fit-dpp-ace-na.jl",
"Subsample Si dataset with DPP, fit with ACE, and cross validate" => "DPP-ACE-Si/fit-dpp-ace-si.jl",
"Reduce ACE descriptors with PCA and fit a-HfO2 dataset" => "PCA-ACE-aHfO2/fit-pca-ace-ahfo2.jl",
"Load Ar+Lennard-Jones dataset and postprocess" => "LJ-Ar/lennard-jones-ar.jl"
]
ss_examples = create_examples(examples, EXAMPLES_DIR, OUTPUT_DIR)

for (_, example_path) in examples
s = split(example_path, "/")
sub_path, file_name = string(s[1:end-1]...), s[end]
example_filepath = joinpath(EXAMPLES_DIR, example_path)
Literate.markdown(example_filepath,
joinpath(OUTPUT_DIR, sub_path),
documenter = true)
end

examples = [title => joinpath("generated", replace(example_path, ".jl" => ".md"))
for (title, example_path) in examples]
# Dimension reduction examples
examples = [
"Reduce ACE descriptors with PCA and fit a-HfO2 dataset" => "PCA-ACE-aHfO2/fit-pca-ace-ahfo2.jl",
]
dr_examples = create_examples(examples, EXAMPLES_DIR, OUTPUT_DIR)

# Make and deploy docs #########################################################

makedocs(
root = joinpath(dirname(pathof(PotentialLearning)), "..", "docs"),
Expand All @@ -56,7 +71,9 @@ makedocs(
draft = false,
pages = ["Home" => "index.md",
"How to run the examples" => "how-to-run-the-examples.md",
"Examples" => examples,
"Basic examples" => basic_examples,
"Subsampling examples" => ss_examples,
"Dimension reduction examples" => dr_examples,
"API" => "api.md"],
format = Documenter.HTML(;
prettyurls = get(ENV, "CI", "false") == "true",
Expand All @@ -71,3 +88,4 @@ deploydocs(;
devbranch = "main",
push_preview = true,
)

0 comments on commit 407bdcf

Please sign in to comment.