cgexplore.scram.TopologyIterator¶
- class cgexplore.scram.TopologyIterator(building_block_counts, graph_type=None, graph_set='rxx', allowed_num_components=1, max_samples=None, graph_directory=None, verbose=True)[source]¶
Bases:
objectIterate over topology graphs.
This is the latest version, but without good symmetry and graph checks, this can over produce structures.
This class now contains
agx.TopologyIterator.Important
Warning: Currently, the order of
building_block_countshas to have the building block with the most FGs first! This ordering is defined by the order used when defining the graphs. If you are defining your own graph library (i.e., settinggraph_directoryor using a newgraph_type), then the order is defined by the order inbuilding_block_countswhen generating the json.Important
To reproduce the
no_doublesdataset, you must filter the topology codes after generation using thecgexplore.scram.TopologyCodemethods (this is now the recommended approach).- Parameters:
building_block_counts (dict[BuildingBlock, int]) – Dictionary of
stk.BuildingBlockand their count in the proposed structures. Always put the building blocks with more functional groups first (this is a current bug). Additionally, only mixtures of three distinct building block functional group counts is implemented, and in the case of three components, all building blocks bind to the building block with the most functional groups.graph_type (str | None) – Name of the graph. Current name convention is long, but complete, capturing the count of each building block with certain functional group count included. Following this name convention will allow you to use saved graphs, if not, you can make your own. Although it can be time consuming.
graph_set (str) – Set of graphs to use based on different algorithms or papers. Can be custom, as above. Note that the code to generation
nxgraphs is no longer present incgexplorebecause thenetworkxalgorithms were slow.scale_multiplier – Scale multiplier to use in construction.
allowed_num_components (int) – Allowed number of disconnected graph components. Usually
1to generate complete graphs only.max_samples (int | None) – When constructing graphs, there is some randomness in their order, although that order should be consistent, and only up-to
max_samplesare sampled. For very large numbers of building blocks there is not guarantee all possible graphs will be explored.graph_directory (Path | None) – Directory to check for and save graph jsons.
verbose (bool) – Whether to log outcomes.
Methods
Count completely connected graphs in iteration.
Get potential node configurations.
Get stk Edges from topology code.
Get number of building blocks.
Get vertex prototypes.
Checks if the graphs have been defined.
Return True if the graph is chemically possible.
Get potential node configurations.
Get constructed molecules from iteration.
Attributes
- get_edges_from_topology_code(topology_code, unaligning=False)[source]¶
Get stk Edges from topology code.
- Parameters:
topology_code (TopologyCode)
unaligning (bool)
- Return type:
list[Edge]
- yield_graphs()[source]¶
Get constructed molecules from iteration.
Yields only graphs with the allowed number of components.
- Return type:
- iterator: TopologyIterator¶
- scale_multiplier = 5¶