diff --git a/qsdsan/utils/cod.py b/qsdsan/utils/cod.py index 965bbe99..aa52a039 100644 --- a/qsdsan/utils/cod.py +++ b/qsdsan/utils/cod.py @@ -156,14 +156,25 @@ def cod_test_stoichiometry(atoms, charge=0, MW=None, missing_handling='elemental def electron_acceptor_cod(atoms, charge=0): + r''' + .. math:: + + NO_2^- + 3e^- + 4H^+ -> \frac{1}{2}N_2 + 2H_2O + + NO_3^- + 5e^- + 6H^+ -> \frac{1}{2}N_2 + 3H_2O + + O_2 + 4e^- + 4H^+ -> 2H_2O + + ''' if atoms == {'O':2}: return -1 elif atoms == {'N':2}: return 0 elif atoms == {'N':1, 'O':2} and charge == -1: - return -1.5 + return -3/4 elif atoms == {'N':1, 'O':3} and charge == -1: - return -2 + return -5/4 + def get_cod_stoichiometry(component, aqueous=False, **replace): diff --git a/tests/test_component.py b/tests/test_component.py index f7510046..8c53109d 100644 --- a/tests/test_component.py +++ b/tests/test_component.py @@ -68,8 +68,8 @@ def test_component(): cmps3 = Components.load_default() assert cmps3.S_H2.measured_as == 'COD' assert cmps3.S_H2.i_COD == 1 - assert isclose(cmps3.S_NO2.i_COD, - molecular_weight({'O':3})/molecular_weight({'N':1}), rel_tol=1e-3) - assert isclose(cmps3.S_NO3.i_COD, - molecular_weight({'O':4})/molecular_weight({'N':1}), rel_tol=1e-3) + assert isclose(cmps3.S_NO2.i_COD, - 3*molecular_weight({'O':2})/(4*molecular_weight({'N':1})), rel_tol=1e-3) + assert isclose(cmps3.S_NO3.i_COD, - 5*molecular_weight({'O':2})/(4*molecular_weight({'N':1})), rel_tol=1e-3) set_thermo(cmps3) # Check if the default groups are up-to-date