space_group module¶
Space group support, including building operator dictionary for 230 space groups.
- usage:
space_group.py [build] [name(s)]
Module author: Michael Chapman <chapmanms@missouri.edu>
- Authors:
Michael S. Chapman <chapmanms@missouri.edu>
Oregon Health & Science University and University of Missouri
- Version:
1, Nov 26, 2024
Changed in version 0.1: 09/15/2011
Changed in version 0.2: 11/23/2011
Changed in version 0.5: 05/02/2011 ReStructuredText docs
Changed in version 1.0.0: 11/01/2020 Converted to python 3, but not running.
Changed in version 1.0.1: 01/09/2021 In hiatus, waiting on phenix python 3.
Changed in version 1.0.4: 04/21/2021 Python 3 running w/ PyPI cctbx.
Prints the operator list for space groups listed (Hermann-Mauguin symbols). The space group operator dictionary is built through calls to cctbx.sgtbx (Gross-Kunstleve, RW & CCI, http://cci.lbl.gov). The dictionary is pickled so that the SpaceGroups class defined here can be used without further dependence on cctbx.
Note
04/21/21 New procedure for updating the space_group.pkl table.
Hitherto, we were fulfilling the dependence of option build upon cctbx.sgtbx by accessing the library within a phenix installation (eg. export PYTHONPATH=$PYTHONPATH:/linux/src/phenix-1.18-3855/modules/cctbx_project. ). Phenix is still tied to python2.7, but the conda forge distribution of cctbx is python3 compatible. Thus, a python environment can be created (temporarily) to update the jar file. For example:
conda create --name pasto3cctbx --clone pasto3
conda activate pasto3cctbx
conda install cctbx
python -m space_group build
It is not recommended that cctbx be included in a user’s pasto/rsref python environment, because this is currently the only cctbx dependence. A jar file depends upon python major version, but with the .pkl file included in the distribution, an update might be required only every decade (by the developers).
- class space_group.SpaceGroups¶
Bases:
object
- Variables:
lib – keyed by the extended Hermann-Mauguin symbol with values that are lists of the operators as tuples of (rotation, translation), all in fractional coordinates.
- build()¶
Builds self.lib, a dictionary of operators for all 230 space groups.
- Returns:
self
- Return type:
SpaceGroup
- jar = 'space_group.pkl'¶
- pickle()¶
Serialize self.lib, the dictionary of space group operators.
- which(name)¶
Deduce unique Hermann-Mauguin (extended) International symbol.
The approximation to the short form of the Hermann-Mauguin symbol supported is not fully general (International Tables vol A, sect 12.3), but works for the 65 chiral groups, is used by CCP4 (and most macromolecular crystallographers). If in doubt, use the extended form!
Settings are required to designate the rhombohedral (‘:R’) or hexagonal settings (‘:H’) for rhombohedral, and alternative settings of several other space groups. (The choice should be consistent w/ input of cell parameters!)
- Parameters:
name (str) – (optionally shortened) Hermann-Mauguin symbol. Screw axes can be formatted as ‘2_1’, ‘2(1)’ or ‘21’. Axis-designating ‘ 1’ can be removed except for P1 and unless needed to resolve ambiguity. Spaces can be removed. The setting, eg. ‘H’, ‘R’ or ‘2’ is appended after a colon.
- Returns:
International extended Hermann-Mauguin symbol (unique).
- Return type:
string
- Raises:
ValueError – if name does not give one and only one match.
- space_group.lattice_operators(space_group_name=None, verbose=True)¶
Lattice symmetry operators for a single space group.
Requires cctbx.sgtbx to be available.
- Parameters:
space_group_name (str) – eg P2_12_1_2 or P2(1)2(1)2 or P21212
- Returns:
symmetry operators: [(rotation, translation)]*N, fractional coordinates OR None
- Return type:
list(tuple(numpy.matrix(dtype=float,shape=(3,3), numpy.matrix(dtype=float, shape=(1,3))))