Repository: lmmentel/mendeleev

Issue:
Calculation of Mulliken Electronegativity
Hi!
I realized that during Mulliken electronegativity calculations, electron affinity is not taken into account. When I checked the source code, I think this is related to last if condition. Can you please check if there is an issue, or do I miss something?

mendeleev version: 0.13.1
python version: 3.10
platform: google colab

Below I also shared a code snippet for only one element but I got the same issue for other elements, as well.

## To Reproduce
Steps to reproduce the behavior:
```
from mendeleev import element

Ni = element('Ni')
print('Mulliken with function:', Ni.electronegativity('mulliken'))
print('Mulliken with manual calculation:', (Ni.ionenergies[1]+Ni.electron_affinity)/2)
print('Half of first ionization energy:', (Ni.ionenergies[1])/2)
```
The output is:
```
Mulliken with function: 3.8199385
Mulliken with manual calculation: 4.3979385
Half of first ionization energy: 3.8199385
```


Comments:

Patch:
diff --git a/mendeleev/electronegativity.py b/mendeleev/electronegativity.py
index 4fdcb53..62d47cc 100644
--- a/mendeleev/electronegativity.py
+++ b/mendeleev/electronegativity.py
@@ -3,7 +3,7 @@ Electronegativity scale formulas.
 """
 
 import math
-from typing import List
+from typing import List, Union
 
 import numpy as np
 
@@ -98,17 +98,15 @@ def martynov_batsanov(ionization_energies: List[float]) -> float:
 def mulliken(
     ionization_energy: float,
     electron_affinity: float,
-    missing_is_zero: bool = False,
-    allow_negative_ea: bool = False,
-) -> float:
+) -> Union[float, None]:
     r"""
-    Return the absolute electronegativity (Mulliken scale), calculated as
+    Return the absolute electronegativity (Mulliken scale).
 
     Args:
         ionization_energy: ionization energy
         electron_affinity: electron affinity
-        missing_is_zero: missing values are substituted with zero
-        allow_negative_ea: if `True` negative EA values will be allowed
+
+    The value of electonegativity is calculated as:
 
     .. math::
 
@@ -120,18 +118,14 @@ def mulliken(
     - :math:`A` is the electron affinity
     """
 
-    if ionization_energy is not None:
-        if (
-            electron_affinity is not None
-            and electron_affinity < 0.0
-            and allow_negative_ea
-        ):
-            return (ionization_energy + electron_affinity) * 0.5
-        elif electron_affinity is not None or missing_is_zero:
-            return ionization_energy * 0.5
-    else:
+    if ionization_energy is None:
         return None
 
+    if electron_affinity is None:
+        return ionization_energy * 0.5
+
+    return (ionization_energy + electron_affinity) * 0.5
+
 
 def nagle(nvalence: int, polarizability: float) -> float:
     """
diff --git a/mendeleev/models.py b/mendeleev/models.py
index f6130bc..89646c7 100644
--- a/mendeleev/models.py
+++ b/mendeleev/models.py
@@ -627,23 +627,23 @@ class Element(Base):
     def electronegativity_mulliken(
         self,
         charge: int = 0,
-        missing_is_zero: bool = False,
-        allow_negative_ea: bool = False,
     ) -> float:
         r"""
-        Return the absolute electronegativity (Mulliken scale), calculated as
+        Return the absolute electronegativity (Mulliken scale).
 
         Args:
             charge: charge of the ion
-            missing_is_zero: missing values are substituted with zero
-            allow_negative_ea: if `True` negative EA values will be allowed
+
+        The value of electonegativity is calculated as:
 
         .. math::
 
-           \chi = \frac{I + A}{2}
+        \chi = \frac{I + A}{2}
+
+        where:
 
-        where :math:`I` is the ionization energy and :math:`A` is the electron
-        affinity
+        - :math:`I` is the ionization energy,
+        - :math:`A` is the electron affinity
         """
 
         if charge == 0:
@@ -654,9 +654,7 @@ class Element(Base):
             ea = self.ionenergies.get(charge, None)
         else:
             raise ValueError(f"Charge has to be a non-negative integer, got: {charge}")
-        return mulliken(
-            ip, ea, missing_is_zero=missing_is_zero, allow_negative_ea=allow_negative_ea
-        )
+        return mulliken(ip, ea)
 
     def electronegativity_nagle(self) -> float:
         "Nagle's electronegativity"


Test patch:
diff --git a/tests/test_electronegativity.py b/tests/test_electronegativity.py
index 5080ffd..07935d2 100644
--- a/tests/test_electronegativity.py
+++ b/tests/test_electronegativity.py
@@ -1,6 +1,7 @@
 import pytest
 
 from mendeleev import Element
+from mendeleev.electronegativity import mulliken
 
 
 def test_scales_exception():
@@ -8,3 +9,11 @@ def test_scales_exception():
     e = Element()
     with pytest.raises(ValueError):
         e.electronegativity(scale="unknown")
+
+
+def test_mulliken():
+
+    assert mulliken(None, None) is None
+    assert mulliken(None, 1.0) is None
+    assert mulliken(2.0, None) == pytest.approx(1.0)
+    assert mulliken(2.0, 1.0) == pytest.approx(1.5)