def calc_error(L, M, d_target):
    """ Calculate spacing error
        L = (Lx, Ly, Lz) : lengths of the cell vectors
        M = (Mx, My, Mz) : number of subcells in x,y,z
        d_target : target spacing
    """
    d_calc = L / M
    e = abs(d_calc - d_target)
    print('spacing error(|d_calc-d_target|): {}'.format(e))
    return e