Exemple #1
0
def test_parse_output(driver):
    """
    Test reading gaussian outfiles and extracting the correct information based on the
    driver type.
    """
    outfiles = {}
    with open(get_data("gaussian.log")) as log:
        outfiles["gaussian.log"] = log.read()
    with open(get_data("gaussian.fchk")) as fchk:
        outfiles["lig.fchk"] = fchk.read()

    # build the input
    mol = Ligand.from_file(file_name=get_data("acetone.pdb"))
    # build the atomic model
    qc_spec = qcel.models.common_models.Model(method="pbe", basis="6-31G")
    # build a job for a specific driver
    qc_task = qcel.models.AtomicInput(molecule=mol.to_qcschema(),
                                      driver=driver,
                                      model=qc_spec)
    g = GaussianHarness()
    result = g.parse_output(outfiles=outfiles, input_model=qc_task)
    if driver == "energy":
        assert result.return_result == -1.931393770857046e02
    elif driver == "gradient":
        assert result.return_result.shape == (10, 3)
    elif driver == "hessian":
        assert result.return_result.shape == (30, 30)
Exemple #2
0
def test_full_run(driver, tmpdir):
    """
    For the given driver try a full execution if the user has gaussian installed.
    """
    if not GaussianHarness.found():
        pytest.skip("Gaussian 09/16 not available test skipped.")

    with tmpdir.as_cwd():
        # build the input
        mol = Ligand.from_file(file_name=get_data("acetone.pdb"))
        # build the atomic model
        qc_spec = qcel.models.common_models.Model(method="wB97XD",
                                                  basis="6-311++G(d,p)")
        # build a job for a specific driver
        qc_task = qcel.models.AtomicInput(molecule=mol.to_qcschema(),
                                          driver=driver,
                                          model=qc_spec)
        g = GaussianHarness()
        # run locally with 2 cores and 2 GB memory
        result = g.compute(
            input_data=qc_task,
            config=qcng.config.TaskConfig(**{
                "memory": 2,
                "ncores": 2,
                "nnodes": 1,
                "retries": 1
            }),
        )

        outfiles = {}
        with open(get_data("gaussian.log")) as log:
            outfiles["gaussian.log"] = log.read()
        with open(get_data("gaussian.fchk")) as fchk:
            outfiles["lig.fchk"] = fchk.read()
        ref_result = g.parse_output(outfiles=outfiles, input_model=qc_task)

        assert np.allclose(ref_result.return_result, result.return_result)