-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "Test example from AtomsBase.jl documentation" in test/AtomsBase.jl
- Loading branch information
1 parent
5770b4a
commit 4a7aa15
Showing
2 changed files
with
21 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using AtomsBase | ||
using Unitful: ustrip, @u_str | ||
using UnitfulLinearAlgebra | ||
|
||
# See https://juliamolsim.github.io/AtomsBase.jl/stable/tutorial/#System-interface-and-conventions v0.3.5 | ||
@testset "Test example from AtomsBase.jl documentation" begin | ||
box = [[10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0]]u"Å" # Note the unit! | ||
bc = [Periodic(), Periodic(), Periodic()] | ||
hydrogen = FlexibleSystem( | ||
[Atom(:H, [0, 0, 1.0]u"bohr"), Atom(:H, [0, 0, 3.0]u"bohr")], box, bc | ||
) | ||
cell = Cell( | ||
box, [[0, 0, ustrip(u"Å", 0.1u"bohr")], [0, 0, ustrip(u"Å", 0.3u"bohr")]], [:H, :H] | ||
) | ||
@test Cell(hydrogen) == cell | ||
@test all( | ||
position(FlexibleSystem(cell)) .≈ | ||
[uconvert.(u"Å", [0, 0, 1.0]u"bohr"), uconvert.(u"Å", [0, 0, 3.0]u"bohr")], | ||
) | ||
end |
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 |
---|---|---|
|
@@ -5,4 +5,5 @@ using Test | |
# Write your tests here. | ||
include("lattice.jl") | ||
include("eachatom.jl") | ||
include("AtomsBase.jl") | ||
end |