Skip to content

Commit

Permalink
Rename project
Browse files Browse the repository at this point in the history
  • Loading branch information
mfherbst committed Nov 10, 2024
1 parent 08fe9b6 commit ace1102
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 130 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
shell: julia --project=docs --color=yes {0}
run: |
using Documenter: DocMeta, doctest
using PseudoLibraries
DocMeta.setdocmeta!(PseudoLibraries, :DocTestSetup, :(using PseudoLibraries); recursive=true)
doctest(PseudoLibraries)
using PseudoPotentialData
DocMeta.setdocmeta!(PseudoPotentialData, :DocTestSetup, :(using PseudoPotentialData); recursive=true)
doctest(PseudoPotentialData)
2 changes: 1 addition & 1 deletion Project.toml
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"
Expand Down
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
# PseudoLibraries
# PseudoPotentialData

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliamolsim.github.io/PseudoLibraries.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliamolsim.github.io/PseudoLibraries.jl/dev/)
[![Build Status](https://github.com/JuliaMolSim/PseudoLibraries.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/JuliaMolSim/PseudoLibraries.jl/actions/workflows/CI.yml?query=branch%3Amaster)
[![Coverage](https://codecov.io/gh/JuliaMolSim/PseudoLibraries.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaMolSim/PseudoLibraries.jl)
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliamolsim.github.io/PseudoPotentialData.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliamolsim.github.io/PseudoPotentialData.jl/dev/)
[![Build Status](https://github.com/JuliaMolSim/PseudoPotentialData.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/JuliaMolSim/PseudoPotentialData.jl/actions/workflows/CI.yml?query=branch%3Amaster)
[![Coverage](https://codecov.io/gh/JuliaMolSim/PseudoPotentialData.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaMolSim/PseudoPotentialData.jl)

Package providing programmatic access
to standard pseudopotentials in solid-state calculations.
In using this library the combination of a string identifier and the element
to standard pseudopotential data files for solid-state calculations.
The combination of a string identifier for the
pseudopotential family and the element
symbol provides a unique and reproducible mapping to a pseudopotential file.
Moreover in case the pseudopotential file
happens to be missing on the computer Julia's artifact system takes
care to automatically download it as needed.
In case the pseudopotential data file happens to be missing on the computer
it will be automatically download 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`)
and places the full path to the downloaded pseudopotential file into the `filename` variable:
file for silicon of the [stringent pseudodojo](http://www.pseudo-dojo.org/)
family for LDA pseudopotentials
(referred to by the identifier `pd_nc_sr_lda_stringent_0.4.1_upf`)
and places the full path to the downloaded pseudopotential file
into the `filename` variable:

```julia
using PseudoLibraries
using PseudoPotentialData
identifier = "pd_nc_sr_lda_stringent_0.4.1_upf"
library = PseudoLibrary(identifier)
filename = pseudofile(library, :Si)
family = PseudoFamily(identifier)
filename = pseudofile(family, :Si)
```

For a list of available identifiers see
```julia
PseudoLibraries.available_identifiers()
PseudoPotentialData.family_identifiers()
```
More details on the meaning of these keys is given
in the README of the
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
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"
12 changes: 6 additions & 6 deletions docs/make.jl
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[],
),
Expand All @@ -18,6 +18,6 @@ makedocs(;
)

deploydocs(;
repo="github.com/JuliaMolSim/PseudoLibraries.jl",
repo="github.com/JuliaMolSim/PseudoPotentialData.jl",
devbranch="master",
)
31 changes: 13 additions & 18 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
```@meta
CurrentModule = PseudoLibraries
CurrentModule = PseudoPotentialData
```

# PseudoLibraries
# PseudoPotentialData

Enables programmatic access to
standard pseudopotential libraries in solid-state calculations.
standard pseudopotential libraries for solid-state calculations.
In using this library the combination of a string identifier and the element
symbol provides a unique and reproducible mapping to a pseudopotential file.
Moreover in case the pseudopotential file
Expand All @@ -20,10 +20,10 @@ for LDA pseudopotentials (referred to by the identifier `pd_nc_sr_lda_stringent_
and places the full path to the downloaded pseudopotential file into the `filename` variable:

```@example index-example
using PseudoLibraries
using PseudoPotentialData
identifier = "pd_nc_sr_lda_stringent_0.4.1_upf"
library = PseudoLibrary(identifier)
filename = library[:Si]
family = PseudoFamily(identifier)
filename = pseudofile(family, :Si)
```
As you see this will be a string such as
`/home/user/.julia/artifacts/56094b8162385233890d523c827ba06e07566079/Si.upf`,
Expand All @@ -34,26 +34,21 @@ It is therefore highly recommended to use the above mechanism
based on `identfier` and element symbol instead of hard-coding
the expanded path in user scripts.

An alternative version to achieve the same thing as above is
For multiple elements you can similarly use
```@example index-example
filename = pseudofile(library, :Si)
```
or for multiple elements:
```@example index-example
pseudofile.(library, [:C, :Si])
pseudofile.(family, [:C, :Si])
```

Some metadata information is stored in the `library` object:
Some metadata information is stored in the `family` object:
```@example index-example
library
family
```

For a list of available identifiers see
```@example index-example
PseudoLibraries.available_identifiers()
PseudoPotentialData.family_identifiers()
```
More details on the meaning of these keys is given
in the README of thei
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.

Expand All @@ -64,5 +59,5 @@ repository.
## Interface

```@autodocs
Modules = [PseudoLibraries]
Modules = [PseudoPotentialData]
```
67 changes: 0 additions & 67 deletions src/PseudoLibraries.jl

This file was deleted.

72 changes: 72 additions & 0 deletions src/PseudoPotentialData.jl
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
32 changes: 15 additions & 17 deletions test/runtests.jl
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

2 comments on commit ace1102

@mfherbst
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

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.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

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:

git tag -a v0.1.0 -m "<description of version>" ace1102f0400bde9f5514fba25b06ab32d48d28e
git push origin v0.1.0

Please sign in to comment.