def calc_charge_trans(m_potential, x_potential, iv, elec_affinity_non_metal, d_mx_avg):
    """
    Calculate the estimated charge transfer energy (eV) of a structure

    :param m_potential: Float, the metal site Madelung potential in V
    :param x_potential: Float, the non_metal site Madelung potential in V
    :param iv: Float, the vth ionization energy of the metal in eV
    :param elec_affinity_non_metal: Float, the electron affinity of the non_metal in eV
    :param d_mx_avg: Float, the average metal-non_metal distance in Angstrom
    :return: Float, the estimated charge transfer energy in eV
    """
    # specify the conversion factor from e^2/Angstrom to eV
    conversion_factor = 14.39965
    return x_potential - m_potential + elec_affinity_non_metal - iv - conversion_factor / d_mx_avg