besmarts.core.splits module

besmarts.core.splits

Chemical perception in SMARTS. Functions to find numerical splits based on bit iteration, and analytical splits based on a predefined partitioning.

besmarts.core.splits.assert_bonds(g, n=5, line='None')[source]
besmarts.core.splits.dprint(*args, **kwargs)[source]
besmarts.core.splits.make_branches(ref: structure, G: List[graph], selections, max_branch_depth, max_branches=6, gcd=None, icd=None)[source]
besmarts.core.splits.process_split(pack)[source]
class besmarts.core.splits.process_split_ctx[source]

Bases: object

A = None
S0 = None
pool = None
splitter = None
besmarts.core.splits.process_split_difference(pack, T)[source]
besmarts.core.splits.process_split_difference_distributed(pack, T, S0, splitter, A, selections, icd)[source]
besmarts.core.splits.process_split_distributed(pack, shm=None)[source]
besmarts.core.splits.process_split_general_distributed(pack, shm=None)[source]
besmarts.core.splits.process_split_intersect(pack, T)[source]
besmarts.core.splits.process_split_intersect_distributed(pack, T, S0, splitter, A, selections, icd: intvec_codec)[source]
besmarts.core.splits.process_split_matches(Sj, A, selections, icd: intvec_codec, return_matches=True)[source]
besmarts.core.splits.process_split_matches_distributed(Sj, indices, shm=None)[source]
besmarts.core.splits.process_split_specific_distributed(pack, shm=None)[source]
besmarts.core.splits.split_all_partitions(topology: structure_topology, perception: smarts_perception_config, fragments: List[subgraph], assignments: List[str], gcd=None, maxmoves=0) return_value[List[Tuple[structure, List[int]]]][source]

Find a shard that induces the given partition in a sequence of fragments. Up to two shards can be found; one will match everything in the specified partition, and the other will match the fragments not in the partition.

Parameters:
  • topology (structure_topology) – The topology of the structures to split

  • perception (smarts_perception_config) – The settings that control the search depth

  • fragments (List[subgraph]) – The list of subgraphs that are the target of splitting

  • assignments (List[str]) – The label for each subgraph. The function will try to create partitions that group these labels together

  • gcd (graph_codec) – A graph codec

  • maxmoves (int) – The number of subgraphs that we can allow to move around to arrive at a solution

Returns:

  • A return_value containing pairs of structures and indices of the subgraphs

  • that belong to the structures. The structures are the SMARTS that cluster

  • the subgraphs..

besmarts.core.splits.split_branches(ref: structure, G: List[graph], selections, max_branch_depth, max_branches=6, primitives=None, icd=None) List[structure][source]
besmarts.core.splits.split_partition(topology: structure_topology, perception: smarts_perception_config, fragments: List[subgraph], partition: Set[int], gcd=None, maxmoves=0) return_value[Tuple[structure, structure, List, List]][source]

Find a shard that induces the given partition in a sequence of fragments. Up to two shards can be found; one will match everything in the specified partition, and the other will match the fragments not in the partition.

class besmarts.core.splits.split_return_type(splits: Sequence[subgraph], shards: Sequence[subgraph], matched_idx: Sequence[Sequence[int]], unmatch_idx: Sequence[Sequence[int]], subgraphs: Sequence[subgraph], topology: structure_topology)[source]

Bases: object

matched_idx: Sequence[Sequence[int]]
shards: Sequence[subgraph]
splits: Sequence[subgraph]
subgraphs: Sequence[subgraph]
topology: structure_topology
unmatch_idx: Sequence[Sequence[int]]
besmarts.core.splits.split_shm_load(shm)[source]

this is the process init, so called by pool init, or maybe even during wsr creation

besmarts.core.splits.split_single_bits(topology: structure_topology, splitter: smarts_splitter_config, S0: subgraph, G: Sequence[graph], selections, icd, Q=None)[source]
besmarts.core.splits.split_structures(splitter: smarts_splitter_config, S0: structure, G: Sequence[structure], selections, Q=None) split_return_type[source]
besmarts.core.splits.split_structures_distributed(splitter: smarts_splitter_config, S0: structure, G: Sequence[graph], selections, wq: workqueue_local, icd, Q=None) split_return_type[source]
besmarts.core.splits.split_subgraphs(topology: structure_topology, splitter: smarts_splitter_config, S0: subgraph, G: Sequence[graph], selections, Q=None, verbose=False, debug=False) List[mapped_type][source]
besmarts.core.splits.split_subgraphs_distributed(topology: structure_topology, splitter: smarts_splitter_config, S0: subgraph, G: Sequence[graph], selections, wq: workqueue_local, icd: intvec_codec, Q=None, verbose=False, debug=False) List[mapped_type][source]