Skip to content

Commit 615108a

Browse files
committed
Fix divide-by-zero in aromaticity index calculation
1 parent a5227ed commit 615108a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

corems/molecular_formula/calc/MolecularFormulaCalc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ def _calc_aromaticity_index_mod(self):
560560
)
561561
ai_d = ai_es["C"] - (0.5 * ai_es["O"]) - ai_es["N"] - ai_es["S"]
562562

563-
ai = ai_n / ai_d
563+
ai = ai_n / ai_d if ai_d != 0 else 0
564564

565565
if ai < 0:
566566
ai = 0
@@ -601,7 +601,7 @@ def _calc_aromaticity_index(self):
601601
)
602602
ai_d = ai_es["C"] - (ai_es["O"]) - ai_es["N"] - ai_es["S"]
603603

604-
ai = ai_n / ai_d
604+
ai = ai_n / ai_d if ai_d != 0 else 0
605605

606606
if ai < 0:
607607
ai = 0

0 commit comments

Comments
 (0)