Skip to content

Commit

Permalink
Merge pull request #43 from MineralsCloud/feature/docs
Browse files Browse the repository at this point in the history
Finish docs
  • Loading branch information
singularitti authored Oct 12, 2019
2 parents 84eb6a5 + 52dee3c commit 4f9af74
Show file tree
Hide file tree
Showing 16 changed files with 661 additions and 374 deletions.
17 changes: 11 additions & 6 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ version = "0.2.0"

[[Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
git-tree-sha1 = "84aa74986c5b9b898b0d1acaf3258741ee64754f"
git-tree-sha1 = "ed2c4abadf84c53d9e58510b5fc48912c2336fbb"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "2.1.0"
version = "2.2.0"

[[ConstructionBase]]
git-tree-sha1 = "e3efe0a0f49dcd294c8c73e897b4fdf891f0fbd3"
Expand Down Expand Up @@ -179,10 +179,10 @@ deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUID
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[[Polynomials]]
deps = ["LinearAlgebra", "SparseArrays", "Test"]
git-tree-sha1 = "62142bd65d3f8aeb2226ec64dd8493349147df94"
deps = ["LinearAlgebra", "RecipesBase"]
git-tree-sha1 = "f7c0c07e82798aef542d60a6e6e85e39f4590750"
uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
version = "0.5.2"
version = "0.5.3"

[[Printf]]
deps = ["Unicode"]
Expand All @@ -202,6 +202,11 @@ uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[RecipesBase]]
git-tree-sha1 = "7bdce29bc9b2f5660a6e5e64d64d91ec941f6aa2"
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version = "0.7.0"

[[Reexport]]
deps = ["Pkg"]
git-tree-sha1 = "7b1d07f411bc8ddb7977ec7f377b97b158514fe0"
Expand Down Expand Up @@ -302,6 +307,6 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
deps = ["LinearAlgebra", "Random"]
git-tree-sha1 = "0e9ad8a9621a9e1ec48f7cb48a5d6ded9e2c68f3"
repo-rev = "master"
repo-url = "https://github.com/PainterQubits/Unitful.jl.git"
repo-url = "https://github.com/PainterQubits/Unitful.jl"
uuid = "1986cc42-f94f-5a68-af5c-568840ba703d"
version = "0.17.0"
104 changes: 104 additions & 0 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# This file is machine-generated - editing it directly is not advised

[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[DocStringExtensions]]
deps = ["LibGit2", "Markdown", "Pkg", "Test"]
git-tree-sha1 = "88bb0edb352b16608036faadcc071adda068582a"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.1"

[[Documenter]]
deps = ["Base64", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
git-tree-sha1 = "d45c163c7a3ae293c15361acc52882c0f853f97c"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "0.23.4"

[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.0"

[[LibGit2]]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"

[[Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

[[LinearAlgebra]]
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"

[[Parsers]]
deps = ["Dates", "Test"]
git-tree-sha1 = "ef0af6c8601db18c282d092ccbd2f01f3f0cd70b"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "0.3.7"

[[Pkg]]
deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[[Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[[REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[[Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[[Unitful]]
deps = ["LinearAlgebra", "Random"]
git-tree-sha1 = "0e9ad8a9621a9e1ec48f7cb48a5d6ded9e2c68f3"
repo-rev = "master"
repo-url = "https://github.com/PainterQubits/Unitful.jl.git"
uuid = "1986cc42-f94f-5a68-af5c-568840ba703d"
version = "0.17.0"
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
5 changes: 4 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using Documenter, EquationsOfState

DocMeta.setdocmeta!(EquationsOfState, :DocTestSetup, :(using EquationsOfState, EquationOfState.Collections, Unitful); recursive=true)
makedocs(;
modules=[EquationsOfState],
format=Documenter.HTML(),
pages=[
"Home" => "index.md",
"Installation" => "Installation.md",
"Manual" => [
"Collections" => "Collections.md",
"Nonlinear fitting" => "NonlinearFitting.md"
"Nonlinear fitting" => "NonlinearFitting.md",
"Find volume" => "Find.md"
]
],
repo="https://github.com/MineralsCloud/EquationsOfState.jl/blob/{commit}{path}#L{line}",
Expand Down
150 changes: 57 additions & 93 deletions docs/src/Collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,94 +18,67 @@ EquationOfState
│ ├─ PoirierTarantola3rd
│ └─ PoirierTarantola4th
├─ Murnaghan
├─ PolynomialEquationOfState
└─ Vinet
```

## Types

```@docs
EquationOfState
FiniteStrainEquationOfState
Murnaghan
BirchMurnaghan2nd
BirchMurnaghan3rd
BirchMurnaghan4th
PoirierTarantola2nd
PoirierTarantola3rd
PoirierTarantola4th
Vinet
```

## Usage

### Construct an `EquationOfState`

We will use `BirchMurnaghan3rd` as an example.

`BirchMurnaghan3rd` can be constructed from scratch:
A `BirchMurnaghan3rd` can be constructed from scratch, as shown above. It can
also be constructed from an existing `BirchMurnaghan3rd`, with
[`Setfield.jl`](https://github.com/jw3126/Setfield.jl)
[`@set!`](https://jw3126.github.io/Setfield.jl/stable/#Setfield.@set!-Tuple{Any})
macro:

```julia
julia> BirchMurnaghan3rd(1, 2, 3)
4-element BirchMurnaghan3rd{Int64}:
1
2
3
0

julia> BirchMurnaghan3rd(1, 2, 3, 4)
4-element BirchMurnaghan3rd{Int64}:
1
2
3
4

julia> BirchMurnaghan3rd(1, 2, 3, 4.0)
4-element BirchMurnaghan3rd{Float64}:
1.0
2.0
3.0
4.0
julia> using Setfield

julia> eos = Murnaghan(1, 2, 3.0)
Murnaghan{Float64}(1.0, 2.0, 3.0, 0.0)

julia> @set! eos.v0 = 4
Murnaghan{Float64}(4.0, 2.0, 3.0, 0.0)

julia> eos
Murnaghan{Float64}(4.0, 2.0, 3.0, 0.0)
```

It can also be constructed from an existing `BirchMurnaghan3rd`:
To modify multiple fields (say, `:v0`, `:bp0`, `:bpp0`, `:e0`) at a time, use
[`@batchlens`](https://tkf.github.io/Kaleido.jl/stable/#Kaleido.@batchlens) from
[`Kaleido.jl`](https://github.com/tkf/Kaleido.jl):

```julia
julia> BirchMurnaghan3rd(BirchMurnaghan3rd(1, 2, 3, 4.0), b0=10, e0=5)
4-element BirchMurnaghan3rd{Float64}:
1.0
10.0
3.0
5.0
julia> using Setfield, Kaleido

julia> BirchMurnaghan3rd(BirchMurnaghan3rd(1, 2, 3, 4.0), Dict(:b0=>10, :e0=>5))
4-element BirchMurnaghan3rd{Float64}:
1.0
10.0
3.0
5.0
julia> lens = @batchlens(begin
_.v0
_.bp0
_.bpp0
_.e0
end)
IndexBatchLens(:v0, :bp0, :bpp0, :e0)

julia> BirchMurnaghan3rd(BirchMurnaghan3rd(1, 2, 3, 4.0), (:b0, 10))
4-element BirchMurnaghan3rd{Float64}:
1.0
10.0
3.0
4.0
julia> eos = BirchMurnaghan4th(1, 2.0, 3, 4)
BirchMurnaghan4th{Float64}(1.0, 2.0, 3.0, 4.0, 0.0)

julia> set(eos, lens, (5, 6, 7, 8))
BirchMurnaghan4th{Float64}(5.0, 2.0, 6.0, 7.0, 8.0)
```

Users can access `BirchMurnaghan3rd`'s element by either "dot notation" or indexing:
Users can access `BirchMurnaghan3rd`'s elements by "dot notation":

```julia
julia> b = BirchMurnaghan3rd(1, 2, 3, 4.0)
julia> eos = BirchMurnaghan3rd(1, 2, 3, 4.0)
4-element BirchMurnaghan3rd{Float64}:
1.0
2.0
3.0
4.0

julia> b.v0
1.0

julia> b[1]
julia> eos.v0
1.0
```

Expand All @@ -114,6 +87,7 @@ julia> b[1]
The $E(V)$ relation of equations of state are listed as below:

1. `Murnaghan`:

```math
E(V) = E_{0}+K_{0} V_{0}\left[\frac{1}{K_{0}^{\prime}\left(K_{0}^{\prime}-1\right)}\left(\frac{V}{V_{0}}\right)^{1-K_{0}^{\prime}}+\frac{1}{K_{0}^{\prime}} \frac{V}{V_{0}}-\frac{1}{K_{0}^{\prime}-1}\right].
```
Expand All @@ -130,7 +104,8 @@ The $E(V)$ relation of equations of state are listed as below:
E(V) = E_{0}+\frac{9}{16} V_{0} B_{0} \frac{\left(x^{2 / 3}-1\right)^{2}}{x^{7 / 3}}\left\{x^{1 / 3}\left(B_{0}^{\prime}-4\right)-x\left(B_{0}^{\prime}-6\right)\right\}.
```

where ``x = V / V_0``, and ``f = \frac{ 1 }{ 2 } \bigg[ \bigg( \frac{ V_0 }{ V } \bigg)^{2/3} - 1 \bigg]``.
where ``x = V / V_0``, and
``f = \frac{ 1 }{ 2 } \bigg[ \bigg( \frac{ V_0 }{ V } \bigg)^{2/3} - 1 \bigg]``.

4. `BirchMurnaghan4th`:

Expand All @@ -157,6 +132,7 @@ The $E(V)$ relation of equations of state are listed as below:
```math
E(V) = E_{0}+\frac{1}{24} B_{0} V_{0} \ln ^{2} x\left\{\left(H+3 B_{0}^{\prime}+3\right) \ln ^{2} x\right. \left.+4\left(B_{0}^{\prime}+2\right) \ln x+12\right\}.
```

where ``H = B_0 B_0'' + (B_0')^2``.

8. `Vinet`:
Expand Down Expand Up @@ -242,7 +218,7 @@ The $B(V)$ relation of equations of state are listed as below:
2. `BirchMurnaghan3rd`:

```math
B(V) = \frac{B_{0}}{8 \chi^{10 / 3}}\left\{x^{5 / 3}\left(15 B_{0}^{\prime}-80\right)-x\left(42 B_{0}^{\prime}-196\right)\right.\left.+27 x^{1 / 3}\left(B_{0}^{\prime}-4\right)\right\}.
B(V) = \frac{B_{0}}{8 x^{10 / 3}}\left\{x^{5 / 3}\left(15 B_{0}^{\prime}-80\right)-x\left(42 B_{0}^{\prime}-196\right)\right.\left.+27 x^{1 / 3}\left(B_{0}^{\prime}-4\right)\right\}.
```

3. `BirchMurnaghan4th`:
Expand Down Expand Up @@ -281,38 +257,26 @@ The $B(V)$ relation of equations of state are listed as below:
B(V) = \beta\left(\frac{V}{V_{0}}\right)^{n}\left[1+n \ln \frac{V}{V_{0}}\right].
```

## Types

```@docs
EquationOfState
FiniteStrainEquationOfState
Murnaghan
BirchMurnaghan2nd
BirchMurnaghan3rd
BirchMurnaghan4th
PoirierTarantola2nd
PoirierTarantola3rd
PoirierTarantola4th
Vinet
```

## Public interfaces

```@docs
apply(::EnergyForm, eos::EquationOfState)
apply(::EnergyForm, eos::Murnaghan, v::Real)
apply(::EnergyForm, eos::BirchMurnaghan2nd, v::Real)
apply(::EnergyForm, eos::BirchMurnaghan3rd, v::Real)
apply(::EnergyForm, eos::BirchMurnaghan4th, v::Real)
apply(::EnergyForm, eos::PoirierTarantola2nd, v::Real)
apply(::EnergyForm, eos::PoirierTarantola3rd, v::Real)
apply(::EnergyForm, eos::PoirierTarantola4th, v::Real)
apply(::EnergyForm, eos::Vinet, v::Real)
apply(::EnergyForm, eos::AntonSchmidt, v::Real)
apply(::PressureForm, eos::EquationOfState)
apply(::PressureForm, eos::Murnaghan, v::Real)
apply(::PressureForm, eos::BirchMurnaghan2nd, v::Real)
apply(::PressureForm, eos::BirchMurnaghan3rd, v::Real)
apply(::PressureForm, eos::BirchMurnaghan4th, v::Real)
apply(::PressureForm, eos::PoirierTarantola2nd, v::Real)
apply(::PressureForm, eos::PoirierTarantola3rd, v::Real)
apply(::PressureForm, eos::PoirierTarantola4th, v::Real)
apply(::PressureForm, eos::Vinet, v::Real)
apply(::PressureForm, eos::AntonSchmidt, v::Real)
apply(::PressureForm, eos::BreenanStacey, v::Real)
apply(::BulkModulusForm, eos::EquationOfState)
apply(::BulkModulusForm, eos::BirchMurnaghan2nd, v::Real)
apply(::BulkModulusForm, eos::BirchMurnaghan3rd, v::Real)
apply(::BulkModulusForm, eos::BirchMurnaghan4th, v::Real)
apply(::BulkModulusForm, eos::PoirierTarantola2nd, v::Real)
apply(::BulkModulusForm, eos::PoirierTarantola3rd, v::Real)
apply(::BulkModulusForm, eos::PoirierTarantola4th, v::Real)
apply(::BulkModulusForm, eos::Vinet, v::Real)
apply(::BulkModulusForm, eos::AntonSchmidt, v::Real)
apply(::EnergyForm, eos::Murnaghan, v)
apply(::PressureForm, eos::Murnaghan, v)
apply(::BulkModulusForm, eos::BirchMurnaghan2nd, v)
```
Loading

0 comments on commit 4f9af74

Please sign in to comment.