-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
130 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name = "PseudoLibraries" | ||
name = "PseudoPotentialData" | ||
uuid = "5751a51d-ac76-4487-a056-413ecf6fbe19" | ||
authors = ["Michael F. Herbst <[email protected]> and contributors"] | ||
version = "0.1.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
PseudoLibraries = "5751a51d-ac76-4487-a056-413ecf6fbe19" | ||
PseudoPotentialData = "5751a51d-ac76-4487-a056-413ecf6fbe19" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
using PseudoLibraries | ||
using PseudoPotentialData | ||
using Documenter | ||
|
||
DocMeta.setdocmeta!(PseudoLibraries, :DocTestSetup, :(using PseudoLibraries); recursive=true) | ||
DocMeta.setdocmeta!(PseudoPotentialData, :DocTestSetup, :(using PseudoPotentialData); recursive=true) | ||
|
||
makedocs(; | ||
modules=[PseudoLibraries], | ||
modules=[PseudoPotentialData], | ||
authors="Michael F. Herbst <[email protected]> and contributors", | ||
sitename="PseudoLibraries.jl", | ||
sitename="PseudoPotentialData.jl", | ||
format=Documenter.HTML(; | ||
canonical="https://juliamolsim.github.io/PseudoLibraries.jl", | ||
canonical="https://juliamolsim.github.io/PseudoPotentialData.jl", | ||
edit_link="master", | ||
assets=String[], | ||
), | ||
|
@@ -18,6 +18,6 @@ makedocs(; | |
) | ||
|
||
deploydocs(; | ||
repo="github.com/JuliaMolSim/PseudoLibraries.jl", | ||
repo="github.com/JuliaMolSim/PseudoPotentialData.jl", | ||
devbranch="master", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
module PseudoPotentialData | ||
using Artifacts | ||
using Compat: @compat | ||
using LazyArtifacts | ||
using TOML | ||
|
||
export PseudoFamily, pseudofile | ||
@compat public families | ||
@compat public family_identifiers | ||
|
||
struct PseudoFamily | ||
identifier::String | ||
# metadata | ||
extension::String # Filename expected as $(symbol).$(extension) | ||
functional::String # DFT functional keyword (or "" if unspecified) | ||
version::VersionNumber | ||
# TODO More things will probably follow | ||
# - Type of pseudisation (norm-conserving, PAW, ...) | ||
# - References to papers describing these pseudopotentials | ||
# - Elements available | ||
end | ||
|
||
""" | ||
Construction of a PseudoFamily from a `identifier` representing | ||
the pseudopotential family to use. | ||
""" | ||
function PseudoFamily(identifier::AbstractString) | ||
artifact_file = find_artifacts_toml(@__FILE__) | ||
@assert !isnothing(artifact_file) | ||
meta = artifact_meta(identifier, artifact_file) | ||
isnothing(meta) && throw(ArgumentError("Invalid pseudo identifier: $identifier")) | ||
PseudoFamily(identifier, | ||
meta["extension"], | ||
meta["functional"], | ||
VersionNumber(meta["version"])) | ||
end | ||
|
||
Base.Broadcast.broadcastable(l::PseudoFamily) = Ref(l) | ||
|
||
|
||
"""Get the list of available pseudopotential family identifiers.""" | ||
function family_identifiers() | ||
artifact_file = find_artifacts_toml(@__FILE__) | ||
@assert !isnothing(artifact_file) | ||
collect(keys(TOML.parsefile(artifact_file))) | ||
end | ||
|
||
"""The list of all known pseudopotential families.""" | ||
const families = map(PseudoFamily, family_identifiers()) | ||
|
||
|
||
""" | ||
Return the directory containing the pseudo files. | ||
This downloads the artifact if necessary. | ||
""" | ||
artifact_directory(family::PseudoFamily) = (@artifact_str "$(family.identifier)") | ||
|
||
""" | ||
Get the full path to the file containing the pseudopotential information | ||
for a particular element and a particular pseudopotential `family`. | ||
The family can be specified as an identifier or an object. | ||
""" | ||
function pseudofile(family::PseudoFamily, element::Symbol) | ||
file = joinpath(artifact_directory(family), "$(element)." * family.extension) | ||
isfile(file) || throw(KeyError(element)) | ||
file | ||
end | ||
function pseudofile(family::AbstractString, element::Symbol) | ||
pseudofile(PseudoFamily(family), element) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
using PseudoLibraries | ||
using PseudoPotentialData | ||
using Test | ||
|
||
@testset "PseudoLibraries.jl" begin | ||
@testset "Test one library can be loaded" begin | ||
@testset "PseudoPotentialData.jl" begin | ||
@testset "Test one family can be loaded" begin | ||
identifier = "pd_nc_sr_lda_stringent_0.4.1_upf" | ||
library = PseudoLibrary(identifier) | ||
@test library.identifier == identifier | ||
@test library.extension == "upf" | ||
@test library.functional == "lda" | ||
@test library.version == v"0.4.1" | ||
family = PseudoFamily(identifier) | ||
@test family.identifier == identifier | ||
@test family.extension == "upf" | ||
@test family.functional == "lda" | ||
@test family.version == v"0.4.1" | ||
|
||
file = pseudofile("pd_nc_sr_lda_stringent_0.4.1_upf", :Si) | ||
@test basename(file) == "Si.upf" | ||
@test file == pseudofile(library, :Si) | ||
@test file == library[:Si] | ||
@test file == pseudofile(family, :Si) | ||
|
||
files = pseudofile.(library, [:Si, :Si]) | ||
files = pseudofile.(family, [:Si, :Si]) | ||
@test all(isequal(file), files) | ||
|
||
@test_throws KeyError library[:Uun] | ||
@test_throws KeyError pseudofile(library, :Uun) | ||
@test_throws KeyError pseudofile(library, :Uun) | ||
@test_throws KeyError pseudofile(family, :Uun) | ||
@test_throws KeyError pseudofile(identifier, :Uub) | ||
end | ||
|
||
@testset "Test all libraries can be loaded" begin | ||
for identifier in PseudoLibraries.available_identifiers() | ||
library = PseudoLibrary(identifier) | ||
@test library.identifier == identifier | ||
for identifier in PseudoPotentialData.family_identifiers() | ||
family = PseudoFamily(identifier) | ||
@test family.identifier == identifier | ||
end | ||
end | ||
end |
ace1102
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
ace1102
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/119113
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: