예제 #1
0
def test_recon_2b():
    res = intf_dftd3.from_arrays(name_hint='pbe', level_hint='d3')
    assert compare_dicts(dpbed3zero, res, 4, sys._getframe().f_code.co_name)
    assert compare_strings('PBE-D3', compute_key(res), 'key')
    res = intf_dftd3.from_arrays(
        name_hint=res['fctldash'], level_hint=res['dashlevel'], param_tweaks=res['dashparams'])
    assert compare_dicts(dpbed3zero, res, 4, sys._getframe().f_code.co_name + ' idempotent')
예제 #2
0
def test_recon_1d():
    res = intf_dftd3.from_arrays(name_hint='b3lyp', level_hint='d3bJ', param_tweaks={'a2': 4.4211})
    assert compare_dicts(db3lypd3bj, res, 4, sys._getframe().f_code.co_name)
    assert compare_strings('B3LYP-D3(BJ)', compute_key(res), 'key')
    res = intf_dftd3.from_arrays(
        name_hint=res['fctldash'], level_hint=res['dashlevel'], param_tweaks=res['dashparams'])
    assert compare_dicts(db3lypd3bj, res, 4, sys._getframe().f_code.co_name + ' idempotent')
예제 #3
0
def test_recon_2c():
    res = intf_dftd3.from_arrays(name_hint='pbe-d3')
    assert compare_dicts(dpbed3zero, res, 4, sys._getframe().f_code.co_name)
    res = intf_dftd3.from_arrays(name_hint=res['fctldash'],
                                 level_hint=res['dashlevel'],
                                 param_tweaks=res['dashparams'])
    assert compare_dicts(dpbed3zero, res, 4,
                         sys._getframe().f_code.co_name + ' idempotent')
예제 #4
0
def test_recon_2b():
    res = intf_dftd3.from_arrays(name_hint='pbe', level_hint='d3')
    assert compare_dicts(dpbed3zero, res, 4, sys._getframe().f_code.co_name)
    assert compare_strings('PBE-D3', compute_key(res), 'key')
    res = intf_dftd3.from_arrays(name_hint=res['fctldash'],
                                 level_hint=res['dashlevel'],
                                 param_tweaks=res['dashparams'])
    assert compare_dicts(dpbed3zero, res, 4,
                         sys._getframe().f_code.co_name + ' idempotent')
예제 #5
0
def test_recon_1i():
    res = intf_dftd3.from_arrays(name_hint='b3lyp-d3bj',
                                 param_tweaks={'a2': 4.4211})
    assert compare_dicts(db3lypd3bj, res, 4, sys._getframe().f_code.co_name)
    res = intf_dftd3.from_arrays(name_hint=res['fctldash'],
                                 level_hint=res['dashlevel'],
                                 param_tweaks=res['dashparams'])
    assert compare_dicts(db3lypd3bj, res, 4,
                         sys._getframe().f_code.co_name + ' idempotent')
예제 #6
0
def test_recon_1b():
    res = intf_dftd3.from_arrays(name_hint='b3LYP', level_hint='D3bj')
    assert compare_dicts(db3lypd3bj, res, 4, sys._getframe().f_code.co_name)
    assert compare_strings('B3LYP-D3(BJ)', compute_key(res), 'key')
    res = intf_dftd3.from_arrays(name_hint=res['fctldash'],
                                 level_hint=res['dashlevel'],
                                 param_tweaks=res['dashparams'])
    assert compare_dicts(db3lypd3bj, res, 4,
                         sys._getframe().f_code.co_name + ' idempotent')
예제 #7
0
def test_recon_1e():
    ans = copy.deepcopy(db3lypd3bj)
    ans['fctldash'] = ''
    ans['dashparams']['a2'] = 5.4211

    res = intf_dftd3.from_arrays(verbose=3, name_hint='b3lyp', level_hint='d3bJ', param_tweaks={'a2': 5.4211})
    assert compare_dicts(ans, res, 4, sys._getframe().f_code.co_name)
    #assert compare_strings('-D3BJ', compute_key(res), 'key')
    assert compare_strings('', compute_key(res), 'key')
    res = intf_dftd3.from_arrays(
        verbose=3, name_hint=res['fctldash'], level_hint=res['dashlevel'], param_tweaks=res['dashparams'])
    assert compare_dicts(ans, res, 4, sys._getframe().f_code.co_name + ' idempotent')
예제 #8
0
def test_recon_1c():
    res = intf_dftd3.from_arrays(param_tweaks={
        's8': 1.9889,
        's6': 1.0,
        'a2': 4.4211,
        'a1': 0.3981
    },
                                 level_hint='d3bj')
    assert compare_dicts(db3lypd3bj, res, 4, sys._getframe().f_code.co_name)
    assert compare_strings('B3LYP-D3(BJ)', compute_key(res), 'key')
    res = intf_dftd3.from_arrays(name_hint=res['fctldash'],
                                 level_hint=res['dashlevel'],
                                 param_tweaks=res['dashparams'])
    assert compare_dicts(db3lypd3bj, res, 4,
                         sys._getframe().f_code.co_name + ' idempotent')
예제 #9
0
def test_recon_2e():
    ans = {'dashlevel': 'chg', 'dashparams': {'s6': 4.05}, 'fctldash': 'asdf-d4', 'dashparams_citation': '    mypaper\n'}
    supp = {'chg': {'definitions': {'asdf-d4': {'params': {'s6': 4.05}, 'citation': '    mypaper\n'}}}}

    res = intf_dftd3.from_arrays(name_hint='asdf-d4', level_hint='chg', dashcoeff_supplement=supp)
    print(res)
    assert compare_dicts(ans, res, 4, sys._getframe().f_code.co_name)
    with pytest.raises(qcdb.ValidationError):
        intf_dftd3.from_arrays(name_hint=res['fctldash'], level_hint=res['dashlevel'], param_tweaks=res['dashparams'])
    res = intf_dftd3.from_arrays(
        name_hint=res['fctldash'],
        level_hint=res['dashlevel'],
        param_tweaks=res['dashparams'],
        dashcoeff_supplement=supp)
    assert compare_dicts(ans, res, 4, sys._getframe().f_code.co_name + ' idempotent')
예제 #10
0
def test_recon_1j():
    with pytest.raises(qcdb.ValidationError):
        res = intf_dftd3.from_arrays(name_hint='b3lyp-d3bj',
                                     param_tweaks={
                                         'a2': 4.4211,
                                         'zzz': 0.0
                                     })
예제 #11
0
def test_recon_1e():
    ans = copy.deepcopy(db3lypd3bj)
    ans['fctldash'] = ''
    ans['dashparams']['a2'] = 5.4211

    res = intf_dftd3.from_arrays(verbose=3,
                                 name_hint='b3lyp',
                                 level_hint='d3bJ',
                                 param_tweaks={'a2': 5.4211})
    assert compare_dicts(ans, res, 4, sys._getframe().f_code.co_name)
    #assert compare_strings('-D3BJ', compute_key(res), 'key')
    assert compare_strings('', compute_key(res), 'key')
    res = intf_dftd3.from_arrays(verbose=3,
                                 name_hint=res['fctldash'],
                                 level_hint=res['dashlevel'],
                                 param_tweaks=res['dashparams'])
    assert compare_dicts(ans, res, 4,
                         sys._getframe().f_code.co_name + ' idempotent')
예제 #12
0
def test_recon_2e():
    ans = {
        'dashlevel': 'chg',
        'dashparams': {
            's6': 4.05
        },
        'fctldash': 'asdf-d4',
        'dashparams_citation': '    mypaper\n'
    }
    supp = {
        'chg': {
            'definitions': {
                'asdf-d4': {
                    'params': {
                        's6': 4.05
                    },
                    'citation': '    mypaper\n'
                }
            }
        }
    }

    res = intf_dftd3.from_arrays(name_hint='asdf-d4',
                                 level_hint='chg',
                                 dashcoeff_supplement=supp)
    print(res)
    assert compare_dicts(ans, res, 4, sys._getframe().f_code.co_name)
    with pytest.raises(qcdb.ValidationError):
        intf_dftd3.from_arrays(name_hint=res['fctldash'],
                               level_hint=res['dashlevel'],
                               param_tweaks=res['dashparams'])
    res = intf_dftd3.from_arrays(name_hint=res['fctldash'],
                                 level_hint=res['dashlevel'],
                                 param_tweaks=res['dashparams'],
                                 dashcoeff_supplement=supp)
    assert compare_dicts(ans, res, 4,
                         sys._getframe().f_code.co_name + ' idempotent')
예제 #13
0
def test_recon_1h():
    with pytest.raises(qcdb.ValidationError):
        res = intf_dftd3.from_arrays(level_hint='d3bJ',
                                     param_tweaks={'s6': 5.4211})
예제 #14
0
def test_recon_2d():
    with pytest.raises(qcdb.ValidationError):
        res = intf_dftd3.from_arrays(name_hint='asdf-d4')
예제 #15
0
def test_recon_2c():
    res = intf_dftd3.from_arrays(name_hint='pbe-d3')
    assert compare_dicts(dpbed3zero, res, 4, sys._getframe().f_code.co_name)
    res = intf_dftd3.from_arrays(
        name_hint=res['fctldash'], level_hint=res['dashlevel'], param_tweaks=res['dashparams'])
    assert compare_dicts(dpbed3zero, res, 4, sys._getframe().f_code.co_name + ' idempotent')
예제 #16
0
def test_recon_1j():
    with pytest.raises(qcdb.ValidationError):
        res = intf_dftd3.from_arrays(name_hint='b3lyp-d3bj', param_tweaks={'a2': 4.4211, 'zzz': 0.0})
예제 #17
0
def test_recon_1i():
    res = intf_dftd3.from_arrays(name_hint='b3lyp-d3bj', param_tweaks={'a2': 4.4211})
    assert compare_dicts(db3lypd3bj, res, 4, sys._getframe().f_code.co_name)
    res = intf_dftd3.from_arrays(
        name_hint=res['fctldash'], level_hint=res['dashlevel'], param_tweaks=res['dashparams'])
    assert compare_dicts(db3lypd3bj, res, 4, sys._getframe().f_code.co_name + ' idempotent')
예제 #18
0
def test_recon_1h():
    with pytest.raises(qcdb.ValidationError):
        res = intf_dftd3.from_arrays(level_hint='d3bJ', param_tweaks={'s6': 5.4211})
예제 #19
0
def test_recon_1g():
    with pytest.raises(qcdb.ValidationError):
        intf_dftd3.from_arrays(name_hint='fakeb3lyp', level_hint='d3bJ', param_tweaks={'s6': 5.4211})
예제 #20
0
def test_recon_1g():
    with pytest.raises(qcdb.ValidationError):
        intf_dftd3.from_arrays(name_hint='fakeb3lyp',
                               level_hint='d3bJ',
                               param_tweaks={'s6': 5.4211})
예제 #21
0
def test_recon_2d():
    with pytest.raises(qcdb.ValidationError):
        res = intf_dftd3.from_arrays(name_hint='asdf-d4')