symmetry_operation
SymmetryOperation
Class to represent a crystallographic symmetry operation, composed of a rotation and a translation.
Attributes:
| Name | Type | Description |
|---|---|---|
rotation |
ndarray
|
(3, 3) rotation matrix in fractional coordinates |
translation |
ndarray
|
(3) translation vector in fractional coordinates |
Source code in chmpy/crystal/symmetry_operation.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
cif_form
property
Represent this SymmetryOperation in string form e.g. '+x,+y,+z'
geometric_type
property
Classify this operation as a crystallographic symmetry element.
Returns one of
"identity", "translation", "rotation", "screw", "inversion", "mirror", "glide", "rotoinversion"
The distinction between rotation/screw and mirror/glide is made on the
intrinsic translation (see has_intrinsic_translation). Use
rotation_symbol to recover the order (e.g. to distinguish a -3 from a
-4 rotoinversion). The classification reflects the operation as written;
in centered cells an operation that combines a rotation with a centering
translation is still reported as a screw or glide.
Examples:
>>> SymmetryOperation.from_string_code("x,y,z").geometric_type
'identity'
>>> SymmetryOperation.from_string_code("-x,1/2+y,-z").geometric_type
'screw'
>>> SymmetryOperation.from_string_code("x,-y,1/2+z").geometric_type
'glide'
>>> SymmetryOperation.from_string_code("-x,-y,-z").geometric_type
'inversion'
has_intrinsic_translation
property
True if this operation has a non-zero intrinsic (screw/glide) translation, i.e. it is a screw axis, glide plane or lattice translation.
Examples:
integer_code
property
Represent this SymmetryOperation as a packed integer
intrinsic_translation
property
The origin-independent (screw/glide) component of the translation.
This is the projection of the translation onto the +1 eigenspace of the rotation, i.e. the part that cannot be removed by any choice of origin. It is zero for pure rotations, mirrors, rotoinversions and the identity, and non-zero for screw axes, glide planes and lattice translations.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: (3,) intrinsic translation vector, reduced into [0, 1) |
Examples:
rotation_order
property
The order n of the rotational (linear) part: the smallest n > 0 such that R**n is the identity.
Note for rotoinversions the order is that of the matrix, e.g. a -3 (3-bar) operation has rotation_order 6.
Examples:
rotation_symbol
property
The Hermann-Mauguin symbol of the rotational (linear) part of this operation, ignoring any translation.
One of "1", "2", "3", "4", "6" (proper rotations), or "-1", "m", "-3", "-4", "-6" (improper: inversion, reflection, rotoinversions).
Examples:
seitz_matrix
property
The Seitz matrix form of this SymmetryOperation
__add__(value)
Add a vector to this symmetry operation's translation vector.
Returns:
| Name | Type | Description |
|---|---|---|
SymmetryOperation |
a copy of this symmetry operation under additional translation" |
Source code in chmpy/crystal/symmetry_operation.py
__init__(rotation, translation)
Construct a new symmetry operation from a rotation matrix and a translation vector
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rotation
|
ndarray
|
(3, 3) rotation matrix |
required |
translation
|
ndarray
|
(3) translation vector |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SymmetryOperation |
a new SymmetryOperation |
Source code in chmpy/crystal/symmetry_operation.py
__mul__(other)
Multiplication operator for symmetry operations: self * other = self ∘ other.
This is equivalent to self.compose(other).
Source code in chmpy/crystal/symmetry_operation.py
__sub__(value)
Subtract a vector from this symmetry operation's translation.
Returns:
| Name | Type | Description |
|---|---|---|
SymmetryOperation |
a copy of this symmetry operation under additional translation" |
Source code in chmpy/crystal/symmetry_operation.py
apply(coordinates)
Apply this symmetry operation to a set of fractional coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinates
|
ndarray
|
(N,3) or (N,4) array of fractional coordinates or homogeneous fractional coordinates. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: (N, 3) array of transformed coordinates |
Source code in chmpy/crystal/symmetry_operation.py
compose(other)
Compose this symmetry operation with another: self ∘ other.
The result is a new symmetry operation that first applies other,
then applies self. In matrix form: (R_self, t_self) ∘ (R_other, t_other)
= (R_self @ R_other, R_self @ t_other + t_self)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
SymmetryOperation
|
The symmetry operation to compose with |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SymmetryOperation |
SymmetryOperation
|
The composed operation (self ∘ other) |
Source code in chmpy/crystal/symmetry_operation.py
from_integer_code(code)
classmethod
Alternative constructor from an integer-encoded symmetry operation e.g. 16484
See also the encode_symm_int, decode_symm_int methods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
int
|
integer-encoded symmetry operation |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SymmetryOperation |
a new symmetry operation from the provided integer code |
Source code in chmpy/crystal/symmetry_operation.py
from_string_code(code)
classmethod
Alternative constructor from a string encoded symmetry operation e.g. '+x,+y,+z'.
See also the encode_symm_str, decode_symm_str methods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
string-encoded symmetry operation |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SymmetryOperation |
a new symmetry operation from the provided string code |
Source code in chmpy/crystal/symmetry_operation.py
identity()
classmethod
inverse()
Return the inverse of this symmetry operation.
For a symmetry operation (R, t), the inverse is (R^-1, -R^-1 @ t).
Returns:
| Name | Type | Description |
|---|---|---|
SymmetryOperation |
SymmetryOperation
|
The inverse operation |
Source code in chmpy/crystal/symmetry_operation.py
inverted()
" A copy of this symmetry operation under inversion
Returns:
| Name | Type | Description |
|---|---|---|
SymmetryOperation |
an inverted copy of this symmetry operation |
decode_symm_int(coded_integer)
Decode an integer encoded symmetry operation.
A space group operation is compressed using ternary numerical system for rotation and duodecimal system for translation. This is achieved because each element of rotation matrix can have only one of {-1,0,1}, and the translation can have one of {0,2,3,4,6,8,9,10} divided by 12. Therefore 3^9 * 12^3 = 34012224 different values can map space group operations. In principle, octal numerical system can be used for translation, but duodecimal system is more convenient.
encode_symm_str(*decode_symm_int(16484)) '+x,+y,+z'
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coded_integer
|
int
|
integer encoding a symmetry operation |
required |
Returns:
| Type | Description |
|---|---|
|
Tuple[np.ndarray, np.ndarray]: (3,3) rotation matrix, (3) translation vector |
Source code in chmpy/crystal/symmetry_operation.py
decode_symm_str(s)
Decode a symmetry operation represented in the string form e.g. '1/2 + x, y, -z -0.25' into a rotation matrix and translation vector.
encode_symm_str(decode_symm_str("x,y,z")) '+x,+y,+z' encode_symm_str(decode_symm_str("1/2 - x,y-0.3333333,z")) '1/2-x,2/3+y,+z'
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
str
|
the encoded symmetry operation string |
required |
Returns:
| Type | Description |
|---|---|
|
Tuple[np.ndarray, np.ndarray]: a (3,3) rotation matrix and a (3) translation vector |
Source code in chmpy/crystal/symmetry_operation.py
encode_symm_int(rotation, translation)
Encode an integer encoded symmetry from a rotation matrix and translation vector.
A space group operation is compressed using ternary numerical system for rotation and duodecimal system for translation. This is achieved because each element of rotation matrix can have only one of {-1,0,1}, and the translation can have one of {0,2,3,4,6,8,9,10} divided by 12. Therefore 3^9 * 12^3 = 34012224 different values can map space group operations. In principle, octal numerical system can be used for translation, but duodecimal system is more convenient.
encode_symm_int(((1, 0, 0), (0, 1, 0), (0, 0, 1)), (0, 0, 0)) 16484 encode_symm_int(((1, 0, 0), (0, 1, 0), (0, 1, 1)), (0, 0.5, 0)) 1433663
Args: rotation (array_like): (3,3) matrix of -1, 0, or 1s encoding the rotation component of the symmetry operation translation (array_like): (3) vector of rational numbers encoding the translation component of the symmetry operation
Returns:
| Name | Type | Description |
|---|---|---|
int |
the encoded symmetry operation |
Source code in chmpy/crystal/symmetry_operation.py
encode_symm_str(rotation, translation)
Encode a rotation matrix (of -1, 0, 1s) and (rational) translation vector into string form e.g. 1/2-x,z-1/3,-y-1/6
encode_symm_str(((-1, 0, 0), (0, 0, 1), (0, 1, 0)), (0, 0.5, 1 / 3)) '-x,1/2+z,1/3+y' encode_symm_str(((1, 1, 1), (1, 0, 1), (0, 1, 0)), (0, 0.5, 1 / 3)) '+x+y+z,1/2+x+z,1/3+y'
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rotation
|
array_like
|
(3,3) matrix of -1, 0, or 1s encoding the rotation component of the symmetry operation |
required |
translation
|
array_like
|
(3) vector of rational numbers encoding the translation component of the symmetry operation |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
the encoded symmetry operation |
Source code in chmpy/crystal/symmetry_operation.py
expanded_symmetry_list(reduced_symops, lattice_type)
Create an expanded list of symmetry operations from the minimum specification given a certain lattice type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reduced_symops
|
List[SymmetryOperation]
|
reduced list of symmetry operations |
required |
lattice_type
|
int
|
required |
Returns: List[SymmetryOperation]: an expanded list of symmetry operations given lattice type
Source code in chmpy/crystal/symmetry_operation.py
reduced_symmetry_list(full_symops, lattice_type)
Reduce an expanded list of symmetry operations to the minimum specification given a certain lattice type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
full_symops
|
List[SymmetryOperation]
|
list of symmetry operations |
required |
lattice_type
|
int
|
required |
Returns: List[SymmetryOperation]: minimal list of symmetry operations given lattice type