def angstrom_to_axunits(val, ax):
    """
    Converts value in Angstrom to units of x axis
    - used to scale bond widths regardless of axis size

    Args:
    val (float): value in Angstroms
    ax (plt.axis): matplotlib axis object used to scale value
    """
    # get x range
    xr = ax.get_xlim()[1] - ax.get_xlim()[0]

    # get width
    fig = ax.get_figure()
    width = fig.bbox_inches.width * ax.get_position().width

    # convert length to points (72 points per inch)
    width *= 72

    # scale value to axis units
    return val * (width / xr)