Skip to content

Commit 873c3c6

Browse files
committed
Update some docs.
1 parent 0197856 commit 873c3c6

File tree

2 files changed

+157
-131
lines changed

2 files changed

+157
-131
lines changed

src/pymatgen/core/bonds.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,28 @@
1818

1919

2020
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+
"""
2243
with open(
2344
os.path.join(os.path.dirname(__file__), "bond_lengths.json"),
2445
encoding="utf-8",
@@ -37,11 +58,16 @@ class CovalentBond:
3758
"""A covalent bond between two sites."""
3859

3960
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.
4167
4268
Args:
43-
site1 (Site): First site.
44-
site2 (Site): Second site.
69+
site1: The first site object.
70+
site2: The second site object.
4571
"""
4672
self.site1 = site1
4773
self.site2 = site2

0 commit comments

Comments
 (0)