def main(argv=[__name__]): if len(argv) != 3: oechem.OEThrow.Usage("calc_et.py <reffile> <fitfile>") refmol = oechem.OEGraphMol() ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) oechem.OEReadMolecule(ifs, refmol) oechem.OEAssignBondiVdWRadii(refmol) oechem.OEMMFFAtomTypes(refmol) oechem.OEMMFF94PartialCharges(refmol) et = oezap.OEET() et.SetRefMol(refmol) oechem.OEThrow.Info("dielectric: %.4f" % et.GetDielectric()) oechem.OEThrow.Info("inner mask: %.4f" % et.GetInnerMask()) oechem.OEThrow.Info("outer mask: %.4f" % et.GetOuterMask()) oechem.OEThrow.Info("salt conc : %.4f" % et.GetSaltConcentration()) oechem.OEThrow.Info("join : %d" % et.GetJoin()) if not ifs.open(argv[2]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[2]) fitmol = oechem.OEGraphMol() while oechem.OEReadMolecule(ifs, fitmol): oechem.OEAssignBondiVdWRadii(fitmol) oechem.OEMMFFAtomTypes(fitmol) oechem.OEMMFF94PartialCharges(fitmol) oechem.OEThrow.Info("Title: %s, ET %4.2f" % (fitmol.GetTitle(), et.Tanimoto(fitmol))) return 0
def main(argv=[__name__]): if len(argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % argv[0]) epsin = 1.0 zap = oezap.OEZap() zap.SetInnerDielectric(epsin) zap.SetGridSpacing(0.5) area = oezap.OEArea() mol = oechem.OEGraphMol() ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) oechem.OEThrow.Info("%-20s %6s\n" % ("Title", "Vacuum->Water(kcal)")) while oechem.OEReadMolecule(ifs, mol): oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) zap.SetMolecule(mol) solv = zap.CalcSolvationEnergy() aval = area.GetArea(mol) oechem.OEThrow.Info("%-20s %6.2f" % (mol.GetTitle(), KCalsPerKT*solv+KCalsPerSqAngstrom*aval)) return 0
def main(argv=[__name__]): itf = oechem.OEInterface() if not SetupInterface(argv, itf): return 1 zap = oezap.OEZap() zap.SetInnerDielectric(itf.GetFloat("-epsin")) zap.SetOuterDielectric(itf.GetFloat("-epsout")) zap.SetGridSpacing(itf.GetFloat("-grid_spacing")) zap.SetBoundarySpacing(itf.GetFloat("-buffer")) mol = oechem.OEGraphMol() ifs = oechem.oemolistream() if not ifs.open(itf.GetString("-in")): oechem.OEThrow.Fatal("Unable to open %s for reading" % itf.GetString("-in")) oechem.OEReadMolecule(ifs, mol) oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) zap.SetMolecule(mol) grid = oegrid.OEScalarGrid() if zap.CalcPotentialGrid(grid): if itf.GetBool("-mask"): oegrid.OEMaskGridByMolecule(grid, mol) oegrid.OEWriteGrid(itf.GetString("-out"), grid) return 0
def SetPartialCharge(mol, tagname): oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) tag = oechem.OEGetTag(tagname) for atom in mol.GetAtoms(): atom.SetData(tag, atom.GetPartialCharge())
def Draw2DSurfacePartialCharge(image, mol): oedepict.OEPrepareDepiction(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) opts = oedepict.OE2DMolDisplayOptions(image.GetWidth(), image.GetHeight(), oedepict.OEScale_AutoScale) opts.SetTitleLocation(oedepict.OETitleLocation_Hidden) opts.SetScale(oegrapheme.OEGetMoleculeSurfaceScale(mol, opts)) coloranion = oechem.OEColorStop(-1.0, oechem.OEColor(oechem.OEDarkRed)) colorcation = oechem.OEColorStop(+1.0, oechem.OEColor(oechem.OEDarkBlue)) colorg = oechem.OELinearColorGradient(coloranion, colorcation) colorg.AddStop(oechem.OEColorStop(0.0, oechem.OEColor(oechem.OEWhite))) arcfxn = AtomPartialChargeArcFxn(colorg) for atom in mol.GetAtoms(): oegrapheme.OESetSurfaceArcFxn(mol, atom, arcfxn) disp = oedepict.OE2DMolDisplay(mol, opts) oegrapheme.OEDraw2DSurface(disp) oedepict.OERenderMolecule(image, disp)
def main(argv=[__name__]): if len(argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % argv[0]) epsin = 1.0 zap = oezap.OEZap() zap.SetInnerDielectric(epsin) zap.SetGridSpacing(0.5) area = oezap.OEArea() PrintHeader() mol = oechem.OEGraphMol() ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) while oechem.OEReadMolecule(ifs, mol): oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) zap.SetMolecule(mol) solv = zap.CalcSolvationEnergy() aval = area.GetArea(mol) coul = oezap.OECoulombicSelfEnergy(mol, epsin) PrintLine(mol.GetTitle(), solv, aval, coul) return 0
def SetPartialCharge(mol, tagname, minvalue, maxvalue): oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) tag = oechem.OEGetTag(tagname) for atom in mol.GetAtoms(): charge = atom.GetPartialCharge() atom.SetData(tag, charge) minvalue = min(minvalue, charge) maxvalue = max(maxvalue, charge) return minvalue, maxvalue
def main(argv=[__name__]): if len(argv) != 3: oechem.OEThrow.Usage("%s <protein> <ligand>" % argv[0]) ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) protein = oechem.OEGraphMol() oechem.OEReadMolecule(ifs, protein) if not ifs.open(argv[2]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[2]) ligand = oechem.OEGraphMol() oechem.OEReadMolecule(ifs, ligand) oechem.OEAssignBondiVdWRadii(protein) oechem.OEMMFFAtomTypes(protein) oechem.OEMMFF94PartialCharges(protein) oechem.OEAssignBondiVdWRadii(ligand) oechem.OEMMFFAtomTypes(ligand) oechem.OEMMFF94PartialCharges(ligand) cmplx = oechem.OEGraphMol(protein) oechem.OEAddMols(cmplx, ligand) epsin = 1.0 spacing = 0.5 zap = oezap.OEZap() zap.SetInnerDielectric(epsin) zap.SetGridSpacing(spacing) PrintHeader(protein.GetTitle(), ligand.GetTitle()) CalcBindingEnergy(zap, protein, ligand, cmplx) zap.SetFocusTarget(ligand) CalcBindingEnergy(zap, protein, ligand, cmplx) return 0
def main(argv=[__name__]): if len(argv) != 3: oechem.OEThrow.Usage("%s <protein> <ligands>" % argv[0]) protein = oechem.OEMol() ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) oechem.OEReadMolecule(ifs, protein) oechem.OEAssignBondiVdWRadii(protein) oechem.OEMMFFAtomTypes(protein) oechem.OEMMFF94PartialCharges(protein) print("protein: " + protein.GetTitle()) epsin = 1.0 bind = oezap.OEBind() bind.GetZap().SetInnerDielectric(epsin) bind.SetProtein(protein) results = oezap.OEBindResults() if not ifs.open(argv[2]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[2]) ifs.SetConfTest(oechem.OEIsomericConfTest()) ligand = oechem.OEMol() while oechem.OEReadMolecule(ifs, ligand): oechem.OEAssignBondiVdWRadii(ligand) oechem.OEMMFFAtomTypes(ligand) oechem.OEMMFF94PartialCharges(ligand) print("ligand: %s has %d conformers" % (ligand.GetTitle(), ligand.NumConfs())) for conf in ligand.GetConfs(): bind.Bind(conf, results) print(" conf# %d be = %f" % (conf.GetIdx(), results.GetBindingEnergy())) return 0
def main(argv=[__name__]): if len(argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % argv[0]) ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) mol = oechem.OEGraphMol() oechem.OEReadMolecule(ifs, mol) oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) epsin = 1.0 zap = oezap.OEZap() zap.SetInnerDielectric(epsin) zap.SetMolecule(mol) grid = oegrid.OEScalarGrid() if zap.CalcPotentialGrid(grid): oegrid.OEWriteGrid("zap.grd", grid)
def main(argv=[__name__]): if len(argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % argv[0]) epsin = 1.0 zap = oezap.OEZap() zap.SetInnerDielectric(epsin) mol = oechem.OEGraphMol() ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) while oechem.OEReadMolecule(ifs, mol): PrintHeader(mol.GetTitle()) forces = oechem.OEFloatArray(mol.GetMaxAtomIdx() * 3) oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) zap.SetMolecule(mol) zap.CalcForces(forces) PrintForces(mol, forces) return 0
def main(argv=[__name__]): if len(argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % argv[0]) ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) mol = oechem.OEGraphMol() oechem.OEReadMolecule(ifs, mol) oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) zap = oezap.OEZap() zap.SetInnerDielectric(1.0) zap.SetGridSpacing(0.5) zap.SetMolecule(mol) # calculate standard 2-dielectric grid grid1 = oegrid.OEScalarGrid() zap.CalcPotentialGrid(grid1) # calculate grid with single dielectric grid2 = oegrid.OEScalarGrid() zap.SetOuterDielectric(zap.GetInnerDielectric()) zap.CalcPotentialGrid(grid2) # take the difference oegrid.OESubtractScalarGrid(grid1, grid2) # mask out everything outside the molecule oegrid.OEMaskGridByMolecule(grid1, mol, oegrid.OEGridMaskType_GaussianMinus) oegrid.OEWriteGrid("zap_diff.grd", grid1)
if len(sys.argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % sys.argv[0]) mol = oechem.OEGraphMol() ifs = oechem.oemolistream() if not ifs.open(sys.argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading", sys.argv[1]) if not oechem.OEIs3DFormat(ifs.GetFormat()): oechem.OEThrow.Fatal("Invalid input format: need 3D coordinates") oechem.OEReadMolecule(ifs, mol) oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) # @ <SNIPPET-GetArea-Molecule> area = oezap.OEArea() a = area.GetArea(mol) print("Molecule area =", a) # @ </SNIPPET-GetArea-Molecule> # @ <SNIPPET-GetArea-Atoms> atomArea = oechem.OEFloatArray(mol.GetMaxAtomIdx()) area = oezap.OEArea() area.GetArea(mol, atomArea) for atom in mol.GetAtoms(): idx = atom.GetIdx() print(idx, atomArea[idx])