core_utils.py 文件源码

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

项目:ESPEI 作者: PhasesResearchLab 项目源码 文件源码
def symmetry_filter(x, config, symmetry):
    """
    Return True if the candidate sublattice configuration has any symmetry
    which matches the phase model symmetry.

    Parameters
    ----------
    x : the candidate dataset 'solver' dict. Must contain the "sublattice_configurations" key
    config : the configuratino of interest: e.g. ['AL', ['AL', 'NI'], 'VA']
    symmetry : tuple of tuples where each inner tuple is a group of equivalent
               sublattices. A value of ((0, 1), (2, 3, 4)) means that sublattices
               at indices 0 and 1 are symmetrically equivalent to each other and
               sublattices at indices 2, 3, and 4 are symetrically equivalent to
               each other.

    Returns
    -------
    bool

    """
    if x['mode'] == 'manual':
        if len(config) != len(x['sublattice_configurations'][0]):
            return False
        # If even one matches, it's a match
        # We do more filtering downstream
        for data_config in x['sublattice_configurations']:
            if canonicalize(config, symmetry) == canonicalize(data_config, symmetry):
                return True
    return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号