pyxtal.supergroup module
Module to search for the supergroup symmetry
- pyxtal.supergroup.find_mapping(atom_sites, splitter)[source]
Search for all mappings for a given splitter.
- Parameters:
atom_sites – list of wp object
splitter – wp_splitter object
- Returns:
unique solutions
- pyxtal.supergroup.find_mapping_per_element(sites1, sites2)[source]
Search for all mappings for a given splitter.
- Parameters:
sites1 (list) – e.g., l layer [‘4a’, ‘8b’, ‘4c’]
sites2 (list) – e.g., 2 layers [[‘4a’], [‘8b’, ‘4c’]]
- Returns:
e.g. 3 layers: [[[0], [1,2]]]
- Return type:
unique solutions
- pyxtal.supergroup.find_xyz(G2_op, coord, quadrant=None)[source]
Finds the x,y,z free parameter values for positions in the G_2 basis.
- Parameters:
G2_op – a symmetry operation in G2
coord – the coordinate that matches G2_op
quadrant – a 3 item list (ex:[1,1,-1]) that contains information on the orientation of the molecule
- Returns:
x,y,z parameters written in the G2 basis
- Return type:
G2_holder
- pyxtal.supergroup.new_structure(struc, refs)[source]
Check if struc is already in the reference solutions.
- pyxtal.supergroup.search_G1(G, rot, tran, pos, wp1, op)[source]
Search the best matched position in the G1 basis.
- Parameters:
G – Target space group object
rot – Rotation matrix (3x3)
tran – Translation vector (1x3)
pos – Starting position
wp1 – Wyckoff position symmetry
op – Symmetry operation
- Returns:
- (closest_position, distance)
closest_position: The best matched position in G1 basis
distance: Distance between original and matched positions
- Return type:
tuple
- pyxtal.supergroup.search_G2(rot, tran, pos1, pos2, cell=None)[source]
Search the best matched position in G2 basis.
- Parameters:
rot – Rotation matrix (3x3)
tran – Translation vector (1x3)
pos1 – Position in G1
pos2 – Reference position in G2
cell – Unit cell matrix (3x3), optional
- Returns:
- (pos, dist)
pos: Matched position in G2 basis
dist: Relative distance between matched positions
- Return type:
tuple
- class pyxtal.supergroup.supergroup(struc, G, random_state=None)[source]
Bases:
objectClass to find the structure with supergroup symmetry
- Parameters:
struc – pyxtal structure
G – target supergroup number
- calc_disps(split_id, solution, d_tol)[source]
For a given solution, compute the minimum disp by adusting translation.
- Parameters:
split_id (int) – integer
solution (list) – e.g., [[‘2d’], [‘6h’], [‘2c’, ‘6h’, ‘12i’]]
d_tol (float) – tolerance
- Returns:
maximum atomic displcement translation: overall cell translation
- Return type:
max_disp
- make_pyxtal_in_supergroup(solution)[source]
Make the pyxtal according to the given solution
- Parameters:
solution – a tuple of (sp, mapping, translation, wyc_set_id, max_disp)
- Returns:
a pyxtal structure in high symmetry
- make_pyxtals_in_subgroup(solution, N_images=5)[source]
Make the pyxtal according to the given solution
- Parameters:
solution – a tuple of (sp, mapping, translation, wyc_set_id, max_disp)
N_images – number of images
- Returns:
a list of pyxtal structures in low symmetry
- make_supergroup(solutions, show_detail=False)[source]
Create unique supergroup structures from a list of solutions
- Parameters:
solutions – list of tuples (splitter, mapping, translation, disp)
show_detail (bool) – print out the detail
- Returns:
list of pyxtal structures
- print_detail(solution, coords_H, coords_G, elements)[source]
Print out the details of tranformation
- search_supergroup(d_tol=0.9, max_per_G=2500, max_solutions=None)[source]
Search for valid supergroup transition
- Parameters:
d_tol (float) – tolerance for atomic displacement
max_per_G (int) – maximum number of possible solution for each G
max_solutions (int) – maximum number of solutions.
- Returns:
list of solutions with small displacements
- Return type:
solutions
- symmetrize(splitter, mapping, translation)[source]
Symmetrize the structure (G) to supergroup symmetry (H)
- Parameters:
splitter – Splitter object to specify the relation between G and H
mapping – Atomic mapping between H and G
translation – An overall shift from H to G, None or 3 vector
- Returns:
- (coords_G1, coords_G2, coords_H, elements, ordered_mapping)
coords_G1: Coordinates in G
coords_G2: Coordinates in G under the subgroup setting
coords_H1: Coordinates in H
elements: List of elements
- Return type:
tuple
- symmetrize_dist(splitter, mapping, mask, translation=None, d_tol=1.2)[source]
For a given solution, search for the possbile supergroup structure based on a given
translationandmask.- Parameters:
splitter – Splitter object between G and H
mapping – List of sites in H, e.g., [‘4a’, ‘8b’]
mask – If there is a need to freeze the direction
translation – An overall shift from H to G, None or 3 vector
d_tol – The tolerance in angstrom
- Returns:
- (max_disp, translation, mask)
max_disp: Maximum atomic displacement
translation: Cell translation vector
mask: Direction mask
- Return type:
tuple
- symmetrize_site_double_k(splitter, id, coord_H, translation, run_type=1)[source]
Symmetrize two WPs (wp_h1, wp_h2) to another wp_G with higher symmetry.
- Parameters:
splitter (Splitter) – Splitter object between G and H groups
id (int) – Index of splitter
coord_H (array) – Array of shape (2,3) containing coordinates
translation (array) – Translation vector of shape (3,)
run_type (int) – Whether to return distance (1) or coordinates (0)
- Returns:
float: Maximum atomic displacement run_type=0: tuple: (coord_G1, coord_G2, coord_H)
coord_G1: coordinate in G1 basis
coord_G2: coordinates in G2 basis
coord_H: original coordinates in H basis
- Return type:
run_type=1
- symmetrize_site_double_t(splitter, id, coord_H, translation, run_type=1)[source]
Symmetrize two WPs (wp_h1, wp_h2) to another wp_G with higher symmetry.
- Parameters:
splitter (Splitter) – Splitter object to specify relation between groups
id (int) – Index in the splitter
coord_H (array) – Atomic coordinates
translation (array) – 1x3 translation vector
run_type (int) – Whether to return distances (1) or coordinates (0)
- Returns:
float: Maximum atomic displacement run_type=0: tuple: (coord_G1, coord_G2, coord_H)
coord_G1: Coordinates in G1 basis
coord_G2: Coordinates in G2 basis
coord_H: Original coordinates in H basis
- Return type:
run_type=1
- symmetrize_site_multi(splitter, id, coord_H, translation, run_type=1)[source]
Symmetrize multiple WPs to another with higher symmetry.
- Parameters:
splitter (Splitter) – Splitter object between G and H groups
id (int) – Index in the splitter
coord_H (array) – Array of atomic coordinates
translation (array) – Translation vector of shape (3,)
run_type (int) – Whether to return distances (1) or coordinates (0)
- Returns:
float: Maximum atomic displacement run_type=0: tuple: (coord_G1, coord_G2, coord_H) - coord_G1: Coordinate in G1 basis - coord_G2: Coordinates in G2 basis - coord_H: Original coordinates in H basis
- Return type:
run_type=1
- symmetrize_site_single(splitter, id, base, translation, run_type=1)[source]
Symmetrize one WP to another with higher symmetry
- Parameters:
splitter – splitter object
id – index of splitter
base – atomic position of site in H
translation – 1*3 translation vector
run_type – return distance or coordinates
- Returns:
- run_type=1: (dist, translation, mask)
dist: minimum distance
translation: optimal translation vector
mask: direction mask
- run_type=0: (coord_G1, [coord_G2], [coord_H])
coord_G1: coordinate in G1
coord_G2: coordinate in G2
coord_H: coordinate in H
- Return type:
Two types of results
- class pyxtal.supergroup.supergroups(struc, G=None, path=None, d_tol=1.0, max_per_G=100, max_layer=5, show=False)[source]
Bases:
objectClass to search for the feasible transition to a given super group.
- Parameters:
struc – PyXtal object Input structure with subgroup symmetry (H)
G – int, optional Target supergroup space group number
path – list, optional List of space group numbers defining path from H to G (e.g. [62, 59, 74])
d_tol – float, default=1.0 Maximum allowed atomic displacement during symmetry change
max_per_G – int, default=100 Maximum number of symmetry solutions to consider per group
max_layer – int, default=5 Maximum number of intermediate groups in path
show – bool, default=False Whether to show detailed progress
Note
Either G or path must be provided, but not both None.
- get_transformation(N_images=2)[source]
Get the series of transformed structures between H and G
- Parameters:
N_images – number of structures
- Returns:
a series of pyxtal structures
- struc_along_path(path)[source]
Search for the super group structure along a given path.
- Parameters:
path (list) – List of space group numbers, e.g. [59, 71, 139]
- Returns:
(strucs, valid_sols, working_path, valid) - strucs: List of structures along the path - valid_sols: List of valid solutions for each transition - working_path: List of space group numbers along the path - valid: True if successfully reached target group, False otherwise
- Return type:
tuple
- pyxtal.supergroup.write_poscars(H_struc, G_struc, mappings, splitters, wyc_sets, N_images=3)[source]
Write the intermediate POSCARs between H and G structure.
The key is to continuously change G to subgroup representations with zero displacements. Finally, call
write_poscars_intermediate.- Parameters:
H_struc – PyXtal low symmetry structure
G_struc – PyXtal high symmetry structure
mappings – List of atomic mappings
splitters – List of splitter objects
wyc_sets – List of wyc_set transformations
N_images – Number of intermediate structures between H and G. Default is 3.
- Returns:
List of POSCARs between H and G structure.