Skip to content

Commit

Permalink
Naming consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
kbarros committed Nov 1, 2024
1 parent 1365b6b commit 20e8375
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/Symmetry/Crystal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Symmetry/Parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/Symmetry/WyckoffData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/test_symmetry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 20e8375

Please sign in to comment.