Ejemplo n.º 1
0
                                 local_options={
                                     "ncores": 13,
                                     "retries": 1
                                 })
    assert ret.success is False
    assert ret.input_data["trajectory"][0]["provenance"]["retries"] == 1
    assert len(ret.input_data["trajectory"]) == 2


@using("geometric")
@pytest.mark.parametrize(
    "program, model, bench",
    [
        pytest.param("rdkit", {"method": "UFF"},
                     [1.87130923886072, 2.959448636243545, 104.5099642579023],
                     marks=using("rdkit")),
        pytest.param(
            "rdkit",
            {"method": "mmff94"},
            [1.8310842343589573, 2.884612338953529, 103.93822919865106],
            marks=using("rdkit"),
        ),
        pytest.param(
            "rdkit",
            {"method": "MMFF94s"},
            [1.8310842343589573, 2.884612338953529, 103.93822919865106],
            marks=using("rdkit"),
        ),
        pytest.param(
            "torchani",
            {"method": "ANI1x"},
Ejemplo n.º 2
0
import pytest
import qcengine
from qcelemental import constants
from qcengine.programs.tests.test_dftd3_mp2d import eneyne_ne_qcdbmols
from qcengine.programs.tests.test_ghost import bimol_ref
from qcengine.testing import using

import qcdb

from .utils import *


@pytest.mark.parametrize(
    "qcp",
    [
        pytest.param("p4-", marks=using("psi4")),
        pytest.param("c4-", marks=using("cfour")),
        pytest.param("nwc-", marks=using("nwchem")),
        pytest.param("gms-", marks=using("gamess")),
    ],
)
def test_simple_ghost(qcp):

    dimer = qcdb.set_molecule(
        f"""
      He
    --
      Ne 1 R
    """
    )
    dimer.R = 2.5
Ejemplo n.º 3
0
    ],
    ids=['qmol', 'pmol'])
@pytest.mark.parametrize(
    "inp", [
        ({'first': 'b3lyp', 'second': 'd', 'parent': 'eneyne', 'subject': 'dimer', 'lbl': 'B3LYP-D2'}),
        ({'first': 'b3lyp', 'second': 'd3bj', 'parent': 'eneyne', 'subject': 'mA', 'lbl': 'B3LYP-D3(BJ)'}),
        ({'first': 'pbe', 'second': 'd3zero', 'parent': 'eneyne', 'subject': 'mB', 'lbl': 'PBE-D3'}),
        ({'first': 'pbe', 'second': 'd3zero', 'parent': 'eneyne', 'subject': 'gAmB', 'lbl': 'PBE-D3'}),
        ({'first': 'pbe', 'second': 'd2', 'parent': 'eneyne', 'subject': 'mAgB', 'lbl': 'PBE-D2'}),
        ({'first': 'b3lyp', 'second': 'd3bj', 'parent': 'ne', 'subject': 'atom', 'lbl': 'B3LYP-D3(BJ)'}),
        #({'first': '', 'second': 'atmgr', 'parent': 'eneyne', 'subject': 'dimer', 'lbl': 'ATM'}),
        #({'first': 'b3lyp', 'second': 'atmgr', 'parent': 'eneyne', 'subject': 'mA', 'lbl': 'ATM'}),
        #({'first': 'pbe', 'second': 'atm(gr)', 'parent': 'eneyne', 'subject': 'mB', 'lbl': 'ATM'}),
        #({'first': '', 'second': 'ATMgr', 'parent': 'eneyne', 'subject': 'mAgB', 'lbl': 'ATM'}),
        # below two xfail until dftd3 that's only 2-body is out of psi4 proper
        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)


@using_qcdb
def test_qcdb__energy_d3():
    eneyne = qcdb.set_molecule(seneyne)
Ejemplo n.º 4
0
     {
         'driver': 'energy',
         'name': 'Mp2',
         'pv': 'MP2',
         'options': {}
     },
     id='mp2-energy'),
 pytest.param(
     {
         'driver': 'energy',
         'name': 'MP2-d',
         'pv': 'MP2D',
         'options': {}
     },
     id='mp2d-energy',
     marks=using('mp2d')),
 pytest.param(
     {
         'driver': 'gradient',
         'name': 'Mp2',
         'pv': 'MP2',
         'options': {}
     },
     id='mp2-gradient'),
 pytest.param(
     {
         'driver': 'gradient',
         'name': 'Mp2',
         'pv': 'MP2',
         'dertype': 0,
         'options': {}
Ejemplo n.º 5
0
    assert "retries" not in ret.trajectory[2].provenance.dict()

    # Ensure we still fail
    failure_engine.iter_modes = ["random_error", "pass", "random_error", "random_error", "pass"]  # Iter 1  # Iter 2
    ret = qcng.compute_procedure(input_data, "geometric", local_options={"ncores": 13, "retries": 1})
    assert ret.success is False
    assert ret.input_data["trajectory"][0]["provenance"]["retries"] == 1
    assert len(ret.input_data["trajectory"]) == 2


@using("geometric")
@pytest.mark.parametrize(
    "program, model, bench",
    [
        pytest.param(
            "rdkit", {"method": "UFF"}, [1.87130923886072, 2.959448636243545, 104.5099642579023], marks=using("rdkit")
        ),
        pytest.param(
            "rdkit",
            {"method": "mmff94"},
            [1.8310842343589573, 2.884612338953529, 103.93822919865106],
            marks=using("rdkit"),
        ),
        pytest.param(
            "rdkit",
            {"method": "MMFF94s"},
            [1.8310842343589573, 2.884612338953529, 103.93822919865106],
            marks=using("rdkit"),
        ),
        pytest.param(
            "torchani",
Ejemplo n.º 6
0
import pytest

import qcengine as qcng
from qcengine.testing import using


def test_list_programs():

    r = qcng.list_all_programs()
    assert r >= {"psi4", "rdkit", "molpro", "dftd3"}


@pytest.mark.parametrize(
    "program",
    [
        pytest.param("psi4", marks=using("psi4")),
        pytest.param("torchani", marks=using("torchani")),
        pytest.param("rdkit", marks=using("rdkit")),
    ],
)
def test_check_program_avail(program):

    assert program in qcng.list_available_programs()


def test_program_avail_bounce():

    with pytest.raises(qcng.exceptions.InputError) as exc:
        qcng.compute({}, "bad_program", raise_error=True)

    assert "not registered" in str(exc.value)
Ejemplo n.º 7
0
)
@pytest.mark.parametrize(
    "inp",
    [
        # yapf: disable
        pytest.param(
            {
                "call": "cfour",
                "reference": "rhf",
                "fcae": "ae",
                "keywords": {
                    "scf_conv": 12
                },
            },
            id="hf  rhf ae: cfour",
            marks=using("cfour")),
        pytest.param(
            {
                "call": "gamess",
                "reference": "rhf",
                "fcae": "ae",
                "keywords": {},
            },
            id="hf  rhf ae: gamess",
            marks=using("gamess")),
        pytest.param(
            {
                "call": "nwchem",
                "reference": "rhf",
                "fcae": "ae",
                "keywords": {
Ejemplo n.º 8
0
 # R=1.008 #A=105.0
 0 2
 N   0.000000000000000   0.000000000000000  -0.145912918634892
 H   0.000000000000000  -1.511214298139000   1.013682596946108
 H   0.000000000000000   1.511214298139000   1.013682596946108
 units au
 symmetry c1
"""
    return qcel.models.Molecule.from_data(smol)


@pytest.mark.parametrize(
    "program,basis,keywords",
    [
        pytest.param(
            "cfour", "aug-pvdz", {"scf_conv": 12}, marks=using("cfour")),
        pytest.param("cfour", "aug-pvdz", {}, marks=using("cfour")),
        pytest.param(
            "qcore",
            "aug-cc-pVDZ",
            {
                "coulomb_method": "direct_4idx",
                "exchange_method": "direct_4idx"
            },
            marks=using("qcore"),
        ),
        pytest.param(
            "gamess", "accd", {"contrl__ispher": 1}, marks=using("gamess")),
        pytest.param("molpro", "aug-cc-pvdz", {}, marks=using("molpro")),
        pytest.param("nwchem",
                     "aug-cc-pvdz", {"basis__spherical": True},
def nh2():
    smol = """
 # R=1.008 #A=105.0
 0 2
 N   0.000000000000000   0.000000000000000  -0.145912918634892
 H   0.000000000000000  -1.511214298139000   1.013682596946108
 H   0.000000000000000   1.511214298139000   1.013682596946108
 units au
"""
    return qcel.models.Molecule.from_data(smol)


@pytest.mark.parametrize(
    "program,basis,keywords",
    [
        pytest.param("cfour", "aug-pvdz", {"scf_conv": 12, "cc_conv": 12}, marks=using("cfour")),
        pytest.param("cfour", "aug-pvdz", {}, marks=using("cfour")),
        pytest.param("nwchem", "aug-cc-pvdz", {"basis__spherical": True}, marks=using("nwchem")),
        pytest.param("nwchem", "aug-cc-pvdz", {"basis__spherical": True, "qc_module": "tce"}, marks=using("nwchem")),
        pytest.param("psi4", "aug-cc-pvdz", {}, marks=using("psi4")),
        pytest.param("gamess", "accd", {"ccinp__ncore": 0, "contrl__ispher": 1}, marks=using("gamess")),
    ],
)
def test_sp_ccsd_t_rhf_full(program, basis, keywords, h2o):
    """cfour/sp-rhf-ccsd/input.dat
    #! single point CCSD(T)/adz on water

    """
    resi = {"molecule": h2o, "driver": "energy", "model": {"method": "ccsd(t)", "basis": basis}, "keywords": keywords}

    res = qcng.compute(resi, program, raise_error=True, return_dict=True)
Ejemplo n.º 10
0
        'keywords': {
            'level_hint': 'd3bj'
        },
    }
    res = qcng.compute(resinp, 'dftd3', raise_error=True)
    res = res.dict()

    #res = dftd3.run_dftd3_from_arrays(molrec=sys, name_hint='b3lyp', level_hint='d3bj')
    assert compare('B3LYP-D3(BJ)', _compute_key(res['extras']['local_keywords']), 'key')


@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
    ],
    ids=['qmol', 'pmol'])
@pytest.mark.parametrize(
    "inp", [
        ({'first': 'b3lyp', 'second': 'd', 'parent': 'eneyne', 'subject': 'dimer', 'lbl': 'B3LYP-D2'}),
        ({'first': 'b3lyp', 'second': 'd3bj', 'parent': 'eneyne', 'subject': 'mA', 'lbl': 'B3LYP-D3(BJ)'}),
        ({'first': 'pbe', 'second': 'd3zero', 'parent': 'eneyne', 'subject': 'mB', 'lbl': 'PBE-D3'}),
        ({'first': 'pbe', 'second': 'd3zero', 'parent': 'eneyne', 'subject': 'gAmB', 'lbl': 'PBE-D3'}),
        ({'first': 'pbe', 'second': 'd2', 'parent': 'eneyne', 'subject': 'mAgB', 'lbl': 'PBE-D2'}),
        ({'first': 'b3lyp', 'second': 'd3bj', 'parent': 'ne', 'subject': 'atom', 'lbl': 'B3LYP-D3(BJ)'}),
        #({'first': '', 'second': 'atmgr', 'parent': 'eneyne', 'subject': 'dimer', 'lbl': 'ATM'}),
        #({'first': 'b3lyp', 'second': 'atmgr', 'parent': 'eneyne', 'subject': 'mA', 'lbl': 'ATM'}),
        #({'first': 'pbe', 'second': 'atm(gr)', 'parent': 'eneyne', 'subject': 'mB', 'lbl': 'ATM'}),
Ejemplo n.º 11
0
    "driver": "energy",
    "model": {
        "method": "ccsd",
        "basis": "aug-cc-pvdz"
    },
    "keywords": {
        "reference": "rohf",
        "freeze_core": False
    },
}


@pytest.mark.parametrize(
    "qcprog",
    [
        pytest.param("cfour", marks=using("cfour")),
        pytest.param("gamess", marks=using("gamess")),
        pytest.param("nwchem", marks=using("nwchem")),
        pytest.param("psi4", marks=using("psi4")),
    ],
)
def test_fig2a_txt(qcprog):
    """
    Execution (a; txt)

    cp infile . && xcfour        > outfile
                   rungms infile > outfile
                   nwchem infile > outfile
                   psi4   infile   outfile
    """
    smol = """
 # R=1.008 #A=105.0
 0 2
 N   0.000000000000000   0.000000000000000  -0.145912918634892
 H   0.000000000000000  -1.511214298139000   1.013682596946108
 H   0.000000000000000   1.511214298139000   1.013682596946108
 units au
 symmetry c1
"""
    return qcel.models.Molecule.from_data(smol)


@pytest.mark.parametrize(
    "program,basis,keywords",
    [
        pytest.param("cfour", "aug-pvdz", {"scf_conv": 12}, marks=using("cfour")),
        pytest.param("cfour", "aug-pvdz", {}, marks=using("cfour")),
        pytest.param(
            "entos",
            "aug-cc-pVDZ",
            {"coulomb_method": "direct_4idx", "exchange_method": "direct_4idx"},
            marks=using("entos"),
        ),
        pytest.param("gamess", "accd", {"contrl__ispher": 1}, marks=using("gamess")),
        pytest.param("molpro", "aug-cc-pvdz", {}, marks=using("molpro")),
        pytest.param("nwchem", "aug-cc-pvdz", {"basis__spherical": True}, marks=using("nwchem")),
        pytest.param("nwchem", "aug-cc-pvdz", {"basis__spherical": True, "qc_module": "tce"}, marks=using("nwchem")),
        pytest.param("psi4", "aug-cc-pvdz", {"scf_type": "direct"}, marks=using("psi4")),
        pytest.param("qchem", "aug-cc-pvdz", {}, marks=using("qchem")),
        pytest.param("turbomole", "aug-cc-pVDZ", {}, marks=using("turbomole")),
    ],
Ejemplo n.º 13
0

@pytest.fixture
def hene():
    smol = """
 0 1
 He 0 0 0
 @Ne 2.5 0 0
"""
    return qcel.models.Molecule.from_data(smol)


@pytest.mark.parametrize(
    "program,basis,keywords",
    [
        pytest.param("cfour", "aug-pvdz", {}, marks=using("cfour")),
        pytest.param(
            "gamess", "ccd", {"contrl__ispher": 1}, marks=using("gamess")),
        pytest.param("nwchem",
                     "aug-cc-pvdz", {"basis__spherical": True},
                     marks=using("nwchem")),
        pytest.param("nwchem",
                     "aug-cc-pvdz", {
                         "basis__spherical": True,
                         "qc_module": "tce"
                     },
                     marks=using("nwchem")),
        pytest.param("psi4",
                     "aug-cc-pvdz", {"scf_type": "direct"},
                     marks=using("psi4")),
    ],
Ejemplo n.º 14
0
                                 local_options={
                                     "ncores": 13,
                                     "retries": 1
                                 })
    assert ret.success is False
    assert ret.input_data["trajectory"][0]["provenance"]["retries"] == 1
    assert len(ret.input_data["trajectory"]) == 2


@using("geometric")
@pytest.mark.parametrize(
    "program, model, bench",
    [
        pytest.param("rdkit", {"method": "UFF"},
                     [1.87130923886072, 2.959448636243545, 104.5099642579023],
                     marks=using("rdkit")),
        pytest.param(
            "torchani",
            {"method": "ANI1x"},
            [1.82581873750194, 2.866376526793269, 103.4332610730292],
            marks=using("torchani"),
        ),
        pytest.param(
            "mopac",
            {"method": "PM6"},
            [1.7927843431811934, 2.893333237502448, 107.60441967992045],
            marks=using("mopac"),
        ),
    ],
)
def test_geometric_generic(input_data, program, model, bench):
Ejemplo n.º 15
0
import pytest

from .utils import *

import psi4
from qcengine.testing import using


@pytest.mark.parametrize('engine', [
    pytest.param('optking'),
    pytest.param('geometric', marks=using('geometric')),
])  # yapf: disable
@pytest.mark.parametrize('inp', [
    pytest.param({'name': 'hf', 'options': {'scf_type': 'df'}, 'ref_ene' : -76.027032783717, 'ref_nuc': 9.300794299874}, id='rhf(df)'),
    pytest.param({'name': 'hf', 'options': {'scf_type': 'pk'}, 'ref_ene' : -76.027053512764, 'ref_nuc': 9.300838770294}, id='rhf(pk)'),
    pytest.param({'name': 'mp2', 'options': {'mp2_type': 'df'}, 'ref_ene' : -76.230938589591, 'ref_nuc': 9.133271168193}, id='mp2(df)'),
    pytest.param({'name': 'mp2', 'options': {'mp2_type': 'conv'}, 'ref_ene' : -76.230989373502, 'ref_nuc': 9.133125471291}, id='mp2(conv)'),
    pytest.param({'name': 'b3lyp', 'options': {'scf_type': 'df'}, 'ref_ene' : -76.420645414834, 'ref_nuc': 9.090397129492}, id='b3lyp'),
])  # yapf: disable
def test_h2o(inp, engine):
    """Optimization of the square water molecule"""

    h2o = psi4.geometry("""
        O
        H 1 1.0
        H 1 1.0 2 90.0
    """)

    psi4.set_options({'basis': 'cc-pvdz', 'g_convergence': 'gau_tight'})
    psi4.set_options(inp['options'])
Ejemplo n.º 16
0
    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_mdi = pytest.mark.skipif(
    which_import('mdi', return_bool=True) is False,
    reason=
    "Not detecting module mdi. Install package if necessary and add to envvar PYTHONPATH (or rebuild Psi with -DENABLE_mdi)"
)

using_dftd3 = using('dftd3')
using_dftd3_321 = using('dftd3')
using_mp2d = using('mp2d')
Ejemplo n.º 17
0
)
@pytest.mark.parametrize(
    "inp",
    [
        # yapf: disable
        pytest.param(
            {
                "call": "cfour",
                "reference": "rhf",
                "fcae": "ae",
                "keywords": {
                    "scf_conv": 12
                },
            },
            id="mp2  rhf ae: cfour",
            marks=using("cfour")),
        pytest.param(
            {
                "call": "gamess",
                "reference": "rhf",
                "fcae": "ae",
                "keywords": {
                    "mp2__nacore": 0
                },
            },
            id="mp2  rhf ae: gamess",
            marks=using("gamess")),
        pytest.param(
            {
                "call": "nwchem",
                "reference": "rhf",
Ejemplo n.º 18
0
    ],
)
@pytest.mark.parametrize(
    "basis, subjects",
    [
        pytest.param("cc-pvdz", ["hf", "bh3p", "bh3p"], id="dz"),
        pytest.param("aug-cc-pvdz", ["h2o", "nh2", "nh2"], id="adz", marks=pytest.mark.long),
        pytest.param("cfour-qz2p", ["h2o", "nh2", "nh2"], id="qz2p", marks=pytest.mark.long),
    ],
)
@pytest.mark.parametrize(
    "inp",
    [
        # yapf: disable
        ######## Are all possible ways of computing <method> working?
        pytest.param({"call": "cfour",  "reference": "rhf",  "fcae": "ae", "keywords": {"scf_conv": 12},                                                                     }, id="hf  rhf ae: cfour",      marks=using("cfour")),
        pytest.param({"call": "gamess", "reference": "rhf",  "fcae": "ae", "keywords": {},                                                                                   }, id="hf  rhf ae: gamess",     marks=using("gamess")),
        pytest.param({"call": "nwchem", "reference": "rhf",  "fcae": "ae", "keywords": {},                                                                                   }, id="hf  rhf ae: nwchem",     marks=using("nwchem")),
        pytest.param({"call": "psi4",   "reference": "rhf",  "fcae": "ae", "keywords": {"scf_type": "pk"},                                                                   }, id="hf  rhf ae: psi4",       marks=using("psi4_mp2qcsk")),

        pytest.param({"call": "cfour",  "reference": "uhf",  "fcae": "ae", "keywords": {"reference": "uhf", "scf_conv": 12},                                                 }, id="hf  uhf ae: cfour",      marks=using("cfour")),
        pytest.param({"call": "gamess", "reference": "uhf",  "fcae": "ae", "keywords": {"contrl__scftyp": "uhf"},                                                            }, id="hf  uhf ae: gamess",     marks=using("gamess")),
        pytest.param({"call": "nwchem", "reference": "uhf",  "fcae": "ae", "keywords": {"scf__uhf": True},                                                                   }, id="hf  uhf ae: nwchem",     marks=using("nwchem")),
        pytest.param({"call": "psi4",   "reference": "uhf",  "fcae": "ae", "keywords": {"reference": "uhf", "scf_type": "pk"},                                               }, id="hf  uhf ae: psi4",       marks=using("psi4_mp2qcsk")),

        pytest.param({"call": "cfour",  "reference": "rohf", "fcae": "ae", "keywords": {"reference": "rohf", "scf_conv": 12},                                                }, id="hf rohf ae: cfour",      marks=using("cfour")),
        pytest.param({"call": "gamess", "reference": "rohf", "fcae": "ae", "keywords": {"contrl__scftyp": "rohf"},                                                           }, id="hf rohf ae: gamess",     marks=using("gamess")),
        pytest.param({"call": "nwchem", "reference": "rohf", "fcae": "ae", "keywords": {"scf__rohf": True},                                                                  }, id="hf rohf ae: nwchem",     marks=using("nwchem")),
        pytest.param({"call": "psi4",   "reference": "rohf", "fcae": "ae", "keywords": {"reference": "rohf", "scf_type": "pk"},                                              }, id="hf rohf ae: psi4",       marks=using("psi4_mp2qcsk")),
        # yapf: enable
    ],
    smol = """
 # R=1.008 #A=105.0
 0 2
 N   0.000000000000000   0.000000000000000  -0.145912918634892
 H   0.000000000000000  -1.511214298139000   1.013682596946108
 H   0.000000000000000   1.511214298139000   1.013682596946108
 units au
"""
    return qcel.models.Molecule.from_data(smol)


@pytest.mark.parametrize(
    "program,basis,keywords",
    [
        pytest.param(
            "cfour", "aug-pvdz", {"scf_conv": 12}, marks=using("cfour")),
        pytest.param("cfour", "aug-pvdz", {}, marks=using("cfour")),
        pytest.param("gamess",
                     "accd", {
                         "mp2__nacore": 0,
                         "contrl__ispher": 1
                     },
                     marks=using("gamess")),
        pytest.param("nwchem",
                     "aug-cc-pvdz", {"basis__spherical": True},
                     marks=using("nwchem")),
        pytest.param("nwchem",
                     "aug-cc-pvdz", {
                         "basis__spherical": True,
                         "qc_module": "tce"
                     },
Ejemplo n.º 20
0
        "method": "hf",
        "basis": qcsk_bs
    }, {}),
    ("nwchem", {
        "method": "hf",
        "basis": qcsk_bs
    }, {}),
    ("openmm", {
        "method": "openff-1.0.0",
        "basis": qcsk_bs
    }, {}),
    pytest.param("psi4", {
        "method": "hf",
        "basis": qcsk_bs
    }, {},
                 marks=using("psi4_mp2qcsk")),
    ("qchem", {
        "method": "hf",
        "basis": qcsk_bs
    }, {}),
    ("qcore", {
        "method": "pbe",
        "basis": qcsk_bs
    }, {}),
    ("turbomole", {
        "method": "pbe",
        "basis": qcsk_bs
    }, {}),
]

Ejemplo n.º 21
0
    ("mrchem", {"method": "blyp"}, {"world_prec": 1.0e-3}),
    ("cfour", {"method": "hf", "basis": "6-31G"}, {}),
    ("gamess", {"method": "hf", "basis": "n31"}, {"basis__NGAUSS": 6}),
    ("mctc-gcp", {"method": "dft/sv"}, {}),
    # add as programs available
    # ("terachem", {"method": "bad"}),
]

_canonical_methods_qcsk_basis = [
    ("adcc", {"method": "adc2", "basis": qcsk_bs}, {"n_triplets": 3}),
    ("cfour", {"method": "hf", "basis": qcsk_bs}, {}),
    ("gamess", {"method": "hf", "basis": qcsk_bs}, {}),
    ("molpro", {"method": "hf", "basis": qcsk_bs}, {}),
    ("nwchem", {"method": "hf", "basis": qcsk_bs}, {}),
    ("openmm", {"method": "openff-1.0.0", "basis": qcsk_bs}, {}),
    pytest.param("psi4", {"method": "hf", "basis": qcsk_bs}, {}, marks=using("psi4_mp2qcsk")),
    ("qchem", {"method": "hf", "basis": qcsk_bs}, {}),
    ("qcore", {"method": "pbe", "basis": qcsk_bs}, {}),
    ("turbomole", {"method": "pbe", "basis": qcsk_bs}, {}),
]


def _get_molecule(program):
    if program in ["openmm", "terachem_pbs"]:
        return qcng.get_molecule("water")
    else:
        return qcng.get_molecule("hydrogen")


@pytest.mark.parametrize("program, model, keywords", _canonical_methods)
def test_compute_energy(program, model, keywords):
Ejemplo n.º 22
0
            "program": None
        },
        "input_specification": {
            "driver": "gradient",
            "model": None,
            "keywords": {}
        },
        "initial_molecule": None,
    }


@using("psi4")
@pytest.mark.parametrize(
    "optimizer",
    [
        pytest.param("geometric", marks=using("geometric")),
        pytest.param("optking", marks=using("optking"))
    ],
)
def test_geometric_psi4(input_data, optimizer):

    input_data["initial_molecule"] = qcng.get_molecule("hydrogen")
    input_data["input_specification"]["model"] = {
        "method": "HF",
        "basis": "sto-3g"
    }
    input_data["input_specification"]["keywords"] = {
        "scf_properties": ["wiberg_lowdin_indices"]
    }
    input_data["keywords"]["program"] = "psi4"
Ejemplo n.º 23
0

@pytest.fixture
def h2o():
    mol = qcelemental.models.Molecule.from_data("""
            O 0.000000000000     0.000000000000    -0.068516245955
            H 0.000000000000    -0.790689888800     0.543701278274
            H 0.000000000000     0.790689888800     0.543701278274
    """)
    return mol


@pytest.mark.parametrize(
    "method, keywords, ref_energy",
    [
        pytest.param("hf", {}, -75.95536954370, marks=using("turbomole")),
        pytest.param(
            "pbe0", {"grid": "m5"}, -76.27371135900, marks=using("turbomole")),
        pytest.param("ricc2", {}, -76.1603807755, marks=using("turbomole")),
        pytest.param("rimp2", {}, -76.1593614075, marks=using("turbomole")),
    ],
)
def test_turbomole_energy(method, keywords, ref_energy, h2o):
    resi = {
        "molecule": h2o,
        "driver": "energy",
        "model": {
            "method": method,
            "basis": "def2-SVP"
        },
        "keywords": keywords
Ejemplo n.º 24
0
    "inp",
    [
        ("subject1", {"dtype": "xyz", "units": "kg", "prec": 8, "atom_format": "{elea}{elem}{elbl}"}),
    ],
)  # yapf: disable
def test_to_string_error(inp):
    mol = qcdb.Molecule(_results[inp[0]])

    with pytest.raises(pint.errors.DimensionalityError):
        mol.to_string(**inp[1])


@pytest.mark.parametrize(
    "subjects",
    [
        pytest.param("pmol", marks=using("psi4")),
        pytest.param("qmol"),
        pytest.param("qcmol"),
    ],
)
@pytest.mark.parametrize(
    "inp,expected",
    [
        (("subject1", {"dtype": "xyz", "units": "Bohr"}), "ans1_xyz_au"),
        (("subject1", {"dtype": "xyz", "units": "Angstrom"}), "ans1_xyz_ang"),
        (("subject1", {"dtype": "xyz", "prec": 8, "atom_format": "{elea}{elem}{elbl}"}), "ans1c_xyz_ang"),
        (("subject1", {"dtype": "xyz", "units": "nm", "prec": 8, "atom_format": "{elea}{elem}{elbl}"}), "ans1c_xyz_nm"),
        (("subject1", {"dtype": "psi4", "units": "angstrom"}), "ans1_psi4_ang"),
        (("subject1", {"dtype": "qchem", "units": "angstrom"}), "ans1_qchem_ang"),
        (("subject1", {"dtype": "orca", "units": "angstrom"}), "ans1_orca_ang"),
        (("subject2", {"dtype": "xyz", "units": "Bohr"}), "ans2_au"),