18
18
19
19
20
20
def _load_bond_length_data () -> dict [tuple [str , ...], dict [float , float ]]:
21
- """Load bond length data from bond_lengths.json file."""
21
+ """
22
+ Loads bond length data from a JSON file.
23
+
24
+ This function reads a `bond_lengths.json` file located in the same
25
+ directory as the current script. The file contains bond length data
26
+ for different combinations of elements and bond orders. The data
27
+ is processed and structured into a dictionary format for further
28
+ use in the application.
29
+
30
+ Returns:
31
+ dict[tuple[str, ...], dict[float, float]]:
32
+ A nested dictionary where the keys of the outer dictionary
33
+ are tuples containing sorted element symbols, and the values
34
+ are dictionaries that map bond orders (float) to bond lengths
35
+ (float).
36
+
37
+ Raises:
38
+ FileNotFoundError: If the `bond_lengths.json` file is not found
39
+ in the expected location.
40
+ JSONDecodeError: If the file is corrupted or not a valid JSON
41
+ format.
42
+ """
22
43
with open (
23
44
os .path .join (os .path .dirname (__file__ ), "bond_lengths.json" ),
24
45
encoding = "utf-8" ,
@@ -37,11 +58,16 @@ class CovalentBond:
37
58
"""A covalent bond between two sites."""
38
59
39
60
def __init__ (self , site1 : Site , site2 : Site ) -> None :
40
- """Initialize a covalent bond between two sites.
61
+ """
62
+ Initializes the object with two site instances.
63
+
64
+ This constructor method assigns the provided `site1` and `site2`
65
+ parameters to the instance attributes, enabling interaction
66
+ with two separate `Site` objects.
41
67
42
68
Args:
43
- site1 (Site): First site.
44
- site2 (Site): Second site.
69
+ site1: The first site object .
70
+ site2: The second site object .
45
71
"""
46
72
self .site1 = site1
47
73
self .site2 = site2
0 commit comments