From 8ffcfd7149a7ff4e8cfb5df7e362da8ffcdb3339 Mon Sep 17 00:00:00 2001 From: Greg Landrum Date: Fri, 11 May 2012 07:13:45 +0000 Subject: [PATCH] fix and test issue 35525671 --- Code/GraphMol/SmilesParse/SmilesWrite.cpp | 4 ++-- Code/GraphMol/SmilesParse/test.cpp | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Code/GraphMol/SmilesParse/SmilesWrite.cpp b/Code/GraphMol/SmilesParse/SmilesWrite.cpp index e7d249812..8dd5e6b52 100644 --- a/Code/GraphMol/SmilesParse/SmilesWrite.cpp +++ b/Code/GraphMol/SmilesParse/SmilesWrite.cpp @@ -64,9 +64,9 @@ namespace RDKit{ bool nonStandard; nonStandard = std::find(defaultVs.begin(),defaultVs.end(), totalValence)==defaultVs.end(); - // another type of "nonstandard" valence is an aromatic N with + // another type of "nonstandard" valence is an aromatic N or P with // explicit Hs indicated: - if(num==7 && atom->getIsAromatic() && atom->getNumExplicitHs()){ + if((num==7||num==15) && atom->getIsAromatic() && atom->getNumExplicitHs()){ nonStandard=true; } diff --git a/Code/GraphMol/SmilesParse/test.cpp b/Code/GraphMol/SmilesParse/test.cpp index ee45b6744..26b53cec8 100644 --- a/Code/GraphMol/SmilesParse/test.cpp +++ b/Code/GraphMol/SmilesParse/test.cpp @@ -1726,8 +1726,17 @@ void testBug1719046(){ smi = MolToSmiles(*mol,false,false,-1); TEST_ASSERT(smi=="c1cc[nH]c1"); + delete mol; + // this was Issue 35525671 + smi="P1C=CC=C1"; + mol = SmilesToMol(smi); + TEST_ASSERT(mol); + smi = MolToSmiles(*mol,false,false,-1); + TEST_ASSERT(smi=="c1cc[pH]c1"); + delete mol; BOOST_LOG(rdInfoLog) << "\tdone" << std::endl; + } void testBug1842174(){