Skip to content

Instantly share code, notes, and snippets.

@singularitti
Created July 8, 2022 05:55
Show Gist options
  • Save singularitti/286731bc7ba15811b41f035808719b7d to your computer and use it in GitHub Desktop.
Save singularitti/286731bc7ba15811b41f035808719b7d to your computer and use it in GitHub Desktop.
Generate static file for qha
using Crystallography
using QuantumESPRESSO.Inputs.PWscf
using QuantumESPRESSO.Outputs.PWscf
press = [-10 -5 0 10 20 40 60 70 80 90]
e = map(sort(press |> vec)) do p
str = read(joinpath("p=$p.0", "SelfConsistentField.out"), String)
parse_electrons_energies(str, :converged).ε |> only
end |> vec
v = map(sort(press |> vec)) do p
pw = read(joinpath("p=$p.0", "SelfConsistentField.in"), PWInput)
pw |> cellvolume
end |> vec
p = map(sort(press |> vec)) do p
str = read(joinpath("p=$p.0", "SelfConsistentField.out"), String)
parse_stress(str)[1] |> only
end |> vec
open("static", "w") do io
for (pp, vv, ee) in zip(p, v, e)
write(io, "P= $pp V= $vv E= $ee\n")
end
end
for pp in press
a = joinpath("p=$pp.0", "phscf.out")
b = joinpath("p=$pp.0", "SelfConsistentField.out")
if isfile(a) && isfile(b)
@show a, b
run(`diff $a $b`)
end
end
for pp in press
a = joinpath("p=$pp.0", "phscf.in")
b = joinpath("p=$pp.0", "SelfConsistentField.in")
if isfile(a)
cp(a, b)
end
end
for pp in press
file = joinpath("p=$pp.0", "freq.out")
cp(file, joinpath("qha", "p$pp.out"))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment