Assembly Enumeration
enumerate_assemblies(template, *, leaving_ligand, leaving_ligand_site=None, metal_kinds, symmetry_operations=None, comp_kind_order_in_formula=None)
Enumerate assemblies which can be formed by adding the leaving ligand to the fragments of the template assembly.
This function generates all possible assemblies by attaching the specified leaving ligand to each fragment in the template assembly. It ensures that the resulting assemblies are unique by excluding duplicates based on symmetry operations and isomorphism checks.
Any two assemblies that meet either of the following conditions are considered duplicates, and only one of them is included in the output list: - One can be transformed into the other by applying a symmetry operation from the provided list. - They are isomorphic, i.e., they have the same connectivity structure.
Providing symmetry operations is strongly recommended to reduce the computational cost of duplicate exclusion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template
|
Assembly
|
The template assembly to base the enumeration on. |
required |
leaving_ligand
|
Component
|
The ligand to be added to the fragments of the template assembly. |
required |
leaving_ligand_site
|
ID | None
|
The site ID on the leaving ligand where it will be attached. If None, the first site ID of the leaving ligand will be used. Default is None. |
None
|
metal_kinds
|
Iterable[str]
|
The kinds of metal components in the assembly. All binding sites on these components will be considered for attaching the leaving ligand. |
required |
symmetry_operations
|
Iterable[Mapping[Any, ID]] | None
|
A list of symmetry operations to consider when excluding duplicate assemblies. Each symmetry operation is represented as a mapping from original site IDs to transformed site IDs. |
None
|
comp_kind_order_in_formula
|
Sequence[str] | None
|
The order of component kinds to use when assigning composition formula IDs to the assemblies. If None, the kinds will be sorted alphabetically. Default is None. |
None
|
Returns:
| Type | Description |
|---|---|
list[Assembly]
|
A list of unique assemblies formed by adding the leaving ligand to the fragments of the template assembly. Also includes the free leaving ligand as an assembly. |
Examples:
>>> from nasap_net import Component, Assembly, Bond, enumerate_assemblies
>>> M = Component(kind='M', sites=[0, 1])
>>> L = Component(kind='L', sites=[0, 1])
>>> X = Component(kind='X', sites=[0])
>>> M2L2 = Assembly(
... components={'M0': M, 'M1': M, 'L0': L, 'L1': L},
... bonds=[
... Bond('M0', 1, 'L0', 0), Bond('L0', 1, 'M1', 0),
... Bond('M1', 1, 'L1', 0), Bond('L1', 1, 'M0', 0),
... ]
... )
>>> assemblies = enumerate_assemblies(M2L2, leaving_ligand=X, metal_kinds='M')
Source code in src/nasap_net/assembly_enumeration/core.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 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 | |