From 407bdcfe7c1971e29a90cf2c7d86a52ea4a0b18e Mon Sep 17 00:00:00 2001 From: Emmanuel Lujan Date: Tue, 18 Jun 2024 10:22:03 -0400 Subject: [PATCH] New documentation sections. --- docs/make.jl | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index e0f1c4a2..22685c10 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -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"), @@ -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", @@ -71,3 +88,4 @@ deploydocs(; devbranch = "main", push_preview = true, ) +