Exemple #1
0
def test_global_rational_nnpp_grand_potential_reactivity():
    # E(N) = (-0.15 - 4.2 N) / (1 + 0.45 N)
    n0, a0, a1, b1 = 6.5, -0.15, -4.2, 0.45
    # build global tool
    model = RationalGlobalTool({6.5: -6.99363057, 7.5: -7.23428571, 5.5: -6.69064748})
    # check hyper-softnesses
    expected = 3.0 * (1 + b1 * n0)**5 / (4 * b1 * (a1 - a0 * b1)**2)
    assert_almost_equal(model.hyper_softness(2), expected, decimal=5)
    assert_almost_equal(model.grand_potential_derivative(6.5, 3), -expected, decimal=5)
    expected = -15 * (1 + b1 * n0)**7 / (8 * b1 * (a1 - a0 * b1)**3)
    assert_almost_equal(model.hyper_softness(3), expected, decimal=4)
    assert_almost_equal(model.grand_potential_derivative(6.5, 4), -expected, decimal=4)
Exemple #2
0
def test_global_rational_pnpp_grand_potential_reactivity():
    # E(N) = (0.5 - 2.2 N) / (1 + 0.7 N)
    n0, a0, a1, b1 = 2.0, 0.5, -2.2, 0.7
    # build global tool
    model = RationalGlobalTool({2.: -1.6250, 3.: -1.96774193, 1.: -1.0})
    # check hyper-softnesses
    expected = 3.0 * (1 + b1 * n0)**5 / (4 * b1 * (a1 - a0 * b1)**2)
    assert_almost_equal(model.hyper_softness(2), expected, decimal=6)
    assert_almost_equal(model.grand_potential_derivative(2.0, 3), -expected, decimal=6)
    expected = -15 * (1 + b1 * n0)**7 / (8 * b1 * (a1 - a0 * b1)**3)
    assert_almost_equal(model.hyper_softness(3), expected, decimal=6)
    assert_almost_equal(model.grand_potential_derivative(2.0, 4), -expected, decimal=6)