"""
Atomic elements.

"""

def elementMoles(s, element):
    """Number of moles of an element in one mole of a solution.

    s       -- an object representing a solution.
    element -- the symbol for an element in 's'.
    """
    
    nsp = mix.nSpecies()

    # see if 'element' corresponds to a symbol for one of the elements
    # in s. If it does not, return zero moles.
    try:
        m = s.elementIndex(element)
	if m < 0.0: return 0.0
    except:
        return 0.0
    
    x = s.moleFractions()
    moles = 0.0
    for k in range(nsp):
        moles += x[k]*s.nAtoms(k,m)
    return moles




@@ -226,39 +226,8 @@
 %22%22%22%0A
-    %0A    nsp = mix.nSpecies()%0A%0A
     
@@ -444,13 +444,9 @@
 0.0%0A
-    
 %0A
+
     
@@ -506,11 +506,20 @@
 nge(
-nsp
+s.nSpecies()
 ):%0A 
@@ -553,16 +553,16 @@
 ms(k,m)%0A
+
     retu
@@ -570,11 +570,8 @@
 n moles%0A
-%0A%0A%0A

Fixed incorrect object name in the Python 'elementMoles' function