How to use the qcelemental.models.ResultInput function in qcelemental

To help you get started, we’ve selected a few qcelemental 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_qcschema.py View on Github external
def test_qcschema_cli(input_enc, input_fn, output_enc, output_fn, result_data_fixture):

    data = qcel.models.ResultInput(**result_data_fixture)

    if (input_enc == "msgpack-ext") or (output_enc == "msgpack-ext"):
        try:
            import msgpack
        except:
            pytest.skip("Msgpack could not be found, skipping.")

    inputs = {input_fn: data.serialize(input_enc)}

    cmds = ["--qcschema"]
    if output_fn:
        outfiles = [output_fn]
        cmds.extend(["-o", output_fn])
    else:
        outfiles = [input_fn]
        output_fn = input_fn
github hjkgrp / MultirefPredict / MultirefPredict / fonbased_diagnostic.py View on Github external
"method": tc_method,
                "closed": self.ncore,
                "active": self.norb-self.ncore}
            if self.wfn != None:
                if self.wfn[0]!="" and self.wfn[1]!="":
                    additional_keywords["guess"] = self.wfn[0] + " " + self.wfn[1]
                elif self.wfn[2]!="":
                    additional_keywords["guess"] = self.wfn[2]
                else:
                    print("Warning: initial guess for SCF is not provided with"\
                          + "the correct format and will be ignored")
            extra_files = {}
            if isinstance(self.extras,list):
                for extra in self.extras:
                    extra_files[extra] = ""
            task = qcelemental.models.ResultInput(
                molecule=mol,
                driver="energy",
                model={"method": tc_method, "basis": basis_set},
                keywords= additional_keywords,
                extras=extra_files
            )
        else:
            raise ValueError("FON calculation is not implemented for the requested program yet.")
        return task
github MolSSI / QCPortal / models / records.py View on Github external
model = {"method": self.method}
        if self.basis:
            model["basis"] = self.basis

        if not self.keywords:
            keywords = {}
        else:
            keywords = keywords.values

        if not self.protocols:
            protocols = {}
        else:
            protocols = self.protocols

        model = qcel.models.ResultInput(
            id=self.id,
            driver=self.driver.name,
            model=model,
            molecule=molecule,
            keywords=keywords,
            extras=self.extras,
            protocols=protocols,
        )
        return model
github hjkgrp / MultirefPredict / MultirefPredict / ccbased_diagnostic.py View on Github external
def computeCCSDT(self):
        print("")
        print("Preparing CCSD(T) calculation")
        method = "ccsd(t)"
        basis = "cc-pvdz"
        if self.program != "psi4":
            raise ValueError("Support for packages other than psi4 is to be done\n")

        # Caculate energy for the whole molecule
        molecule_task = qcelemental.models.ResultInput(
            molecule=self.molecule,
            driver="energy",
            model={"method": method, "basis": basis},
        )
        print("Evaluating the energy of the whole molecule...")
        self.result = qcengine.compute(molecule_task, "psi4")
        print("self.result:", self.result)
        if not self.result.success:
            raise RuntimeError("Quantum chemistry calculation failed.")
        if self.record:
            filename = self.rundir + "/" + self.diagnostic_type + "_" + self.molname + "_" + "ccsd(t)" + "_" + "whole" + ".json"
            qcres_to_json(self.result, filename=filename)
github MolSSI / QCEngine / qcengine / mdi_server.py View on Github external
def send_forces(self) -> np.ndarray:
        """ Send the nuclear forces through MDI

        Returns
        -------
        forces : np.ndarray
            Forces on the nuclei
        """
        # Ensure that the molecule currently passes validation
        if not self.molecule_validated:
            raise Exception('MDI attempting to compute gradients on an unvalidated molecule')

        input = qcel.models.ResultInput(molecule=self.molecule,
                                        driver="gradient",
                                        model=self.model,
                                        keywords=self.keywords)
        self.compute_return = compute(input_data=input,
                                      program=self.program,
                                      raise_error=self.raise_error,
                                      local_options=self.local_options)

        forces = self.compute_return.return_result
        MDI_Send(forces, len(forces), MDI_DOUBLE_NUMPY, self.comm)
        return forces
github MolSSI / QCFractal / qcfractal / procedures / procedures_util.py View on Github external
"keywords": keyword_set,
            "model": {"method": meta["method"], "basis": meta["basis"]},
            "extras": {"_qcfractal_tags": {"program": meta["program"], "keywords": meta["keywords"]}},
        }
    )

    tasks = []
    for mol in raw_molecules_query["data"]:
        if mol is None:
            tasks.append(None)
            continue

        data = json.loads(task_meta)
        data["molecule"] = mol

        tasks.append(ResultInput(**data))

    return tasks, []
github MolSSI / QCFractal / qcfractal / interface / models / records.py View on Github external
if checks:
            assert self.molecule == molecule.id
            if self.keywords:
                assert self.keywords == keywords.id

        model = {"method": self.method}
        if self.basis:
            model["basis"] = self.basis

        if not self.keywords:
            keywords = {}
        else:
            keywords = keywords.values

        model = qcel.models.ResultInput(id=self.id,
                                        driver=self.driver.name,
                                        model=model,
                                        molecule=molecule,
                                        keywords=keywords,
                                        extras=self.extras)
        return model
github hjkgrp / MultirefPredict / MultirefPredict / ebased_diagnostic.py View on Github external
def energyTask(self, mol, method, program):
        task = None
        if program == "psi4":
            task = qcelemental.models.ResultInput(
                molecule=mol,
                driver="energy",
                model={"method": method, "basis": "6-31g"},
            )
        elif program == "terachem":
            tc_method = method if mol.molecular_multiplicity == 1 else "u" + method
            task = qcelemental.models.ResultInput(
                molecule=mol,
                driver="energy",
                model={"method": method, "basis": "6-31g"},
                keywords={"gpus":"1",
                          "maxit":"1500", 
                          "scf":"diis+a", 
                          "convthre":"1e-6",  
                          "precision":"double",
                          "units":"bohr",
                          "method":tc_method}
            )
        return task
github hjkgrp / MultirefPredict / MultirefPredict / casbased_diagnostic.py View on Github external
def compute(self):
        print(self.molecule)
        casscf_task = qcelemental.models.ResultInput(molecule=self.molecule,
                                                     driver="energy",
                                                     model={"method": "casscf", "basis": "cc-pvdz"},
                                                     keywords={"reference": "rohf"}
                                                     )
        self.results = qcengine.compute(casscf_task, "psi4")
        if not self.results.success:
            raise RuntimeError("Quantum chemistry calculation failed.")
        else:
            self.get_C0()
        if self.record:
            filename = self.rundir + "/" + self.diagnostic_type + "_" + self.molname + "_" + "casscf" + "_" + "whole" + ".json"
            qcres_to_json(self.results, filename=filename)