When you add Hs to the molecule they are explicitly present in the molecular graph. The SMILES code includes everything in the graph. This is why you end up with [H]s in the SMILES. -greg
_____________________________ From: Bennion, Brian <benni...@llnl.gov> Sent: Thursday, September 1, 2016 7:19 PM Subject: RE: [Rdkit-discuss] protonating proper tertiary amines To: Greg Landrum <greg.land...@gmail.com> Cc: <rdkit-discuss@lists.sourceforge.net> Hello All, I just inserted the test smile string as shown in the code below. This should just test the function and not how molecule information is passed to it. I can see that the molecular formula is indeed updated for both formal charge and the additional hydrogen atom. The bond order also seems correct. The sdf file looks correct as well with the proper charge and 4 bonds on nitrogen. However, a printing of the smiles string shows an odd placement of the Hydrogen atom [N+]([H]) is not what I would expect.... The test output is: Tertiary nitrogen found: ((1, 2, 3, 5),) This is the symbol and charge for the tertiary nitrogen before: N 0 CCN(CC)CC This is the symbol and charge for the tertiary nitrogen after: N 1 test3-10: SANITIZE_NONE C6H15N C6H15N+ C6H16N+ 4 [H]C([H])([H])C([H])([H])[N+]([H])(C([H])([H])C([H])([H])[H])C([H])([H])C([H])([H])[H] test code def tertNitrogenProt(molecule0,molName1,w_sdf,w_smi): patt=rdkit.Chem.MolFromSmarts('[#6]-[#7]([#6])-[#6]') molecule=rdkit.Chem.MolFromSmiles('CCN(CC)CC') matches=molecule.GetSubstructMatches(patt) tertNHnum=0 if matches: print "Tertiary nitrogen found: ", matches for i in matches: moleculeStrings=rdkit.Chem.MolToSmiles(molecule,isomericSmiles=True) molecule.UpdatePropertyCache() atomSymbol9=molecule.GetAtomWithIdx(i[1]).GetSymbol() formalCharge9=molecule.GetAtomWithIdx(i[1]).GetFormalCharge() print "This is the symbol and charge for the tertiary nitrogen before: ",atomSymbol9,formalCharge9,moleculeStrings #set the formal charge on the protonated tertiary nitrogen to zero test7=rdkit.Chem.AllChem.CalcMolFormula(molecule) molecule.GetAtomWithIdx(i[1]).SetFormalCharge(1) atomSymbol9=molecule.GetAtomWithIdx(i[1]).GetSymbol() formalCharge9=molecule.GetAtomWithIdx(i[1]).GetFormalCharge() test8=rdkit.Chem.AllChem.CalcMolFormula(molecule) print "This is the symbol and charge for the tertiary nitrogen after: ",atomSymbol9,formalCharge9 #update property cache and check for nonsense molecule.UpdatePropertyCache() moleculeH=rdkit.Chem.AddHs(molecule) test3=rdkit.Chem.SanitizeMol(moleculeH) test9=rdkit.Chem.AllChem.CalcMolFormula(moleculeH) test10=moleculeH.GetAtomWithIdx(i[1]).GetDegree() moleculeStrings2=rdkit.Chem.MolToSmiles(moleculeH,isomericSmiles=True) print "test3-10: ",test3,test7,test8,test9,test10,moleculeStrings2 From: Greg Landrum [greg.land...@gmail.com] Sent: Wednesday, August 31, 2016 7:49 PM To: Bennion, Brian Cc: rdkit-discuss@lists.sourceforge.net Subject: Re: [Rdkit-discuss] protonating proper tertiary amines On Thu, Sep 1, 2016 at 1:01 AM, Bennion, Brian <benni...@llnl.gov> wrote: On one compute node with one thread, two reagents are combined in a synthesis function and then the tertNitrogenProt function is called and the current molecule is passed through to be searched for the tertiary nitrogen and protonated if found. What I am not clear on, is whether the properties are passed properly from the synthesis function to the tertNitrogenProt function. Yeah, given that the function works correctly when it's called on its own, I think the problem is likely to be in the way it's being called. Question, what are the outputs of UpdatePropertyCache()? When I test for output, only the word _none_ is printed. I don't know if that means there were no properties present, or they did not need to be updated. UpdatePropertyCache() doesn't return a value, that's why you're seeing None. The method just causes the implicit properties on each of the molecule's atoms to be re-computed, but it doesn't return anything. -greg
------------------------------------------------------------------------------
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss