How to use the qcengine.testing.using function in qcengine

To help you get started, we’ve selected a few qcengine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github psi4 / psi4 / tests / pytests / test_qcng_dftd3_mp2d.py View on Github external
@using("dftd3")
@pytest.mark.parametrize(
    "subjects",
    [
        pytest.param(eneyne_ne_psi4mols, marks=using_psi4),
        pytest.param(eneyne_ne_qcdbmols,
                     marks=using_psi4),  # needs qcdb.Molecule, presently more common in psi4 than in qcdb
        pytest.param(eneyne_ne_qcschemamols),
    ],
    ids=['qmol', 'pmol', 'qcmol'])
@pytest.mark.parametrize("inp", [
    ({'parent': 'eneyne', 'name': 'd3-b3lyp-d', 'subject': 'dimer', 'lbl': 'B3LYP-D2'}),
    ({'parent': 'eneyne', 'name': 'd3-b3lyp-d3bj', 'subject': 'mA', 'lbl': 'B3LYP-D3(BJ)'}),
    ({'parent': 'eneyne', 'name': 'd3-PBE-D3zero', 'subject': 'mB', 'lbl': 'PBE-D3'}),
    ({'parent': 'eneyne', 'name': 'd3-PBE-D3zero', 'subject': 'gAmB', 'lbl': 'PBE-D3'}),
    ({'parent': 'eneyne', 'name': 'd3-PBE-D2', 'subject': 'mAgB', 'lbl': 'PBE-D2'}),
    ({'parent': 'ne', 'name': 'd3-b3lyp-d3bj', 'subject': 'atom', 'lbl': 'B3LYP-D3(BJ)'}),
github psi4 / psi4 / tests / pytests / test_addons.py View on Github external
@using('mp2d')
def test_mp2d():
    eneyne = psi4.geometry("""
    C   0.000000  -0.667578  -2.124659
    C   0.000000   0.667578  -2.124659
    H   0.923621  -1.232253  -2.126185
    H  -0.923621  -1.232253  -2.126185
    H  -0.923621   1.232253  -2.126185
    H   0.923621   1.232253  -2.126185
    --
    C   0.000000   0.000000   2.900503
    C   0.000000   0.000000   1.693240
    H   0.000000   0.000000   0.627352
    H   0.000000   0.000000   3.963929
    """)
    mol = eneyne.to_schema(dtype=2)
    expected = 0.00632174635953
github psi4 / psi4 / tests / pytests / test_mp2d.py View on Github external
    pytest.param({'driver': 'gradient', 'name': 'MP2-d', 'pv': 'MP2D', 'options': {}}, id='mp2d-gradient', marks=using('mp2d')),
    pytest.param({'driver': 'gradient', 'name': 'MP2-d', 'pv': 'MP2D', 'dertype': 0, 'options': {}}, id='mp2d-gradient-findif', marks=using('mp2d')),
#    ('mp2mp2'),
#    ('mp2-dmp2'),
])
def test_dft_mp2(inp):
    """Adapted from dfmp2-2"""

    h2 = psi4.geometry("""
        0 1
        H
        H 1 1.7007535129120455
        units bohr
        """)

    basisset = "cc-pVDZ"
    psi4.set_options({
github psi4 / psi4 / tests / pytests / addons.py View on Github external
using_qcdb = pytest.mark.skipif(
    True, reason='Not detecting common driver. Install package if necessary and add to envvar PYTHONPATH')

using_gcp = pytest.mark.skipif(
    which("gcp", return_bool=True) is False,
    reason="Not detecting executable gcp. Install package if necessary and add to envvar PATH")

using_cppe = pytest.mark.skipif(
    which_import('cppe', return_bool=True) is False,
    reason="Not detecting module cppe. Rebuild with -DENABLE_cppe")

using_networkx = pytest.mark.skipif(
    which_import('networkx', return_bool=True) is False,
    reason='Not detecting module networkx. Install package if necessary and add to envvar PYTHONPATH')

using_dftd3 = using('dftd3')
using_dftd3_321 = using('dftd3')
using_mp2d = using('mp2d')
github psi4 / psi4 / tests / pytests / test_qcng_dftd3_mp2d.py View on Github external
        pytest.param({'first': 'atmgr', 'second': 'atmgr', 'parent': 'eneyne', 'subject': 'gAmB', 'lbl': 'ATM'}, marks=[using("dftd3_321"), pytest.mark.xfail]),
        pytest.param({'first': 'pbe-atmgr', 'second': None, 'parent': 'ne', 'subject': 'atom', 'lbl': 'ATM'}, marks=[using("dftd3_321"), pytest.mark.xfail]),
    ])  # yapf: disable
def test_molecule__run_dftd3__23body(inp, subjects):
    subject = subjects()[inp['parent']][inp['subject']]
    expected = ref[inp['parent']][inp['lbl']][inp['subject']]
    gexpected = gref[inp['parent']][inp['lbl']][inp['subject']]

    E, G = subject.run_dftd3(inp['first'], inp['second'])
    assert compare_values(expected, E, atol=1.e-7)
    assert compare_values(gexpected, G, atol=1.e-7)
github psi4 / psi4 / tests / pytests / test_qcng_dftd3_mp2d.py View on Github external
@using("mp2d")
@pytest.mark.parametrize(
    "subjects",
    [
        pytest.param(eneyne_ne_psi4mols, marks=using_psi4),
        pytest.param(eneyne_ne_qcdbmols,
                     marks=using_psi4),  # needs qcdb.Molecule, presently more common in psi4 than in qcdb
        pytest.param(eneyne_ne_qcschemamols),
    ],
    ids=['qmol', 'pmol', 'qcmol'])
@pytest.mark.parametrize("inp", [
    ({'parent': 'eneyne', 'name': 'mp2d-mp2-dmp2', 'subject': 'dimer', 'lbl': 'MP2-DMP2'}),
    ({'parent': 'eneyne', 'name': 'mp2d-mp2-dmp2', 'subject': 'mA', 'lbl': 'MP2-DMP2'}),
    ({'parent': 'eneyne', 'name': 'mp2d-mp2-dmp2', 'subject': 'mB', 'lbl': 'MP2-DMP2'}),
    ({'parent': 'eneyne', 'name': 'mp2d-mp2-dmp2', 'subject': 'gAmB', 'lbl': 'MP2-DMP2'}),
    ({'parent': 'eneyne', 'name': 'mp2d-mp2-dmp2', 'subject': 'mAgB', 'lbl': 'MP2-DMP2'}),
    ({'parent': 'ne', 'name': 'mp2d-mp2-dmp2', 'subject': 'atom', 'lbl': 'MP2-DMP2'}),
github psi4 / psi4 / tests / pytests / addons.py View on Github external
using_gcp = pytest.mark.skipif(
    which("gcp", return_bool=True) is False,
    reason="Not detecting executable gcp. Install package if necessary and add to envvar PATH")

using_cppe = pytest.mark.skipif(
    which_import('cppe', return_bool=True) is False,
    reason="Not detecting module cppe. Rebuild with -DENABLE_cppe")

using_networkx = pytest.mark.skipif(
    which_import('networkx', return_bool=True) is False,
    reason='Not detecting module networkx. Install package if necessary and add to envvar PYTHONPATH')

using_dftd3 = using('dftd3')
using_dftd3_321 = using('dftd3')
using_mp2d = using('mp2d')
github psi4 / psi4 / tests / pytests / test_qcng_dftd3_mp2d.py View on Github external
@using("dftd3")
@pytest.mark.parametrize("method", [
    "b3lyp-d3",
    "b3lyp-d3m",
    "b3lyp-d3bj",
    "b3lyp-d3mbj",
])
def test_dftd3_task(method):
    json_data = {"molecule": qcng.get_molecule("eneyne"), "driver": "energy", "model": {"method": method}}

    ret = qcng.compute(json_data, "dftd3", raise_error=True, return_dict=True)

    assert ret["driver"] == "energy"
    assert "provenance" in ret
    assert "normal termination of dftd3" in ret["stdout"]

    for key in ["cpu", "hostname", "username", "wall_time"]:
github psi4 / psi4 / tests / pytests / test_mp2d.py View on Github external
@using('mp2d')
def test_mp2d_opt():

    h2 = psi4.geometry("""
        0 1
        H
        H 1 R
        units bohr
        R = 1.7007535129120455
        """)

    psi4.set_options({
        'scf_type': 'df',
        'd_convergence': 12,
        'e_convergence': 12,
        'g_convergence': 'gau_verytight',
    })
github psi4 / psi4 / tests / pytests / test_qcng_dftd3_mp2d.py View on Github external
@using("dftd3_321")
@pytest.mark.parametrize(
    "subjects",
    [
        pytest.param(eneyne_ne_psi4mols, marks=using_psi4),
        pytest.param(eneyne_ne_qcdbmols,
                     marks=using_psi4),  # needs qcdb.Molecule, presently more common in psi4 than in qcdb
        pytest.param(eneyne_ne_qcschemamols),
    ],
    ids=['qmol', 'pmol', 'qcmol'])
@pytest.mark.parametrize("inp", [
    ({'parent': 'eneyne', 'name': 'd3-atmgr', 'subject': 'dimer', 'lbl': 'ATM'}),
    ({'parent': 'eneyne', 'name': 'd3-b3lyp-atmgr', 'subject': 'mA', 'lbl': 'ATM'}),
    ({'parent': 'eneyne', 'name': 'd3-pbe-atm(gr)', 'subject': 'mB', 'lbl': 'ATM'}),
    ({'parent': 'eneyne', 'name': 'd3-ATMgr', 'subject': 'mAgB', 'lbl': 'ATM'}),
    ({'parent': 'eneyne', 'name': 'd3-atmgr', 'subject': 'gAmB', 'lbl': 'ATM'}),
    ({'parent': 'ne', 'name': 'd3-atmgr', 'subject': 'atom', 'lbl': 'ATM'}),