Пример #1
0
def test_default_matches(opt_state_basic):
    """
    Tests that defaults properly come through on different compute
    """
    bench = "/home/user/psi4"
    assert dc.get_config(hostname="nr5")["psi_path"] == bench
    assert dc.get_config(key="psi_path", hostname="nr5") == bench
Пример #2
0
def test_terachem_input_formatter(test_case):
    # Get input file data
    data = terachem_info.get_test_data(test_case)
    inp = qcel.models.AtomicInput.parse_raw(data["input.json"])

    # TODO add actual comparison of generated input file
    input_file = qcng.get_program("terachem", check=False).build_input(inp, qcng.get_config())
    assert input_file.keys() >= {"commands", "infiles"}
Пример #3
0
def test_molpro_input_formatter(test_case):

    # Get output file data
    data = molpro_info.get_test_data(test_case)
    inp = qcel.models.ResultInput.parse_raw(data["input.json"])

    # Just test that it runs for now
    input_file = qcng.get_program('molpro').build_input(inp, qcng.get_config())
    assert input_file.keys() >= {"commands", "infiles"}
Пример #4
0
def test_entos_input_formatter_template(test_case):

    # Get input file data
    data = entos_info.get_test_data(test_case)
    inp = qcel.models.ResultInput.parse_raw(data["input.json"])

    # TODO add actual comparison of generated input file
    input_file = qcng.get_program('entos', check=False).build_input(
        inp, qcng.get_config(), template="Test template")
    assert input_file.keys() >= {"commands", "infiles"}
Пример #5
0
def test_node_auto():

    desc = {
        "name": "something",
        "hostname_pattern": "*",
        "jobs_per_node": 1,
        "ncores": 4,
        "memory": 10,
        "memory_safety_factor": 0,
    }
    node1 = qcng.config.NodeDescriptor(**desc)
    job1 = qcng.get_config(hostname=node1)
    assert job1.ncores == 4
    assert pytest.approx(job1.memory) == 10.0

    desc["jobs_per_node"] = 2
    node2 = qcng.config.NodeDescriptor(**desc)
    job2 = qcng.get_config(hostname=node2)
    assert job2.ncores == 2
    assert pytest.approx(job2.memory) == 5.0
Пример #6
0
def test_molpro_input_formatter(test_case):

    # Get output file data
    data = molpro_info.get_test_data(test_case)
    inp = qcel.models.ResultInput.parse_raw(data["input.json"])

    # Just test that it runs for now
    # TODO add actual comparison
    input_file = qcng.get_program('molpro').build_input(inp, qcng.get_config())
    #print(input_file['infiles']['dispatch.mol'])
    assert input_file.keys() >= {"commands", "infiles"}
Пример #7
0
def test_auto_threads(opt_state_auto):

    assert dc.get_config("jobs_per_node") == 1
    assert isinstance(dc.get_config("nthreads_per_job"), int)
    assert dc.get_config("nthreads_per_job") > 0
    assert dc.get_config("nthreads_per_job") < 100

    assert isinstance(dc.get_config("memory_per_job"), (int, float))
    assert dc.get_config(
        "memory_per_job") > 0.01  # Always more than 1OMB free?
Пример #8
0
def test_terachem_executer(test_case):

    # Get input file data
    data = terachem_info.get_test_data(test_case)
    inp = qcel.models.ResultInput.parse_raw(data["input.json"])

    # Just test that it runs for now
    result = qcng.get_program('terachem').compute(inp, qcng.get_config())
    assert result.success == True

    # Get output file data

    output_ref = qcel.models.Result.parse_raw(data["output.json"])

    if result.success:
        atol = 1e-6
        if result.driver == "gradient":
            atol = 1e-3
        assert compare_recursive(output_ref.return_result,
                result.return_result, atol = atol) 
Пример #9
0
import os
import json
import qcelemental as qcel
import qcengine as qcng

from qcelemental.util import serialize

molecule_name = "water"
drivers = ["energy", "gradient", "hessian"]
keywords = {}
model = {"method": "HF", "basis": "6-31g"}
program = "qchem"

config = qcng.get_config()
temporary_directory = os.path.join(os.getcwd(), "build")
os.makedirs(temporary_directory, exist_ok=True)

for driver in drivers:
    folder_name = os.path.join(
        temporary_directory,
        f"{model['method'].lower()}_{molecule_name}_{driver}")
    os.makedirs(folder_name, exist_ok=True)

    input_model = {
        "molecule": qcng.get_molecule(molecule_name),
        "keywords": keywords,
        "model": model,
        "driver": driver,
    }
    input_model = qcel.models.ResultInput(**input_model)
Пример #10
0
def test_environmental_vars(opt_state_basic):

    assert dc.get_config("scratch_directory") == "/tmp/"
    assert dc.get_config("scratch_directory", hostname="dt5") is None
Пример #11
0
def test_hostname_matches(opt_state_basic):
    assert dc.get_config(hostname="dt5")["memory_per_job"] == 60
    assert dc.get_config(key="memory_per_job", hostname="dt5") == 60
Пример #12
0
def test_get_default(opt_state_basic):
    assert dc.get_config()["memory_per_job"] == 4
    assert dc.get_config(key="memory_per_job") == 4