disorder
Describe and resolve the substitutional disorder in a crystal structure.
A disordered crystal is really several structures superimposed: a site that is only 0.63 occupied is there in 63% of unit cells and something else is there in the rest. chmpy models one set of sites, so until the disorder is resolved a methyl group modelled in two orientations has six hydrogens on one carbon, and every molecule, surface and energy derived from it is wrong.
The CIF dictionary describes disorder with two labels per site:
_atom_site_disorder_assembly
which independent set of alternatives a site takes part in
_atom_site_disorder_group
which alternative, within that assembly, the site belongs to
A component of the structure is every ordered site plus one group from each assembly, so taking group 1 everywhere gives one ordered structure, group 2 everywhere gives the next, and so on.
Plenty of files -- most of the ones deposited without those labels -- only
give partial occupancies, so :func:analyse_disorder falls back to reading
the occupancies -- values that pair up to 1.0 are two alternatives of one
assembly -- and then to the site labels, where O1A and O1B name one
oxygen in two places. What none of those can work out is reported rather
than guessed at, because a wrong guess here quietly produces a plausible and
incorrect structure.
Disorder
dataclass
How the sites of an asymmetric unit are shared between alternatives.
Attributes:
| Name | Type | Description |
|---|---|---|
assemblies |
tuple
|
the independent sets of alternatives |
unresolved |
tuple
|
indices of partially occupied sites that could not be placed in any assembly |
reason |
str
|
what is going on with those sites, in words |
source |
str
|
where the grouping came from, one of |
n_sites |
int
|
how many sites the asymmetric unit has |
Source code in chmpy/crystal/disorder.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
is_disordered
property
whether any site is shared between alternatives
is_resolvable
property
whether every partially occupied site was placed in an assembly
n_components
property
How many ordered structures this disorder describes.
One, if there is nothing to resolve; otherwise the largest number of alternatives any one assembly has.
site_groups
property
An (n_sites,) array naming the alternative each site belongs to.
Ordered sites are "."; the rest read "assembly:group". Handy
for looking at what was inferred before trusting it.
component_mask(index)
A boolean mask over the asymmetric unit selecting component index.
Component 0 takes the most occupied alternative of every assembly,
component 1 the next, and so on. An assembly with fewer alternatives
than index contributes its least occupied one.
Source code in chmpy/crystal/disorder.py
DisorderAssembly
dataclass
One independent set of alternatives, and the sites in each.
Source code in chmpy/crystal/disorder.py
group_labels
property
group labels, most occupied first, ties broken by label
analyse_disorder(crystal, tolerance=0.001)
Work out how the sites of crystal are shared between alternatives.
The CIF's own _atom_site_disorder_group labels are used when the file
carries them. Otherwise the occupancies are read, and then the site
labels for whatever is left -- which is what resolves the common case of
two alternatives at 0.5 each, where the occupancies say nothing. See the
module docstring for what each can and cannot say.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
the crystal structure to examine |
required | |
tolerance
|
how far an occupancy may stray from a whole number, or from summing to 1.0 with its partner, and still count |
0.001
|
Returns:
| Name | Type | Description |
|---|---|---|
Disorder |
Disorder
|
the grouping, and what could not be grouped |
Source code in chmpy/crystal/disorder.py
descend_for_disorder(crystal, disorder=None, max_index=4, clash_distance=CLASH_DISTANCE)
Lower the symmetry until the disorder is a choice rather than a fact.
Where alternatives are related by a symmetry operation -- a group straddling the mirror it sits on, say -- no selection of sites is ordered in the parent group, because picking one alternative picks its image too. Dropping that operation splits the orbit, and the alternatives become separate sites that can be chosen between.
The descent is to a translationengleiche subgroup, so the cell is
unchanged and only the point operations are reduced. Giving up a factor
of n in symmetry multiplies the size of the asymmetric unit by n:
Ima2 with 8 operations and 6 sites becomes, at index 2, one of Pna2_1,
Pnc2, Pma2, Pmc2_1, Pm, Cc or C2 with 4 operations and 11 sites.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
the structure to lower |
required | |
disorder
|
a :class: |
None
|
|
max_index
|
how much symmetry may be given up. The index of a
subgroup is |
4
|
|
clash_distance
|
how close two sites must be to be alternatives |
CLASH_DISTANCE
|
Returns:
| Name | Type | Description |
|---|---|---|
Crystal |
the same structure in a subgroup, its asymmetric unit |
|
|
expanded, or None if no subgroup within |
Note
The subgroup is one of several symmetry equivalent choices, so the structures that come out are one ordering of many rather than the ordering. Disorder that is genuinely smeared -- alternatives that do not correspond to any discrete arrangement -- is not made resolvable by this, and is still reported as unresolved afterwards.
Source code in chmpy/crystal/disorder.py
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 | |
disorder_components(crystal, disorder=None, strict=True, descend=False, max_index=4)
Split a disordered crystal into ordered ones.
Each returned crystal keeps every fully occupied site and one alternative from each disorder assembly, with the surviving occupancies set to 1.0. An ordered crystal comes back as a single-item list, so callers need no special case for it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
the structure to resolve |
required | |
disorder
|
a :class: |
None
|
|
strict
|
raise if some partially occupied site could not be placed in
an assembly. Pass |
True
|
|
descend
|
where alternatives are related by symmetry, lower the
symmetry to a subgroup in which they are not, and resolve there.
The components then have the subgroup's symmetry, and are one of
several symmetry equivalent orderings -- see
:func: |
False
|
|
max_index
|
how much symmetry |
4
|
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
one ordered :class: |
list
|
most occupied alternatives first |