def test_generate_by_list_error(): pm = ParameterHelper(verbose="DEBUG") pm.list_groups('specie', ['O', ['C', 'N'], 'H']) with raises(RuntimeError): pm.list_groups('specie', ['O', 'C', 'H']) pm = ParameterHelper(verbose="DEBUG") with raises(RuntimeError): pm.list_groups('specie', 'O') pm = ParameterHelper(verbose="DEBUG") with raises(RuntimeError): pm.list_groups('specie', 'O')
def test_generate_by_list_error(): pm = ParameterHelper(verbose="DEBUG") pm.list_groups("specie", ["O", ["C", "N"], "H"]) with raises(RuntimeError): pm.list_groups("specie", ["O", "C", "H"]) pm = ParameterHelper(verbose="DEBUG") with raises(RuntimeError): pm.list_groups("specie", "O") pm = ParameterHelper(verbose="DEBUG") with raises(RuntimeError): pm.list_groups("specie", "O")
def test_generate_by_list(): pm = ParameterHelper(verbose="DEBUG") pm.list_groups('specie', ['O', ['C', 'N'], 'H']) pm.list_groups('twobody', [['*', '*'], ['O', 'O']]) pm.list_groups('threebody', [['*', '*', '*'], ['O', 'O', 'O']]) pm.list_parameters({'twobody0': [1, 0.5], 'twobody1': [2, 0.2], 'threebody0': [1, 0.5], 'threebody1': [2, 0.2], 'cutoff_twobody': 2, 'cutoff_threebody': 1}) hm = pm.as_dict() Parameters.check_instantiation( hm['hyps'], hm['cutoffs'], hm['kernels'], hm)
def test_generate_by_list2(): pm = ParameterHelper(verbose="DEBUG") pm.list_groups("specie", {"s1": "O", "s2": ["C", "N"], "s3": "H"}) pm.list_groups("twobody", {"t0": ["*", "*"], "t1": [["s1", "s1"], ["s1", "s3"]]}) pm.list_groups("threebody", [["*", "*", "*"], ["s1", "s1", "s1"]]) pm.list_parameters( { "t0": [1, 0.5], "t1": [2, 0.2], "threebody0": [1, 0.5], "threebody1": [2, 0.2], "cutoff_twobody": 2, "cutoff_threebody": 1, } ) hm = pm.as_dict() Parameters.check_instantiation(hm["hyps"], hm["cutoffs"], hm["kernels"], hm)