Skip to content

Commit e355609

Browse files
authored
support AtomsCalculators v0.2 (#72)
1 parent 6d3710f commit e355609

File tree

5 files changed

+28
-24
lines changed

5 files changed

+28
-24
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ ACE1x = "0.1.8"
3636
ACEbase = "0.4.3"
3737
ACEfit = "0.1.4"
3838
AtomsBase = "0.3"
39-
AtomsCalculators = "0.1.1"
39+
AtomsCalculators = "0.2"
4040
ChunkSplitters = "2"
4141
Folds = "0.2"
42-
Molly = "0.19, 0.20, 0.21"
42+
Molly = "0.21"
4343
NeighbourLists = "0.5"
4444
Reexport = "1"
4545
StaticArrays = "1"

src/atoms_calculators.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11

2+
AtomsCalculators.energy_unit(ace::ACEpotential) = ace.energy_unit
3+
AtomsCalculators.length_unit(ace::ACEpotential) = ace.length_unit
4+
25

36
AtomsCalculators.@generate_interface function AtomsCalculators.potential_energy(
47
system,

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ACEfit = "ad31a8ef-59f5-4a01-b543-a85c2f73e95c"
55
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
66
AtomsCalculators = "a3e0e189-c65a-42c1-833c-339540406eb1"
77
ExtXYZ = "352459e4-ddd7-4360-8937-99dcb397b478"
8-
Molly = "aa0f7f06-fcc0-5ec4-a7f3-a573f33f9c4c"
8+
#Molly = "aa0f7f06-fcc0-5ec4-a7f3-a573f33f9c4c"
99
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
1010
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
1111
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

test/molly_tests.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This is not run at the moment due to Molly having only AtomsCalculators v0.1 support.
2+
# The plan is also to remove the extension in the future, but saving test here for now.
3+
4+
using Molly
5+
6+
@testset "Molly support" begin
7+
pot = load_ace_model(fname_ace)
8+
data = ExtXYZ.Atoms(read_frame(fname_xyz))
9+
10+
sys = Molly.System(data, pot)
11+
12+
@test ace_energy(pot, data) Molly.potential_energy(sys)
13+
@test all( ace_forces(pot, data) .≈ Molly.forces(sys) )
14+
15+
simulator = VelocityVerlet(
16+
dt=1.0u"fs",
17+
coupling=AndersenThermostat(300u"K", 1.0u"ps"),
18+
)
19+
simulate!(sys, simulator, 10)
20+
end

test/runtests.jl

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ using ACE1
33
using ACE1x
44
using ACEfit
55
using AtomsBase
6-
using AtomsCalculators.AtomsCalculatorsTesting
6+
using AtomsCalculators.Testing
77
using ExtXYZ
8-
using Molly
98
using Unitful
109
using UnitfulAtomic
1110
using Test
@@ -150,22 +149,6 @@ end
150149
@test ace_fv[:virial] V
151150
end
152151

153-
@testset "Molly support" begin
154-
pot = load_ace_model(fname_ace)
155-
data = ExtXYZ.Atoms(read_frame(fname_xyz))
156-
157-
sys = Molly.System(data, pot)
158-
159-
@test ace_energy(pot, data) Molly.potential_energy(sys)
160-
@test all( ace_forces(pot, data) .≈ Molly.forces(sys) )
161-
162-
simulator = VelocityVerlet(
163-
dt=1.0u"fs",
164-
coupling=AndersenThermostat(300u"K", 1.0u"ps"),
165-
)
166-
simulate!(sys, simulator, 10)
167-
end
168-
169152

170153
@testset "ACEfit extension" begin
171154
data = ExtXYZ.load(fname_train)
@@ -219,7 +202,5 @@ end
219202
pot = load_ace_model(fname_ace)
220203
data = ExtXYZ.load(fname_xyz)
221204

222-
test_potential_energy(data, pot)
223-
test_forces(data, pot)
224-
test_virial(data, pot)
205+
test_energy_forces_virial(data, pot)
225206
end

0 commit comments

Comments
 (0)