utils.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:cg 作者: michaelhabeck 项目源码 文件源码
def rdf(coords, bins=100, r_max=None):
    """
    Radial distribution function

    Parameters
    ----------

    coords :
      list of coordinate arrays

    bins : int or numpy array
      distance bins

    r_max : positive float or None
      maximum distance
    """
    if np.ndim(coords) == 2: coords = [coords]

    d = np.sqrt(np.concatenate(map(calc_distances, coords), 0))
    if r_max is not None: d = d[d<r_max]

    g, bins = np.histogram(d, bins=bins)
    r = 0.5 * (bins[1:]+bins[:-1])

    return r, g/r**2
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号