Skip to content

Commit e76d701

Browse files
committed
strip down visualization code
1 parent 6bea1f6 commit e76d701

File tree

9 files changed

+39
-86
lines changed

9 files changed

+39
-86
lines changed

Project.toml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
1-
authors = ["Jeremiah DeGreeff <[email protected]>"]
21
name = "Atomistic"
32
uuid = "3e762ff9-b8d8-45cf-a902-edcbc7124e71"
3+
authors = ["Jeremiah DeGreeff <[email protected]>"]
44
version = "0.3.4"
55

6-
[compat]
7-
AtomsBase = "0.2"
8-
DFTK = "0.4"
9-
Distances = "0.10"
10-
InteratomicPotentials = "0.1"
11-
Molly = "0.9"
12-
NBodySimulator = "1"
13-
PeriodicTable = "1"
14-
Plots = "1"
15-
PyCall = "1"
16-
Reexport = "1"
17-
StaticArrays = "1"
18-
Unitful = "1"
19-
UnitfulAtomic = "1"
20-
UnitfulRecipes = "1"
21-
julia = "1.7"
22-
236
[deps]
247
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
258
DFTK = "acf6eb54-70d9-11e9-0013-234b7a5f5337"
@@ -30,12 +13,27 @@ Molly = "aa0f7f06-fcc0-5ec4-a7f3-a573f33f9c4c"
3013
NBodySimulator = "0e6f8da7-a7fc-5c8b-a220-74e902c310f9"
3114
PeriodicTable = "7b2266bf-644c-5ea3-82d8-af4bbd25a884"
3215
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
33-
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
3416
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
3517
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
3618
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
3719
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
3820
UnitfulRecipes = "42071c24-d89e-48dd-8a24-8a12d9b8861f"
3921

22+
[compat]
23+
AtomsBase = "0.2"
24+
DFTK = "0.4"
25+
Distances = "0.10"
26+
InteratomicPotentials = "0.1"
27+
Molly = "0.9"
28+
NBodySimulator = "1"
29+
PeriodicTable = "1"
30+
Plots = "1"
31+
Reexport = "1"
32+
StaticArrays = "1"
33+
Unitful = "1"
34+
UnitfulAtomic = "1"
35+
UnitfulRecipes = "1"
36+
julia = "1.7"
37+
4038
[extras]
4139
CPUSummary = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"

examples/argon/molly_dftk_ab_initio_simulation.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ display(@time plot_temperature(ab_initio_result, 1))
4545
display(@time plot_energy(ab_initio_result, 1))
4646
display(@time plot_rdf(ab_initio_result, potential.σ))
4747

48-
write_molly_visualization(ab_initio_result, "artifacts/argon_ab_initio_molly.mp4")
49-
write_ase_trajectory(ab_initio_result, "artifacts/argon_ab_initio_molly.traj")
48+
visualize(ab_initio_result, "artifacts/argon_ab_initio_molly.mp4")
5049

5150
;

examples/argon/nbs_dftk_ab_initio_simulation.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ display(@time plot_temperature(ab_initio_result, 1))
4444
display(@time plot_energy(ab_initio_result, 1))
4545
display(@time plot_rdf(ab_initio_result, potential.σ))
4646

47-
write_nbs_animation(ab_initio_result, "artifacts/argon_ab_initio_nbs.gif")
48-
write_ase_trajectory(ab_initio_result, "artifacts/argon_ab_initio_nbs.traj")
47+
animate(ab_initio_result, "artifacts/argon_ab_initio_nbs.gif")
4948

5049
;

src/Atomistic.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,14 @@ using Distances
99
using LinearAlgebra
1010
using StaticArrays
1111
using Base.Threads
12-
@reexport using Unitful
13-
@reexport using UnitfulAtomic
12+
@reexport using Unitful, UnitfulAtomic
1413

1514
using DFTK
1615
using Molly
1716
using NBodySimulator
1817

1918
using PeriodicTable
20-
using Plots
21-
using PyCall
22-
using UnitfulRecipes
19+
using Plots, UnitfulRecipes
2320

2421
import Base: @kwdef
2522
import DFTK: Mixing
@@ -52,8 +49,6 @@ include("integrations/initialization.jl")
5249
# Analysis
5350
export plot_temperature, plot_temperature!, plot_energy, plot_energy!, plot_rdf
5451
include("analysis/plotting.jl")
55-
export write_nbs_animation, write_molly_visualization, write_ase_trajectory
56-
include("analysis/visualization.jl")
5752

5853
# DFTK Integrations
5954
export DFTKPotential

src/analysis/visualization.jl

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/implementations/molly/molly_result.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,14 @@ get_particles(result::MollyResult, t::Integer) = AtomsBase.Atom.(result.system.a
4242

4343
temperature(result::MollyResult, t::Integer) = result.system.loggers["t"].temperatures[t]
4444
kinetic_energy(result::MollyResult, t::Integer) = result.system.loggers["k"].energies[t]
45-
potential_energy(result::MollyResult, t::Integer) = result.system.loggers["p"].energies[t]
45+
potential_energy(result::MollyResult, t::Integer) = result.system.loggers["p"].energies[t]
46+
47+
"""
48+
visualize(result::MollyResult, filename::String; kwargs...)
49+
50+
Animate a `MollyResult` using Molly's `visualize` function and store the result in a file.
51+
Any kwargs will be passed directly to the `visualize` function.
52+
53+
This function is only available when GLMakie is imported.
54+
"""
55+
Molly.visualize(result::MollyResult, filename::String; kwargs...) = visualize(result.system.loggers["c"], result.system.box_size, filename; kwargs...)

src/implementations/nbodysimulator/nbodysimulator_result.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,10 @@ get_particles(result::NBSResult, t::Integer) = AtomsBase.Atom.(result.result.sim
3838
temperature(result::NBSResult, t::Integer) = NBodySimulator.temperature(result.result, result.result.solution.t[t]) * TEMPERATURE_UNIT
3939
kinetic_energy(result::NBSResult, t::Integer) = NBodySimulator.kinetic_energy(result.result, result.result.solution.t[t]) * ENERGY_UNIT
4040
potential_energy(result::NBSResult, t::Integer) = result.energy_cache[t] * ENERGY_UNIT
41+
42+
"""
43+
animate(result::NBSResult, filename::String; kwargs...)
44+
45+
Animate an `NBSResult` using the interface provided by NBodySimulator.jl and store the result in a file.
46+
"""
47+
Plots.animate(result::NBSResult, filename::String; kwargs...) = animate(result.result, filename; kwargs...)

test/analysis/visualization.jl

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,5 @@ Base.:(==)(a1::Atomistic.AugmentedAtomData, a2::Atomistic.AugmentedAtomData) = p
4040
end
4141
@testset "Analysis Unit Tests" begin
4242
include("analysis/plotting.jl")
43-
include("analysis/visualization.jl")
4443
end
4544
end

0 commit comments

Comments
 (0)