diff --git a/src/Symmetry/Crystal.jl b/src/Symmetry/Crystal.jl index 697fedebb..30facf63a 100644 --- a/src/Symmetry/Crystal.jl +++ b/src/Symmetry/Crystal.jl @@ -355,7 +355,7 @@ function is_spacegroup_type_consistent(sgt, latvecs) end -function crystallographic_orbit_for_symops(position::Vec3, symops::Vector{SymOp}; symprec) +function crystallographic_orbit(position::Vec3, symops::Vector{SymOp}; symprec) orbit = Vec3[] for s = symops x = wrap_to_unit_cell(transform(s, position); symprec) @@ -366,8 +366,8 @@ function crystallographic_orbit_for_symops(position::Vec3, symops::Vector{SymOp} return orbit end -function crystallographic_orbits_for_symops(positions::Vector{Vec3}, symops::Vector{SymOp}; symprec, wyckoffs=nothing) - orbits = crystallographic_orbit_for_symops.(positions, Ref(symops); symprec) +function crystallographic_orbits_distinct(positions::Vector{Vec3}, symops::Vector{SymOp}; symprec, wyckoffs=nothing) + orbits = crystallographic_orbit.(positions, Ref(symops); symprec) # Check orbits are distinct for (i, ri) in enumerate(positions), j in i+1:length(orbits) @@ -395,7 +395,7 @@ end # of positions function crystal_from_spacegroup(latvecs::Mat3, positions::Vector{Vec3}, types::Vector{String}, sg::Spacegroup; symprec) wyckoffs = find_wyckoff_for_position.(Ref(sg), positions; symprec) - orbits = crystallographic_orbits_for_symops(positions, sg.symops; symprec, wyckoffs) + orbits = crystallographic_orbits_distinct(positions, sg.symops; symprec, wyckoffs) # Check that inferred orbits match known multiplicities of the Wyckoffs foreach(orbits, wyckoffs) do orbit, wyckoff diff --git a/src/Symmetry/Parsing.jl b/src/Symmetry/Parsing.jl index bee5698d2..ec3dc9b45 100644 --- a/src/Symmetry/Parsing.jl +++ b/src/Symmetry/Parsing.jl @@ -186,7 +186,7 @@ function Crystal(filename::AbstractString; symprec=nothing, override_symmetry=fa symops = [SymOp(s.R, s.T) for s in symops] # Fill atom positions by symmetry and infer symmetry operations - orbits = crystallographic_orbits_for_symops(positions, symops; symprec) + orbits = crystallographic_orbits_distinct(positions, symops; symprec) all_positions = reduce(vcat, orbits) all_types = repeat_multiple(classes, length.(orbits)) supercell = crystal_from_inferred_symmetry(latvecs, all_positions, all_types; symprec, check_cell=false) diff --git a/src/Symmetry/WyckoffData.jl b/src/Symmetry/WyckoffData.jl index 0d6a3bff2..36ace1754 100644 --- a/src/Symmetry/WyckoffData.jl +++ b/src/Symmetry/WyckoffData.jl @@ -33,7 +33,7 @@ function is_periodic_copy(w1::WyckoffExpr, w2::WyckoffExpr) return isapprox(w1.F, w2.F; atol) && all_integer(w2.c - w1.c; symprec=atol) end -function crystallographic_orbit(symops::Vector{SymOp}, w::WyckoffExpr) +function crystallographic_orbit(w::WyckoffExpr, symops::Vector{SymOp}) orbit = WyckoffExpr[] for s in symops w2 = transform(s, w) @@ -74,7 +74,7 @@ function find_wyckoff_for_position(sgnum::Int, r::Vec3; symprec) symops = SymOp.(Rs, Ts) for (multiplicity, letter, sitesym, pos) in reverse(wyckoff_table[sgnum]) - for w in crystallographic_orbit(symops, WyckoffExpr(pos)) + for w in crystallographic_orbit(WyckoffExpr(pos), symops) θ = position_to_wyckoff_params(r, w; symprec) if !isnothing(θ) return Wyckoff(multiplicity, letter, sitesym) diff --git a/test/test_symmetry.jl b/test/test_symmetry.jl index 047f15a41..62c1c3c2e 100644 --- a/test/test_symmetry.jl +++ b/test/test_symmetry.jl @@ -29,7 +29,7 @@ for sgnum in 1:230 sg = Sunny.Spacegroup(Sunny.standard_setting[sgnum]) for (mult, letter, sitesym, pos) in Sunny.wyckoff_table[sgnum] - orbit = Sunny.crystallographic_orbit(sg.symops, Sunny.WyckoffExpr(pos)) + orbit = Sunny.crystallographic_orbit(Sunny.WyckoffExpr(pos), sg.symops) @assert length(orbit) == mult end end