Пример #1
0
def main(args):
    if len(args) != 3:
        oechem.OEThrow.Usage("%s input_molecule output_molecule" % args[0])

    ifs = oechem.oemolistream()
    if not ifs.open(args[1]):
        oechem.OEThrow.Fatal("Unable to open %s for reading" % args[1])

    ofs = oechem.oemolostream()
    if not ofs.open(args[2]):
        oechem.OEThrow.Fatal("Unable to open %s for writing" % args[2])

    opts = oeszybki.OESzybkiOptions()
    opts.GetOptOptions().SetOptimizerType(oeszybki.OEOptType_NEWTON)
    opts.GetGeneralOptions().SetForceFieldType(
        oeszybki.OEForceFieldType_MMFF94S)
    opts.GetSolventOptions().SetSolventModel(oeszybki.OESolventModel_Sheffield)
    opts.GetSolventOptions().SetChargeEngine(oequacpac.OEChargeEngineNoOp())
    sz = oeszybki.OESzybki(opts)
    res = oeszybki.OESzybkiResults()
    for mol in ifs.GetOEMols():
        for conf in mol.GetConfs():
            if sz(conf, res):
                oechem.OESetSDData(
                    conf,
                    oechem.OESDDataPair('Total_energy',
                                        "%0.4f" % res.GetTotalEnergy()))

        oechem.OEWriteMolecule(ofs, mol)

    ifs.close()
    ofs.close()

    return 0
Пример #2
0
def min_mmff94x(mol, ofs, mmff94s=False):
    """
    Minimize the mol with MMFF94 or MMFF94S force field.

    Parameters
    ----------
    mol : OpenEye single-conformer molecule
    ofs : OpenEye output filestream
    mmff94s : Boolean
        True to minimize with MMFF94S

    """

    # make copy of the input mol
    oe_mol = oechem.OEGraphMol(mol)

    # set general energy options along with the run type specification
    optSzybki = oeszybki.OESzybkiOptions()
    optSzybki.SetSolventModel(oeszybki.OESolventModel_NoSolv)
    optSzybki.SetOptimizerType(oeszybki.OEOptType_BFGS)

    # minimize with input charges not mmff94(s) charges
    # https://docs.eyesopen.com/toolkits/python/szybkitk/examples.html#optimization-of-all-conformers-of-a-ligand
    optSzybki.GetSolventOptions().SetChargeEngine(oequacpac.OEChargeEngineNoOp())

    # set the particular force field
    if mmff94s:
        sdlabel = "MMFF94S"
        optSzybki.SetForceFieldType(oeszybki.OEForceFieldType_MMFF94S)
    else:
        sdlabel = "MMFF94"
        optSzybki.SetForceFieldType(oeszybki.OEForceFieldType_MMFF94)

    # generate minimization engine
    szOpt = oeszybki.OESzybki(optSzybki)

    # make object to hold szybki results
    szResults = oeszybki.OESzybkiResults()

    # perform minimization
    if not szOpt(oe_mol, szResults):
        smilabel = oechem.OEGetSDData(oe_mol, "SMILES QCArchive")
        print( ' >>> MMFF94x minimization failed for %s\n' % smilabel )
    energy = szResults.GetTotalEnergy()

    # save geometry, save energy as tag, write mol to file
    oechem.OESetSDData(oe_mol, f"Energy {sdlabel}", str(energy))
    oechem.OEWriteConstMolecule(ofs, oe_mol)
Пример #3
0
def AssignChargesByName(mol, name):
    if name == "noop":
        return oequacpac.OEAssignCharges(mol, oequacpac.OEChargeEngineNoOp())
    elif name == "mmff" or name == "mmff94":
        return oequacpac.OEAssignCharges(mol, oequacpac.OEMMFF94Charges())
    elif name == "am1bcc":
        return oequacpac.OEAssignCharges(mol, oequacpac.OEAM1BCCCharges())
    elif name == "am1bccnosymspt":
        optimize = True
        symmetrize = True
        return oequacpac.OEAssignCharges(
            mol, oequacpac.OEAM1BCCCharges(not optimize, not symmetrize))
    elif name == "amber" or name == "amberff94":
        return oequacpac.OEAssignCharges(mol, oequacpac.OEAmberFF94Charges())
    elif name == "am1bccelf10":
        return oequacpac.OEAssignCharges(mol, oequacpac.OEAM1BCCELF10Charges())
    return False
Пример #4
0
def main(args):
    if len(args) != 3:
        oechem.OEThrow.Usage("%s input_molecule output_molecule" % args[0])

    ifs = oechem.oemolistream()
    if not ifs.open(args[1]):
        oechem.OEThrow.Fatal("Unable to open %s for reading" % args[1])

    ofs = oechem.oemolostream()
    if not ofs.open(args[2]):
        oechem.OEThrow.Fatal("Unable to open %s for writing" % args[2])

    # input set of conformations in solution
    mol = oechem.OEMol()
    oechem.OEReadMolecule(ifs, mol)

    opts = oeszybki.OESzybkiOptions()
    opts.GetSolventOptions().SetChargeEngine(oequacpac.OEChargeEngineNoOp())

    sz = oeszybki.OESzybki(opts)
    eres = oeszybki.OESzybkiEnsembleResults()
    entropy = sz.GetEntropy(mol, eres, oeszybki.OEEntropyMethod_Analytic,
                            oeszybki.OEEnvType_SolutionSPT)

    oechem.OEThrow.Info(
        "Estimated molar solution entropy of the input compound is: %5.1f J/(mol*K)"
        % entropy)

    oechem.OEThrow.Info(
        "Vibrational entropies (in J/(mol*K)) for all conformations:")
    for conf, r in zip(mol.GetConfs(), eres.GetResultsForConformations()):
        oechem.OEThrow.Info("%2d %5.1f" % (conf.GetIdx(), r.GetVibEntropy()))

    # ensemble of unique conformations
    oechem.OEWriteMolecule(ofs, mol)

    return 0