Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New naming convention #7

Merged
merged 4 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 0 additions & 110 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -1,36 +1,3 @@
["pd_nc_sr_pbesol_standard_0.4.1_psp8"]
extension = "psp8"
functional = "pbesol"
version = "0.4.1"
git-tree-sha1 = "d5d914c4b8ae3119fae60f3a3e66225db41de579"
lazy = true

[["pd_nc_sr_pbesol_standard_0.4.1_psp8".download]]
sha256 = "6870faeceb4f68196901160a6ac455016dc1b9b1ea4ec629607d8e1757d9055f"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_sr_pbesol_standard_0.4.1_psp8.tar.gz"

["pd_nc_sr_pbe_standard_0.4.1_psp8"]
extension = "psp8"
functional = "pbe"
version = "0.4.1"
git-tree-sha1 = "054625d663e05d8c86bd3b8c1b7f371b85eb906f"
lazy = true

[["pd_nc_sr_pbe_standard_0.4.1_psp8".download]]
sha256 = "cffaf5a4bf41cca1f45d9f6f1ae8a6d5b83083ef62e69052459c26913bcf555a"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_sr_pbe_standard_0.4.1_psp8.tar.gz"

["pd_nc_sr_lda_standard_0.4.1_psp8"]
extension = "psp8"
functional = "lda"
version = "0.4.1"
git-tree-sha1 = "13a9394a722182e06cd28f7d8c0c6ed491b55c5d"
lazy = true

[["pd_nc_sr_lda_standard_0.4.1_psp8".download]]
sha256 = "840a5f654e841ef8b42a5867c27d181996998535a118b7ccbfe355101352a5b7"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_sr_lda_standard_0.4.1_psp8.tar.gz"

["pd_nc_sr_lda_stringent_0.4.1_upf"]
extension = "upf"
functional = "lda"
Expand All @@ -42,17 +9,6 @@ lazy = true
sha256 = "ba0c16c557f24e39b0b71d64a1ba3582421e016ce7a9cc799c4de195b7c4ec21"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_sr_lda_stringent_0.4.1_upf.tar.gz"

["pd_nc_fr_pbe_standard_0.4_psp8"]
extension = "psp8"
functional = "pbe"
version = "0.4"
git-tree-sha1 = "82ac4c373d1a564f97638f28bc39bcdf076c665a"
lazy = true

[["pd_nc_fr_pbe_standard_0.4_psp8".download]]
sha256 = "7b56901e5a68adf9de79a00cd192904585bb8985f10fc70c3ee9c0c27dbf9467"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_fr_pbe_standard_0.4_psp8.tar.gz"

["pd_paw_pbe_standard_1.1_xml"]
extension = "xml"
functional = "pbe"
Expand All @@ -64,17 +20,6 @@ lazy = true
sha256 = "83c288b1356d4322c51ebef61975e1434bbf5eb303a82d41c0f4b076958b9beb"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_paw_pbe_standard_1.1_xml.tar.gz"

["pd_nc_sr_pbe_stringent_0.4.1_psp8"]
extension = "psp8"
functional = "pbe"
version = "0.4.1"
git-tree-sha1 = "a87b12bba53fc184bf2eef49ab89f76837615cec"
lazy = true

[["pd_nc_sr_pbe_stringent_0.4.1_psp8".download]]
sha256 = "eb7e7845711fe280cc0a5ebfb18c7cbb3c014bdc1ceab1897fd10c41c916775c"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_sr_pbe_stringent_0.4.1_psp8.tar.gz"

["pd_nc_sr_lda_standard_0.4.1_upf"]
extension = "upf"
functional = "lda"
Expand All @@ -86,17 +31,6 @@ lazy = true
sha256 = "7606cfa6d1cfab22ff584c548d13fc37872ec648c5c4f6636ee7b1221277128a"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_sr_lda_standard_0.4.1_upf.tar.gz"

["pd_nc_fr_pbesol_stringent_0.4_psp8"]
extension = "psp8"
functional = "pbesol"
version = "0.4"
git-tree-sha1 = "9b3ace1374e6876109c9f38de8eaa3adc9ee0cfc"
lazy = true

[["pd_nc_fr_pbesol_stringent_0.4_psp8".download]]
sha256 = "d32eae3c40ef4a64520b882378941864166673c94c3d69f067a1be2b3d1fbd12"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_fr_pbesol_stringent_0.4_psp8.tar.gz"

["pd_nc_fr_pbesol_stringent_0.4_upf"]
extension = "upf"
functional = "pbesol"
Expand All @@ -119,17 +53,6 @@ lazy = true
sha256 = "63b71d31f22b06965c9dd484d406d3deb63ea21b58d7b658727f09d210850d72"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_sr_pbe_stringent_0.4.1_upf.tar.gz"

["pd_nc_sr_pbesol_stringent_0.4.1_psp8"]
extension = "psp8"
functional = "pbesol"
version = "0.4.1"
git-tree-sha1 = "d43d8c44e419608c67397263e63ff7c7d7993bd1"
lazy = true

[["pd_nc_sr_pbesol_stringent_0.4.1_psp8".download]]
sha256 = "b2d64feabd3b338f62f66a3e5d50ee285c665d8e76db9ff5a446c993de348707"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_sr_pbesol_stringent_0.4.1_psp8.tar.gz"

["pd_nc_fr_pbesol_standard_0.4_upf"]
extension = "upf"
functional = "pbesol"
Expand All @@ -152,28 +75,6 @@ lazy = true
sha256 = "56a9b15cac540357a67cf33b3219af59962bbaa7d4a1bac5b7dab72ed2462e88"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_sr_pbesol_standard_0.4.1_upf.tar.gz"

["pd_nc_fr_pbe_stringent_0.4_psp8"]
extension = "psp8"
functional = "pbe"
version = "0.4"
git-tree-sha1 = "05bf66898e0e961a583bd46d53eb18fda5fa239c"
lazy = true

[["pd_nc_fr_pbe_stringent_0.4_psp8".download]]
sha256 = "020a3bfbe6a90adf8298272f1f98d617787cc0a622725e32c1f30393b438dc92"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_fr_pbe_stringent_0.4_psp8.tar.gz"

["pd_nc_fr_pbesol_standard_0.4_psp8"]
extension = "psp8"
functional = "pbesol"
version = "0.4"
git-tree-sha1 = "793a9fccb2865d26c160595db36c785a4fbb9b4a"
lazy = true

[["pd_nc_fr_pbesol_standard_0.4_psp8".download]]
sha256 = "b893fe721c51080fe5f3d19724042d6c9e2af2f245169e264b07bc58c7675273"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_fr_pbesol_standard_0.4_psp8.tar.gz"

["pd_nc_sr_pbe_standard_0.4.1_upf"]
extension = "upf"
functional = "pbe"
Expand All @@ -196,17 +97,6 @@ lazy = true
sha256 = "1edd99303e7965091741be4286d9b6e3e1673fa3e8936a24a7ecd33dccc74985"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_fr_pbe_standard_0.4_upf.tar.gz"

["pd_nc_sr_lda_stringent_0.4.1_psp8"]
extension = "psp8"
functional = "lda"
version = "0.4.1"
git-tree-sha1 = "e85a22581ece0447fe495371807db281d59052f8"
lazy = true

[["pd_nc_sr_lda_stringent_0.4.1_psp8".download]]
sha256 = "2ec784ac815d80c6c20d7f51ae7bb9c2ebec491d6225c85f0833cabcc5e12a63"
url = "https://github.com/JuliaMolSim/PseudoLibrary/raw/main/artifacts/pd_nc_sr_lda_stringent_0.4.1_psp8.tar.gz"

["pd_nc_fr_pbe_stringent_0.4_upf"]
extension = "upf"
functional = "pbe"
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PseudoPotentialData"
uuid = "5751a51d-ac76-4487-a056-413ecf6fbe19"
authors = ["Michael F. Herbst <[email protected]> and contributors"]
version = "0.1.2"
version = "0.2.0"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,3 @@ More details on the meaning of these keys is given
in the README of the
[PseudoLibrary](https://github.com/JuliaMolSim/PseudoLibrary/blob/7c4b71a3b9d70a229d757aa6d546ef22b83a85a9/README.md)
repository.

**Warning:**
The current identifiers for the pseudopotential families is planned to be overhauled.
This will be a breaking change, where the minor version of the package will be bumped.
30 changes: 22 additions & 8 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ care to automatically download it as needed.

For example, the following code automatically downloads the pseudopotential
file of the [stringent pseudodojo](http://www.pseudo-dojo.org/) pseudopotential
for LDA pseudopotentials (referred to by the identifier `pd_nc_sr_lda_stringent_0.4.1_upf`)
for LDA pseudopotentials (referred to by the identifier `dojo.nc.sr.lda.v0_4_1.oncvpsp3.standard.upf`)
and places the full path to the downloaded pseudopotential file into the `filename` variable:

```@example index-example
using PseudoPotentialData
identifier = "pd_nc_sr_lda_stringent_0.4.1_upf"
identifier = "dojo.nc.sr.lda.v0_4_1.oncvpsp3.standard.upf"
family = PseudoFamily(identifier)
filename = pseudofile(family, :Si)
```
Expand Down Expand Up @@ -53,18 +53,32 @@ for (k, v) in family
end
```

For a list of available identifiers see
## Available keys and naming convention
A list of available pseudopotential identifiers is available as
```@example index-example
PseudoPotentialData.family_identifiers()
```
More details on the meaning of these keys is given in the README of the

The naming convention is as that each pseudo family name consists
of a list of fields, which are concatenated using a `.` (dot).
These are:
1. An identifier for the pseudo family (like `dojo` for the [PseudoDojo](http://www.pseudo-dojo.org/) family of potentials.
2. The type of pseudopotential (`nc`: norm-conserving, `us`: ultrasoft, `paw`: projected augmented wave)
3. Details on the level of relativistic effects employed when generating the pseudo (`fr`: Full relativistic, `sr`: Scalar relativistic, `nr`: No relativistic)
4. The functional for which the pseudopotential was prepared
5. The version of the pseudopotential construction (with version points replaced by underscores)
6. The program used to generate the pseudopotential
7. Some additional comments specifying the pseudopotential.
E.g. for PseudoDojo potentials there is usually a `stringent` version
(requiring slightly larger cutoffs) and a `standard` version being a bit softer.
8. The format of the pseudopotential files in this library.

More details on the meaning of these keys
will be provided at a later stage.
Some information is also available in the README of the
[PseudoLibrary](https://github.com/JuliaMolSim/PseudoLibrary/blob/7c4b71a3b9d70a229d757aa6d546ef22b83a85a9/README.md)
repository.

!!! warning "Rename of pseudopotential identifier reserved"
The current identifiers for the pseudopotential families is planned to be overhauled.
This will be a breaking change, where the minor version of the package will be bumped.

## Interface

```@autodocs
Expand Down
7 changes: 6 additions & 1 deletion src/PseudoPotentialData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ include("pseudofamily.jl")
function family_identifiers()
artifact_file = find_artifacts_toml(@__FILE__)
@assert !isnothing(artifact_file)
collect(keys(TOML.parsefile(artifact_file)))

# TODO For compatibility already use new keys
artifactmap_inv = Dict(v => k for (k, v) in artifactmap)
map(collect(keys(TOML.parsefile(artifact_file)))) do key
artifactmap_inv[key]
end
end

"""The list of all known pseudopotential families."""
Expand Down
20 changes: 18 additions & 2 deletions src/pseudofamily.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ an element symbol to the full path of the pseudopotential file.
function PseudoFamily(identifier::AbstractString)
artifact_file = find_artifacts_toml(@__FILE__)
@assert !isnothing(artifact_file)
meta = artifact_meta(identifier, artifact_file)
meta = artifact_meta(artifactmap[identifier], artifact_file)
isnothing(meta) && throw(ArgumentError("Invalid pseudo identifier: $identifier"))
PseudoFamily(identifier,
meta["extension"],
Expand All @@ -39,11 +39,27 @@ Base.show(io::IO, ::MIME"text/plain", family::PseudoFamily) = show(io, family)
# Helper functions (not exported)
#

# TODO For compatibility, map new to old ... will disappear at some point
const artifactmap = Dict(
"dojo.nc.fr.pbesol.v0_4.oncvpsp3.standard.upf" => "pd_nc_fr_pbesol_standard_0.4_upf",
"dojo.nc.fr.pbesol.v0_4.oncvpsp3.stringent.upf" => "pd_nc_fr_pbesol_stringent_0.4_upf",
"dojo.nc.fr.pbe.v0_4.oncvpsp3.standard.upf" => "pd_nc_fr_pbe_standard_0.4_upf",
"dojo.nc.fr.pbe.v0_4.oncvpsp3.stringent.upf" => "pd_nc_fr_pbe_stringent_0.4_upf",
"dojo.nc.sr.lda.v0_4_1.oncvpsp3.standard.upf" => "pd_nc_sr_lda_standard_0.4.1_upf",
"dojo.nc.sr.lda.v0_4_1.oncvpsp3.stringent.upf" => "pd_nc_sr_lda_stringent_0.4.1_upf",
"dojo.nc.sr.pbesol.v0_4_1.oncvpsp3.standard.upf" => "pd_nc_sr_pbesol_standard_0.4.1_upf",
"dojo.nc.sr.pbe.v0_4_1.oncvpsp3.standard.upf" => "pd_nc_sr_pbe_standard_0.4.1_upf",
"dojo.nc.sr.pbe.v0_4_1.oncvpsp3.stringent.upf" => "pd_nc_sr_pbe_stringent_0.4.1_upf",
"dojo.paw.pbe.v1_1.jth.standard.xml" => "pd_paw_pbe_standard_1.1_xml",
)

"""
Return the directory containing the pseudo files.
This downloads the artifact if necessary.
"""
artifact_directory(family::PseudoFamily) = (@artifact_str "$(family.identifier)")
function artifact_directory(family::PseudoFamily)
@artifact_str "$(artifactmap[family.identifier])"
end

"""Return the list of all pseudopotential files in the artifact"""
function available_elements(family::PseudoFamily)
Expand Down
7 changes: 3 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Test

@testset "PseudoPotentialData.jl" begin
@testset "Test one family can be loaded" begin
identifier = "pd_nc_sr_lda_stringent_0.4.1_upf"
identifier = "dojo.nc.sr.lda.v0_4_1.oncvpsp3.stringent.upf"
family = PseudoFamily(identifier)
@test family.identifier == identifier
@test family.extension == "upf"
Expand Down Expand Up @@ -36,8 +36,7 @@ using Test
end

@testset "Dict interface of PseudoFamily" begin
identifier = "pd_nc_sr_pbe_stringent_0.4.1_upf"
family = PseudoFamily(identifier)
family = PseudoFamily("dojo.nc.sr.pbe.v0_4_1.oncvpsp3.stringent.upf")
@test length(family) == 72
@test :Si in keys(family)
@test !(:Uub in keys(family))
Expand All @@ -51,7 +50,7 @@ using Test

@testset "Printing of family objects" begin
io = IOBuffer()
show(io, PseudoFamily("pd_nc_sr_pbe_stringent_0.4.1_upf"))
show(io, PseudoFamily("dojo.nc.sr.pbe.v0_4_1.oncvpsp3.stringent.upf"))
@test occursin("PseudoFamily", String(take!(io)))
end
end