Esempio n. 1
0
def test_global_quadratic_n0p_energy_reactivity():
    # E(N) = -100 + 5*N^2, N0=5
    energy, _, _ = make_symbolic_quadratic_model(5.0, 0., -100.)
    ip = energy(4) - energy(5)
    ea = energy(5) - energy(6)
    # build global tool
    model = QuadraticGlobalTool({5: 25.0, 6: 80.0, 4: -20.0})
    # check ionization potential and electron affinity
    assert_almost_equal(model.ionization_potential, ip, decimal=6)
    assert_almost_equal(model.electron_affinity, ea, decimal=6)
    assert_almost_equal(model.ip, ip, decimal=6)
    assert_almost_equal(model.ea, ea, decimal=6)
    assert_almost_equal(model.electronegativity, 0.5 * (ip + ea), decimal=6)
    electrophil = (-0.5 * (ip + ea))**2 / (2 * (ip - ea))
    assert_almost_equal(model.electrophilicity, -electrophil, decimal=6)
    nucleofugal = (ip - 3 * ea)**2 / (8 * (ip - ea))
    assert_almost_equal(model.nucleofugality, nucleofugal, decimal=6)
    electrofugal = (3 * ip - ea)**2 / (8 * (ip - ea))
    assert_almost_equal(model.electrofugality, -electrofugal, decimal=6)
    # check chemical potential, chemical hardness, and related tools
    assert_almost_equal(model.chemical_potential, -0.5 * (ip + ea), decimal=6)
    assert_almost_equal(model.chemical_hardness, ip - ea, decimal=6)
    assert_almost_equal(model.mu, -0.5 * (ip + ea), decimal=6)
    assert_almost_equal(model.eta, ip - ea, decimal=6)
    assert_almost_equal(model.hyper_hardness(2), 0.0, decimal=6)
    assert_almost_equal(model.hyper_hardness(3), 0.0, decimal=6)
    assert_almost_equal(model.hyper_hardness(4), 0.0, decimal=6)
    assert_almost_equal(model.softness, 1.0 / (ip - ea), decimal=6)
Esempio n. 2
0
def test_global_quadratic_nnp_energy_reactivity():
    # E(N) = -9.0 + (-25.0)*N + N^2, N0=15
    energy, _, _ = make_symbolic_quadratic_model(1.0, -25.0, -9.0)
    # build global tool
    model = QuadraticGlobalTool({15: -159.0, 16: -153.0, 14: -163.0})
    # check ionization potential and electron affinity
    ip = energy(14) - energy(15)
    ea = energy(15) - energy(16)
    assert_almost_equal(model.ionization_potential, ip, decimal=6)
    assert_almost_equal(model.electron_affinity, ea, decimal=6)
    assert_almost_equal(model.ip, ip, decimal=6)
    assert_almost_equal(model.ea, ea, decimal=6)
    assert_almost_equal(model.electronegativity, 0.5 * (ip + ea), decimal=6)
    electrophil = (-0.5 * (ip + ea))**2 / (2 * (ip - ea))
    assert_almost_equal(model.electrophilicity, -electrophil, decimal=6)
    nucleofugal = (ip - 3 * ea)**2 / (8 * (ip - ea))
    assert_almost_equal(model.nucleofugality, nucleofugal, decimal=6)
    electrofugal = (3 * ip - ea)**2 / (8 * (ip - ea))
    assert_almost_equal(model.electrofugality, -electrofugal, decimal=6)
    # check chemical potential, chemical hardness, and related tools
    assert_almost_equal(model.chemical_potential, -0.5 * (ip + ea), decimal=6)
    assert_almost_equal(model.chemical_hardness, ip - ea, decimal=6)
    assert_almost_equal(model.mu, -0.5 * (ip + ea), decimal=6)
    assert_almost_equal(model.eta, ip - ea, decimal=6)
    assert_almost_equal(model.hyper_hardness(2), 0.0, decimal=6)
    assert_almost_equal(model.hyper_hardness(3), 0.0, decimal=6)
    assert_almost_equal(model.hyper_hardness(4), 0.0, decimal=6)
    assert_almost_equal(model.softness, 1.0 / (ip - ea), decimal=6)