quemb.molbe.graphfrag.graphgen¶
- quemb.molbe.graphfrag.graphgen(mol, n_BE=2, frozen_core=True, remove_nonunique_frags=True, frag_prefix='f', connectivity='euclidean', iao_valence_basis=None, cutoff=0.0, export_graph_to=None, print_frags=True)¶
Generate fragments via adjacency graph.
Generalizes the BEn fragmentation scheme to arbitrary fragment sizes using a graph theoretic heuristic. In brief: atoms are assigned to nodes in an adjacency graph and edges are weighted by some distance metric. For a given fragment center site, Dijkstra’s algorithm is used to find the shortest path from that center to its neighbors. The number of nodes visited on that shortest path determines the degree of separation of the corresponding neighbor. I.e., all atoms whose shortest paths from the center site visit at most 1 node must be direct neighbors to the center site, which gives BE2-type fragments; all atoms whose shortest paths visit at most 2 nodes must then be second-order neighbors, hence BE3; and so on. NOTE: Currently does not support periodic calculations or IAOs.
- Parameters:
mol (
Mole
) – The gto.Mole object.n_BE (
str
|int
) – The order of nearest neighbors (with respect to the center atom) included in a fragment. Supports all ‘n’ in ‘BEn’. Defaults to 2.frozen_core (
bool
) – Whether to exclude core AO indices from the fragmentation process. True by default.remove_nonunique_frags (
bool
) – Whether to remove fragments which are strict subsets of another fragment in the system. Defaults to True.frag_prefix (
str
) – Prefix to be appended to the fragment datanames. Useful for managing fragment scratch directories. Defaults to “f”.connectivity (
Literal
['euclidean'
]) – Keyword string specifying the distance metric to be used for edge weights in the fragment adjacency graph. Currently supports “euclidean” (which uses the square of the distance between atoms in real space to determine connectivity within a fragment.) Defaults to “euclidean”.cutoff (
float
) – Atoms with an edge weight beyond cutoff will be excluded from the shortest_path calculation. When set to 0.0, cutoff will be determined dynamically based on the magnitude of n_BE. Defaults to 0.0. NOTE: For very large systems a smaller cutoff often significantly improves runtime, but can sometimes affect the fragmentation pattern if set too small.export_graph_to (
Path
|None
) – If not None, specifies the path to which the fragment connectivity graph will be saved. Defaults to None.print_frags (
bool
) – Whether to print simplified string representations of fragment connectivity graphs. Defaults to True.
- Return type: