Skip to content

Commit

Permalink
Fix leftover getoption forgot in #197
Browse files Browse the repository at this point in the history
  • Loading branch information
singularitti committed Mar 5, 2023
1 parent 5dea071 commit bd6e78c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/Inputs/Inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Inputs
using AbInitioSoftwareBase.Inputs: Input, InputEntry, Namelist, Card, Setter, groupname
using OrderedCollections: OrderedDict

export optionof,
export getoption,
optionpool,
groupname,
required_namelists,
Expand Down Expand Up @@ -43,14 +43,14 @@ function dropdefault(nml::Namelist)
end

"""
optionof(x::Card)
getoption(card::Card)
Return a `String` representing the option for `Card` `x`.
Return a `String` representing the option of a `Card`.
!!! warning
Do not use `x.option` to access a `Card`'s `option`.
Do not use `card.option` to access the option since it may not exist.
"""
optionof(card::Card) = hasfield(typeof(card), :option) ? getfield(card, :option) : nothing
getoption(card::Card) = hasproperty(card, :option) ? getproperty(card, :option) : ""

"""
optionpool(T::Type{<:Card})
Expand Down
3 changes: 1 addition & 2 deletions src/Inputs/PWscf/PWscf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ using ..Inputs: QuantumESPRESSOInput, VerbositySetter
import AbInitioSoftwareBase.Inputs: groupname, getpseudodir, getpotentials
import CrystallographyBase: Lattice, cellvolume
# import Pseudopotentials: pseudoformat
import ..Inputs: optionof

export optionof, groupname
export groupname

include("namelists.jl")
include("cards.jl")
Expand Down
9 changes: 1 addition & 8 deletions src/Inputs/PWscf/cards.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using ConstructionBase: constructorof
using CrystallographyBase: Cell, ReciprocalPoint, MonkhorstPackGrid
using StaticArrays: MVector, MMatrix

import ..Inputs: optionpool
import ..Inputs: getoption, optionpool

export AtomicSpecies,
AtomicSpeciesCard,
Expand Down Expand Up @@ -249,13 +249,6 @@ Represent the `K_POINTS` card in QE.
end
end

"""
getoption(card::Card)
Return the option of a `Card`.
"""
getoption(card::Card) = card.option
getoption(::Union{AtomicSpeciesCard,AtomicForcesCard}) = ""
getoption(::KMeshCard) = "automatic"
getoption(::GammaPointCard) = "gamma"

Expand Down
2 changes: 1 addition & 1 deletion src/Inputs/PWscf/set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function (x::CellParametersCardSetter)(template::PWInput)
if isnothing(template.cell_parameters) ||
getoption(template.cell_parameters) == "alat"
@set! template.system.celldm = [template.system.celldm[1]]
else # optionof(template.cell_parameters) is "bohr" or "angstrom"
else # getoption(template.cell_parameters) is "bohr" or "angstrom"
throw(InsufficientInfoError("the `CellParametersCard` does not have units!"))
end
else # "bohr" or "angstrom"
Expand Down

0 comments on commit bd6e78c

Please sign in to comment.