add isotope info to depictions

This commit is contained in:
Greg Landrum
2011-07-01 03:52:01 +00:00
parent b8f7f9f934
commit c552ad6afc
2 changed files with 10 additions and 2 deletions

View File

@@ -187,8 +187,12 @@ namespace RDKit {
}
}
}
double massDiff=fabs(PeriodicTable::getTable()->getAtomicWeight(mol[*bAts]->getAtomicNum()) -
mol[*bAts]->getMass());
static double massTol=0.001;
if(mol[*bAts]->getAtomicNum()!=6 ||
mol[*bAts]->getFormalCharge()!=0 ){
mol[*bAts]->getFormalCharge()!=0 ||
massDiff>massTol ){
res.push_back(ATOM);
res.push_back(mol[*bAts]->getAtomicNum());
res.push_back(static_cast<ElementType>(dotsPerAngstrom*a1.x));
@@ -198,6 +202,10 @@ namespace RDKit {
if(mol[*bAts]->getDegree()==1 && nbrSum.x>0){
leftToRight=false;
}
if(massDiff>massTol){
symbol = boost::lexical_cast<std::string>(int(mol[*bAts]->getMass()+.1))+symbol;
}
if(mol[*bAts]->getAtomicNum()!=6){
int nHs=mol[*bAts]->getTotalNumHs();
if(nHs>0){

View File

@@ -358,7 +358,7 @@ void DrawDemo(){
delete mol;
}
{
RWMol *mol=SmilesToMol("c1ccccn1");
RWMol *mol=SmilesToMol("c1c[12cH]ccn1");
cairo_surface_t *surface =
cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 300, 300);
cairo_t *cr = cairo_create (surface);