-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial support for serialisation to JSON (#875)
* Basic, untested json output * Test stub * move things around * Serialisation test * Add json example * docfix
- Loading branch information
Showing
9 changed files
with
87 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 0.6.10 | ||
current_version = 0.6.11 | ||
commit = True | ||
tag = False | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "DFTK" | ||
uuid = "acf6eb54-70d9-11e9-0013-234b7a5f5337" | ||
authors = ["Michael F. Herbst <[email protected]>", "Antoine Levitt <[email protected]>"] | ||
version = "0.6.10" | ||
version = "0.6.11" | ||
|
||
[deps] | ||
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c" | ||
|
@@ -100,6 +100,7 @@ FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000" | |
GenericLinearAlgebra = "14197337-ba66-59df-a3e3-ca00e7dcff7a" | ||
IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" | ||
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" | ||
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" | ||
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77" | ||
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" | ||
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" | ||
|
@@ -110,4 +111,4 @@ WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" | |
wannier90_jll = "c5400fa0-8d08-52c2-913f-1e3f656c1ce9" | ||
|
||
[targets] | ||
test = ["Test", "ASEconvert", "Aqua", "AtomsIO", "AtomsIOPython", "CUDA", "CUDA_Runtime_jll", "ComponentArrays", "DoubleFloats", "FiniteDiff", "FiniteDifferences", "GenericLinearAlgebra", "IntervalArithmetic", "JLD2", "Logging", "Plots", "QuadGK", "Random", "KrylovKit", "WriteVTK", "wannier90_jll"] | ||
test = ["Test", "ASEconvert", "Aqua", "AtomsIO", "AtomsIOPython", "CUDA", "CUDA_Runtime_jll", "ComponentArrays", "DoubleFloats", "FiniteDiff", "FiniteDifferences", "GenericLinearAlgebra", "IntervalArithmetic", "JLD2", "JSON3", "Logging", "Plots", "QuadGK", "Random", "KrylovKit", "WriteVTK", "wannier90_jll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function save_scfres_master(filename::AbstractString, scfres::NamedTuple, ::Val{:json}) | ||
# TODO Quick and dirty solution for now. | ||
# The better approach is to integrate with StructTypes.jl | ||
|
||
data = Dict("energies" => todict(scfres.energies), "damping" => scfres.α) | ||
for key in (:converged, :occupation_threshold, :εF, :eigenvalues, | ||
:occupation, :n_bands_converge, :n_iter, :algorithm, :norm_Δρ) | ||
data[string(key)] = getproperty(scfres, key) | ||
end | ||
|
||
open(filename, "w") do io | ||
JSON3.pretty(io, data) | ||
end | ||
end | ||
|
||
#TODO introduce `todict` functions for all sorts of datastructures (basis, ...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters