def vel_avg_vv(g: float, ve_before1: float, ve_after1: float, ve_before2:
    float, ve_after2: float, mass: float) ->float:
    """Returns the arithmetic mean of the relative velocity of particles before and after
    a VV transition (using the energy conservation law) **M1(i1) + M2(k1) -> M1(i2) + M2(k2)**

    Parameters
    ----------
    g : float
        the relative dimensional velocity of the particles before the collision
    ve_before1 : float
        the vibrational energy of the molecule M1 before the transition
    ve_after1 : float
        the vibrational energy of the molecule M1 after the transition
    ve_before2 : float
        the vibrational energy of the molecule M2 before the transition
    ve_after2 : float
        the vibrational energy of the molecule M2 after the transition
    mass : float
        the collision-reduced mass :math:`m_{cd}`

    Returns
    -------
    float
        Arithmetic mean of before- and after- velocities for a VT transition

    Notes
    -----
    If the squared after-collision velocity is < 0, then the collision is impossible for such parameters and
    the function returns -1
    """
    gn_sq = (ve_before1 - ve_after1 + ve_before2 - ve_after2) * (2.0 / mass
        ) + g ** 2
    if gn_sq < 0:
        return -1
    else:
        return 0.5 * (g + gn_sq ** 0.5)
