Cage builders¶
CageBuilder is the base class every topology-specific builder inherits
from; it holds the full build, optimise, enumerate, functionalise, save, and
statistics API. Topology-specific classes (Tri4Di6CageBuilder,
M6L12CubeCageBuilder, ...) only override the topology graph and the
point-group transformation library. See Topologies for
the full list.
CageBuilder ¶
CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: ABC
Base class for building cages and enumerating their isomers.
Each subclass sets one STK topology graph and, optionally, a symmetry
library. The shared workflow is: build, optimise, functionalise, count or
enumerate isomers, then compute statistics and descriptors. Structures from
files (a MOF CIF, a cage from elsewhere) enter the same workflow through
:meth:load_from_file.
Optimise a built cage before functionalising it. STK can place bulky nodes
away from their linkers, and functionalise() warns when the building
blocks are not bonded.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build() # STK assembly
>>> _ = cage.optimise(include_charges=False, logfile=None) # UFF4MOF, rigid building blocks
>>> anchors, slots = cage.functionalise() # every aromatic C-H becomes an R site
>>> cage.point_group().name, cage.count_unique_isomers_burnside()
('Td', 176)
Initialise a cage builder.
The linker and node may be a SMILES string, an ASE Atoms object, or a
structure file readable by ASE (.xyz, .mol, .mol2, .sdf,
.pdb, .cif, ...).
Functional groups (the connection points) are found in this order:
- Single atom (nodes only): a node of one atom (e.g.
"[Zn]") becomes anstk.SingleAtombuilding block. - Dummy atoms:
Xatoms in a structure, or*,[*]or[#0]in a SMILES string, mark the connection points. SMILES dummies are rewritten as[Fr]placeholders (STK cannot build atomic number 0) and matched by the SMARTS[Fr][*]. - Given factory:
linker_fgornode_fg. - Automatic: the factories of
FG_FACTORY_MAPare tried in turn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
linker
|
MoleculeInput
|
Linker building block. Defaults to |
None
|
node
|
MoleculeInput
|
Node building block. Defaults to |
None
|
linker_fg
|
str or FunctionalGroupFactory
|
Functional-group factory of the linker: a key of |
None
|
node_fg
|
str or FunctionalGroupFactory
|
Functional-group factory of the node. |
None
|
node_fg_count
|
int
|
Number of functional groups of a single-atom node (ignored otherwise).
Defaults to |
None
|
smarts_pattern
|
str
|
SMARTS pattern used when |
None
|
optimizer_step
|
float
|
Step size of the STK |
0.01
|
distance_threshold
|
float
|
Distance threshold (Angstrom) of the STK |
5.0
|
expansion_factor
|
float
|
After assembly, every building block is translated rigidly so that its
distance from the cage centroid is multiplied by this factor. Use a value
slightly above 1 when bulky nodes overlap their neighbours in the
initial placement; the smallest factor is |
1.0
|
scale_multiplier
|
float
|
Passed to the STK topology graph, which scales its vertex positions by
|
1.0
|
linker_smiles
|
str
|
Deprecated aliases of |
None
|
node_smiles
|
str
|
Deprecated aliases of |
None
|
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
adjacency ¶
Bond graph of the current structure: from the STK bond matrix for a built
structure (whatever its geometry), otherwise from distances
(:func:cage_isomer_builder.utils.features.bond_graph).
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> graph = cage.adjacency() # from the STK bond matrix
>>> zr = next(i for i, a in enumerate(cage.to_ase()) if a.symbol == "Zr")
>>> len(graph[zr]) # 8 oxygens around each Zr
8
Source code in cage_isomer_builder/cage/base.py
build ¶
Build the cage using the configured node and linker.
Returns:
| Type | Description |
|---|---|
ConstructedMolecule
|
Constructed STK cage. |
Notes
Building blocks are generated automatically from the supplied node
and linker inputs before constructing the topology graph.
If expansion_factor > 1, each subunit is translated rigidly
outward after assembly (see :meth:_expand_cage_rigid).
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C120H132O128Zr24'
Source code in cage_isomer_builder/cage/base.py
building_blocks ¶
Atom indices of every linker and every node.
Returns:
| Name | Type | Description |
|---|---|---|
linkers |
list of list of int
|
In the order used for FG slots ( |
nodes |
list of list of int
|
One list per node (metal cluster with whatever is bonded to it outside the linkers). |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> linkers, nodes = cage.building_blocks()
>>> len(linkers), len(nodes), len(nodes[0])
(6, 4, 86)
Source code in cage_isomer_builder/cage/base.py
count_defect_isomers ¶
count_defect_isomers(n_missing_linkers=1, groups='A', linker_patterns: Optional[dict] = None) -> int
Number of symmetry-unique structures with n_missing_linkers linkers
removed and the groups placed on the others (groups="" for bare
linkers), from Burnside's lemma. A missing linker is a linker pattern whose
sites all carry a vacancy label. With several linker types,
n_missing_linkers is {type name: number} and groups or
linker_patterns can be given per type.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> cage.count_defect_isomers(1, groups="A") # one linker missing, A on the other five
256
>>> cage.count_defect_isomers(1, groups="") # bare: all six edges are equivalent
1
Source code in cage_isomer_builder/cage/base.py
count_node_defect_isomers ¶
Symmetry-unique ways of removing n_missing_nodes nodes (linkers
unfunctionalised), via Burnside's lemma on the node permutations.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> cage.count_node_defect_isomers(1), cage.count_node_defect_isomers(2) # Td: all equivalent
(1, 1)
Source code in cage_isomer_builder/cage/base.py
count_rgroup_isomers ¶
count_rgroup_isomers(groups: Union[str, list] = 'AB', linker_patterns: Optional[dict] = None) -> int
Number of symmetry-unique isomers with several different groups placed at once, from Burnside's lemma.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
groups
|
(str, list or dict)
|
Groups on every linker: |
"AB"
|
linker_patterns
|
dict
|
Fixed numbers of linkers per pattern instead: |
None
|
Returns:
| Type | Description |
|---|---|
int
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the specification does not fit the linkers, or the symmetry operations do not form a group on the sites. |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> cage.count_rgroup_isomers("AB") # one A and one B on every linker
124464
>>> cage.count_rgroup_isomers(linker_patterns={"A": 3, "B": 3}) # 50:50 linkers
3424
Source code in cage_isomer_builder/cage/base.py
count_unique_isomers_burnside ¶
Number of symmetry-unique isomers, from Burnside's lemma, without enumerating them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
active_per_linker
|
int
|
Number of groups on every linker: 1 gives the isomers of
:meth: |
1
|
Returns:
| Type | Description |
|---|---|
int
|
|
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> cage.count_unique_isomers_burnside(), cage.count_unique_isomers_burnside(active_per_linker=2)
(176, 2013)
Source code in cage_isomer_builder/cage/base.py
distance_scaling ¶
FG site-pair distances at each scale factor and their slopes (see
:func:cage_isomer_builder.utils.flexibility.distance_scaling).
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> pairs, distances, slopes = cage.distance_scaling((0.95, 1.0, 1.05))
>>> pairs.shape, distances.shape
((276, 2), (3, 276))
Source code in cage_isomer_builder/cage/base.py
enumerate_defect_isomers ¶
enumerate_defect_isomers(n_missing_linkers=1, groups='A', linker_patterns: Optional[dict] = None, output_path: Optional[str] = None, generate_files: bool = True, limit: Optional[int] = None)
Enumerate the structures counted by :meth:count_defect_isomers.
The missing linkers are deleted; the exposed node sites are left open (the same for cages, MOFs and COFs). Each file holds the R sites of the remaining linkers.
Returns:
| Type | Description |
|---|---|
list of (RGroupIsomer, ase.Atoms)
|
|
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> iso, atoms = cage.enumerate_defect_isomers(1, groups="", generate_files=False)[0]
>>> len(cage.to_ase()) - len(atoms) # one 10-atom linker removed
10
Source code in cage_isomer_builder/cage/base.py
3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 | |
enumerate_isomers ¶
enumerate_isomers(output_path: str = None, generate_files: bool = True, limit: int = None, naming: str = 'sites') -> list
Enumerate the symmetry-unique isomers with one group on every linker.
Each candidate is checked against its own symmetry orbit, so memory use does
not grow with the number of linkers; the run time grows with the number of
raw placements unless limit stops early.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
str
|
Directory for one extended XYZ file per isomer. Nothing is written if
None or if |
None
|
generate_files
|
bool
|
|
True
|
limit
|
int
|
Stop after this many isomers. Canonical representatives occur about once per |symmetry group| raw placements, so a modest limit is fast even when the full enumeration is not. |
None
|
naming
|
(sites, vertex)
|
File names: the active site indices ( |
"sites"
|
Returns:
| Type | Description |
|---|---|
list of list of int
|
The active site indices of each isomer. |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> import os, tempfile
>>> folder = tempfile.mkdtemp()
>>> isomers = cage.enumerate_isomers(output_path=folder, limit=3)
>>> isomers[0], sorted(os.listdir(folder))[0]
([0, 4, 8, 12, 16, 20], '0-4-8-12-16-20.xyz')
>>> from cage_isomer_builder.utils.sites import read_isomer
>>> info = read_isomer(os.path.join(folder, "0-4-8-12-16-20.xyz")).info
>>> info["vertex_linkers"] # vertex 2 joins linkers 1, 3 and 5
'0:0,1,2 1:0,3,4 2:1,3,5 3:2,4,5'
>>> info["linker_sites"] # linker 1 owns sites 4 to 7
'0:0-3 1:4-7 2:8-11 3:12-15 4:16-19 5:20-23'
>>> info["vertex_name"], info["vertex_labels"]
('000-100-110-111', '000-100-110-111')
>>> by_vertex = tempfile.mkdtemp()
>>> _ = cage.enumerate_isomers(output_path=by_vertex, limit=3, naming="vertex")
>>> name = sorted(os.listdir(by_vertex))[0]
>>> name, read_isomer(os.path.join(by_vertex, name)).info["isomer"]
('000-100-110-111.xyz', '0-4-8-12-16-20')
Source code in cage_isomer_builder/cage/base.py
2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 | |
enumerate_node_defect_isomers ¶
enumerate_node_defect_isomers(n_missing_nodes: int = 1, output_path: Optional[str] = None, generate_files: bool = True) -> list
The structures counted by :meth:count_node_defect_isomers: each
missing node is deleted with all its atoms; the linker ends left
behind stay open. FG slots are restored to H.
Returns:
| Type | Description |
|---|---|
list of (tuple of removed node indices, ase.Atoms)
|
|
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> removed, atoms = cage.enumerate_node_defect_isomers(1, generate_files=False)[0]
>>> removed, len(cage.to_ase()) - len(atoms) # one 86-atom Zr6 node removed
((0,), 86)
Source code in cage_isomer_builder/cage/base.py
enumerate_rgroup_isomers ¶
enumerate_rgroup_isomers(groups: Union[str, list] = 'AB', linker_patterns: Optional[dict] = None, output_path: str = None, generate_files: bool = True, limit: int = None, naming: str = 'sites') -> list
Enumerate the symmetry-unique isomers with several different groups.
Each isomer written to output_path is an extended XYZ file in which every
active site is an R site (X atom) whose per-atom "rgroup" value says
which group goes there (1 = first label, 2 = second, ...).
:func:~cage_isomer_builder.utils.functionalise.functionalise_isomer_sites
attaches the matching fragment at each site. A complete enumeration
(limit=None) is checked against :meth:count_rgroup_isomers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
groups
|
Union[str, list]
|
As for :meth: |
'AB'
|
linker_patterns
|
Union[str, list]
|
As for :meth: |
'AB'
|
output_path
|
str
|
Directory for the structure files. |
None
|
generate_files
|
bool
|
|
True
|
limit
|
int
|
Stop after this many isomers. |
None
|
naming
|
(sites, vertex)
|
File names: the groups' sites ( |
"sites"
|
Returns:
| Type | Description |
|---|---|
list of RGroupIsomer
|
|
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> first = cage.enumerate_rgroup_isomers(["NH2", "OH"], generate_files=False, limit=1)[0]
>>> first.to_dict()
{'NH2': [2, 6, 10, 14, 18, 22], 'OH': [3, 7, 11, 15, 19, 23]}
Files named by their vertex names:
>>> import os, tempfile
>>> folder = tempfile.mkdtemp()
>>> _ = cage.enumerate_rgroup_isomers(["NH2", "OH"], output_path=folder, limit=1,
... naming="vertex")
>>> os.listdir(folder)
['AB.AB.AB-00.AB.AB-00.00.AB-00.00.00.xyz']
Source code in cage_isomer_builder/cage/base.py
2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 | |
functionalise ¶
Find the functional-group sites: every aromatic C-H of every linker becomes
an R site (all linker types of a MOF with several, see :meth:slot_layout).
aromatic_only=False also marks H on alkyl carbons.
Returns:
| Name | Type | Description |
|---|---|---|
fg_anchors |
Atoms
|
The site atoms. |
fg_anchor_indices |
list of int
|
Index of each site atom in the structure. |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None)
>>> anchors, slots = cage.functionalise()
>>> len(slots), set(cage.to_ase()[slots].get_chemical_symbols()) # 4 slots on each of 6 rings
(24, {'X'})
Source code in cage_isomer_builder/cage/base.py
get_bond_matrix ¶
Bond-order matrix of the built cage, taken from the STK construction rather
than perceived from the geometry. It is correct even where bonded atoms are
far apart, and it adds no bonds between atoms that are merely close. Used by
the GULP and AMS writers and accepted by
functionalise.place_guest_in_host(host_bond_matrix=...) and
functionalise_isomer_sites(host_bond_matrix=...).
Returns:
| Type | Description |
|---|---|
(ndarray, shape(n_atoms, n_atoms))
|
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the structure was not built with :meth: |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> bonds = cage.get_bond_matrix()
>>> bonds.shape, bool((bonds == bonds.T).all())
((404, 404), True)
Source code in cage_isomer_builder/cage/base.py
get_descriptor ¶
get_descriptor(kinds=('fg', 'pi', 'donor', 'acceptor', 'open_metal'), by: str = 'kind', max_distance: Optional[float] = None, exclude_same_owner: bool = True, **feature_kwargs) -> distributions.Descriptor
Pair descriptor of every feature site of this (static) structure,
including all cross terms between kinds. For a periodic structure
pairs are counted over all images up to max_distance (default
20 Angstrom). See :mod:cage_isomer_builder.utils.distributions.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> desc = cage.get_descriptor()
>>> desc.summary()[("fg", "pi")] # 24 sites x 6 rings, minus each ring's own 4
(120, 120.0)
Source code in cage_isomer_builder/cage/base.py
get_ensemble_descriptor ¶
get_ensemble_descriptor(groups='A', linker_patterns: Optional[dict] = None, n_missing_linkers: int = 0, mode: str = 'fixed', fractions: Optional[dict] = None, by: str = 'orientation', include_same_linker: bool = False, rotation_angles=None, angle_weights=None, threshold: float = 0.5, max_distance: Optional[float] = None) -> distributions.Descriptor
Exact FG pair descriptor averaged over every placement of the groups
(several groups, partial functionalisation, missing linkers), optionally
also over ring rotations. See
:func:cage_isomer_builder.utils.ensemble.ensemble_descriptor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
groups
|
As for :meth: |
'A'
|
|
linker_patterns
|
As for :meth: |
'A'
|
|
n_missing_linkers
|
int or dict
|
Number of missing linkers (they carry no groups); |
0
|
mode
|
str
|
|
'fixed'
|
fractions
|
str
|
|
'fixed'
|
by
|
str
|
Pair types by group and endo/exo class, or by group only ( |
"orientation"
|
include_same_linker
|
bool
|
Also count pairs of two groups on one linker. |
False
|
rotation_angles
|
sequence of float
|
Ring rotation angles (degrees) to average over; every ring turns independently. |
None
|
angle_weights
|
sequence of float
|
One weight per angle (default uniform), e.g. Boltzmann weights from a torsion scan. |
None
|
threshold
|
float
|
Endo/exo cosine limit. |
0.5
|
max_distance
|
float
|
Periodic structures: pairs over all images up to this distance, per unit cell (default 20 Angstrom). Finite structures: an optional cutoff. |
None
|
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> ens = cage.get_ensemble_descriptor(linker_patterns={"N": 3, "C": 3}, by="label")
>>> {key: round(weight, 3) for key, (_, weight) in ens.summary().items()}
{('fg:C', 'fg:C'): 3.0, ('fg:C', 'fg:N'): 9.0, ('fg:N', 'fg:N'): 3.0}
>>> flexible = cage.get_ensemble_descriptor(groups="A", rotation_angles=range(0, 360, 90))
>>> round(flexible.total(), 6) # still 15 pairs of the 6 groups
15.0
Source code in cage_isomer_builder/cage/base.py
3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 | |
get_features ¶
get_features(kinds=('fg', 'pi', 'donor', 'acceptor', 'open_metal'), expected_cn: Optional[dict] = None, include_metal_bound: bool = False, threshold: float = 0.5, open_metal_method: str = 'auto') -> features.FeatureSet
Every feature site of the structure: FG slots, aromatic rings
(with normals), H-bond donors/acceptors (with directions) and open
metal sites (with the direction of the empty site). Owners are the
building blocks (linkers first, then nodes), so pairs inside one
building block can be excluded. Open metal sites come from
mofstructure's geometric detector unless open_metal_method=
"coordination". See :mod:cage_isomer_builder.utils.features.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> cage.get_features().counts() # R sites, rings, mu3-O acceptors; no open metals
{'acceptor': 32, 'fg': 24, 'pi': 6}
Source code in cage_isomer_builder/cage/base.py
get_statistics ¶
get_statistics(n_kde_bins: int = 200, threshold: float = 0.5, max_distance: Optional[float] = None) -> CageStatistics
FG-FG distance statistics: every pair of sites on different linkers, once, split by where the sites point, with a smoothed curve.
A site is endo or exo by the direction of its C-site bond relative to the
pore centre (see :func:cage_isomer_builder.utils.features.orientation_class):
the cosine with the inward direction is above threshold (endo) or below
-threshold (exo); otherwise the site is tangential and its pairs are
counted in other_pairs. The counts are proportional to the average over
all placements of one group per linker. For several groups, ratios, defects
or flexibility, use :meth:get_ensemble_descriptor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_kde_bins
|
int
|
Number of points of the smoothed curve. |
200
|
threshold
|
float
|
|
0.5
|
max_distance
|
float
|
Periodic structures: count pairs over all periodic images up to this distance, per unit cell (default 20 Angstrom). |
None
|
Returns:
| Type | Description |
|---|---|
CageStatistics
|
|
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> stats = cage.get_statistics()
>>> sum(stats.total_fg_pairs), sum(stats.other_pairs) # face-on rings: tangential sites
(240, 240)
Source code in cage_isomer_builder/cage/base.py
2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 | |
load_from_file
classmethod
¶
Create a builder from an existing structure instead of building one with STK. The structure can then be functionalised, analysed and enumerated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Structure file readable by ASE (PDB, CIF, XYZ, MOL, SDF, ...). |
required |
primitive
|
bool
|
Replace a periodic cell by its primitive cell (see
:func: |
False
|
symprec
|
float
|
spglib tolerance used when |
1e-2
|
**init_kwargs
|
Passed to the constructor. |
{}
|
Returns:
| Type | Description |
|---|---|
CageBuilder
|
|
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import CageBuilder
>>> len(CageBuilder.load_from_file(example_data.path("RUBTAK01")).to_ase())
440
>>> len(CageBuilder.load_from_file(example_data.path("RUBTAK01"), primitive=True).to_ase())
110
Source code in cage_isomer_builder/cage/base.py
optimise ¶
optimise(fmax: float = 0.05, steps: int = 500, optimizer_cls=None, trajectory: Optional[str] = None, rigid_sbus: bool = True, include_charges: bool = True, charge: float = 0.0, method: str = 'UFF4MOF', logfile: Optional[str] = '-') -> Atoms
Optimise the cage geometry.
method="UFF4MOF"(default): the UFF4MOF force field with the STK bond orders and UFF atom types (see :mod:cage_isomer_builder.utils.optimise). The bonds are those of the construction, so atypical distances in the starting geometry do not change the connectivity.method="GFN1-xTB"or"GFN2-xTB": tblite tight binding. It needs no bond orders or atom types, and so cannot be held to a bond matrix.
Call this after :meth:build and before :meth:functionalise. After
:meth:functionalise, the site markers are removed before optimising and
:meth:functionalise must be run again.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fmax
|
float
|
Force convergence threshold (eV/Angstrom). |
0.05
|
steps
|
int
|
Maximum number of steps. |
500
|
optimizer_cls
|
ASE optimizer class
|
Any |
None
|
trajectory
|
str
|
Path of an ASE |
None
|
rigid_sbus
|
bool
|
Keep every node and linker rigid (see
:class: |
True
|
include_charges
|
bool
|
Store partial charges on the result ( |
True
|
charge
|
float
|
Total charge passed to tblite. |
0.0
|
method
|
str
|
|
"UFF4MOF"
|
logfile
|
str or None
|
Optimiser log: |
"-"
|
Returns:
| Type | Description |
|---|---|
Atoms
|
The optimised structure, which also replaces the builder's structure. |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> relaxed = cage.optimise(include_charges=False, logfile=None)
>>> len(relaxed), relaxed is cage.to_ase()
(404, True)
Source code in cage_isomer_builder/cage/base.py
1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 | |
point_group ¶
Point group of the finite structure's framework, detected from the atoms
chosen by symmetry_reference with tolerance symmetry_tol.
result.name is the Schoenflies symbol (e.g. "Td"), result.order
the number of operations and result.max_deviation how far (Angstrom) the
structure is from perfect symmetry.
Raises:
| Type | Description |
|---|---|
ValueError
|
For a periodic structure (which uses spglib), or if no consistent group exists at this tolerance (see utils.pointgroup). |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> pg = cage.point_group()
>>> pg.name, pg.order
('Td', 24)
Source code in cage_isomer_builder/cage/base.py
pore_centre ¶
Centre of the pore: the point-group centre of a finite structure (centroid of its non-H, non-site atoms if no group is found), None for a periodic one.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> import numpy as np
>>> bool(np.allclose(cage.pore_centre(), cage.point_group().centre))
True
Source code in cage_isomer_builder/cage/base.py
rotors ¶
Rotatable linker rings (see :func:cage_isomer_builder.utils.flexibility.find_rotors).
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> len(cage.rotors())
6
Source code in cage_isomer_builder/cage/base.py
save ¶
Save the cage structure to file.
A PDB file of a built cage is written by STK, with the bonds of the
construction; every other format by ase.io.write. Both hold the
current geometry, so the optimised one after :meth:optimise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Output file path, e.g. |
required |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> import os, tempfile
>>> path = os.path.join(tempfile.mkdtemp(), "cage.xyz")
>>> cage.save(path) # any ASE format; PDB via STK
>>> os.path.getsize(path) > 0
True
Source code in cage_isomer_builder/cage/base.py
scaled ¶
The structure with every building block moved rigidly by an
isotropic expansion (factor > 1) or contraction (< 1) about the
pore centre (periodic: the cell is scaled).
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> import numpy as np
>>> bigger = cage.scaled(1.05)
>>> _, nodes = cage.building_blocks()
>>> r0 = np.linalg.norm(cage.to_ase().positions[nodes[0]].mean(0) - cage.pore_centre())
>>> r1 = np.linalg.norm(bigger.positions[nodes[0]].mean(0) - cage.pore_centre())
>>> round(float(r1 / r0), 6)
1.05
Source code in cage_isomer_builder/cage/base.py
slot_features ¶
One fg feature per FG slot, in slot order, with its C-site
direction and endo/exo/tangential class relative to
:meth:pore_centre. The owner of a slot is the index of the linker
holding it in :meth:building_blocks, so it matches the owners of
:meth:get_features' other sites.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> slots = cage.slot_features()
>>> len(slots), sorted(set(slots.orientation.tolist()))
(24, ['tangential'])
Source code in cage_isomer_builder/cage/base.py
slot_group ¶
The structure's symmetry as permutations of its functional-group sites,
checked to be a group that maps linkers onto linkers of the same type.
Every isomer count and enumeration uses it; pass it to the functions of
:mod:cage_isomer_builder.utils.rgroup and
:mod:cage_isomer_builder.utils.ensemble.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import CageBuilder
>>> mof = CageBuilder.load_from_file(example_data.path("RUBTAK01"), primitive=True)
>>> _ = mof.functionalise()
>>> group = mof.slot_group()
>>> group.order, group.perms.shape # Fm-3m: 48 operations on 24 sites
(48, (48, 24))
Source code in cage_isomer_builder/cage/base.py
slot_layout ¶
How the FG slots are grouped: slots per linker and linker type
(layout.type_names are the linkers' chemical formulas). A MOF with
several kinds of linker has several types, possibly with different
numbers of slots; groups can then be given per type, e.g.
groups={"C6H4": "A", "C10H8N2": ""}.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import CageBuilder
>>> mof = CageBuilder.load_from_file(example_data.path("ABIXEQ")) # two kinds of linker
>>> _ = mof.functionalise()
>>> layout = mof.slot_layout()
>>> layout.type_names, layout.sizes
(('C18H18N4', 'C6H4'), (8, 4))
Source code in cage_isomer_builder/cage/base.py
to_ase ¶
The structure as ASE Atoms (converted from the STK cage on first use).
After :meth:functionalise it holds the R-site markers (X atoms).
hydrogens=True returns a copy with every site turned back into its
original H, i.e. the parent cage, for docking or optimisation.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> atoms = cage.to_ase()
>>> len(atoms), bool(atoms.pbc.any())
(404, False)
>>> _ = cage.functionalise()
>>> "X" in cage.to_ase().get_chemical_symbols(), "X" in cage.to_ase(hydrogens=True).symbols
(True, False)
Source code in cage_isomer_builder/cage/base.py
to_smiles ¶
Convert the cage to a SMILES string using mofstructure (OpenBabel).
Returns:
| Name | Type | Description |
|---|---|---|
smiles |
str
|
|
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> "Zr" in cage.to_smiles()
True
Source code in cage_isomer_builder/cage/base.py
vertex_scheme ¶
Vertex codes of this cage: what each vertex (node) sees of the groups on its linkers.
Seen from the pore centre with the vertex at the bottom of a linker,
the linker reads 1 if its group is next to this vertex on the left, 4
if on the right, and 0 otherwise (one group per linker on a
four-site linker); 5 for both, one character per depth on longer
linkers, and pairs of group letters for several kinds of group. A vertex's code lists its linkers
clockwise as seen from the pore centre, starting at the lowest-numbered
linker (the vertex and linker numbers of info["vertex_linkers"]).
The vertex name of an isomer, its codes in vertex order joined by
-, is unique and converts back to the site indices;
labels gives the environment of each vertex whatever linker its
code starts at (see :mod:cage_isomer_builder.utils.vertex_codes).
Raises:
| Type | Description |
|---|---|
ValueError
|
For a periodic structure, if a linker does not join two vertices, or a site is neither left nor right of its linker, or midway between its vertices. |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> scheme = cage.vertex_scheme()
>>> scheme.name([0, 4, 9, 13, 16, 22]), scheme.labels([0, 4, 9, 13, 16, 22])
('000-100-141-401', ['000', '100', '114', '140'])
>>> scheme.resolve("000-100-141-401"), scheme.resolve("0-4-9-13-16-22")
([0, 4, 9, 13, 16, 22], [0, 4, 9, 13, 16, 22])
Source code in cage_isomer_builder/cage/base.py
2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 | |
vertex_table ¶
vertex_table(max_placements: int = 4 ** 16, groups='A', linker_patterns: Optional[dict] = None) -> vertex_tables.VertexTable
Every symmetry-unique isomer, with its vertex name and environment
labels, for statistics over vertex environments (see
:mod:cage_isomer_builder.utils.vertex_table), without building any
structures. With one group per linker (the default) the isomers are
the ones :meth:enumerate_isomers writes, in the same order;
otherwise the ones :meth:enumerate_rgroup_isomers writes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_placements
|
int
|
Refuse cages with more than this many raw placements
( |
``4 ** 16``
|
groups
|
What goes on the linkers, as for :meth: |
'A'
|
|
linker_patterns
|
What goes on the linkers, as for :meth: |
'A'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the cage has no vertex codes (see :meth: |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> table = cage.vertex_table()
>>> len(table), table.site_name(0), table.labels(0)
(176, '0-4-8-12-16-20', '111-110-100-000')
>>> table.environment_counts(both_hands=True)["114"]
64
>>> ab = cage.vertex_table(groups=["NH2", "OH"])
>>> len(ab) == cage.count_rgroup_isomers(["NH2", "OH"]), ab.site_name(0)
(True, 'NH2-2-6-10-14-18-22_OH-3-7-11-15-19-23')
Source code in cage_isomer_builder/cage/base.py
write_ams_run ¶
Write an AMS geometry-optimisation run script for this cage, with Cartesian
coordinates (the optimised ones after :meth:optimise), bond orders from the STK bond matrix, lattice vectors for a
periodic structure, and an Engine DFTB block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Output file, e.g. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If :meth: |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> import os, tempfile
>>> path = os.path.join(tempfile.mkdtemp(), "cage.run")
>>> cage.write_ams_run(path)
>>> "BondOrders" in open(path).read()
True
Source code in cage_isomer_builder/cage/base.py
write_gulp_gin ¶
Write a GULP input file for this cage, with UFF4MOF atom types from
gulp_setup (as used by optimise(method="UFF4MOF")), Cartesian
coordinates (the optimised ones after :meth:optimise), connect records from the STK bond matrix and a uff4mof
library block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Output file, e.g. |
required |
lattice
|
str
|
|
"conv"
|
mechanical
|
bool
|
Use |
False
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If :meth: |
Notes
gulp_setup.mmanalysis.write_gin accepts bond orders 4, 3, 2, 1.5, 1, 0.5
and 0.25; any other order raises KeyError. STK bond matrices hold
integer orders and 1.5 for aromatic bonds.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> import os, tempfile
>>> path = os.path.join(tempfile.mkdtemp(), "cage.gin")
>>> cage.write_gulp_gin(path)
>>> open(path).read().startswith("opti")
True
Source code in cage_isomer_builder/cage/base.py
CageStatistics
dataclass
¶
CageStatistics(n_linkers: int, n_fg_slots: int, n_unique_isomers: int, distance_keys: list, total_fg_pairs: list, endo_endo_pairs: list, endo_exo_pairs: list, exo_exo_pairs: list, kde_x: ndarray, kde_y: ndarray, other_pairs: list = None)
FG-FG distance statistics of a structure (see :meth:CageBuilder.get_statistics).
Attributes:
| Name | Type | Description |
|---|---|---|
n_linkers |
int
|
Number of linkers carrying sites. |
n_fg_slots |
int
|
Total number of functional-group sites. |
n_unique_isomers |
int
|
Symmetry-unique isomers with one group per linker (Burnside's lemma). |
distance_keys |
list of float
|
Sorted distinct site-site distances between linkers (Angstrom). |
total_fg_pairs |
list of int
|
Number of site pairs at each distance. |
endo_endo_pairs |
list of int
|
Pairs where both sites point into the pore. |
endo_exo_pairs |
list of int
|
Pairs with one site pointing in and one out. |
exo_exo_pairs |
list of int
|
Pairs where both sites point out. |
kde_x |
(ndarray, shape(n_kde_bins))
|
Distance grid of the smoothed curve. |
kde_y |
(ndarray, shape(n_kde_bins))
|
Smoothed pair counts on |
other_pairs |
list of int
|
Pairs involving a tangential site (its C-site bond within 60 degrees of
perpendicular to the pore direction, e.g. on a ring lying face-on to the
pore) or, in periodic structures, an unclassified site. The four classes
add up to |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder(node=example_data.path("uio66_tri_node"),
... linker=example_data.path("bdc"), scale_multiplier=0.225)
>>> _ = cage.build()
>>> _ = cage.optimise(include_charges=False, logfile=None) # the UiO-66 tetrahedral cage
>>> _ = cage.functionalise()
>>> stats = cage.get_statistics()
>>> stats.n_linkers, stats.n_fg_slots, stats.n_unique_isomers, sum(stats.total_fg_pairs)
(6, 24, 176, 240)
Topology-specific builders¶
One cage builder per topology. Each sets the STK topology graph, the
number of connection points of its node and, where one exists, its
hand-written symmetry library for symmetry_method="topology".
Tet2Di4CageBuilder ¶
Tet2Di4CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tet2Di4: 2 tetratopic nodes + 4 ditopic linkers (TwoPlusFour). Point group D4h.
Examples:
>>> from cage_isomer_builder.cage import Tet2Di4CageBuilder
>>> cage = Tet2Di4CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C24H16N8Zr2'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tet3_3Di3CageBuilder ¶
Tet3_3Di3CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tet3-3Di3: 3 tetratopic nodes + 6 ditopic linkers (_ThreePlusSix). Point group D3h.
Examples:
>>> from cage_isomer_builder.cage import Tet3_3Di3CageBuilder
>>> cage = Tet3_3Di3CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C36H24N12Zr3'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tet4_4Di8CageBuilder ¶
Tet4_4Di8CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tet4-4Di8: 4 tetratopic nodes + 8 ditopic linkers (FourPlusEight). Point group D4h.
Examples:
>>> from cage_isomer_builder.cage import Tet4_4Di8CageBuilder
>>> cage = Tet4_4Di8CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C48H32N16Zr4'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tet5Di10CageBuilder ¶
Tet5Di10CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tet5Di10: 5 tetratopic nodes (pentagonal arrangement) + 10 ditopic linkers (FivePlusTen). Point group D5h.
Examples:
>>> from cage_isomer_builder.cage import Tet5Di10CageBuilder
>>> cage = Tet5Di10CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C60H40N20Zr5'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tet6Di12CageBuilder ¶
Tet6Di12CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tet6Di12: 6 tetratopic nodes + 12 ditopic linkers (SixPlusTwelve). Point group Oh.
Examples:
>>> from cage_isomer_builder.cage import Tet6Di12CageBuilder
>>> cage = Tet6Di12CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C72H48N24Zr6'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tet8Di16CageBuilder ¶
Tet8Di16CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tet8Di16: 8 tetratopic nodes + 16 ditopic linkers (EightPlusSixteen). Point group D4d.
Examples:
>>> from cage_isomer_builder.cage import Tet8Di16CageBuilder
>>> cage = Tet8Di16CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C96H64N32Zr8'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tet16Di32CageBuilder ¶
Bases: CageBuilder
Tet16Di32: M12L24, 12 tetratopic nodes + 24 ditopic linkers. Point group D4h.
Examples:
>>> from cage_isomer_builder.cage import Tet16Di32CageBuilder
>>> cage = Tet16Di32CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C144H96N48Zr12'
Source code in cage_isomer_builder/cage/library.py
Tet24Di48CageBuilder ¶
Tet24Di48CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tet24Di48: M24L48, 24 tetratopic nodes + 48 ditopic linkers. Point group Oh.
Examples:
>>> from cage_isomer_builder.cage import Tet24Di48CageBuilder
>>> cage = Tet24Di48CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C288H192N96Zr24'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tri2Di3CageBuilder ¶
Tri2Di3CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tri2Di3: 2 tritopic (triamine) nodes + 3 ditopic linkers (_TwoPlusThree). Point group D3h.
Examples:
>>> from cage_isomer_builder.cage import Tri2Di3CageBuilder
>>> cage = Tri2Di3CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C18H12N6Zr2'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tri4Di6CageBuilder ¶
Tri4Di6CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tri4Di6: 4 tritopic nodes + 6 ditopic linkers (FourPlusSix). Point group Td.
With symmetry_method="topology" the operations come from the four
node centres (universal_transformation_library), which also works for
multi-atom nodes such as Zr6 clusters.
Examples:
>>> from cage_isomer_builder.cage import Tri4Di6CageBuilder
>>> cage = Tri4Di6CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C36H24N12Zr4'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tri4_2Di6CageBuilder ¶
Tri4_2Di6CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tri4-2Di6: 4 tritopic nodes + 6 ditopic linkers (FourPlusSix2 isomeric variant). Point group D2h.
Examples:
>>> from cage_isomer_builder.cage import Tri4_2Di6CageBuilder
>>> cage = Tri4_2Di6CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C36H24N12Zr4'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tri6Di9CageBuilder ¶
Tri6Di9CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tri6Di9: 6 tritopic nodes + 9 ditopic linkers (SixPlusNine). Point group D3h.
Examples:
>>> from cage_isomer_builder.cage import Tri6Di9CageBuilder
>>> cage = Tri6Di9CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C54H36N18Zr6'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tri8Di12CageBuilder ¶
Tri8Di12CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tri8Di12: 8 tritopic nodes + 12 ditopic linkers (EightPlusTwelve). Point group Oh.
With symmetry_method="topology" the operations come from the eight
node centres (universal_transformation_library).
Examples:
>>> from cage_isomer_builder.cage import Tri8Di12CageBuilder
>>> cage = Tri8Di12CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C72H48N24Zr8'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tri20Di30CageBuilder ¶
Tri20Di30CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tri20Di30: 20 tritopic nodes + 30 ditopic linkers (TwentyPlusThirty). Point group Ih.
Full enumeration of 4^30 isomers is impractical; use count_unique_isomers_burnside() instead.
Examples:
>>> from cage_isomer_builder.cage import Tri20Di30CageBuilder
>>> cage = Tri20Di30CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C180H120N60Zr20'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tet6Tri8CageBuilder ¶
Tet6Tri8CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tet6Tri8: 6 tetratopic nodes + 8 tritopic linkers (SixPlusEight). Point group Oh.
Isomers are counted from the point group detected from the atoms (the
default symmetry_method="detect"); there is no hand-written
library for symmetry_method="topology".
Examples:
>>> from cage_isomer_builder.cage import Tet6Tri8CageBuilder
>>> cage = Tet6Tri8CageBuilder() # default single-atom [Zr] node + 1,3,5-triaminobenzene
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C48H24N24Zr6'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tri4Tri4CageBuilder ¶
Tri4Tri4CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tri4Tri4: 4 + 4 tritopic building blocks (FourPlusFour). Point group Td.
Isomers are counted from the point group detected from the atoms (the
default symmetry_method="detect"); there is no hand-written
library for symmetry_method="topology".
Examples:
>>> from cage_isomer_builder.cage import Tri4Tri4CageBuilder
>>> cage = Tri4Tri4CageBuilder() # default single-atom [Zr] node + 1,3,5-triaminobenzene
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C24H12N12Zr4'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tri1Tri1CageBuilder ¶
Tri1Tri1CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tri1Tri1: 1 + 1 tritopic building blocks (OnePlusOne). Point group C3v.
Isomers are counted from the point group detected from the atoms (the
default symmetry_method="detect"); there is no hand-written
library for symmetry_method="topology".
Examples:
>>> from cage_isomer_builder.cage import Tri1Tri1CageBuilder
>>> cage = Tri1Tri1CageBuilder() # default single-atom [Zr] node + 1,3,5-triaminobenzene
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C6H3N3Zr'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Tri2_2Tri2CageBuilder ¶
Tri2_2Tri2CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
Tri2²Tri2: 2 + 2 tritopic building blocks (TwoPlusTwo). Point group D2h.
Isomers are counted from the point group detected from the atoms (the
default symmetry_method="detect"); there is no hand-written
library for symmetry_method="topology".
Examples:
>>> from cage_isomer_builder.cage import Tri2_2Tri2CageBuilder
>>> cage = Tri2_2Tri2CageBuilder() # default single-atom [Zr] node + 1,3,5-triaminobenzene
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C12H6N6Zr2'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
M2L4LanternCageBuilder ¶
M2L4LanternCageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
M2L4Lantern: 2 tetratopic nodes + 4 ditopic linkers. Point group D4h.
Examples:
>>> from cage_isomer_builder.cage import M2L4LanternCageBuilder
>>> cage = M2L4LanternCageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C24H16N8Zr2'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
M3L6CageBuilder ¶
M3L6CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
M3L6: 3 tetratopic nodes + 6 ditopic linkers. Point group D3h.
Examples:
>>> from cage_isomer_builder.cage import M3L6CageBuilder
>>> cage = M3L6CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C36H24N12Zr3'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
M4L6TetrahedronSpacerCageBuilder ¶
M4L6TetrahedronSpacerCageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
M4L6TetrahedronSpacer: 4 tritopic nodes + 6 ditopic (spacered) linkers. Point group Td.
Examples:
>>> from cage_isomer_builder.cage import M4L6TetrahedronSpacerCageBuilder
>>> cage = M4L6TetrahedronSpacerCageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C36H24N12Zr4'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
M4L8CageBuilder ¶
M4L8CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
M4L8: 4 tetratopic nodes + 8 ditopic linkers. Point group D2d.
Examples:
>>> from cage_isomer_builder.cage import M4L8CageBuilder
>>> cage = M4L8CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C48H32N16Zr4'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
M4L82CageBuilder ¶
M4L82CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
M4L82: 4 tetratopic nodes + 8 ditopic linkers (M4L8 vertex-arrangement isomer). Point group D2d.
Examples:
>>> from cage_isomer_builder.cage import M4L82CageBuilder
>>> cage = M4L82CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C48H32N16Zr4'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
M4L8xCageBuilder ¶
M4L8xCageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
M4L8x: 4 tetratopic nodes + 8 ditopic linkers (M4L8 vertex-arrangement isomer). Point group D2d.
Examples:
>>> from cage_isomer_builder.cage import M4L8xCageBuilder
>>> cage = M4L8xCageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C48H32N16Zr4'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
M6L12CubeCageBuilder ¶
M6L12CubeCageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
M6L12Cube: 6 tetratopic nodes + 12 ditopic linkers. Point group Oh.
Examples:
>>> from cage_isomer_builder.cage import M6L12CubeCageBuilder
>>> cage = M6L12CubeCageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C72H48N24Zr6'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
M8L6CubeCageBuilder ¶
M8L6CubeCageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
M8L6Cube: 8 tritopic corner nodes + 6 tetratopic face linkers. Point group Oh.
Unlike most other topologies here, linker must be tetratopic (4
functional groups): it caps a cube face, not an edge.
Examples:
>>> from cage_isomer_builder.cage import M8L6CubeCageBuilder
>>> cage = M8L6CubeCageBuilder() # default single-atom [Zr] node + 1,2,4,5-tetraaminobenzene
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C36H12N24Zr8'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
M9L18CageBuilder ¶
M9L18CageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
M9L18: 9 tetratopic nodes + 18 ditopic linkers.
Isomers are counted from the point group detected from the atoms (the
default symmetry_method="detect"). symmetry_method="topology" is
not available: with 9 metal nodes, universal_transformation_library's
node-permutation search (N! permutations) is past its practical limit.
Examples:
>>> from cage_isomer_builder.cage import M9L18CageBuilder
>>> cage = M9L18CageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C108H72N36Zr9'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
TenPlusTwentyCageBuilder ¶
TenPlusTwentyCageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
TenPlusTwenty: 10 tetratopic nodes + 20 ditopic linkers.
Isomers are counted from the detected point group (the default); the
node-permutation library of symmetry_method="topology" is not
available (see M9L18).
Examples:
>>> from cage_isomer_builder.cage import TenPlusTwentyCageBuilder
>>> cage = TenPlusTwentyCageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C120H80N40Zr10'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
TwelvePlusThirtyCageBuilder ¶
TwelvePlusThirtyCageBuilder(linker: MoleculeInput = None, node: MoleculeInput = None, linker_fg=None, node_fg=None, node_fg_count: int = None, smarts_pattern: str = None, optimizer_step: float = 0.01, distance_threshold: float = 5.0, expansion_factor: float = 1.0, scale_multiplier: float = 1.0, linker_smiles: str = None, node_smiles: str = None)
Bases: CageBuilder
TwelvePlusThirty: 12 pentatopic nodes + 30 ditopic linkers. Point group Ih.
Isomers are counted from the detected point group (the default); the
node-permutation library of symmetry_method="topology" is not
available (see M9L18).
Examples:
>>> from cage_isomer_builder.cage import TwelvePlusThirtyCageBuilder
>>> cage = TwelvePlusThirtyCageBuilder() # default single-atom [Zr] node + p-phenylenediamine
>>> _ = cage.build()
>>> cage.to_ase().get_chemical_formula()
'C180H120N60Zr12'
Source code in cage_isomer_builder/cage/base.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | |
Building-block helpers¶
Functions in cage_isomer_builder.cage.base that turn node and linker
inputs (SMILES, files, ASE atoms) into STK building blocks, and find the
linkers and nodes of a structure.
The cage builder base class: building a cage with STK or loading a structure, optimising it, marking its functional-group sites, counting and enumerating isomers, and computing descriptors.
dummies_to_placeholder ¶
Rewrite every SMILES dummy atom as the [Fr] placeholder that
:func:make_dummy_factory matches.
Examples:
>>> from cage_isomer_builder.cage.base import dummies_to_placeholder
>>> dummies_to_placeholder("[*]c1ccc(*)cc1"), dummies_to_placeholder("[1*:1]CC[#0]")
('[Fr]c1ccc([Fr])cc1', '[Fr]CC[Fr]')
Source code in cage_isomer_builder/cage/base.py
make_dummy_factory ¶
Factory for dummy atoms attached to any atom, written as the [Fr]
placeholder (see :func:dummies_to_placeholder).
Atom 0: dummy atom, deleted. Atom 1: real attachment atom, used as bonder.
Examples:
>>> import stk
>>> from cage_isomer_builder.cage.base import dummies_to_placeholder, make_dummy_factory
>>> smiles = dummies_to_placeholder("[*]c1ccc([*])cc1")
>>> stk.BuildingBlock(smiles, [make_dummy_factory()]).get_num_functional_groups()
2
Source code in cage_isomer_builder/cage/base.py
find_unique_building_units ¶
find_unique_building_units(list_of_connected_components, bonds_to_break, ase_atom, porphyrin_checker, all_regions)
Split a MOF or cage into its building units, metal SBUs and organic linkers (adapted from mofstructure).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
list_of_connected_components
|
list
|
Connected components of the structure's bond graph. |
required |
bonds_to_break
|
list of list
|
Atom indices at each breaking point. |
required |
ase_atom
|
Atoms
|
|
required |
porphyrin_checker
|
list of int
|
Indices of porphyrin atoms. |
required |
all_regions
|
dict
|
Region index -> connected-component mapping. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
mof_metal |
list of ase.Atoms
|
Metal building-unit fragments. |
mof_linker |
list of ase.Atoms
|
Organic linker building-unit fragments. |
building_unit_regions |
dict
|
Region index -> atom-index mapping. |
Examples:
>>> from cage_isomer_builder import example_data
>>> uio66 = example_data.read("RUBTAK01")
>>> from mofstructure.mofdeconstructor import secondary_building_units
>>> from cage_isomer_builder.cage.base import find_unique_building_units
>>> components, breaks, porphyrin, regions, _ = secondary_building_units(uio66)
>>> metals, organics, _ = find_unique_building_units(components, breaks, uio66, porphyrin, regions)
>>> [m.get_chemical_formula() for m in metals], [o.get_chemical_formula() for o in organics]
(['C12O32Zr6'], ['C6H4'])
Source code in cage_isomer_builder/cage/base.py
find_linkers ¶
Every linker of a MOF or cage, grouped by chemical type.
A linker is an organic building unit (from mofstructure's deconstruction) bonded to the framework at two or more points, so terminal ligands (e.g. a thiolate bound to one metal) and unbound guests are not linkers. All linker types are kept. If no unit has two connection points, the first organic unit with at least six atoms is used.
Returns:
| Name | Type | Description |
|---|---|---|
linker_atom_indices |
list of list of int
|
Atom indices of every linker instance. |
linker_types |
list of int
|
Type index of each instance. |
type_names |
list of str
|
Chemical formula of each type (made unique if two types share one). |
metal_atom_indices |
list of int
|
Every atom not in a linker. |
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage.base import find_linkers
>>> linkers, types, names, rest = find_linkers(example_data.read("ABIXEQ"))
>>> names, len(linkers) # two linker types, one of each per cell
(['C18H18N4', 'C6H4'], 2)
>>> find_linkers(example_data.read("ABINOQ"))[2] # bipyridine; terminal thiolates excluded
['C10H8N2']
Source code in cage_isomer_builder/cage/base.py
get_sbus_indices ¶
Return linker and metal atom indices from a MOF or metal-organic cage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ase_atom
|
Atoms
|
Structure to analyse. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
linker_atom_indices |
list of list of int
|
Atom indices per organic linker. |
metal_atom_indices |
list of int
|
Flat list of atom indices belonging to metal nodes. |
Examples:
>>> from cage_isomer_builder import example_data
>>> uio66 = example_data.read("RUBTAK01")
>>> from cage_isomer_builder.cage.base import get_sbus_indices
>>> linkers, rest = get_sbus_indices(uio66)
>>> len(linkers), len(linkers[0]), len(rest) # 24 phenylene rings in the cell
(24, 10, 200)
Source code in cage_isomer_builder/cage/base.py
get_node_centers ¶
Return the centre-of-mass position of each metal node instance.
Builds a bond graph restricted to the supplied metal atom indices, finds connected components (one per node cluster), and returns one CoM per component. This works for both single-atom nodes (each atom is its own component) and multi-atom clusters (e.g. Zr6).
metal_atom_indices is every atom outside the linkers (from
:func:get_sbus_indices), so groups bonded to a node, such as capping
methyls, are part of its cluster.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ase_atom
|
Atoms
|
|
required |
metal_atom_indices
|
list of int
|
Flat list of atom indices belonging to nodes (not linkers). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
node_centers |
np.ndarray, shape (n_nodes, 3), or None if empty
|
|
Examples:
>>> from cage_isomer_builder import example_data
>>> uio66 = example_data.read("RUBTAK01")
>>> from cage_isomer_builder.cage.base import get_node_centers, get_sbus_indices
>>> _, rest = get_sbus_indices(uio66)
>>> get_node_centers(uio66, rest).shape # the four Zr6 nodes of the fcu cell
(4, 3)
Source code in cage_isomer_builder/cage/base.py
is_file_like ¶
Return True if value looks like a molecular structure file path.
Examples:
>>> from cage_isomer_builder.cage.base import is_file_like
>>> is_file_like("linker.xyz"), is_file_like("Nc1ccc(N)cc1")
(True, False)
Source code in cage_isomer_builder/cage/base.py
is_smiles_like ¶
Return True if value should be interpreted as a SMILES string.
Examples:
>>> from cage_isomer_builder.cage.base import is_smiles_like
>>> is_smiles_like("Nc1ccc(N)cc1"), is_smiles_like("linker.mol2")
(True, False)
Source code in cage_isomer_builder/cage/base.py
atoms_to_smiles ¶
Convert ASE Atoms to SMILES using mofstructure/OpenBabel.
Examples:
>>> from ase.build import molecule
>>> from cage_isomer_builder.cage.base import atoms_to_smiles
>>> atoms_to_smiles(molecule("CH3OH")).split()[0]
'CO'
Source code in cage_isomer_builder/cage/base.py
file_to_atoms ¶
Read a molecular structure file with ASE.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage.base import file_to_atoms
>>> file_to_atoms(example_data.path("methane")).get_chemical_formula()
'CH4'
Source code in cage_isomer_builder/cage/base.py
mol_input_to_smiles ¶
Convert SMILES, file path, or ASE Atoms into a SMILES string.
Examples:
>>> from ase.build import molecule
>>> from cage_isomer_builder.cage.base import mol_input_to_smiles
>>> mol_input_to_smiles(" NCCN "), mol_input_to_smiles(molecule("CH4")).split()[0]
('NCCN', 'C')
Source code in cage_isomer_builder/cage/base.py
mol_input_to_atoms_or_none ¶
Return ASE Atoms if input is a file or ASE Atoms, otherwise None.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage.base import mol_input_to_atoms_or_none
>>> print(mol_input_to_atoms_or_none("NCCN")) # a SMILES string has no coordinates
None
>>> len(mol_input_to_atoms_or_none(example_data.path("methane")))
5
Source code in cage_isomer_builder/cage/base.py
normalize_molecule_input ¶
Normalize user molecule input for later building-block creation.
Defaults and SMILES strings are kept as SMILES. Structure files are read once into ASE Atoms, and ASE Atoms are passed through.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage.base import normalize_molecule_input
>>> normalize_molecule_input(None, default="[Zr]"), normalize_molecule_input(" NCCN", "[Zr]")
('[Zr]', 'NCCN')
>>> type(normalize_molecule_input(example_data.path("bdc"), "[Zr]")).__name__ # files are read
'Atoms'
Source code in cage_isomer_builder/cage/base.py
get_smiles_and_position_matrix ¶
Return SMILES and coordinates for STK BuildingBlock construction.
Examples:
>>> from ase.build import molecule
>>> from cage_isomer_builder.cage.base import get_smiles_and_position_matrix
>>> get_smiles_and_position_matrix("NCCN")
('NCCN', None)
>>> smiles, positions = get_smiles_and_position_matrix(molecule("CH4"))
>>> positions.shape
(5, 3)
Source code in cage_isomer_builder/cage/base.py
has_dummy_marker_atoms ¶
Return True if ASE Atoms contains dummy attachment markers.
Examples:
>>> from ase.build import molecule
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage.base import has_dummy_marker_atoms
>>> has_dummy_marker_atoms(example_data.read("bdc")), has_dummy_marker_atoms(molecule("CH4"))
(True, False)
Source code in cage_isomer_builder/cage/base.py
remove_dummy_marker_atoms ¶
Remove dummy marker and noble-gas atoms; return bonder indices.
X atoms mark attachment directions. Noble-gas atoms (He, Ne, ...) are
orientation markers added by MOF deconstruction tools. Both are removed
before STK construction. Each X marker is paired with the nearest
non-hydrogen atom of the stripped molecule, which becomes the bonder of the
corresponding functional group.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage.base import remove_dummy_marker_atoms
>>> stripped, bonders = remove_dummy_marker_atoms(example_data.read("bdc"))
>>> stripped.get_chemical_formula(), [stripped[i].symbol for i in bonders]
('C6H4', ['C', 'C'])
Source code in cage_isomer_builder/cage/base.py
make_building_block_from_dummy_markers ¶
Build an STK BuildingBlock from ASE Atoms with X marker atoms.
Uses BuildingBlock.init() directly, without a SMILES round trip, so the
atom order and 3D coordinates are kept. A SMILES round trip through
OpenBabel and RDKit reorders atoms, which would put the bonders of large
inorganic clusters (e.g. UiO-66 Zr nodes) at the wrong positions.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage.base import make_building_block_from_dummy_markers
>>> bb = make_building_block_from_dummy_markers(example_data.read("bdc"))
>>> bb.get_num_atoms(), bb.get_num_functional_groups()
(10, 2)
Source code in cage_isomer_builder/cage/base.py
has_dummy_atom ¶
Detect dummy atoms in SMILES.
Handles common dummy representations: - [*] - * - [#0]
Examples:
>>> from cage_isomer_builder.cage.base import has_dummy_atom
>>> has_dummy_atom("[*]c1ccc([*])cc1"), has_dummy_atom("c1ccccc1")
(True, False)
Source code in cage_isomer_builder/cage/base.py
is_single_atom_smiles ¶
Return True for bracketed single-atom SMILES such as [Zn], [Pd], [Zr].
Examples:
>>> from cage_isomer_builder.cage.base import is_single_atom_smiles
>>> is_single_atom_smiles("[Zn]"), is_single_atom_smiles("[Zn]O")
(True, False)
Source code in cage_isomer_builder/cage/base.py
is_single_atom_input ¶
Return True if input represents exactly one atom.
Examples:
>>> from ase import Atoms
>>> from cage_isomer_builder.cage.base import is_single_atom_input
>>> is_single_atom_input("[Pd]"), is_single_atom_input(Atoms("Cu")), is_single_atom_input("NCCN")
(True, True, False)
Source code in cage_isomer_builder/cage/base.py
get_single_atom_symbol ¶
Extract element symbol from a single-atom input.
Examples:
>>> from ase import Atoms
>>> from cage_isomer_builder.cage.base import get_single_atom_symbol
>>> get_single_atom_symbol("[Pd]"), get_single_atom_symbol(Atoms("Cu"))
('Pd', 'Cu')
Source code in cage_isomer_builder/cage/base.py
make_single_atom_building_block ¶
Build an STK single-atom BuildingBlock.
This is intended for metal nodes such as [Zn], [Pd], [Zr], etc.
Examples:
>>> from cage_isomer_builder.cage.base import make_single_atom_building_block
>>> make_single_atom_building_block("[Zr]", fg_count=4).get_num_functional_groups()
4
Source code in cage_isomer_builder/cage/base.py
resolve_factory ¶
Resolve a functional-group name or factory instance.
Returns None for 'single_atom'.
Examples:
>>> from cage_isomer_builder.cage.base import resolve_factory
>>> type(resolve_factory("primary_amine")).__name__, resolve_factory("single_atom")
('PrimaryAminoFactory', None)
Source code in cage_isomer_builder/cage/base.py
try_building_block_with_factory ¶
try_building_block_with_factory(smiles: str, factory, position_matrix: Optional[ndarray] = None) -> Optional[stk.BuildingBlock]
Try one factory and return the BuildingBlock only if it finds FGs.
Examples:
>>> import stk
>>> from cage_isomer_builder.cage.base import try_building_block_with_factory
>>> print(try_building_block_with_factory("CCO", stk.PrimaryAminoFactory())) # no amine
None
Source code in cage_isomer_builder/cage/base.py
autodetect_building_block ¶
autodetect_building_block(mol: MoleculeInput, fg: Any = None, fg_count: int = 1, smarts_pattern: Optional[str] = None, allow_single_atom: bool = True, role: str = 'building block') -> stk.BuildingBlock
Build an STK BuildingBlock from SMILES, file, or ASE Atoms.
Detection priority
- If true single atom and allow_single_atom=True: use stk.SingleAtom.
- If ASE/file input contains
Xmarker atoms: strip markers and create GenericFunctionalGroup bonders. - Convert file/ASE input to SMILES using mofstructure/OpenBabel.
- If SMILES dummy atoms (
*,[*],[#0]) are present: rewrite them as[Fr]and use the[Fr][*]SMARTS factory. - If user provided fg: use that factory.
- Otherwise search FG_FACTORY_MAP.
Examples:
>>> from cage_isomer_builder import example_data
>>> from cage_isomer_builder.cage.base import autodetect_building_block
>>> autodetect_building_block("Nc1ccc(N)cc1").get_num_functional_groups() # two amines
2
>>> autodetect_building_block(example_data.path("bdc")).get_num_functional_groups() # X markers
2
>>> autodetect_building_block("[Zr]", fg_count=4).get_num_functional_groups()
4
Source code in cage_isomer_builder/cage/base.py
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | |