Skip to content

Commit 94941c1

Browse files
authored
Merge pull request #32 from easyscience/26-improve-performance-of-symmetry-constraints-via-lookup-table
generate lookup table for space groups
2 parents 92dc90a + 066256e commit 94941c1

File tree

3 files changed

+50503
-14
lines changed

3 files changed

+50503
-14
lines changed

src/easydiffraction/crystallography/crystallography.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
get_it_number_by_name_hm_short,
1010
get_symop_pcentr_multiplicity_letter_site_symmetry_coords_xyz_2
1111
)
12+
from easydiffraction.crystallography.space_group_lookup_table import SPACE_GROUP_LOOKUP_DICT
1213

1314

1415
def apply_cell_symmetry_constraints(cell: dict,
@@ -83,20 +84,10 @@ def apply_atom_site_symmetry_constraints(atom_site: dict,
8384
print(error_msg)
8485
return atom_site
8586

86-
# 1 - OK
87-
# TODO: This is very slow!!!
88-
89-
result = get_symop_pcentr_multiplicity_letter_site_symmetry_coords_xyz_2(it_number, it_coordinate_system_code)
90-
91-
#return atom_site
92-
# 2 - NOT OK
93-
94-
letter_list = result[3]
95-
coords_xyz_list = result[5]
96-
97-
idx = letter_list.index(wyckoff_letter)
98-
coords_xyz = coords_xyz_list[idx]
99-
87+
space_group_entry = SPACE_GROUP_LOOKUP_DICT[(it_number, it_coordinate_system_code)]
88+
wyckoff_positions = space_group_entry["Wyckoff_positions"][wyckoff_letter]
89+
coords_xyz = wyckoff_positions["coords_xyz"]
90+
10091
first_position = coords_xyz[0]
10192
components = first_position.strip("()").split(",")
10293
parsed_exprs = [sympify(comp.strip()) for comp in components]

0 commit comments

Comments
 (0)