From aae2e04108e92ed9a6e45da81f6345c7d844f027 Mon Sep 17 00:00:00 2001 From: Emmanuel Lujan Date: Wed, 5 Jun 2024 11:54:22 -0400 Subject: [PATCH] First update to documentation. --- docs/make.jl | 23 ++++++++++++++--------- docs/src/how-to-run-the-examples.md | 28 +++++++++++----------------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index ecd9db4d..cf17d070 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -12,21 +12,25 @@ DocMeta.setdocmeta!( recursive = true, ) + bib = CitationBibliography(joinpath(@__DIR__, "citation.bib")) # Generate examples -#const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples") -#const OUTPUT_DIR = joinpath(@__DIR__, "src/generated") +const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples") +const OUTPUT_DIR = joinpath(@__DIR__, "src/generated") + +examples = [ + "Subsampling, compute descriptors, and fit ACE" => "Na/fit-dpp-ace-na" +] -#examples = Pair{String,String}[] +for (_, name) in examples + example_filepath = joinpath(EXAMPLES_DIR, string(name, ".jl")) + Literate.markdown(example_filepath, OUTPUT_DIR, documenter=true) +end -#for (_, name) in examples -# example_filepath = joinpath(EXAMPLES_DIR, string(name, ".jl")) -# Literate.markdown(example_filepath, OUTPUT_DIR, documenter = true) -#end +examples = [title=>joinpath("generated", string(name, ".md")) for (title, name) in examples] -#examples = [title => joinpath("generated", string(name, ".md")) for (title, name) in examples] makedocs( root = joinpath(dirname(pathof(PotentialLearning)), "..", "docs"), @@ -39,9 +43,10 @@ makedocs( highlightsig = true, sitename = "PotentialLearning.jl", expandfirst = [], - draft = false, + draft = false, pages = ["Home" => "index.md", "How to run the examples" => "how-to-run-the-examples.md", + "Examples" => examples, "API" => "api.md"], format = Documenter.HTML(; prettyurls = get(ENV, "CI", "false") == "true", diff --git a/docs/src/how-to-run-the-examples.md b/docs/src/how-to-run-the-examples.md index a5fd45b7..a063835a 100644 --- a/docs/src/how-to-run-the-examples.md +++ b/docs/src/how-to-run-the-examples.md @@ -1,7 +1,6 @@ # How to run the examples ## Add registries - Open a Julia REPL (`$ julia`), type `]` to enter the Pkg REPL, and add the following registries: ```julia pkg> registry add https://github.com/JuliaRegistries/General @@ -10,32 +9,27 @@ Open a Julia REPL (`$ julia`), type `]` to enter the Pkg REPL, and add the follo pkg> registry add https://github.com/ACEsuit/ACEregistry ``` -## Install the dependencies of the `examples` folder project - +## Clone repository and access an example folder Clone `PotentialLearning.jl` repository in your working directory. ```shell $ git clone git@github.com:cesmix-mit/PotentialLearning.jl.git ``` -Open a Julia REPL activating the `examples` folder project. -```shell - $ julia --project=PotentialLearning.jl/examples -``` - Type `]` to enter the Pkg REPL and instantiate. -```julia - pkg> instantiate -``` - -## Run an example - Access to any folder within `PotentialLearning.jl/examples`. E.g. ```shell - $ cd PotentialLearning.jl/examples/ACE + $ cd PotentialLearning.jl/examples/Na ``` + +## Run example Open a Julia REPL, activate the `examples` folder project, and define the number of threads. ```julia - $ julia --project=../ --threads=4 + $ julia --project=./ --threads=4 +``` +Type `]` to enter the Pkg REPL and instantiate. +```julia + pkg> instantiate ``` Finally, include the example file. ```julia - julia> include("fit-ace.jl") + julia> include("fit-dpp-ace-na.jl") ``` +