mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-04 21:54:27 +08:00
periodic table optimization
This commit is contained in:
@@ -77,8 +77,14 @@ namespace RDKit {
|
||||
}
|
||||
//! overload
|
||||
int getAtomicNumber( const std::string &elementSymbol ) const {
|
||||
PRECONDITION(byname.count(elementSymbol),"Element '" + elementSymbol +"' not found");
|
||||
int anum = byname.find(elementSymbol)->second;
|
||||
// this little optimization actually makes a measurable difference
|
||||
// in molecule-construction time
|
||||
int anum=-1;
|
||||
if(elementSymbol=="C") anum=6;
|
||||
else if(elementSymbol=="N") anum=7;
|
||||
else if(elementSymbol=="O") anum=8;
|
||||
else anum = byname.find(elementSymbol)->second;
|
||||
POSTCONDITION(anum>-1,"Element '" + elementSymbol +"' not found");
|
||||
return anum;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user