Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasSachs committed Oct 30, 2023
1 parent 8424b36 commit 9ad2822
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/iterator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ using ACE: State, filter
using JuLIP.Potentials: neigsz
using JuLIP: Atoms
# using ACE: BondEnvelope, filter, State, CylindricalBondEnvelope

using ACEbonds.BondCutoffs: AbstractBondCutoff, env_cutoff, env_filter, EllipsoidCutoff
import ACEbonds.BondCutoffs: env_cutoff
using ACEbonds.BondCutoffs: AbstractBondCutoff, env_filter, EllipsoidCutoff

_msort(z1,z2) = (z1<=z2 ? (z1,z2) : (z2,z1)) #TODO: this is hack. Need to either not use it here or define it once across all packages.
enclosing_spherical_cutoff(cutoff::EllipsoidCutoff) = max(cutoff.rcutbond*.5 + cutoff.zcutenv, sqrt((cutoff.rcutbond*.5)^2+ cutoff.rcutenv^2))
enclosing_spherical_cutoff(cutoffs::Dict{Tuple{AtomicNumber,AtomicNumber},CUTOFF}) where {CUTOFF<:AbstractBondCutoff} = maximum(enclosing_spherical_cutoff(c) for c in values(cutoffs))
#env_cutoff(cutoff::EllipsoidCutoff) = max(cutoff.rcutbond*.5 + cutoff.zcutenv, sqrt((cutoff.rcutbond*.5)^2+ cutoff.rcutenv^2))
env_cutoff(cutoffs::Dict{Tuple{AtomicNumber,AtomicNumber},CUTOFF}) where {CUTOFF<:AbstractBondCutoff} = maximum(env_cutoff(c) for c in values(cutoffs))


bonds(at::Atoms, env::AbstractBondCutoff, args...) =
Expand Down Expand Up @@ -152,7 +152,7 @@ Alternatively, indsf can also be of the form of a filter function `atom_filter(i
"""
bonds(at::Atoms, rcutbond, rcutenv, env_filter, subset) = FilteredBondsIterator(at, rcutbond, rcutenv, env_filter, subset)
bonds(at::Atoms, cutoff::AbstractBondCutoff, filter=_->true) = FilteredBondsIterator( at, cutoff.rcutbond,
enclosing_spherical_cutoff(cutoff) ,
env_cutoff(cutoff) ,
(r, z) -> env_filter(r, z, cutoff), filter )

"""
Expand Down Expand Up @@ -292,7 +292,7 @@ Alternatively, indsf can also be of the form of a filter function `atom_filter(i
"""
function bonds(at::Atoms, cutoffs::Dict{Tuple{AtomicNumber,AtomicNumber},CUTOFF}, subset::Array{<:Int}) where {CUTOFF<:AbstractBondCutoff}
rcutbond = maximum(cutoff.rcutbond for cutoff in values(cutoffs))
rcutenv = enclosing_spherical_cutoff(cutoffs)
rcutenv = env_cutoff(cutoffs)
return FilteredBondsIteratorVarCutoff(at, rcutbond, rcutenv,subset, cutoffs)
end

Expand Down

0 comments on commit 9ad2822

Please sign in to comment.