Skip to content

Commit

Permalink
Parse n_electrons from QE xml
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaojunfeng committed Dec 5, 2023
1 parent 5249115 commit aa71c65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/qe/xml.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function read_qe_xml(filename::AbstractString)
end
kpoints = Vec3{Float64}[]

n_electrons = parse(Float64, findfirst("nelec", band_structure).content)
fermi_energy = parse(Float64, findfirst("fermi_energy", band_structure).content)
# Hartree to eV
fermi_energy *= AUTOEV
Expand Down Expand Up @@ -120,7 +121,14 @@ function read_qe_xml(filename::AbstractString)
recip_lattice = Mat3(recip_lattice)

results = (;
lattice, atom_positions, atom_labels, recip_lattice, kpoints, fermi_energy, alat
lattice,
atom_positions,
atom_labels,
recip_lattice,
kpoints,
n_electrons,
fermi_energy,
alat,
)
if lsda && !spinorbit
return (; results..., eigenvalues_up, eigenvalues_dn)
Expand Down
1 change: 1 addition & 0 deletions test/qe/xml.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
@test qe.eigenvalues[1] eigenvalues1
@test qe.eigenvalues[end] eigenvalues511

@test qe.n_electrons 8.0
@test qe.fermi_energy 6.528341904366175
@test qe.alat 3.8399645884368714
end
Expand Down

0 comments on commit aa71c65

Please sign in to comment.