From 7ed5f0c03772e7da811bdb7273316e0b46759282 Mon Sep 17 00:00:00 2001 From: Matthias Sachs Date: Fri, 13 Jan 2023 22:52:20 +0000 Subject: [PATCH] clean up --- src/ACEbonds.jl | 3 --- src/bondpot.jl | 11 ----------- src/temp_ACE_patch.jl | 22 ---------------------- 3 files changed, 36 deletions(-) delete mode 100644 src/temp_ACE_patch.jl diff --git a/src/ACEbonds.jl b/src/ACEbonds.jl index 6ffa1ec..9abf073 100644 --- a/src/ACEbonds.jl +++ b/src/ACEbonds.jl @@ -1,9 +1,6 @@ module ACEbonds import ACE -#import ACE: B1pMultiplier, AbstractState - -include("temp_ACE_patch.jl") # MS: code in this file will be included in the next ACE update include("envelopes.jl") # MS: I believe code in this file is depreciated? diff --git a/src/bondpot.jl b/src/bondpot.jl index 0a4b1ad..e5d0f95 100644 --- a/src/bondpot.jl +++ b/src/bondpot.jl @@ -89,7 +89,6 @@ function energy(calc::ACEBondPotential, at::Atoms) # find the right ace model ace = _get_model(calc, at.Z[i], at.Z[j]) # transform the euclidean to cylindrical coordinates - #env = eucl2cyl(rrij, at.Z[i], at.Z[j], Rs, Zs) env = env_transform(rrij, at.Z[i], at.Z[j], Rs, Zs, calc.cutoff) # evaluate Eij = evaluate(ace, env) @@ -106,14 +105,11 @@ function forces(calc::ACEBondPotential, at::Atoms) # find the right ace model ace = _get_model(calc, Zi, Zj) # transform the euclidean to cylindrical coordinates - #env = eucl2cyl(rrij, Zi, Zj, Rs, Zs) env = env_transform(rrij, Zi, Zj, Rs, Zs, calc.cutoff) # evaluate dV_cyl = grad_config(ace, env) - #@show dV_cyl # transform back? dV_drrij, dV_dRs = rrule_env_transform(rrij::SVector, Zi, Zj, Rs, Zs, dV_cyl, calc.cutoff) - #rrule_eucl2cyl(rrij::SVector, Zi, Zj, Rs, Zs, dV_cyl) # assemble the forces F[i] += dV_drrij F[j] -= dV_drrij @@ -139,12 +135,10 @@ function virial(calc::ACEBondPotential, at::Atoms{T}) where {T} # find the right ace model for this bond ace = _get_model(calc, Zi, Zj) # transform the euclidean to cylindrical coordinates - #env = eucl2cyl(rrij, Zi, Zj, Rs, Zs) env = env_transform(rrij, Zi, Zj, Rs, Zs, calc.cutoff) # evaluate dV_cyl = grad_config(ace, env) # transform back? - #dV_drrij, dV_dRs = rrule_eucl2cyl(rrij::SVector, Zi, Zj, Rs, Zs, dV_cyl) dV_drrij, dV_dRs = rrule_env_transform(rrij::SVector, Zi, Zj, Rs, Zs, dV_cyl, calc.cutoff) # assemble the virial # dV_dRs contain derivative relative to midpoint @@ -166,7 +160,6 @@ function energy(basis::ACEBondPotentialBasis, at::Atoms) # find the right ace model ace = _get_model(basis, at.Z[i], at.Z[j]) # transform the euclidean to cylindrical coordinates - #env = eucl2cyl(rrij, at.Z[i], at.Z[j], Rs, Zs) env = env_transform(rrij, at.Z[i], at.Z[j], Rs, Zs, basis.cutoff) # evaluate ACE.evaluate!(Et, ace, ACE.ACEConfig(env)) @@ -183,12 +176,10 @@ function forces(basis::ACEBondPotentialBasis, at::Atoms) # find the right ace model ace = _get_model(basis, Zi, Zj) # transform the euclidean to cylindrical coordinates - # env = eucl2cyl(rrij, Zi, Zj, Rs, Zs) env = env_transform(rrij, Zi, Zj, Rs, Zs, basis.cutoff) # evaluate dB_cyl = evaluate_d(ace, env) # transform back? - # dB_drrij, dB_dRs = rrule_eucl2cyl(rrij::SVector, Zi, Zj, Rs, Zs, dB_cyl) dB_drrij, dB_dRs = rrule_env_transform(rrij, Zi, Zj, Rs, Zs, dB_cyl, basis.cutoff) # assemble the forces F[:, i] += dB_drrij @@ -211,12 +202,10 @@ function virial(basis::ACEBondPotentialBasis, at::Atoms{T}) where {T} # find the right ace model ace = _get_model(basis, Zi, Zj) # transform the euclidean to cylindrical coordinates - #env = eucl2cyl(rrij, Zi, Zj, Rs, Zs) env = env_transform(rrij, Zi, Zj, Rs, Zs, basis.cutoff) # evaluate dB_cyl = evaluate_d(ace, env) # transform back? - #dB_drrij, dB_dRs = rrule_eucl2cyl(rrij::SVector, Zi, Zj, Rs, Zs, dB_cyl) dB_drrij, dB_dRs = rrule_env_transform(rrij, Zi, Zj, Rs, Zs, dB_cyl, basis.cutoff) # assemble the virials for iB = 1:length(basis) diff --git a/src/temp_ACE_patch.jl b/src/temp_ACE_patch.jl deleted file mode 100644 index c44fd28..0000000 --- a/src/temp_ACE_patch.jl +++ /dev/null @@ -1,22 +0,0 @@ - -import ACE: filter - -@warn "Monkey-patched code for ACE.filter should be moved to the package ACE." -function filter(b::ACE.Onepb, Bsel::ACE.CategorySparseBasis, basis::ACE.OneParticleBasis) - return true - end - - function filter(bb, Bsel::ACE.CategorySparseBasis, basis::ACE.OneParticleBasis) - # auxiliary function to count the number of 1pbasis functions in bb - # for which b.isym == s. - num_b_is_(s) = sum([(getproperty(b, Bsel.isym) == s) for b in bb]) - - # Within category min correlation order constaint: - cond_ord_cats_min = all( num_b_is_(s) >= ACE.minorder(Bsel, s) - for s in keys(Bsel.minorder_dict) ) - # Within category max correlation order constaint: - cond_ord_cats_max = all( num_b_is_(s) <= ACE.maxorder(Bsel, s) - for s in keys(Bsel.maxorder_dict) ) - - return cond_ord_cats_min && cond_ord_cats_max - end \ No newline at end of file