Re: [Rdkit-discuss] Writing a Tripos MOL2 file with charges
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: Paolo T. <pao...@un...> - 2016-10-31 18:17:00
|
Dear James, this is a small variation on Greg's reply (he was faster than me!): https://gist.github.com/ptosco/02af3456720d54c37ffc488056df02d4 While Greg's reply showed how to set a molecule property as a list of per-atom partial charges, here I have set each partial charge as an atom property. When you read in the SDF file, the partial charge for each atom can be accessed with partialCharge = float(atom.GetProp('molFileAlias')) In the same way you may also associate to each a name or any other property. Cheers, p. On 31/10/2016 17:11, James Johnson wrote: > Is there any supported format that outputs partial charges? > > The speed of RDKit is phenomenal (0.02 seconds) vs obabel's 2 seconds, > but if I cannot output partial charges I'll be forced to use obabel. > > Thank you for your time. > > -James > > On Mon, Oct 31, 2016 at 1:00 AM, Greg Landrum <gre...@gm... > <mailto:gre...@gm...>> wrote: > > Hi James, > > Due to problems with the general ambiguity of the format the RDKIt > does not have a mol2 writer. > > -greg > > > > > > On Mon, Oct 31, 2016 at 12:22 AM +0100, "James Johnson" > <tot...@gm... <mailto:tot...@gm...>> wrote: > > Hello all, > > I've been trying to output my 3D mol object that has Gasteiger > charges to mol2 file format. How would I go about that? I've > only found it for mol and pdb. > > Here is the code I'be been using if that helps: > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > from rdkit import Chem > from rdkit.Chem import AllChem > > smile = 'Cc1ccccc1' > > uncharged_mol_1D = Chem.MolFromSmiles(smile) > > uncharged_mol_3D = Chem.AddHs(uncharged_mol_1D) > AllChem.EmbedMolecule(uncharged_mol_3D) > AllChem.UFFOptimizeMolecule(uncharged_mol_3D) > > charged_mol_3D = uncharged_mol_3D > AllChem.ComputeGasteigerCharges(charged_mol_3D) > > fout = Chem.SDWriter('./charged_test.mol') > fout.write(charged_mol_3D) > fout.close() > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Thank you! > > > > > ------------------------------------------------------------------------------ > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today. http://sdm.link/xeonphi > > > _______________________________________________ > Rdkit-discuss mailing list > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss |