def extract_formation_energies_from_file(file_name):
    """ Read a file with the format:

    ::

        # arbitrary number of comment lines
        defect_name    defect_charge_state   defect_formation_energy

    Parameters
    ----------
    file_name : string
        the file with the data
    
    Returns
    -------
    init_args : tuple
        the tuple contains two elements: the two dictionaries to be used
        as the first two arguments for initializing a
        :class:`EquilibriumConcentrations` instance 
    """
    charge_states = {}
    form_energies = {}
    with open(file_name, 'r') as f:
        for line in f:
            if not line.startswith('#'):
                data = line.strip().split()
                defect = data[0]
                charge = int(data[1])
                form_energy = float(data[-1])
                charge_states.setdefault(defect, [])
                charge_states[defect].append(charge)
                form_energies.setdefault(defect, [])
                form_energies[defect].append(form_energy)
    return charge_states, form_energies
