pw.x
Index
QuantumEspressoIO.read_atomic_positions!QuantumEspressoIO.read_atomic_species!QuantumEspressoIO.read_cell_parameters!QuantumEspressoIO.read_k_points!QuantumEspressoIO.read_pw_inQuantumEspressoIO.read_structuresQuantumEspressoIO.write_atomic_positionsQuantumEspressoIO.write_atomic_speciesQuantumEspressoIO.write_cell_parametersQuantumEspressoIO.write_k_pointsQuantumEspressoIO.write_pw_inQuantumEspressoIO.write_pw_in
Documentation
QuantumEspressoIO.read_atomic_positions! — Method
read_atomic_positions!(lines, n_atoms)
Parse the atomic_positions card of pw.x input.
Arguments
lines::AbstractVector: The lines of the input file.n_atoms::Integer: The number of atoms in theatomic_positionscard.
Returns
- A
Pairof card name to card content. The card option is stored under the:optionkey in the card content.
Examples
lines = [
"ATOMIC_POSITIONS crystal",
"! a comment line",
"Si 0.0000000000 0.0000000000 0.0000000000",
"O 0.5000000000 0.5000000000 0.5000000000",
"following line",
]
n_atoms = 2
card = read_atomic_positions!(lines, n_atoms)
println(card)
println(lines)
# output
:atomic_positions => OrderedCollections.OrderedDict{Symbol, Any}(:option => "crystal", :atoms => ["Si", "O"], :positions => StaticArraysCore.SVector{3, Float64}[[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]])
["following line"]QuantumEspressoIO.read_atomic_species! — Method
read_atomic_species!(lines, n_species)
Parse the atomic_species card of pw.x input.
Arguments
lines::AbstractVector: The lines of the input file.n_species::Integer: The number of species in theatomic_speciescard.
Returns
- A
Pairof card name to card content. The card option is stored under the:optionkey in the card content.
Examples
lines = [
"ATOMIC_SPECIES",
"! a comment line",
"Si 28.085500 Si.upf",
"O 15.999000 O.upf",
"following line",
];
n_species = 2;
card = read_atomic_species!(lines, n_species)
println(card)
println(lines)
# output
:atomic_species => OrderedCollections.OrderedDict{Symbol, Any}(:option => nothing, :species => ["Si", "O"], :masses => [28.0855, 15.999], :pseudos => ["Si.upf", "O.upf"])
["following line"]QuantumEspressoIO.read_cell_parameters! — Method
read_cell_parameters!(lines)
Parse the cell_parameters card of pw.x input.
Arguments
lines::AbstractVector: The lines of the input file.
Examples
lines = [
"CELL_PARAMETERS angstrom",
"! a comment line",
"1.0 0.0 0.0",
"0.0 2.0 0.0",
"0.0 0.0 3.0",
"following line",
]
card = read_cell_parameters!(lines)
println(card)
println(lines)
# output
:cell_parameters => OrderedCollections.OrderedDict{Symbol, Any}(:option => "angstrom", :cell => StaticArraysCore.SVector{3, Float64}[[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]])
["following line"]QuantumEspressoIO.read_k_points! — Method
read_k_points!(lines; name)
Parse the k_points card of pw.x input.
Arguments
lines::AbstractVector: The lines of the input file.
Returns
- A
Pairof card name to card content. The card option is stored under the:optionkey in the card content.
Examples
lines = [
"K_POINTS crystal",
"! a comment line",
"2",
"0.0 0.0 0.0 1.0",
"0.5 0.5 0.5 1.0",
"following line",
]
card = read_k_points!(lines)
println(card)
println(lines)
# output
:k_points => OrderedCollections.OrderedDict{Symbol, Any}(:option => "crystal", :kpoints => StaticArraysCore.SVector{3, Float64}[[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]], :kweights => [1.0, 1.0])
["following line"]QuantumEspressoIO.read_pw_in — Method
read_pw_in(io)
Read the pw.x input file.
Arguments
io::Union{IO,AbstractString}: The IO stream or filename to read from.
Returns
- A dictionary of namelists and cards. The keys are the names of the namelists or cards.
Examples
io = IOBuffer("""
&control
calculation = "scf"
/
&system
ibrav = 0
nat = 2
ntyp = 2
/
ATOMIC_SPECIES
Si 28.085500 Si.upf
O 15.999000 O.upf
ATOMIC_POSITIONS crystal
Si 0.0000000000 0.0000000000 0.0000000000
O 0.5000000000 0.5000000000 0.5000000000
CELL_PARAMETERS angstrom
1.0 0.0 0.0
0.0 2.0 0.0
0.0 0.0 3.0
K_POINTS crystal
2
0.0000000000 0.0000000000 0.0000000000 1.0000000000
0.5000000000 0.5000000000 0.5000000000 1.0000000000
""")
inputs = read_pw_in(io)
println(inputs)
# output
OrderedCollections.OrderedDict{Symbol, Any}(:control => OrderedCollections.OrderedDict{Symbol, Any}(:calculation => "scf"), :system => OrderedCollections.OrderedDict{Symbol, Any}(:ibrav => 0, :nat => 2, :ntyp => 2), :atomic_species => OrderedCollections.OrderedDict{Symbol, Any}(:option => nothing, :species => ["Si", "O"], :masses => [28.0855, 15.999], :pseudos => ["Si.upf", "O.upf"]), :atomic_positions => OrderedCollections.OrderedDict{Symbol, Any}(:option => "crystal", :atoms => ["Si", "O"], :positions => StaticArraysCore.SVector{3, Float64}[[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]]), :cell_parameters => OrderedCollections.OrderedDict{Symbol, Any}(:option => "angstrom", :cell => StaticArraysCore.SVector{3, Float64}[[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]]), :k_points => OrderedCollections.OrderedDict{Symbol, Any}(:option => "crystal", :kpoints => StaticArraysCore.SVector{3, Float64}[[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]], :kweights => [1.0, 1.0]))QuantumEspressoIO.read_structures — Method
Read relaxed structures from stdout file of pw.x.
QuantumEspressoIO.write_atomic_positions — Method
write_atomic_positions(io, card)
Write the atomic_positions card of pw.x.
Examples
inputs = Dict(
:option => "crystal",
:atoms => ["Si", "O"],
:positions => [
[0.0, 0.0, 0.0],
[0.5, 0.5, 0.5],
],
)
write_atomic_positions(stdout, inputs)
# output
ATOMIC_POSITIONS crystal
Si 0.0000000000 0.0000000000 0.0000000000
O 0.5000000000 0.5000000000 0.5000000000QuantumEspressoIO.write_atomic_species — Method
write_atomic_species(io, card)
Write the atomic_species card of pw.x.
Examples
inputs = Dict(
:species => ["Si", "O"],
:masses => [28.0855, 15.999],
:pseudos => ["Si.upf", "O.upf"],
)
write_atomic_species(stdout, inputs)
# output
ATOMIC_SPECIES
Si 28.085500 Si.upf
O 15.999000 O.upfQuantumEspressoIO.write_cell_parameters — Method
write_cell_parameters(io, card)
Write the cell_parameters card of pw.x.
Examples
inputs = Dict(
:option => "angstrom",
:cell => [
[1.0, 0.0, 0.0],
[0.0, 2.0, 0.0],
[0.0, 0.0, 3.0],
],
)
write_cell_parameters(stdout, inputs)
# output
CELL_PARAMETERS angstrom
1.0000000000 0.0000000000 0.0000000000
0.0000000000 2.0000000000 0.0000000000
0.0000000000 0.0000000000 3.0000000000QuantumEspressoIO.write_k_points — Method
write_k_points(io, card; name)
Write the k_points card of pw.x.
Examples
inputs = Dict(
:option => "crystal",
:kpoints => [
[0.0, 0.0, 0.0],
[0.5, 0.5, 0.5],
],
:kweights => [1.0, 1.0],
)
write_k_points(stdout, inputs)
# output
K_POINTS crystal
2
0.0000000000 0.0000000000 0.0000000000 1.0000000000
0.5000000000 0.5000000000 0.5000000000 1.0000000000inputs = Dict(
:option => "automatic",
:kgrid => [8, 8, 8],
:kgrid_shift => [0, 1, 1],
)
write_k_points(stdout, inputs)
# output
K_POINTS automatic
8 8 8 0 1 1QuantumEspressoIO.write_pw_in — Method
write_pw_in(filename, inputs)
Write the pw.x input file to a file.
Arguments
filename::AbstractString: The name of the file to write to.inputs::AbstractDict: Seewrite_pw_in(io::IO, inputs::AbstractDict)for details.
QuantumEspressoIO.write_pw_in — Method
write_pw_in(io, inputs)
Write the pw.x input file.
Arguments
io::IO: The IO stream to write to.inputs::AbstractDict: The input data:- The keys are the names of the namelists or cards.
- The values are the corresponding data for the namelists or cards.
- The namelists are written first, followed by the cards.
Examples
# Use OrderedDict to preserve the order of the keys
using OrderedCollections
inputs = OrderedDict(
:control => OrderedDict(
:calculation => "scf",
:prefix => "SiO",
:outdir => "./out",
:pseudo_dir => "./pseudo",
),
:system => OrderedDict(
:ibrav => 0,
:nat => 2,
:ntyp => 2,
),
:electrons => OrderedDict(
:conv_thr => 1e-6,
),
:atomic_species => Dict(
:species => ["Si", "O"],
:masses => [28.0855, 15.999],
:pseudos => ["Si.upf", "O.upf"],
),
:atomic_positions => Dict(
:option => "crystal",
:atoms => ["Si", "O"],
:positions => [
[0.0, 0.0, 0.0],
[0.5, 0.5, 0.5],
],
),
:cell_parameters => Dict(
:option => "angstrom",
:cell => [
[1.0, 0.0, 0.0],
[0.0, 2.0, 0.0],
[0.0, 0.0, 3.0],
],
),
:k_points => Dict(
:option => "crystal",
:kpoints => [
[0.0, 0.0, 0.0],
[0.5, 0.5, 0.5],
],
:kweights => [1.0, 1.0],
),
)
write_pw_in(stdout, inputs)
# output
&control
calculation = 'scf'
prefix = 'SiO'
outdir = './out'
pseudo_dir = './pseudo'
/
&system
ibrav = 0
nat = 2
ntyp = 2
/
&electrons
conv_thr = 1.0e-6
/
ATOMIC_SPECIES
Si 28.085500 Si.upf
O 15.999000 O.upf
ATOMIC_POSITIONS crystal
Si 0.0000000000 0.0000000000 0.0000000000
O 0.5000000000 0.5000000000 0.5000000000
CELL_PARAMETERS angstrom
1.0000000000 0.0000000000 0.0000000000
0.0000000000 2.0000000000 0.0000000000
0.0000000000 0.0000000000 3.0000000000
K_POINTS crystal
2
0.0000000000 0.0000000000 0.0000000000 1.0000000000
0.5000000000 0.5000000000 0.5000000000 1.0000000000