Skip to content

Commit

Permalink
Wyckoff set
Browse files Browse the repository at this point in the history
  • Loading branch information
lan496 committed Apr 6, 2024
1 parent 2cf072e commit ce27cc3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 7 additions & 7 deletions moyo/src/search/symmetry_search.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use itertools::iproduct;
use std::collections::{HashMap, HashSet, VecDeque};
use std::collections::{HashSet, VecDeque};

use log::{debug, warn};
use nalgebra::{Matrix3, Vector3};
Expand Down Expand Up @@ -67,7 +67,7 @@ impl PrimitiveSymmetrySearch {
assert!(!symmetries_tmp.is_empty());

// Purify symmetry operations by permutations
let mut translations_and_permutations = HashMap::new();
let mut operations_and_permutations = vec![];
for (rotation, rough_translation, permutation) in symmetries_tmp.iter() {
let (translation, distance) = symmetrize_translation_from_permutation(
primitive_cell,
Expand All @@ -76,10 +76,10 @@ impl PrimitiveSymmetrySearch {
rough_translation,
);
if distance < symprec {
translations_and_permutations.insert(*rotation, (translation, permutation.clone()));
operations_and_permutations.push((rotation, translation, permutation.clone()));
}
}
if translations_and_permutations.is_empty() {
if operations_and_permutations.is_empty() {
return Err(MoyoError::PrimitiveSymmetrySearchError);
}

Expand All @@ -105,8 +105,8 @@ impl PrimitiveSymmetrySearch {
translations.push(translation_lhs);
permutations.push(permutation_lhs.clone());

for (&rotation_rhs, (translation_rhs, permutation_rhs)) in
translations_and_permutations.iter()
for (&rotation_rhs, translation_rhs, permutation_rhs) in
operations_and_permutations.iter()
{
let new_rotation = rotation_lhs * rotation_rhs;
let new_translation = (rotation_lhs.map(|e| e as f64) * translation_rhs
Expand All @@ -116,7 +116,7 @@ impl PrimitiveSymmetrySearch {
queue.push_back((new_rotation, new_translation, new_permutation));
}
}
if rotations.len() != translations_and_permutations.len() {
if rotations.len() != operations_and_permutations.len() {
warn!("Found operations do not form a group. symprec and angle_tolerance may be too large.");
}

Expand Down
4 changes: 3 additions & 1 deletion moyo/tests/test_moyo_dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@ fn test_with_trigonal_Sc() {
assert_eq!(dataset.hall_number, 458);
assert_eq!(dataset.num_operations(), 12); // Rhombohedral setting
assert_eq!(dataset.orbits, vec![0]);
assert_eq!(dataset.wyckoffs, vec!['a']);
if dataset.wyckoffs[0] != 'a' && dataset.wyckoffs[0] != 'b' {
panic!("Unexpected Wyckoff letter: {}", dataset.wyckoffs[0]);
}
}

#[test]
Expand Down

0 comments on commit ce27cc3

Please sign in to comment.