Skip to content

Commit

Permalink
Add unit tests for diatomic analysis functions for desorption
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexsp32 committed Apr 8, 2024
1 parent 3349b33 commit 292e746
Show file tree
Hide file tree
Showing 5 changed files with 157,845 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ dev/
*.dat
!/.gitignore
!/.github
!/.codecov.yml
!/.codecov.yml
!/test/artifacts/desorption_dynamics.jld2
!/test/artifacts/desorption_test.xyz
21 changes: 21 additions & 0 deletions test/Analysis/diatomic.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Test
using NQCDynamics
using Unitful, UnitfulAtomic
using PyCall
using NQCDynamics, NQCModels
using JLD2

@testset "Desorption Analysis" begin
ase_io=pyimport("ase.io")
desorption_trajectory_ase=ase_io.read("artifacts/desorption_test.xyz", index=":")
desorption_dynamicsvariables=jldopen("artifacts/desorption_dynamics.jld2")["trajectory"]
# Make a dummmy simulation out of the first structure (we don't need a working potential to test. )
atoms, initial_positions, cell=NQCDynamics.NQCBase.convert_from_ase_atoms(desorption_trajectory_ase[1])
simulation=Simulation(atoms, AdiabaticASEModel(desorption_trajectory_ase[1]), cell=cell)
diatomic_indices=[55,56]
@test @time "DesorptionFrame - No views" get_desorption_frame_noviews(desorption_dynamicsvariables, diatomic_indices, simulation; surface_distance_threshold=2.4u"Å") == 2675
@test @time "DesorptionFrame - With views" get_desorption_frame_views(desorption_dynamicsvariables, diatomic_indices, simulation; surface_distance_threshold=2.4u"Å") == 2675
@test @time "DesorptionAngle - No views" get_desorption_angle(desorption_dynamicsvariables, diatomic_indices, simulation; surface_distance_threshold=2.4u"Å", evaluation_function=get_desorption_frame_noviews) 28.05088202518
@test @time "DesorptionAngle - With views" get_desorption_angle(desorption_dynamicsvariables, diatomic_indices, simulation; surface_distance_threshold=2.4u"Å", evaluation_function=get_desorption_frame_views) 28.05088202518
end

Binary file added test/artifacts/desorption_dynamics.jld2
Binary file not shown.
Loading

0 comments on commit 292e746

Please sign in to comment.