From 7e60079b3386853c497c132ffbdaea88ee197142 Mon Sep 17 00:00:00 2001 From: "Michael F. Herbst" Date: Fri, 29 Nov 2024 21:01:23 +0100 Subject: [PATCH] New naming convention (#7) * Change names suggestion * Bump version * fix * Update documentation --- Artifacts.toml | 110 ------------------------------------- Project.toml | 2 +- README.md | 4 -- docs/src/index.md | 30 +++++++--- src/PseudoPotentialData.jl | 7 ++- src/pseudofamily.jl | 20 ++++++- test/runtests.jl | 7 +-- 7 files changed, 50 insertions(+), 130 deletions(-) diff --git a/Artifacts.toml b/Artifacts.toml index be66dbe..4c89d98 100644 --- a/Artifacts.toml +++ b/Artifacts.toml @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" diff --git a/Project.toml b/Project.toml index 91173ba..ed198ed 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PseudoPotentialData" uuid = "5751a51d-ac76-4487-a056-413ecf6fbe19" authors = ["Michael F. Herbst and contributors"] -version = "0.1.2" +version = "0.2.0" [deps] Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" diff --git a/README.md b/README.md index 81aa317..e1e5bcd 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/docs/src/index.md b/docs/src/index.md index bbab15e..4757873 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -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) ``` @@ -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 diff --git a/src/PseudoPotentialData.jl b/src/PseudoPotentialData.jl index 61d32c7..cb29ae7 100644 --- a/src/PseudoPotentialData.jl +++ b/src/PseudoPotentialData.jl @@ -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.""" diff --git a/src/pseudofamily.jl b/src/pseudofamily.jl index c335687..66891df 100644 --- a/src/pseudofamily.jl +++ b/src/pseudofamily.jl @@ -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"], @@ -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) diff --git a/test/runtests.jl b/test/runtests.jl index 1140aff..7a0bb46 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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" @@ -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)) @@ -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