469a596b57153e56073d68b2ddd8afcc1952dde3,qcengine/programs/rdkit.py,RDKitExecutor,compute,#RDKitExecutor#Any#Any#,34

Before Change


            // return FailedOperation(input_data=input_data.dict(), **ret_data)

        if not jmol.connectivity:  // Check for empty list
            ret_data["error"] = ComputeError(
                error_type="input_error", error_message="run_rdkit molecule must have a connectivity graph")
            return FailedOperation(input_data=input_data.dict(), **ret_data)

        // Build out the base molecule
        base_mol = Chem.Mol()
        rw_mol = Chem.RWMol(base_mol)
        for sym in jmol.symbols:
            rw_mol.AddAtom(Chem.Atom(sym.title()))

        // Add in connectivity
        bond_types = {1: Chem.BondType.SINGLE, 2: Chem.BondType.DOUBLE, 3: Chem.BondType.TRIPLE}
        for atom1, atom2, bo in jmol.connectivity:
            rw_mol.AddBond(atom1, atom2, bond_types[bo])

        mol = rw_mol.GetMol()

        // Write out the conformer
        natom = len(jmol.symbols)
        conf = Chem.Conformer(natom)
        bohr2ang = ureg.conversion_factor("bohr", "angstrom")
        for line in range(natom):
            conf.SetAtomPosition(line, (bohr2ang * jmol.geometry[line, 0],
                                        bohr2ang * jmol.geometry[line, 1],
                                        bohr2ang * jmol.geometry[line, 2]))  // yapf: disable

        mol.AddConformer(conf)
        Chem.rdmolops.SanitizeMol(mol)

        if input_data.model.method.lower() == "uff":
            ff = AllChem.UFFGetMoleculeForceField(mol)
            all_params = AllChem.UFFHasAllMoleculeParams(mol)
        else:
            ret_data["error"] = ComputeError(
                error_type="input_error", error_message="run_rdkit can only accepts UFF methods")
            return FailedOperation(input_data=input_data.dict(), **ret_data)

        if all_params is False:
            ret_data["error"] = ComputeError(
                error_type="input_error", error_message="run_rdkit did not match all parameters to molecule")

After Change


            raise InputError("RDKit only supports the UFF method currently.")

        if all_params is False:
            raise InputError("RDKit parameters not found for all atom types in molecule.")

        ff.Initialize()

        ret_data["properties"] = {"return_energy": ff.CalcEnergy() * ureg.conversion_factor("kJ / mol", "hartree")}
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: MolSSI/QCEngine
Commit Name: 469a596b57153e56073d68b2ddd8afcc1952dde3
Time: 2019-05-20
Author: malorian@me.com
File Name: qcengine/programs/rdkit.py
Class Name: RDKitExecutor
Method Name: compute


Project Name: MolSSI/QCEngine
Commit Name: 469a596b57153e56073d68b2ddd8afcc1952dde3
Time: 2019-05-20
Author: malorian@me.com
File Name: qcengine/programs/rdkit.py
Class Name: RDKitExecutor
Method Name: compute


Project Name: MolSSI/QCEngine
Commit Name: 469a596b57153e56073d68b2ddd8afcc1952dde3
Time: 2019-05-20
Author: malorian@me.com
File Name: qcengine/programs/torchani.py
Class Name: TorchANIExecutor
Method Name: compute


Project Name: MolSSI/QCEngine
Commit Name: 9b1249ec521f1a1831ed2a97710b72b9f9b2cd67
Time: 2019-05-20
Author: malorian@me.com
File Name: qcengine/programs/rdkit.py
Class Name: RDKitExecutor
Method Name: compute