|
| 1 | +using Unitful |
| 2 | +using InteratomicPotentials |
| 3 | + |
| 4 | +# TODO: Many tests needed to be added for structs/fns in Data section |
| 5 | + |
| 6 | +#= |
| 7 | +This data is a small subset of the TiAl_tutorial.xyz artifact that was used for |
| 8 | +testing and documentation in Ace1pack https://github.com/ACEsuit/ACE1pack.jl |
| 9 | +=# |
| 10 | +TiAl_ds = load_data("./data/TiAl_examples.xyz", ExtXYZ(u"eV", u"Å")) |
| 11 | + |
| 12 | +ace = ACE(species = [:Ti, :Al], |
| 13 | + body_order = 3, |
| 14 | + polynomial_degree = 6, |
| 15 | + wL = 1.5, |
| 16 | + csp = 1.0, |
| 17 | + r0 = 2.9, |
| 18 | + rcutoff = 5.5 ) |
| 19 | + |
| 20 | +e_descr = compute_local_descriptors(TiAl_ds, ace; pbar=false) |
| 21 | +@test length(e_descr) == 5 |
| 22 | +@test typeof(e_descr) <: Vector{LocalDescriptors} |
| 23 | +@test length(e_descr[1]) == 2 # num atoms in 1st config |
| 24 | +@test length(e_descr[end]) == 54 # num atoms in last config |
| 25 | +@test length(e_descr[1][1]) == 104 # number local descrs |
| 26 | + |
| 27 | +#TODO need to document reference better, preferably w/ repro Manifest.toml etc. |
| 28 | +#long-run, should do more than spot-checking |
| 29 | +@testset "data_utils: local descriptors ref check" begin |
| 30 | + #= |
| 31 | + spot-checking descriptor values (and order), based off of the above basis |
| 32 | + IP.jl v.0.2.7 |
| 33 | + ACE1 v0.10.7 |
| 34 | + JuLIP v0.11.5 |
| 35 | + Julia 1.9.2+0.aarch64.apple.darwin14 |
| 36 | + =# |
| 37 | + |
| 38 | + ed_vals11 = get_values(e_descr[1][1]) |
| 39 | + ed_vals32 = get_values(e_descr[3][2]) |
| 40 | + ed_vals51 = get_values(e_descr[5][1]) |
| 41 | + |
| 42 | + @test ed_vals11[10] ≈ 0.0 |
| 43 | + @test ed_vals11[end-15] ≈ -5.541800263121354 #TODO should actual specify tols |
| 44 | + |
| 45 | + @test ed_vals32[1] ≈ 0.9105447479710141 |
| 46 | + @test ed_vals32[52] ≈ 7.927103583234019 |
| 47 | + |
| 48 | + @test ed_vals51[100] ≈ -0.3889692376173769 |
| 49 | + @test ed_vals51[end] ≈ 4.344079434030667 |
| 50 | +end |
| 51 | + |
| 52 | +f_descr = compute_force_descriptors(TiAl_ds,ace; pbar=false) |
| 53 | +@test length(f_descr) ==5 |
| 54 | +@test typeof(f_descr) <: Vector{ForceDescriptors} |
| 55 | +@test length(f_descr[1]) == 2 |
| 56 | +@test length(f_descr[end]) == 54 |
| 57 | +@test length(f_descr[1][1]) == 3 # 3 cartesian directions |
| 58 | +@test length(get_values(f_descr[1][1])[1]) == 104 |
| 59 | + |
| 60 | +@testset "data_utils: force descriptors ref check" begin |
| 61 | + #= |
| 62 | + spot-checking descriptor values (and order), based off of the above basis |
| 63 | + IP.jl v.0.2.7 |
| 64 | + ACE1 v0.10.7 |
| 65 | + JuLIP v0.11.5 |
| 66 | + Julia 1.9.2+0.aarch64.apple.darwin14 |
| 67 | + =# |
| 68 | + |
| 69 | + fd_vals11_1 = get_values(f_descr[1][1])[1] |
| 70 | + fd_vals32_2 = get_values(f_descr[3][2])[2] |
| 71 | + fd_vals51_3 = get_values(f_descr[5][1])[3] |
| 72 | + |
| 73 | + @test fd_vals11_1[14] ≈ 0.0 |
| 74 | + @test fd_vals11_1[66] ≈ 0.21012541753661917 |
| 75 | + @test fd_vals11_1[90] ≈ 0.07680220708487306 |
| 76 | + @test fd_vals11_1[end] ≈ 0.0 |
| 77 | + |
| 78 | + @test fd_vals32_2[7] ≈ 0.09927939932561863 |
| 79 | + @test fd_vals32_2[31] ≈ -1.1185724606158156 |
| 80 | + @test fd_vals32_2[80] ≈ 1.780519258001138 |
| 81 | + |
| 82 | + @test fd_vals51_3[23] ≈ 0.0 |
| 83 | + @test fd_vals51_3[50] ≈ 8.247266509962259 |
| 84 | + @test fd_vals51_3[end] ≈ 8.194593298142163 |
| 85 | +end |
0 commit comments