def reaction_box_width(n, params):
    """ Calculate the width of the boxes containing reactions

    Parameters
    ----------
    n: int,
        Number of reactions in the box
    params: dict,
        Layout parameters

    Returns
    -------
    float or int,
        Width of the reaction box
    """
    if n == 0:
        return 0
    else:
        width = params['reaction_width']
        return n * width + (n - 1) * params['reaction_x_padding']
