pyxtal.symmetry module

Module for storing & accessing symmetry group information, including
  • Group class
  • Wyckoff_Position class.
  • Hall class
class pyxtal.symmetry.Group(group, dim=3, use_hall=False, style='pyxtal', quick=False)[source]

Bases: object

Class for storing a set of Wyckoff positions for a symmetry group. See the documentation for details about settings.

Examples

>>> from pyxtal.symmetry import Group
>>> g = Group(64)
>>> g
-- Spacegroup --# 64 (Cmce)--
16g site symm: 1
8f  site symm: m..
8e  site symm: .2.
8d  site symm: 2..
8c  site symm: -1
4b  site symm: 2/m..
4a  site symm: 2/m..

one can access data such as symbol, number and Wyckoff_positions

>>> g.symbol
'Cmce'
>>> g.number
64
>>> g.Wyckoff_positions[0]
Wyckoff position 16g in space group 64 with site symmetry 1
x, y, z
-x, -y+1/2, z+1/2
-x, y+1/2, -z+1/2
x, -y, -z
-x, -y, -z
x, y+1/2, -z+1/2
x, -y+1/2, z+1/2
-x, y, z
x+1/2, y+1/2, z
-x+1/2, -y+1, z+1/2
-x+1/2, y+1, -z+1/2
x+1/2, -y+1/2, -z
-x+1/2, -y+1/2, -z
x+1/2, y+1, -z+1/2
x+1/2, -y+1, z+1/2
-x+1/2, y+1/2, z

We also provide several utilities functions, e.g., one can search the possible wyckoff_combinations by a formula

>>> g.list_wyckoff_combinations([4, 2])
(None, False)
>>> g.list_wyckoff_combinations([4, 8])
([[['4a'], ['8c']],
[['4a'], ['8d']],
[['4a'], ['8e']],
[['4a'], ['8f']],
[['4b'], ['8c']],
[['4b'], ['8d']],
[['4b'], ['8e']],
[['4b'], ['8f']]],
[False, True, True, True, False, True, True, True])

or search the subgroup information

>>> g.get_max_t_subgroup()['subgroup']
[12, 14, 15, 20, 36, 39, 41]

or check if a given composition is compatible with Wyckoff positions

>>> g = Group(225)
>>> g.check_compatible([64, 28, 24])
(True, True)

or check the possible transition paths to a given supergroup

>>> g = Group(59)
>>> g.search_supergroup_paths(139, 2)
[[71, 139], [129, 139], [137, 139]]
Parameters:
  • group – the group symbol or international number
  • (defult (dim) – 3): the periodic dimension of the group
  • (default (style) – False): whether or not use the hall number
  • (defaultpyxtal): the choice of hall number (‘pyxtal’/’spglib’)
  • (defaut (quick) – False): whether or not ignore the wyckoff information
add_k_transitions(path, n=1)[source]

Adds additional k transitions to a subgroup path. ONLY n = 1 is supported for now. It will return viable additions in front of each group in the path.

Parameters:
  • path – a single result of search_subgroup_paths function
  • n – number of extra k transitions to add to the given path
Returns:

a list of maximal subgroup chains with extra k type transitions

cellsize()[source]

Returns the number of duplicate atoms in the conventional lattice (in contrast to the primitive cell). Based on the type of cell centering (P, A, C, I, R, or F)

check_compatible(numIons, valid_orientations=None)[source]

Checks if the number of atoms is compatible with the Wyckoff positions. Considers the number of degrees of freedom for each Wyckoff position, and makes sure at least one valid combination of WP’s exists.

Parameters:
  • numIons – list of integers
  • valid_orientations – list of possible orientations (molecule only)
Returns:

True/False has_freedom: True/False

Return type:

Compatible

static clean_lists(numIon, l_mult0, l_maxn0, l_free0, indices0, used_indices)[source]
get_alternatives()[source]

Get the alternative settings as a dictionary

get_ferroelectric_groups()[source]

return the list of possible ferroelectric point groups

get_free_axis()[source]

Get the free axis that can perform continus translation

get_lists(numIon, used_indices)[source]

Compute the lists of possible mult/maxn/freedom/i_wp

Parameters:
  • numIon – integer number of atoms
  • used_indices – a list of integer numbers
get_lists_mol(numIon, used_indices, orientations)[source]

Compute the lists of possible mult/maxn/freedom/i_wp

Parameters:
  • numIon – integer number of atoms
  • used_indices – a list of integer numbers
  • orientations – list of orientations
get_max_k_subgroup()[source]

Returns the maximal k-subgroups as a dictionary

get_max_subgroup(H)[source]
get_max_subgroup_numbers(max_cell=9)[source]

Returns the minimal supergroups as a dictionary

get_max_t_subgroup()[source]

Returns the maximal t-subgroups as a dictionary

get_min_supergroup(group_type='t', G=None)[source]

Returns the minimal supergroups as a dictionary

get_site_dof(sites)[source]

compute the degree of freedom for each site :param sites: list, e.g. [‘4a’, ‘8b’] or [‘a’, ‘b’]

Returns:True or False
get_splitters_from_relation(struc, relation)[source]

Get the valid symmetry relations for a structure to its supergroup e.g.,

Parameters:
  • struc (-) – pyxtal structure
  • group_type (-) – t or k
Returns:

list of valid transitions

get_splitters_from_structure(struc, group_type='t')[source]

Get the valid symmetry relations for a structure to its supergroup e.g.,

Parameters:
  • struc (-) – pyxtal structure
  • group_type (-) – t or k
Returns:

list of valid transitions [(id, ([‘4a’], [‘4b’], [[‘4a’], [‘4c’]])]

get_valid_solutions(solutions)[source]

check if the solutions are valid a special WP such as (0,0,0) cannot be occupied twice

Parameters:solutions – list of solutions about the distibution of WP sites
Returns:the filtered solutions that are vaild
get_wp_list(reverse=False)[source]

Get the reversed list of wps

get_wyckoff_position(index)[source]

Returns a single Wyckoff_position object.

Parameters:index – the index of the Wyckoff position within the group.

Returns: a Wyckoff_position object

get_wyckoff_symmetry(index, molecular=False)[source]

Returns the site symmetry symbol for the Wyckoff position

Parameters:
  • index – the index of the Wyckoff position within the group
  • molecular – use the Euclidean operations or not (for hexagonal group)

Returns: a Hermann-Mauguin style string for the site symmetry

is_valid_combination(sites)[source]

check if the solutions are valid. A special WP with zero freedom (0,0,0) cannot be occupied twice.

Parameters:sites – list, e.g. [‘4a’, ‘8b’] or [‘a’, ‘b’]
Returns:True or False
classmethod list_groups(dim=3)[source]

Function for quick print of groups and symbols.

Parameters:
  • group – the group symbol or international number
  • dim – the periodic dimension of the group
list_wyckoff_combinations(numIons, quick=False)[source]

List all possible wyckoff combinations for the given formula. Note this is really designed for a light weight calculation. If the solution space is big, set quick as True.

Parameters:
  • numIons – [12, 8]
  • quick – Boolean, quickly generate some solutions
Returns:

list of possible sites has_freedom: list of boolean numbers

Return type:

Combinations

path_to_general_wp(index=1, max_steps=1)[source]

Find the path to transform the special wp into general site

Parameters:
  • group – Group object
  • index – the index of starting wp
  • max_steps – the number of steps to search
Returns:

a list of (g_types, subgroup_id, spg_number, wp_list (optional))

search_subgroup_paths(G, max_layer=5)[source]

Search paths to transit to subgroup H. if - path1 is a>>e - path2 is a>>b>>c>>e path 2 will not be counted since path 1 exists

Parameters:
  • G – final subgroup number
  • max_layer – the number of supergroup calculations needed.
Returns:

list of possible paths ordered from H to G

search_supergroup_paths(H, max_layer=5)[source]

Search paths to transit to super group H. if - path1 is a>>e - path2 is a>>b>>c>>e path 2 will not be counted since path 1 exists

Parameters:
  • H – final supergroup number
  • max_layer – the number of supergroup calculations needed.
Returns:

list of possible paths ordered from G to H

short_path_to_general_wp(index=1, t_only=False)[source]

Find a short path to turn the spcical wp to general position

Parameters:
  • index – index of the wp
  • t_only – only consider t_spliting
class pyxtal.symmetry.Hall(spgnum, style='pyxtal', permutation=False)[source]

Bases: object

Class for conversion between Hall and standard spacegroups http://cci.lbl.gov/sginfo/itvb_2001_table_a1427_hall_symbols.html

Parameters:
  • spg_num – interger number between 1 and 230
  • style – spglib or pyxtal
  • permutation – allow permutation or not
class pyxtal.symmetry.Wyckoff_position[source]

Bases: object

Class for a single Wyckoff position within a symmetry group

Examples

>>> from pyxtal.symmetry import Wyckoff_position as wp
>>> wp.from_group_and_index(19, 0)
Wyckoff position 4a in space group 19 with site symmetry 1
x, y, z
-x+1/2, -y, z+1/2
-x, y+1/2, -z+1/2
x+1/2, -y+1/2, -z
apply_ops(pt)[source]

apply symmetry operation

are_equivalent_pts(pt1, pt2, cell=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), tol=0.05)[source]

Check if two pts are equivalent

copy()[source]

Simply copy the structure

equivalent_set(index)[source]

Transform the wp to another equivalent set. Needs to update both wp and positions

Parameters:transformation – index
from_dict()[source]

Constructs a Wyckoff_position object using a dictionary.

from_group_and_index(index, dim=3, use_hall=False, style='pyxtal', wyckoffs=None)[source]

Creates a Wyckoff_position using the space group number and index

Parameters:
  • group – the international number of the symmetry group
  • index – the index of the Wyckoff position within the group.
  • dim – the periodic dimension of the crystal
  • (default (style) – False): whether or not use the hall number
  • (defaultpyxtal): ‘pyxtal’ or ‘spglib’ for hall number
from_group_and_letter(letter, dim=3, style='pyxtal', hn=None)[source]

Creates a Wyckoff_position using the space group number and index

Parameters:
  • group – the international number of the symmetry group
  • letter – e.g. 4a
  • dim – the periodic dimension of the crystal
  • style – ‘pyxtal’ or spglib, differing in the choice of origin
  • hn – hall_number
from_index_quick(wyckoffs, index, P=None, P1=None)[source]

A short cut to create the WP object from a given index ignore the site symmetry and generators Mainly used for the update function

Parameters:
  • wyckoffs – wyckoff position
  • index – index of wp
  • P – transformation matrix (rot + trans)
from_symops(G)[source]

search Wyckoff Position by symmetry operations

Parameters:
  • ops – a list of symmetry operations
  • G – the Group object
Returns:

Wyckoff_position

from_symops_wo_group()[source]

search Wyckoff Position by symmetry operations Now only supports space group symmetry Assuming general position only

Parameters:ops – a list of symmetry operations
Returns:Wyckoff_position
gen_pos()[source]

Returns the general Wyckoff position

get_all_positions(pos)[source]

return the list of position from any single coordinate from wp. The position does not have to be the 1st number in the wp list

>>> from pyxtal.symmetry import Group
>>> wp2 = Group(62)[-1]
>>> wp2
Wyckoff position 4a in space group 62 with site symmetry -1
0, 0, 0
1/2, 0, 1/2
0, 1/2, 0
1/2, 1/2, 1/2
>>> wp2.get_all_positions([1/2, 1/2, 1/2])
array([[0. , 0. , 0. ],
       [0.5, 0. , 0.5],
       [0. , 0.5, 0. ],
       [0.5, 0.5, 0.5]])
get_dof()[source]

Simply return the degree of freedom

get_euclidean_generator(cell, idx=0)[source]

return the symmetry operation object at the Euclidean space

Parameters:
  • cell – 3*3 cell matrix
  • idx – the index of wp generator
Returns:

pymatgen SymmOp object

get_euclidean_symmetries()[source]

return the symmetry operation object at the Euclidean space

Returns:list of pymatgen SymmOp object
get_frozen_axis()[source]
get_hm_number()[source]
get_hm_symbol()[source]

get Hermann-Mauguin symbol

get_ops_from_transformation()[source]

Get symmetry operation from the generators

get_site_symm_wo_translation()[source]
get_site_symmetry()[source]
has_equivalent_ops(wp2, tol=0.001)[source]

check if two wps are equivalent

Parameters:wp2 – wp object or list of operations
is_pure_translation(id)[source]

Check if the operation is equivalent to pure translation

is_standard_setting()[source]

Check if the symmetry operation follows the standard setting

classmethod load_dict(dicts)[source]
merge(pt, lattice, tol, orientations=None)[source]

Given a list of fractional coordinates, merges them within a given tolerance, and checks if the merged coordinates satisfy a Wyckoff position.

Parameters:
  • pt – the originl point (3-vector)
  • lattice – a 3x3 matrix representing the unit cell
  • tol – the cutoff distance for merging coordinates
  • orientations – the valid orientations for a given molecule.
Returns:

3-vector after merge wp: a Wyckoff_position object, If no match, returns False. valid_ori: the valid orientations after merge

Return type:

pt

print_ops(ops=None)[source]
process_ops()[source]

handle some annoying cases e.g., in I2, [‘1/2, y, 1/2’, ‘0, y+1/2, 0’] can be transfered to [‘0, y, 0’, ‘1/2, y+1/2, 1/2’]

project(point, cell=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), PBC=[1, 1, 1], id=0)[source]

Given a 3-vector and a Wyckoff position operator, returns the projection onto the axis, plane, or point.

>>> wp.project_point([0,0.3,0.1],
array([0. , 0.3, 0.1])
Parameters:
  • point – a 3-vector (numeric list, tuple, or array)
  • cell – 3x3 matrix describing the unit cell vectors
  • PBC – A periodic boundary condition list, where 1 means periodic, 0 means not periodic. Ex: [1,1,1] -> full 3d periodicity, [0,0,1] -> 1d periodicity along the z axis
Returns:

a transformed 3-vector (numpy array)

save_dict()[source]
search_all_generators(pos, ops=None, tol=0.01)[source]

search generator for a special Wyckoff position

Parameters:
  • pos – initial xyz position
  • ops – list of symops
  • tol – tolerance
Returns:

the position that matchs the standard setting

Return type:

pos1

search_generator(pos, ops=None, tol=0.01)[source]

search generator for a special Wyckoff position

Parameters:
  • pos – initial xyz position
  • ops – list of symops
  • tol – tolerance
Returns:

the position that matchs the standard setting

Return type:

pos1

search_generator_dist(pt, lattice=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]))[source]

For a given special wp, (e.g., [(x, 0, 1/4), (0, x, 1/4)]), return the first position and distance

Parameters:
  • pt – 1*3 vector
  • lattice – 3*3 matrix
Returns:

the best matched pt diff: numerical difference

Return type:

pt

set_euclidean()[source]

For the hexagonal groups, need to consider the euclidean conversion

set_generators()[source]

set up generators, useful for many things

set_ops()[source]
swap_axis(swap_id)[source]

swap the axis may result in a new wp

transform_from_matrices(trans)[source]
Parameters:trans – a list of transformation matrices
transform_from_matrix(trans=None, reset=True, update=False)[source]

Transform the symmetry operation according to cell transformation Mostly needed when optimizing the lattice

update()[source]

update the spacegroup information if needed

update_hall(hall_numbers=None)[source]

update the Hall number when the symmetry operation changes

Parameters:hall_numbers – a list of numbers for consideration
update_index()[source]

check if needs to update the index due to lattice transformation

pyxtal.symmetry.abc2matrix(abc)[source]

convert the abc string representation to matrix :param abc: string like ‘a, b, c’ or ‘a+c, b, c’ or ‘a+1/4, b+1/4, c’

Returns:4*4 affine matrix
pyxtal.symmetry.are_equivalent_ops(op1, op2, tol=0.01)[source]

check if two ops are equivalent, assuming the same ordering

pyxtal.symmetry.check_symmetry_and_dim(number, dim=3)[source]

check if it is a valid number for the given symmetry

Parameters:
  • number – int
  • dim – 0, 1, 2, 3
pyxtal.symmetry.check_wyckoff_position(points, group, tol=0.001)[source]

Given a list of points, returns a single index of a matching Wyckoff position in the space group. Checks the site symmetry of each supplied point against the site symmetry for each point in the Wyckoff position. Also returns a point which can be used to generate the rest using the Wyckoff position operators.

Parameters:
  • points – a list of 3d coordinates or SymmOps to check
  • group – a Group object
  • tol – the max distance between equivalent points
Returns:

index is a single index for the Wyckoff position within the sg. If no matching WP is found, returns False. point is a coordinate taken from the list points. When plugged into the Wyckoff position, it will generate all the other points.

Return type:

index, p

pyxtal.symmetry.choose_wyckoff(G, number=None, site=None, dim=3)[source]

Choose a Wyckoff position to fill based on the current number of atoms needed to be placed within a unit cell Rules:

  1. use the pre-assigned list if this is provided
  2. The new position’s multiplicity is equal/less than (number).
  3. We prefer positions with large multiplicity.
Parameters:
  • G – a pyxtal.symmetry.Group object
  • number – the number of atoms still needed in the unit cell
  • site – the pre-assigned Wyckoff sites (e.g., 4a)
Returns:

Wyckoff position. If no position is found, returns False

pyxtal.symmetry.choose_wyckoff_mol(G, number, site, orientations, gen_site=True, dim=3)[source]

Choose a Wyckoff position to fill based on the current number of molecules needed to be placed within a unit cell

Rules:

  1. The new position’s multiplicity is equal/less than (number).
  2. We prefer positions with large multiplicity.
  3. The site must admit valid orientations for the desired molecule.
Parameters:
  • G – a pyxtal.symmetry.Group object
  • number – the number of molecules still needed in the unit cell
  • orientations – the valid orientations for a given molecule.
  • gen_site – general WP only
Returns:

Wyckoff position. If no position is found, returns False

pyxtal.symmetry.get_all_polar_space_groups()[source]
pyxtal.symmetry.get_close_packed_groups(pg)[source]

List the close packed groups based on the molcular symmetry Compiled from AIK Book, Table 2 P34

Parameters:pg – point group symbol
Returns:list of space group numbers
pyxtal.symmetry.get_generators(num, dim=3)[source]

Returns a list of Wyckoff generators for a given group. 1st index: index of WP in sg (0 is the WP with largest multiplicity) 2nd index: a generator for the WP This function is useful for rotating molecules based on Wyckoff position, since special Wyckoff positions only encode positional information, but not information about the orientation. The generators for each Wyckoff position form a subset of the spacegroup’s general Wyckoff position.

Parameters:
  • num – the international spacegroup number
  • dim – dimension
Returns:

a 2d list of symmop objects [[wp0], [wp1], … ]

pyxtal.symmetry.get_pbc_and_lattice(number, dim)[source]
pyxtal.symmetry.get_point_group(number)[source]

Parse the point group symmetry info from space group. According to http://img.chem.ucl.ac.uk/sgp/misc/pointgrp.htm, among 32(230) point(space) groups, there are

  • 10(68) polar groups,
  • 11(92) centrosymmetric groups,
  • 11(65) enantiomorphic groups
Parameters:number – space group number
Returns:point group symbol polar: 1, 2, m, mm2, 3, 3m, 4, 4mm, 6, 6mm centrosymmetry: -1, 2/m, mmm, 4/m, 4/mmm, -3, -3m, 6/m, 6/mmm, m-3, m-3m enantiomorphic: 1, 2, 222, 4, 422, 3, 32, 6, 622, 23, 432
pyxtal.symmetry.get_symbol_and_number(input_group, dim=3)[source]

Function for quick conversion between symbols and numbers.

Parameters:
  • input_group – the group symbol or international number
  • dim – the periodic dimension of the group
pyxtal.symmetry.get_symmetry_from_ops(ops, tol=1e-05)[source]

get the hall number from symmetry operations.

Parameters:
  • ops – tuple of (rotation, translation) or list of strings
  • tol – tolerance
pyxtal.symmetry.get_wyckoff_symmetry(num, dim=3)[source]

Returns a list of site symmetry for a given group. 1st index: index of WP in sg (0 is the WP with largest multiplicity) 2nd index: a point within the WP 3rd index: a site symmetry SymmOp of the point

Parameters:
  • sg – the international spacegroup number
  • dim – 0, 1, 2, 3
Returns:

a 3d list of SymmOp objects representing the site symmetry of each point in each Wyckoff position

pyxtal.symmetry.get_wyckoffs(num, organized=False, dim=3)[source]

Returns a list of Wyckoff positions for a given group. Has option to organize the list based on multiplicity (this is used for random_crystal.wyckoffs)

For an unorganized list:

  • 1st index: index of WP in sg (0 is the WP with largest multiplicity)
  • 2nd index: a SymmOp object in the WP

For an organized list:

  • 1st index: specifies multiplicity (0 is the largest multiplicity)
  • 2nd index: a WP within the group of equal multiplicity.
  • 3nd index: a SymmOp object within the Wyckoff position

You may switch between organized and unorganized lists using the methods i_from_jk and jk_from_i. For example, if a Wyckoff position is the [i] entry in an unorganized list, it will be the [j][k] entry in an organized list.

Parameters:
  • num – the international group number
  • dim – dimension [0, 1, 2, 3]
  • organized – whether or not to organize the list based on multiplicity
Returns:

a list of Wyckoff positions, each of which is a list of SymmOp’s

pyxtal.symmetry.i_from_jk(j, k, olist)[source]

Inverse operation of jk_from_i: gives one list index from 2

Parameters:
  • k (j,) – indices corresponding to the location of an element in the organized list
  • olist – the organized list of Wyckoff positions or molecular orientations
Returns:

one index corresponding to the item’s location in the

unorganized list

Return type:

i

pyxtal.symmetry.identity_ops(op)[source]

check if the operation is the identity.

pyxtal.symmetry.index_from_letter(letter, group, dim=3)[source]

Given the Wyckoff letter, returns the index of a Wyckoff position.

Parameters:
  • letter – The wyckoff letter
  • group – an unorganized Wyckoff position array or Group object (preferred)
  • dim – the periodicity dimension of the symmetry group.
Returns:

a single index specifying the location of the Wyckoff position.

pyxtal.symmetry.jk_from_i(i, olist)[source]

Given an organized list (Wyckoff positions or orientations), determine the two indices which correspond to a single index for an unorganized list. Used mainly for organized Wyckoff position lists, but can be used for other lists organized in a similar way

Parameters:
  • i – a single index corresponding to the item’s location in the unorganized list
  • olist – the organized list
Returns:

two indices corresponding to the item’s location in the

organized list

Return type:

[j, k]

pyxtal.symmetry.letter_from_index(index, group, dim=3)[source]

Given a Wyckoff position’s index within a spacegroup, return its number and letter e.g. ‘4a’

Parameters:
  • index – WP’s index (0 is the general position)
  • group – an unorganized Wyckoff position array or Group object (preferred)
  • dim – the periodicity dimension of the symmetry group.
Returns:

the Wyckoff letter corresponding to the Wyckoff position (for example, for position 4a, the function would return ‘a’)

pyxtal.symmetry.op_transform(ops, affine_matrix)[source]

x, y, z -> x+1/2, y+1/2, z 0, 1/2, z -> 1/2, 0, z

Parameters:
  • ops – SymmOp object
  • permutation – list, e.g. [0, 1, 2]
Returns:

the new SymmOp object

pyxtal.symmetry.op_translation(op, tran)[source]
pyxtal.symmetry.organized_wyckoffs(group)[source]

Takes a Group object or unorganized list of Wyckoff positions and returns a 2D list of Wyckoff positions organized by multiplicity.

Parameters:group – a pyxtal.symmetry.Group object
Returns:a 2D list of Wyckoff_position objects if group is a Group object. a 3D list of SymmOp objects if group is a 2D list of SymmOps
pyxtal.symmetry.para2ferro(pg)[source]

88 potential paraelectric-to-ferroelectric phase transitions https://journals.aps.org/prb/abstract/10.1103/PhysRevB.2.754 https://pubs.rsc.org/en/content/articlelanding/2016/cs/c5cs00308c

Parameters:point group (paraelectric) –
Returns:list of ferroelectric point groups
pyxtal.symmetry.search_cloest_wp(G, wp, op, pos)[source]

For a given position, search for the cloest wp which satisfies the desired symmetry relation, e.g., for pos (0.1, 0.12, 0.2) and op (x, x, z) the closest match is (0.11, 0.11, 0.2)

Parameters:
  • G – space group number
  • wp – Wyckoff object
  • op – symmetry operation belonging to wp
  • pos – initial xyz position
Returns:

the position that matchs symmetry operation

Return type:

pos1

pyxtal.symmetry.site_symm(point, gen_pos, tol=0.001, lattice=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), PBC=None)[source]

Given a point and a general Wyckoff position, return the list of symmetry operations leaving the point (coordinate or SymmOp) invariant. The returned SymmOps are a subset of the general position. The site symmetry can be used for determining the Wyckoff position for a set of points, or for determining the valid orientations of a molecule within a given Wyckoff position.

Parameters:
  • point – a 1x3 coordinate or SymmOp object to find the symmetry of. If a SymmOp is given, the returned symmetries must also preserve the point’s orientaion
  • gen_pos – the general position of the spacegroup. Can be a Wyckoff_position object or list of SymmOp objects.
  • tol – the numberical tolerance for determining equivalent positions and orientations.
  • lattice – a 3x3 matrix representing the lattice vectors of the unit cell
  • PBC – A periodic boundary condition list, 1 means periodic, 0 means not periodic. Ex: [1,1,1] -> full 3d periodicity, [0,0,1] -> periodicity along the z axis. Need not be defined here if gen_pos is a Wyckoff_position object.
Returns:

a list of SymmOp objects which leave the given point invariant

pyxtal.symmetry.ss_string_from_ops(ops, number, dim=3, complete=True)[source]

Print the Hermann-Mauguin symbol for a site symmetry group, using a list of SymmOps as input. Note that the symbol does not necessarily refer to the x,y,z axes. For information on reading these symbols, see: http://en.wikipedia.org/wiki/Hermann-Mauguin_notation#Point_groups

Parameters:
  • ops – a list of SymmOp objects representing the site symmetry
  • number – International number of the symmetry group. Used to determine which axes to show. For example, a 3-fold rotation in a cubic system is written as “.3.”, whereas a 3-fold rotation in a trigonal system is written as “3..”
  • dim – the dimension of the crystal. Also used to determine notation type
  • complete – whether or not all symmetry operations in the group are present. If False, we generate the rest
Returns:

a string representing the site symmetry (e.g., 2mm)

pyxtal.symmetry.swap_xyz_ops(ops, permutation)[source]

change the symmetry operation by swaping the axes

Parameters:
  • ops – SymmOp object
  • permutation – list, e.g. [0, 1, 2]
Returns:

the new xyz string after transformation

pyxtal.symmetry.swap_xyz_string(xyzs, permutation)[source]

Permutate the xyz string operation

Parameters:
  • xyzs – e.g. [‘x’, ‘y+1/2’, ‘-z’]
  • permuation – list, e.g., [0, 2, 1]
Returns:

the new xyz string after transformation

pyxtal.symmetry.symmetry_element_from_axis(axis)[source]

Given an axis, returns a SymmOp representing a symmetry element on the axis. For example, the symmetry element for the vector (0,0,2) would be (0,0,z).

Parameters:axis – a 3-vector representing the symmetry element
Returns:a SymmOp object of form (ax, bx, cx), (ay, by, cy), or (az, bz, cz)
pyxtal.symmetry.transform_ops(ops, P, P1)[source]

Transformation according to the P and P1 operations.

Parameters:
  • ops – list of symmtry ops
  • P – transformation
  • P1 – inverse transformation
pyxtal.symmetry.trim_ops(ops)[source]
Convert the operation to the simplest form. e.g.,
  • ‘x+1/8, y+1/8, z+1/8’ -> ‘x, y, z’
  • ‘1/8 y+1/8 -y+1/8’ -> ‘1/8, y, -y+1/4’
Parameters:ops – a list of symmetry opertions.