Re: [Rdkit-discuss] Building mol manually
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: Greg L. <gre...@gm...> - 2015-05-22 14:54:10
|
I agree almost 100% with Nick's answer. The one change I would make is to use Chem.RWMol() instead of Chem.EditableMol(). This is new functionality in the next release and gives you a bit more flexibility with how you work with the editable object. There's more information in the documentation here: http://www.rdkit.org/docs/GettingStartedInPython.html#editing-molecules Best, -greg On Fri, May 22, 2015 at 4:39 PM, Nicholas Firth <Nic...@ic...> wrote: > Hi Eric, > > I don't know if there is a recommended way, but there's an easy way for > sure! > > from rdkit import Chem > m = Chem.Mol() #creates a blank molecule, can use an existing RDKit > molecule though > em = Chem.EditableMol(m) > idx1 = em.AddAtom(Chem.Atom(6)) #this returns the RDKit index of the atom > you're creating, which is atomic number 6 > idx2 = em.AddAtom(Chem.Atom(6)) > bondIdx = em.AddBond(idx1,idx2, Chem.BondType.SINGLE) #returns the RDKit > index of the bond you're creating > m = em.GetMol() > Chem.SanitizeMol(m) > from rdkit.Chem import AllChem > AllChem.EmbedMolecule(m) > AllChem.MMFFOptimizeMolecule(m) > print Chem.MolToMolBlock(m) > > RDKit 3D > > 2 1 0 0 0 0 0 0 0 0999 V2000 > 0.7540 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > -0.7540 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 1 2 1 0 > M END > > > Best, > Nick > > *Nicholas C. Firth* | PhD Student | Cancer Therapeutics > The Institute of Cancer Research | 15 Cotswold Road | Belmont | Sutton | > Surrey | SM2 5NG > > *T* 020 8722 4033 | *E* nic...@ic... | *W* www.icr.ac.uk | > *Twitter* @ICRnews <https://twitter.com/ICRnews> > > *Facebook* www.facebook.com/theinstituteofcancerresearch > > *Making the discoveries that defeat cancer* > > > On 22 May 2015, at 15:22, Eric Smoll <eri...@gm...> wrote: > > Hello RDKIT users, > > I have a molecular data structure with the connectivity of all atoms in my > molecule. Is there a recommended way to build a mol object by manually > specifying each atom and each bond perhaps relaxing the coordinates with a > forcefield? > > Best, > Eric > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y_______________________________________________ > Rdkit-discuss mailing list > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > > > The Institute of Cancer Research: Royal Cancer Hospital, a charitable > Company Limited by Guarantee, Registered in England under Company No. > 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. > > This e-mail message is confidential and for use by the addressee only. If > the message is received by anyone other than the addressee, please return > the message to the sender by replying to it and then delete the message > from your computer and network. > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Rdkit-discuss mailing list > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > > |