Skip to content

Commit 3bcf358

Browse files
committed
Merge branch 'main' of https://github.com/CCPBioSim/CodeEntropy into 110-improve-test-coverage-for-main
2 parents 00d1c15 + 572e5ed commit 3bcf358

File tree

4 files changed

+1677
-19
lines changed

4 files changed

+1677
-19
lines changed

CodeEntropy/entropy.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ def orientational_entropy_calculation(self, neighbours_dict):
822822
# Replaced molecule with neighbour as this is what the for loop uses
823823
S_or_total = 0
824824
for neighbour in neighbours_dict: # we are going through neighbours
825-
if neighbour in []: # water molecules - call POSEIDON functions
825+
if neighbour in ["H2O"]: # water molecules - call POSEIDON functions
826826
pass # TODO temporary until function is written
827827
else:
828828
# the bound ligand is always going to be a neighbour
@@ -835,16 +835,16 @@ def orientational_entropy_calculation(self, neighbours_dict):
835835
f"S_or_component (log(omega)) for neighbour {neighbour}: "
836836
f"{S_or_component}"
837837
)
838-
S_or_component *= self.GAS_CONST
838+
S_or_component *= self._GAS_CONST
839839
logger.debug(
840840
f"S_or_component after multiplying by GAS_CONST for neighbour "
841841
f"{neighbour}: {S_or_component}"
842842
)
843-
S_or_total += S_or_component
844-
logger.debug(
845-
f"S_or_total after adding component for neighbour {neighbour}: "
846-
f"{S_or_total}"
847-
)
843+
S_or_total += S_or_component
844+
logger.debug(
845+
f"S_or_total after adding component for neighbour {neighbour}: "
846+
f"{S_or_total}"
847+
)
848848
# TODO for future releases
849849
# implement a case for molecules with hydrogen bonds but to a lesser
850850
# extent than water

CodeEntropy/levels.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,14 +441,17 @@ def get_sphCoord_axes(self, arg_r):
441441
if x2y2 == 0.0:
442442
raise ValueError("x2y2 is zero, cannot compute sin_phi and cos_phi.")
443443

444+
# These conditions are mathematically unreachable for real-valued vectors.
445+
# Marked as no cover to avoid false negatives in coverage reports.
446+
444447
# Check for non-negative values inside the square root
445-
if x2y2 / r2 < 0:
448+
if x2y2 / r2 < 0: # pragma: no cover
446449
raise ValueError(
447450
f"Negative value encountered for sin_theta calculation: {x2y2 / r2}. "
448451
f"Cannot take square root."
449452
)
450453

451-
if x2y2 < 0:
454+
if x2y2 < 0: # pragma: no cover
452455
raise ValueError(
453456
f"Negative value encountered for sin_phi and cos_phi "
454457
f"calculation: {x2y2}. "
@@ -462,7 +465,7 @@ def get_sphCoord_axes(self, arg_r):
462465
sin_phi = arg_r[1] / np.sqrt(x2y2)
463466
cos_phi = arg_r[0] / np.sqrt(x2y2)
464467

465-
else:
468+
else: # pragma: no cover
466469
sin_theta = 0.0
467470
cos_theta = 1
468471

0 commit comments

Comments
 (0)