Skip to content

Commit

Permalink
Merge pull request #82 from cesmix-mit/fix-paths
Browse files Browse the repository at this point in the history
Fix paths.
  • Loading branch information
emmanuellujan authored Jul 13, 2024
2 parents 66b1242 + bd9741e commit b49be2e
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 33 deletions.
8 changes: 4 additions & 4 deletions examples/ACE-aHfO2/fit-ace-ahfo2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ using Unitful, UnitfulAtomic
using LinearAlgebra, Random, DisplayAs

# Define paths.
path = joinpath(dirname(pathof(PotentialLearning)), "../examples/ACE-aHfO2")
ds_path = "$path/../data/a-HfO2/a-HfO2-300K-NVT-6000.extxyz"
res_path = "$path/results/";
base_path = match(r"^(.*/PotentialLearning/)", @__DIR__).match
ds_path = "$base_path/examples/data/a-HfO2/a-HfO2-300K-NVT-6000.extxyz"
res_path = "$base_path/examples/ACE-aHfO2/results/";

# Load utility functions.
include("$path/../utils/utils.jl")
include("$base_path/examples/utils/utils.jl")

# Create experiment folder.
run(`mkdir -p $res_path`);
Expand Down
4 changes: 2 additions & 2 deletions examples/DPP-ACE-Na/fit-dpp-ace-na.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ using AtomsBase, InteratomicPotentials, PotentialLearning
using LinearAlgebra, Plots

# Define paths.
path = joinpath(dirname(pathof(PotentialLearning)), "../examples/DPP-ACE-Na")
ds_path = "$path/../data/Na/liquify_sodium.yaml";
base_path = match(r"^(.*/PotentialLearning/)", @__DIR__).match
ds_path = "$base_path/examples/data/Na/liquify_sodium.yaml"

# ## b. Load atomistic dataset and split it into training and test.

Expand Down
8 changes: 4 additions & 4 deletions examples/DPP-ACE-Si/fit-dpp-ace-si.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ using CSV, JLD, DataFrames
elname, elspec = "Si", [:Si]

# Define paths.
path = joinpath(dirname(pathof(PotentialLearning)), "../examples/DPP-ACE-Si")
inpath = "$path/../data/Si-3Body-LAMMPS/"
outpath = "$path/output/$elname/"
base_path = match(r"^(.*/PotentialLearning/)", @__DIR__).match
inpath = "$base_path/examples/data/Si-3Body-LAMMPS/"
outpath = "$base_path/examples/DPP-ACE-Si/output/$elname/";

# Load utility functions.
include("$path/subsampling_utils.jl")
include("$base_path/examples/DPP-ACE-Si/subsampling_utils.jl")

# ## b. Load atomistic datasets.

Expand Down
8 changes: 4 additions & 4 deletions examples/DPP-ACE-aHfO2-1/fit-dpp-ace-ahfo2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ using Unitful, UnitfulAtomic
using LinearAlgebra, Random, DisplayAs

# Define paths.
path = joinpath(dirname(pathof(PotentialLearning)), "../examples/DPP-ACE-aHfO2-1")
ds_path = "$path/../data/a-HfO2/a-HfO2-300K-NVT-6000.extxyz"
res_path = "$path/results/";
base_path = match(r"^(.*/PotentialLearning/)", @__DIR__).match
ds_path = "$base_path/examples/data/a-HfO2/a-HfO2-300K-NVT-6000.extxyz"
res_path = "$base_path/examples/DPP-ACE-aHfO2-1/results/";

# Load utility functions.
include("$path/../utils/utils.jl")
include("$base_path/examples/utils/utils.jl")

# Create experiment folder.
run(`mkdir -p $res_path`);
Expand Down
10 changes: 5 additions & 5 deletions examples/DPP-ACE-aHfO2-2/fit-dpp-ace-ahfo2.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
push!(Base.LOAD_PATH, "../../")

using LinearAlgebra, Random
using Statistics, StatsBase, Distributions, Determinantal
using Unitful, UnitfulAtomic
Expand All @@ -8,11 +6,13 @@ using JLD, CairoMakie

#################### Importing Data ###################

path = joinpath(dirname(pathof(PotentialLearning)), "../examples/DPP-ACE-aHfO2")
base_path = match(r"^(.*/PotentialLearning/)", @__DIR__).match
ds_path = "$base_path/examples/data/a-HfO2/aHfO2_diverse_descriptors_3600.jld"
res_path = "$base_path/examples/DPP-ACE-aHfO2-2/results/";

# Import Raw Data
energies, descriptors = JLD.load(
"$path/../data/aHfO2/aHfO2_diverse_descriptors_3600.jld",
ds_path,
"energies",
"descriptors",
)
Expand Down Expand Up @@ -84,4 +84,4 @@ ax4 = Axis(
)
scatter!(ax4, [length(c.B) - 32 for c in configs], ips, markersize = 4.0)

save("examples/aHfO2/figures/aHfO2_dpp_inclusion_probabilities.pdf", fig)
save("$res_path/figures/aHfO2_dpp_inclusion_probabilities.pdf", fig)
4 changes: 2 additions & 2 deletions examples/LJ-Ar/lennard-jones-ar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ using AtomsBase, InteratomicPotentials, PotentialLearning
using LinearAlgebra, Plots, DisplayAs

# Define paths.
path = joinpath(dirname(pathof(PotentialLearning)), "../examples/LJ-Ar")
ds_path = "$path/../data/LJ-AR/lj-ar.yaml";
base_path = match(r"^(.*/PotentialLearning/)", @__DIR__).match
ds_path = "$base_path/examples/data/LJ-AR/lj-ar.yaml"

# ## b. Load atomistic dataset.
ds, thermo = load_data(ds_path, YAML(:Ar, u"eV", u""))
Expand Down
8 changes: 4 additions & 4 deletions examples/Opt-ACE-aHfO2/fit-opt-ace-ahfo2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ using LinearAlgebra, Random, DisplayAs
using DataFrames, Hyperopt

# Define paths.
path = joinpath(dirname(pathof(PotentialLearning)), "../examples/Opt-ACE-aHfO2")
ds_path = "$path/../data/a-HfO2/a-HfO2-300K-NVT-6000.extxyz"
res_path = "$path/results/";
base_path = match(r"^(.*/PotentialLearning/)", @__DIR__).match
ds_path = "$base_path/examples/data/a-HfO2/a-HfO2-300K-NVT-6000.extxyz"
res_path = "$base_path/examples/Opt-ACE-aHfO2/results/";

# Load utility functions.
include("$path/../utils/utils.jl")
include("$base_path/examples/utils/utils.jl")

# Create experiment folder.
run(`mkdir -p $res_path`);
Expand Down
8 changes: 4 additions & 4 deletions examples/PCA-ACE-aHfO2/fit-pca-ace-ahfo2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ using Unitful, UnitfulAtomic
using LinearAlgebra, Random, DisplayAs

# Define paths.
path = joinpath(dirname(pathof(PotentialLearning)), "../examples/PCA-ACE-aHfO2")
ds_path = "$path/../data/a-HfO2/a-HfO2-300K-NVT-6000.extxyz"
res_path = "$path/results/";
base_path = match(r"^(.*/PotentialLearning/)", @__DIR__).match
ds_path = "$base_path/examples/data/a-HfO2/a-HfO2-300K-NVT-6000.extxyz"
res_path = "$base_path/examples/PCA-ACE-aHfO2/results/";

# Load utility functions.
include("$path/../utils/utils.jl")
include("$base_path/examples/utils/utils.jl")

# Create experiment folder.
run(`mkdir -p $res_path`);
Expand Down
2 changes: 1 addition & 1 deletion examples/utils/input.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# New function to read XYZ files ###############################################
include("$path/../utils/xyz.jl")
include("$base_path/examples/utils/xyz.jl")

# New functions to get input parameters from OrderedDict #######################

Expand Down
6 changes: 3 additions & 3 deletions examples/utils/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ using ProgressBars
using Plots
using CSV

include("$path/../utils/input.jl")
include("$path/../utils/macros.jl")
include("$path/../utils/plots.jl")
include("$base_path/examples/utils/input.jl")
include("$base_path/examples/utils/macros.jl")
include("$base_path/examples/utils/plots.jl")

# Missing function
Base.size(fd::ForceDescriptors) = (length(fd), )
Expand Down

0 comments on commit b49be2e

Please sign in to comment.