Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend Formula for AtomicPositionsCard & PWInput #194

Merged
merged 3 commits into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "0.8.0"

[deps]
AbInitioSoftwareBase = "df5135bc-470e-46c6-b451-292e27ca5b84"
ChemicalFormula = "069161ab-964a-4228-89a0-7a676f2e1f46"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
CrystallographyBase = "93b1d1cd-a8ea-4aa5-adb1-b2407ea0ba8d"
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
Expand Down
13 changes: 5 additions & 8 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using QuantumESPRESSOBase
using Documenter

DocMeta.setdocmeta!(QuantumESPRESSOBase, :DocTestSetup, :(using QuantumESPRESSOBase); recursive=true)
DocMeta.setdocmeta!(
QuantumESPRESSOBase, :DocTestSetup, :(using QuantumESPRESSOBase); recursive=true
)

makedocs(;
modules=[QuantumESPRESSOBase],
Expand All @@ -16,9 +18,7 @@ makedocs(;
),
pages=[
"Home" => "index.md",
"Manual" => [
"Installation Guide" => "installation.md",
],
"Manual" => ["Installation Guide" => "installation.md"],
"Public API" => [
"`QuantumESPRESSOBase` module" => "api/api.md",
"`Inputs` module" => "api/Inputs/Inputs.md",
Expand All @@ -34,7 +34,4 @@ makedocs(;
],
)

deploydocs(;
repo="github.com/MineralsCloud/QuantumESPRESSOBase.jl",
devbranch="main",
)
deploydocs(; repo="github.com/MineralsCloud/QuantumESPRESSOBase.jl", devbranch="main")
11 changes: 11 additions & 0 deletions src/Inputs/PWscf/crystallography.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using ChemicalFormula: sumformula
using CrystallographyBase: CartesianFromFractional
using LinearAlgebra: det
using Spglib: get_dataset

using ..Inputs: Ibrav

import CrystallographyBase: Cell, crystaldensity
import ChemicalFormula: Formula

export find_symmetry

Expand Down Expand Up @@ -148,3 +150,12 @@ function find_symmetry(input::PWInput, symprec=1e-5)
dataset = get_dataset(cell, symprec)
return dataset
end

function Formula(card::AtomicPositionsCard)
atoms = map(card.data) do position
filter(isletter, position.atom)
end
str = join(symbol^count(atom == symbol for atom in atoms) for symbol in unique(atoms))
return Formula(sumformula(Formula(str)))
end
Formula(input::PWInput) = Formula(input.atomic_positions)