Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AtomsCalculators v0.2 #72

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ ACE1x = "0.1.8"
ACEbase = "0.4.3"
ACEfit = "0.1.4"
AtomsBase = "0.3"
AtomsCalculators = "0.1.1"
AtomsCalculators = "0.2"
ChunkSplitters = "2"
Folds = "0.2"
Molly = "0.19, 0.20, 0.21"
Molly = "0.21"
NeighbourLists = "0.5"
Reexport = "1"
StaticArrays = "1"
Expand Down
3 changes: 3 additions & 0 deletions src/atoms_calculators.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

AtomsCalculators.energy_unit(ace::ACEpotential) = ace.energy_unit
AtomsCalculators.length_unit(ace::ACEpotential) = ace.length_unit


AtomsCalculators.@generate_interface function AtomsCalculators.potential_energy(
system,
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ACEfit = "ad31a8ef-59f5-4a01-b543-a85c2f73e95c"
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
AtomsCalculators = "a3e0e189-c65a-42c1-833c-339540406eb1"
ExtXYZ = "352459e4-ddd7-4360-8937-99dcb397b478"
Molly = "aa0f7f06-fcc0-5ec4-a7f3-a573f33f9c4c"
#Molly = "aa0f7f06-fcc0-5ec4-a7f3-a573f33f9c4c"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
20 changes: 20 additions & 0 deletions test/molly_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This is not run at the moment due to Molly having only AtomsCalculators v0.1 support.
# The plan is also to remove the extension in the future, but saving test here for now.

using Molly

@testset "Molly support" begin
pot = load_ace_model(fname_ace)
data = ExtXYZ.Atoms(read_frame(fname_xyz))

sys = Molly.System(data, pot)

@test ace_energy(pot, data) ≈ Molly.potential_energy(sys)
@test all( ace_forces(pot, data) .≈ Molly.forces(sys) )

simulator = VelocityVerlet(
dt=1.0u"fs",
coupling=AndersenThermostat(300u"K", 1.0u"ps"),
)
simulate!(sys, simulator, 10)
end
23 changes: 2 additions & 21 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ using ACE1
using ACE1x
using ACEfit
using AtomsBase
using AtomsCalculators.AtomsCalculatorsTesting
using AtomsCalculators.Testing
using ExtXYZ
using Molly
using Unitful
using UnitfulAtomic
using Test
Expand Down Expand Up @@ -150,22 +149,6 @@ end
@test ace_fv[:virial] ≈ V
end

@testset "Molly support" begin
pot = load_ace_model(fname_ace)
data = ExtXYZ.Atoms(read_frame(fname_xyz))

sys = Molly.System(data, pot)

@test ace_energy(pot, data) ≈ Molly.potential_energy(sys)
@test all( ace_forces(pot, data) .≈ Molly.forces(sys) )

simulator = VelocityVerlet(
dt=1.0u"fs",
coupling=AndersenThermostat(300u"K", 1.0u"ps"),
)
simulate!(sys, simulator, 10)
end


@testset "ACEfit extension" begin
data = ExtXYZ.load(fname_train)
Expand Down Expand Up @@ -219,7 +202,5 @@ end
pot = load_ace_model(fname_ace)
data = ExtXYZ.load(fname_xyz)

test_potential_energy(data, pot)
test_forces(data, pot)
test_virial(data, pot)
test_energy_forces_virial(data, pot)
end
Loading