Beispiel #1
0
def test_initialization_allsep(ones):
    '''
    check ones, random
    '''
    specie_list = ['C', 'H', 'O']
    pm = ParameterHelper(species=specie_list,
                         kernels=['twobody', 'threebody'],
                         parameters={'cutoff_twobody': 2,
                                     'cutoff_threebody': 1,
                                     'noise': 0.05},
                         allseparate=True,
                         ones=ones,
                         random=not ones,
                         verbose="DEBUG")
    hm = pm.as_dict()
    Parameters.check_instantiation(
        hm['hyps'], hm['cutoffs'], hm['kernels'], hm)
    name_list = []
    for i in range(3):
        name = pm.find_group('specie', specie_list[i])
        assert name not in name_list
        name_list += [name]
    name_list = []
    for i in range(3):
        for j in range(i, 3):
            name = pm.find_group('twobody', [specie_list[i], specie_list[j]])
            assert name not in name_list
            name_list += [name]

    with raises(RuntimeError):
        pm = ParameterHelper(species=[],
                             kernels=['twobody', 'threebody'],
                             parameters={'cutoff_twobody': 2,
                                         'cutoff_threebody': 1,
                                         'noise': 0.05},
                             allseparate=True,
                             ones=ones,
                             random=not ones)
Beispiel #2
0
def test_initialization_allsep(ones):
    """
    check ones, random
    """
    specie_list = ["C", "H", "O"]
    pm = ParameterHelper(
        species=specie_list,
        kernels=["twobody", "threebody"],
        parameters={"cutoff_twobody": 2, "cutoff_threebody": 1, "noise": 0.05},
        allseparate=True,
        ones=ones,
        random=not ones,
        verbose="DEBUG",
    )
    hm = pm.as_dict()
    Parameters.check_instantiation(hm["hyps"], hm["cutoffs"], hm["kernels"], hm)
    name_list = []
    for i in range(3):
        name = pm.find_group("specie", specie_list[i])
        assert name not in name_list
        name_list += [name]
    name_list = []
    for i in range(3):
        for j in range(i, 3):
            name = pm.find_group("twobody", [specie_list[i], specie_list[j]])
            assert name not in name_list
            name_list += [name]

    with raises(RuntimeError):
        pm = ParameterHelper(
            species=[],
            kernels=["twobody", "threebody"],
            parameters={"cutoff_twobody": 2, "cutoff_threebody": 1, "noise": 0.05},
            allseparate=True,
            ones=ones,
            random=not ones,
        )