Skip to content

Commit ace1102

Browse files
committed
Rename project
1 parent 08fe9b6 commit ace1102

File tree

9 files changed

+130
-130
lines changed

9 files changed

+130
-130
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ jobs:
7272
shell: julia --project=docs --color=yes {0}
7373
run: |
7474
using Documenter: DocMeta, doctest
75-
using PseudoLibraries
76-
DocMeta.setdocmeta!(PseudoLibraries, :DocTestSetup, :(using PseudoLibraries); recursive=true)
77-
doctest(PseudoLibraries)
75+
using PseudoPotentialData
76+
DocMeta.setdocmeta!(PseudoPotentialData, :DocTestSetup, :(using PseudoPotentialData); recursive=true)
77+
doctest(PseudoPotentialData)

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name = "PseudoLibraries"
1+
name = "PseudoPotentialData"
22
uuid = "5751a51d-ac76-4487-a056-413ecf6fbe19"
33
authors = ["Michael F. Herbst <info@michael-herbst.com> and contributors"]
44
version = "0.1.0"

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
1-
# PseudoLibraries
1+
# PseudoPotentialData
22

3-
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliamolsim.github.io/PseudoLibraries.jl/stable/)
4-
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliamolsim.github.io/PseudoLibraries.jl/dev/)
5-
[![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)
6-
[![Coverage](https://codecov.io/gh/JuliaMolSim/PseudoLibraries.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaMolSim/PseudoLibraries.jl)
3+
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliamolsim.github.io/PseudoPotentialData.jl/stable/)
4+
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliamolsim.github.io/PseudoPotentialData.jl/dev/)
5+
[![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)
6+
[![Coverage](https://codecov.io/gh/JuliaMolSim/PseudoPotentialData.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaMolSim/PseudoPotentialData.jl)
77

88
Package providing programmatic access
9-
to standard pseudopotentials in solid-state calculations.
10-
In using this library the combination of a string identifier and the element
9+
to standard pseudopotential data files for solid-state calculations.
10+
The combination of a string identifier for the
11+
pseudopotential family and the element
1112
symbol provides a unique and reproducible mapping to a pseudopotential file.
12-
Moreover in case the pseudopotential file
13-
happens to be missing on the computer Julia's artifact system takes
14-
care to automatically download it as needed.
13+
In case the pseudopotential data file happens to be missing on the computer
14+
it will be automatically download as needed.
1515

1616
For example, the following code automatically downloads the pseudopotential
17-
file of the [stringent pseudodojo](http://www.pseudo-dojo.org/) pseudopotential
18-
for LDA pseudopotentials (referred to by the identifier `pd_nc_sr_lda_stringent_0.4.1_upf`)
19-
and places the full path to the downloaded pseudopotential file into the `filename` variable:
17+
file for silicon of the [stringent pseudodojo](http://www.pseudo-dojo.org/)
18+
family for LDA pseudopotentials
19+
(referred to by the identifier `pd_nc_sr_lda_stringent_0.4.1_upf`)
20+
and places the full path to the downloaded pseudopotential file
21+
into the `filename` variable:
2022

2123
```julia
22-
using PseudoLibraries
24+
using PseudoPotentialData
2325
identifier = "pd_nc_sr_lda_stringent_0.4.1_upf"
24-
library = PseudoLibrary(identifier)
25-
filename = pseudofile(library, :Si)
26+
family = PseudoFamily(identifier)
27+
filename = pseudofile(family, :Si)
2628
```
2729

2830
For a list of available identifiers see
2931
```julia
30-
PseudoLibraries.available_identifiers()
32+
PseudoPotentialData.family_identifiers()
3133
```
3234
More details on the meaning of these keys is given
3335
in the README of the

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3-
PseudoLibraries = "5751a51d-ac76-4487-a056-413ecf6fbe19"
3+
PseudoPotentialData = "5751a51d-ac76-4487-a056-413ecf6fbe19"

docs/make.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
using PseudoLibraries
1+
using PseudoPotentialData
22
using Documenter
33

4-
DocMeta.setdocmeta!(PseudoLibraries, :DocTestSetup, :(using PseudoLibraries); recursive=true)
4+
DocMeta.setdocmeta!(PseudoPotentialData, :DocTestSetup, :(using PseudoPotentialData); recursive=true)
55

66
makedocs(;
7-
modules=[PseudoLibraries],
7+
modules=[PseudoPotentialData],
88
authors="Michael F. Herbst <info@michael-herbst.com> and contributors",
9-
sitename="PseudoLibraries.jl",
9+
sitename="PseudoPotentialData.jl",
1010
format=Documenter.HTML(;
11-
canonical="https://juliamolsim.github.io/PseudoLibraries.jl",
11+
canonical="https://juliamolsim.github.io/PseudoPotentialData.jl",
1212
edit_link="master",
1313
assets=String[],
1414
),
@@ -18,6 +18,6 @@ makedocs(;
1818
)
1919

2020
deploydocs(;
21-
repo="github.com/JuliaMolSim/PseudoLibraries.jl",
21+
repo="github.com/JuliaMolSim/PseudoPotentialData.jl",
2222
devbranch="master",
2323
)

docs/src/index.md

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
```@meta
2-
CurrentModule = PseudoLibraries
2+
CurrentModule = PseudoPotentialData
33
```
44

5-
# PseudoLibraries
5+
# PseudoPotentialData
66

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

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

37-
An alternative version to achieve the same thing as above is
37+
For multiple elements you can similarly use
3838
```@example index-example
39-
filename = pseudofile(library, :Si)
40-
```
41-
or for multiple elements:
42-
```@example index-example
43-
pseudofile.(library, [:C, :Si])
39+
pseudofile.(family, [:C, :Si])
4440
```
4541

46-
Some metadata information is stored in the `library` object:
42+
Some metadata information is stored in the `family` object:
4743
```@example index-example
48-
library
44+
family
4945
```
5046

5147
For a list of available identifiers see
5248
```@example index-example
53-
PseudoLibraries.available_identifiers()
49+
PseudoPotentialData.family_identifiers()
5450
```
55-
More details on the meaning of these keys is given
56-
in the README of thei
51+
More details on the meaning of these keys is given in the README of the
5752
[PseudoLibrary](https://github.com/JuliaMolSim/PseudoLibrary/blob/7c4b71a3b9d70a229d757aa6d546ef22b83a85a9/README.md)
5853
repository.
5954

@@ -64,5 +59,5 @@ repository.
6459
## Interface
6560

6661
```@autodocs
67-
Modules = [PseudoLibraries]
62+
Modules = [PseudoPotentialData]
6863
```

src/PseudoLibraries.jl

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/PseudoPotentialData.jl

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
module PseudoPotentialData
2+
using Artifacts
3+
using Compat: @compat
4+
using LazyArtifacts
5+
using TOML
6+
7+
export PseudoFamily, pseudofile
8+
@compat public families
9+
@compat public family_identifiers
10+
11+
struct PseudoFamily
12+
identifier::String
13+
# metadata
14+
extension::String # Filename expected as $(symbol).$(extension)
15+
functional::String # DFT functional keyword (or "" if unspecified)
16+
version::VersionNumber
17+
# TODO More things will probably follow
18+
# - Type of pseudisation (norm-conserving, PAW, ...)
19+
# - References to papers describing these pseudopotentials
20+
# - Elements available
21+
end
22+
23+
"""
24+
Construction of a PseudoFamily from a `identifier` representing
25+
the pseudopotential family to use.
26+
"""
27+
function PseudoFamily(identifier::AbstractString)
28+
artifact_file = find_artifacts_toml(@__FILE__)
29+
@assert !isnothing(artifact_file)
30+
meta = artifact_meta(identifier, artifact_file)
31+
isnothing(meta) && throw(ArgumentError("Invalid pseudo identifier: $identifier"))
32+
PseudoFamily(identifier,
33+
meta["extension"],
34+
meta["functional"],
35+
VersionNumber(meta["version"]))
36+
end
37+
38+
Base.Broadcast.broadcastable(l::PseudoFamily) = Ref(l)
39+
40+
41+
"""Get the list of available pseudopotential family identifiers."""
42+
function family_identifiers()
43+
artifact_file = find_artifacts_toml(@__FILE__)
44+
@assert !isnothing(artifact_file)
45+
collect(keys(TOML.parsefile(artifact_file)))
46+
end
47+
48+
"""The list of all known pseudopotential families."""
49+
const families = map(PseudoFamily, family_identifiers())
50+
51+
52+
"""
53+
Return the directory containing the pseudo files.
54+
This downloads the artifact if necessary.
55+
"""
56+
artifact_directory(family::PseudoFamily) = (@artifact_str "$(family.identifier)")
57+
58+
"""
59+
Get the full path to the file containing the pseudopotential information
60+
for a particular element and a particular pseudopotential `family`.
61+
The family can be specified as an identifier or an object.
62+
"""
63+
function pseudofile(family::PseudoFamily, element::Symbol)
64+
file = joinpath(artifact_directory(family), "$(element)." * family.extension)
65+
isfile(file) || throw(KeyError(element))
66+
file
67+
end
68+
function pseudofile(family::AbstractString, element::Symbol)
69+
pseudofile(PseudoFamily(family), element)
70+
end
71+
72+
end

test/runtests.jl

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
using PseudoLibraries
1+
using PseudoPotentialData
22
using Test
33

4-
@testset "PseudoLibraries.jl" begin
5-
@testset "Test one library can be loaded" begin
4+
@testset "PseudoPotentialData.jl" begin
5+
@testset "Test one family can be loaded" begin
66
identifier = "pd_nc_sr_lda_stringent_0.4.1_upf"
7-
library = PseudoLibrary(identifier)
8-
@test library.identifier == identifier
9-
@test library.extension == "upf"
10-
@test library.functional == "lda"
11-
@test library.version == v"0.4.1"
7+
family = PseudoFamily(identifier)
8+
@test family.identifier == identifier
9+
@test family.extension == "upf"
10+
@test family.functional == "lda"
11+
@test family.version == v"0.4.1"
1212

1313
file = pseudofile("pd_nc_sr_lda_stringent_0.4.1_upf", :Si)
1414
@test basename(file) == "Si.upf"
15-
@test file == pseudofile(library, :Si)
16-
@test file == library[:Si]
15+
@test file == pseudofile(family, :Si)
1716

18-
files = pseudofile.(library, [:Si, :Si])
17+
files = pseudofile.(family, [:Si, :Si])
1918
@test all(isequal(file), files)
2019

21-
@test_throws KeyError library[:Uun]
22-
@test_throws KeyError pseudofile(library, :Uun)
23-
@test_throws KeyError pseudofile(library, :Uun)
20+
@test_throws KeyError pseudofile(family, :Uun)
21+
@test_throws KeyError pseudofile(identifier, :Uub)
2422
end
2523

2624
@testset "Test all libraries can be loaded" begin
27-
for identifier in PseudoLibraries.available_identifiers()
28-
library = PseudoLibrary(identifier)
29-
@test library.identifier == identifier
25+
for identifier in PseudoPotentialData.family_identifiers()
26+
family = PseudoFamily(identifier)
27+
@test family.identifier == identifier
3028
end
3129
end
3230
end

0 commit comments

Comments
 (0)