Skip to content

Commit

Permalink
Merge pull request #99 from MatthiasSachs/ms/equivarinat_matrices
Browse files Browse the repository at this point in the history
Ms/equivarinat matrices
  • Loading branch information
cortner authored Mar 3, 2022
2 parents d851d05 + 298c8c3 commit f148042
Show file tree
Hide file tree
Showing 15 changed files with 894 additions and 100 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ See [Documentation](https://acesuit.github.io/ACE.jl/dev/) for more details on A

## License

`ACE.jl` is © 2019, Christoph Ortner

`ACE.jl` is published and distributed under the [Academic Software License v1.0 (ASL).](ASL.md)
The majority of `ACE.jl` is published and distributed under the [Academic Software License v1.0 (ASL).](ASL.md). Some parts are distributed under the more permissive [The MIT License](https://opensource.org/licenses/MIT) - see `/license/MIT.md' for further details.

`ACE.jl` is distributed in the hope that it will be useful for non-commercial academic research, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ASL for more details.

Expand Down
25 changes: 25 additions & 0 deletions license/contrib.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Contributions made in the following commits are licensed under the MIT Software License, cf. MIT.md. Contributors agree to their contributions to be licensed in this way by committing changes to this license file. All other contributions are licensed under ASL.

Commit - Contributer (Github username)

e6ba0362d5d062b67b99f4802b3ac84be0975e08 - MatthiasSachs
8dc35260e82afbd1dbc5c69159cdd368e6d33a51 - MatthiasSachs
75d5b6a2bec95ec56518a3298cb10899b28a5139 - MatthiasSachs
d1fa4129fa909e2c8b04a63b5a6520f1e80fb634 - MatthiasSachs
f81c451d346b311610b0f6de7a59635328322183 - MatthiasSachs
c085a441fdac0b0e20832a6ae5db732cbeca62f6 - MatthiasSachs
f445e562ef0143a09b1520fc4c8118cf1e519c41 - MatthiasSachs
9dcc9bb3b6716f6260b1e62003506b0b4d748c88 - MatthiasSachs
f6ea6e80ea3b2f61f0f5358a47c4a5c4e0314d5a - MatthiasSachs
c7cdea1ed37aa3d285d028fc763b01667320b7da - MatthiasSachs
ff7a05e2d59e428564315a3749a0acf88a3cb4f3 - MatthiasSachs
28ac1fb496d4730ef26c4658f3c89c0b2b0ce886 - MatthiasSachs
b035504dfaf41b8418a2d1fc04b95458eb65459e - MatthiasSachs
48bca8371c3106d6f1d38744f3fe88efa271a8f6 - MatthiasSachs
09918210ddeac412e81a5648fd9a8c1d7f5cf9df - MatthiasSachs
a06a3034b7d31bc411926f9cf3811b27be889593 - MatthiasSachs
e856741b89aa75e902eda4ef117cd66e732a99aa - MatthiasSachs
e02dd3663751c92c00c2788d31511a54a29406ed - MatthiasSachs
4b82aece333ef1e010f9f927f2873d5676d439ed - MatthiasSachs

--
5 changes: 5 additions & 0 deletions license/mit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
82 changes: 75 additions & 7 deletions src/basisselectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ maxorder(Bsel::SimpleSparseBasis, args...) =
"""
`AbstractSparseBasis`: Super-type for sparse basis selection as sub-levelsets of
the levelset function `level` and corresponding (possibly order-dependent)
levels provided in the dictionary `maxdegs::Dict{Any, Float64}`. In the default
levels provided in the dictionary `maxlevels::Dict{Any, Float64}`. In the default
implementation the levelset function and the degree function are identical.
Basis functions are selected in two steps. First, "admissible" basis
Expand Down Expand Up @@ -183,15 +183,15 @@ function SparseBasis(; maxorder::Integer = nothing,
p = 1,
weight = Dict(:l => 1.0, :n => 1.0),
default_maxdeg = nothing,
maxdegs = nothing )
if (default_maxdeg != nothing) && (maxdegs == nothing )
maxlevels = nothing )
if (default_maxdeg != nothing) && (maxlevels == nothing )
return SparseBasis(maxorder, weight,
Dict{Any, Float64}("default" => default_maxdeg),
p)
elseif (default_maxdeg == nothing) && (maxdegs != nothing)
SparseBasis(maxorder, weight, maxdegs, p)
elseif (default_maxdeg == nothing) && (maxlevels != nothing)
SparseBasis(maxorder, weight, maxlevels, p)
else
error("""Either both or neither optional arguments `maxdegs` and
error("""Either both or neither optional arguments `maxlevels` and
`default_maxdeg` were provided. To avoid ambiguity ensure that
exactly one of these arguments is provided.""")
end
Expand Down Expand Up @@ -282,10 +282,78 @@ cat_weighted_degree(bb::Prodb, Bsel::CategorySparseBasis, basis::OneParticleBasi
)


# ---------------------------
# ---------------------------
# Some useful filters

struct NoConstant
end

(::NoConstant)(bb) = (length(bb) > 0)


"""
`EvenL`: selects all basis functions where the sum `L = sum_i l_i` of the degrees `l_i` of the spherical harmonics is even.
"""
struct EvenL
isym::Symbol
categories
end

function (f::ACE.EvenL)(bb)
if isempty(bb)
return true
else
suml(s) = sum( [getl(O3(), b) for b in bb if getproperty(b, f.isym) == s])
return all(iseven(suml(s)) for s in f.categories)
end
end


#=
"""
`DownsetIntersection`: Basis selector whose set of admissible specifications is the intersection
of the sets of admissible specifications of the sparse basis selectors contained in the lists `DBsels` and `ABsels`.
"""
struct DownsetIntersection <: DownsetBasisSelector
DBsels::Vector{DownsetBasisSelector}
ABsels::Vector{AbstractBasisSelector}
maxorder::Int
end
maxlevel(Bsel::DownsetIntersection, basis::OneParticleBasis) = 1.0
maxorder(Bsel::DownsetIntersection) = Bsel.maxorder
function Base.intersect(Bsel1::DownsetIntersection,Bsel2::DownsetBasisSelector)
return DownsetIntersection(vcat(Bsel1.DBsels,[Bsel2]), BSel1.ABsels, minimum([maxorder(Bsel1),maxorder(Bsel2)]))
end
function Base.intersect(Bsel1::DownsetIntersection,Bsel2::AbstractBasisSelector)
return DownsetIntersection(Bsel1.DBsels, vcat(Bsel1.ABsels,[Bsel2]), minimum([maxorder(Bsel1),maxorder(Bsel2)]))
end
function Base.intersect(Bsel1::DownsetBasisSelector, Bsel2::AbstractBasisSelector)
Bsel = DownsetIntersection(Vector{DownsetBasisSelector}([]), Vector{AbstractBasisSelector}([]), Inf)
return intersect(intersect(Bsel, Bsel1), Bsel2)
end
Base.intersect(Bsel1::AbstractBasisSelector, Bsel2::DownsetBasisSelector) = intersect(Bsel2,Bsel1)
Base.intersect(Bsel1::AbstractBasisSelector, Bsel2::DownsetIntersection) = intersect(Bsel2,Bsel1)
function Base.intersect(Bsel1::DownsetIntersection, Bsel2::DownsetIntersection)
Bsel = deepcopy(Bsel1)
for b in Bsel2
Bsel = intersect(Bsel, b)
end
return Bsel
end
function level(bb, Bsel::DownsetIntersection, basis::OneParticleBasis)
return maximum([ level(bb, bsel, basis)/maxlevel(bsel,basis) for bsel in Bsel.DBsels])
#return maximum([ level(bb, bsel, basis)/maxlevel(length(bb),bsel,basis) for bsel in Bsel.DBsels])
end
function filter(bb, Bsel::DownsetIntersection, basis::OneParticleBasis)
return all([filter(bb, bsel, basis) for bsel in Bsel.DBsels]) && all([filter(bb, bsel, basis) for bsel in Bsel.ABsels])
end
=#
2 changes: 1 addition & 1 deletion src/bonds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cutoff_env(env::CylindricalBondEnvelope) = sqrt(env.rcut^2 + (env.r0cut + env.zc
cutoff_radialbasis(env::CylindricalBondEnvelope) = sqrt(env.rcut^2 + (env.zcut + env.floppy * env.λ * env.r0cut)^2)

struct EllipsoidBondEnvelope{T} <: BondEnvelope{T}
r0cut::T
r0cut::T # bond-length cutoff
rcut::T
zcut::T # must satisfy zcut >= r0cut/2
p0::Int
Expand Down
29 changes: 29 additions & 0 deletions src/cov_coeffs_dict.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
crmatrices=Dict(
(l=1, m=-1, mu=-1, i=1) => SVector{3,ComplexF64}(0.1666666666666667+0.0im, 0.0+0.1666666666666667im, 0.0+0.0im),
(l=1, m=-1, mu=0, i=1) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im),
(l=1, m=-1, mu=1, i=1) => SVector{3,ComplexF64}(-0.1666666666666667+0.0im, 0.0+-0.1666666666666667im, 0.0+0.0im),
(l=1, m=0, mu=-1, i=1) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, -0.2357022603955158+0.0im),
(l=1, m=0, mu=0, i=1) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im),
(l=1, m=0, mu=1, i=1) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.2357022603955158+0.0im),
(l=1, m=1, mu=-1, i=1) => SVector{3,ComplexF64}(-0.1666666666666667+0.0im, 0.0+0.1666666666666667im, 0.0+0.0im),
(l=1, m=1, mu=0, i=1) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im),
(l=1, m=1, mu=1, i=1) => SVector{3,ComplexF64}(0.1666666666666667+0.0im, 0.0+-0.1666666666666667im, 0.0+0.0im),
(l=1, m=-1, mu=-1, i=2) => SVector{3,ComplexF64}(0.0+-0.1666666666666667im, 0.1666666666666667+0.0im, 0.0+0.0im),
(l=1, m=-1, mu=0, i=2) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im),
(l=1, m=-1, mu=1, i=2) => SVector{3,ComplexF64}(0.0+-0.1666666666666667im, 0.1666666666666667+0.0im, 0.0+0.0im),
(l=1, m=0, mu=-1, i=2) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.2357022603955158im),
(l=1, m=0, mu=0, i=2) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im),
(l=1, m=0, mu=1, i=2) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.2357022603955158im),
(l=1, m=1, mu=-1, i=2) => SVector{3,ComplexF64}(0.0+0.1666666666666667im, 0.1666666666666667+0.0im, 0.0+0.0im),
(l=1, m=1, mu=0, i=2) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im),
(l=1, m=1, mu=1, i=2) => SVector{3,ComplexF64}(0.0+0.1666666666666667im, 0.1666666666666667+0.0im, 0.0+0.0im),
(l=1, m=-1, mu=-1, i=3) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im),
(l=1, m=-1, mu=0, i=3) => SVector{3,ComplexF64}(-0.2357022603955158+0.0im, 0.0+-0.2357022603955158im, 0.0+0.0im),
(l=1, m=-1, mu=1, i=3) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im),
(l=1, m=0, mu=-1, i=3) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im),
(l=1, m=0, mu=0, i=3) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.3333333333333333+0.0im),
(l=1, m=0, mu=1, i=3) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im),
(l=1, m=1, mu=-1, i=3) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im),
(l=1, m=1, mu=0, i=3) => SVector{3,ComplexF64}(0.2357022603955158+0.0im, 0.0+-0.2357022603955158im, 0.0+0.0im),
(l=1, m=1, mu=1, i=3) => SVector{3,ComplexF64}(0.0+0.0im, 0.0+0.0im, 0.0+0.0im)
)
Loading

0 comments on commit f148042

Please sign in to comment.