Skip to content

Commit cff391d

Browse files
Added complete docstring for graphgen.
1 parent cd77b7d commit cff391d

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

src/quemb/molbe/autofrag.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Author: Oinam Romesh Meitei
1+
# Author: Oinam Romesh Meitei, Shaun Weatherly
22

33
import networkx as nx # type: ignore
44
import numpy as np
@@ -43,7 +43,42 @@ def graphgen(
4343
connectivity: str = "euclidean",
4444
# draw_graph: bool = True,
4545
):
46-
"""Generate fragments via adjacency graph."""
46+
"""Generate fragments via adjacency graph.
47+
48+
Generalizes the BEn fragmentation scheme to arbitrary fragment sizes using a
49+
graph theoretic heuristic. In brief: atoms are assigned to nodes in an
50+
adjacency graph and edges are weighted by some distance metric. For a given
51+
fragment center site, Dijkstra's algorithm is used to find the shortest path
52+
from that center to its neighbors. The number of nodes visited on that shortest
53+
path determines the degree of separation of the corresponding neighbor. I.e.,
54+
all atoms whose shortest paths from the center site visit at most 1 node must
55+
be direct neighbors to the center site, which gives BE2-type fragments; all
56+
atoms whose shortest paths visit at most 2 nodes must then be second-order
57+
neighbors, hence BE3; and so on.
58+
59+
Parameters
60+
----------
61+
mol : pyscf.gto.mole.Mole
62+
The molecule object.
63+
be_type : str
64+
The order of nearest neighbors (with respect to the center atom)
65+
included in a fragment. Supports all 'BEn', with 'n' in -
66+
[1, 2, 3, 4, 5, 6, 7, 8, 9] having been tested.
67+
frozen_core: bool
68+
Whether to exclude core AO indices from the fragmentation process.
69+
True by default.
70+
remove_nonunique_frags: bool
71+
Whether to remove fragments which are strict subsets of another
72+
fragment in the system. True by default.
73+
frag_prefix: str
74+
Prefix to be appended to the fragment datanames. Useful for managing
75+
fragment scratch directories.
76+
connectivity: str
77+
Keyword string specifying the distance metric to be used for edge
78+
weights in the fragment adjacency graph. Currently supports "euclidean"
79+
(which uses the square of the distance between atoms in real
80+
space to determine connectivity within a fragment.)
81+
"""
4782
assert mol is not None
4883

4984
fragment_type_order = int(be_type[-1])

0 commit comments

Comments
 (0)