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

Fix dependencies #66

Merged
merged 2 commits into from
Jun 5, 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
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
InteratomicPotentials = "a9efe35a-c65d-452d-b8a8-82646cd5cb04"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
OptimizationOptimisers = "42dfb2eb-d2b4-4451-abcd-913932933ac1"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Expand Down
7 changes: 7 additions & 0 deletions examples/Ar/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[deps]
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
InteratomicPotentials = "a9efe35a-c65d-452d-b8a8-82646cd5cb04"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
5 changes: 2 additions & 3 deletions examples/Ar/plot-lennard-jones-ar.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
push!(Base.LOAD_PATH, "../../")
using AtomsBase

using Unitful, UnitfulAtomic
using InteratomicPotentials
using PotentialLearning
using AtomsBase, InteratomicPotentials, PotentialLearning
using LinearAlgebra, CairoMakie

# Load dataset: Lennard-Jones + Argon
Expand Down
16 changes: 16 additions & 0 deletions examples/DFT-subsampling/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[deps]
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Determinantal = "2673d5e8-682c-11e9-2dfd-471b09c6c819"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
InteratomicPotentials = "a9efe35a-c65d-452d-b8a8-82646cd5cb04"
InvertedIndices = "41ab1584-1d38-5bbf-9106-f11c6c58b48f"
JLD = "4138dd39-2aa7-5051-a626-17a0bb65d9c8"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
16 changes: 6 additions & 10 deletions examples/DFT-subsampling/subsampling_dpp.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
push!(Base.LOAD_PATH, "../../")

using PotentialLearning
using LinearAlgebra, Random, Statistics, StatsBase, Distributions
using AtomsBase, Unitful, UnitfulAtomic
using InteratomicPotentials
using Determinantal
using LinearAlgebra, Random, InvertedIndices
using Statistics, StatsBase, Distributions, Determinantal
using Unitful, UnitfulAtomic
using AtomsBase, InteratomicPotentials, PotentialLearning
using CSV, JLD, DataFrames
using CairoMakie
using InvertedIndices
using CSV
using JLD
using DataFrames

include("subsampling_utils.jl")

Expand Down Expand Up @@ -60,7 +56,7 @@ ds = DataSet(confs .+ e_descr .+ f_descr)
ndata = length(ds)

# Compute cross validation error from training ---------------------------------
batch_size = [80, 40, 20]
batch_size = [80, 40]
sel_ind = Dict{Int64, Vector}()
cond_num = Dict{Int64, Vector}()

Expand Down
7 changes: 7 additions & 0 deletions examples/Na/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[deps]
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
InteratomicPotentials = "a9efe35a-c65d-452d-b8a8-82646cd5cb04"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
8 changes: 2 additions & 6 deletions examples/Na/fit-dpp-ace-na.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
push!(Base.LOAD_PATH, "../../")

using AtomsBase
using InteratomicPotentials
using PotentialLearning
using Unitful, UnitfulAtomic
using LinearAlgebra
using CairoMakie
#using JLD
using AtomsBase, InteratomicPotentials, PotentialLearning
using LinearAlgebra, CairoMakie

# Load dataset
confs, thermo = load_data("data/liquify_sodium.yaml", YAML(:Na, u"eV", u"Å"))
Expand Down
41 changes: 0 additions & 41 deletions examples/Project.toml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $ cd PotentialLearning.jl/examples/Na

Open Julia REPL, activate ```Project.toml``` file in folder ```examples```, and chose the number of threads. E.g.
```bash
$ julia --project=.. --threads=4
$ julia --project=. --threads=4
```

Type ```]``` in Julia REPL, and then run ```instantiate```.
Expand Down
12 changes: 5 additions & 7 deletions examples/aHfO2/build_dpp.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
push!(Base.LOAD_PATH, "../../")

using LinearAlgebra, Random, Statistics, StatsBase, Distributions
using AtomsBase, Unitful, UnitfulAtomic
using InteratomicPotentials
using CairoMakie
using JLD
using Determinantal
using PotentialLearning
using LinearAlgebra, Random
using Statistics, StatsBase, Distributions, Determinantal
using Unitful, UnitfulAtomic
using AtomsBase, InteratomicPotentials, PotentialLearning
using JLD, CairoMakie

#################### Importing Data ###################
# Import Raw Data
Expand Down
12 changes: 5 additions & 7 deletions examples/aHfO2/build_multiple_dpp.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
push!(Base.LOAD_PATH, "../../")

using LinearAlgebra, Random, Statistics, StatsBase, Distributions
using AtomsBase, Unitful, UnitfulAtomic
using InteratomicPotentials, InteratomicBasisPotentials
using CairoMakie
using JLD
using Determinantal
using PotentialLearning
using LinearAlgebra, Random
using Statistics, StatsBase, Distributions, Determinantal
using Unitful, UnitfulAtomic
using AtomsBase, InteratomicPotentials, PotentialLearning
using JLD, CairoMakie

#################### Importing Data ###################
# Import Raw Data
Expand Down
2 changes: 1 addition & 1 deletion src/Learning/linear-learn.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function learn!(
x0 = [log(lp.σe[1]), log(lp.σf[1]), lp.β...]
p = [AtAe, Atbe, AtAf, Atbf, α]
prob = Optimization.OptimizationProblem(g, x0, p)
sol = Optimization.solve(prob, Optim.BFGS())
sol = Optimization.solve(prob, OptimizationOptimisers.Adam(), maxiters = 1000)
lp.σe .= exp(sol.u[1])
lp.σf .= exp(sol.u[2])
lp.β .= sol.u[3:end]
Expand Down
2 changes: 0 additions & 2 deletions src/PotentialLearning.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ using OrderedCollections
using Flux
using Zygote
using Optimization
using Optim
using OptimizationOptimJL
using OptimizationOptimisers
using Printf

Expand Down
2 changes: 1 addition & 1 deletion src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using LinearAlgebra
using StaticArrays
using Statistics
using Optimization
using OptimizationOptimJL
using OptimizationOptimisers
using UnitfulAtomic
using Unitful
using Flux
Expand Down
6 changes: 0 additions & 6 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ Determinantal = "2673d5e8-682c-11e9-2dfd-471b09c6c819"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
InteratomicPotentials = "a9efe35a-c65d-452d-b8a8-82646cd5cb04"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
OptimizationOptimisers = "42dfb2eb-d2b4-4451-abcd-913932933ac1"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
PDMats = "90014a1f-27ba-587c-ab20-58faa44d9150"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Expand All @@ -19,6 +16,3 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"

[compat]
julia = "1.9"
6 changes: 3 additions & 3 deletions test/dimension_reduction/dimension_reduction_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ pca = PCA(num_dim)
@test typeof(as) <: DimensionReducer
@test typeof(pca) <: DimensionReducer

λ_as, W_as = fit(ds, as)
λ_as, W_as = PotentialLearning.fit(ds, as)
@test typeof(λ_as) <: Vector{Float64}
@test typeof(W_as) <: Matrix{Float64}
@test size(W_as, 1) == d
@test size(W_as, 2) == num_dim

λ_pca, W_pca = fit(ds, pca)
λ_pca, W_pca = PotentialLearning.fit(ds, pca)
@test typeof(λ_pca) <: Vector{Float64}
@test typeof(W_pca) <: Matrix{Float64}
@test size(W_pca, 1) == d
@test size(W_pca, 2) == num_dim

@test all(λ_as .≈ λ_pca)
@test all(λ_as .≈ λ_pca)
Loading