2121import org .openscience .cdk .CDKConstants ;
2222import org .openscience .cdk .aromaticity .Aromaticity ;
2323import org .openscience .cdk .exception .CDKException ;
24+ import org .openscience .cdk .interfaces .IElement ;
2425import org .openscience .cdk .interfaces .IAtom ;
2526import org .openscience .cdk .interfaces .IAtomContainer ;
2627import org .openscience .cdk .interfaces .IBond ;
@@ -173,13 +174,13 @@ public DescriptorValue calculate(IAtomContainer atomContainer) {
173174 // labelled for loop to allow for labelled continue statements within the loop
174175 atomloop : for (IAtom atom : ac .atoms ()) {
175176 // looking for suitable nitrogen atoms
176- if (atom .getSymbol (). equals ( "N" ) && atom .getFormalCharge () <= 0 ) {
177+ if (atom .getAtomicNumber () == IElement . N && atom .getFormalCharge () <= 0 ) {
177178
178179 // excluding nitrogens that are adjacent to an oxygen
179180 List <IBond > bonds = ac .getConnectedBondsList (atom );
180181 int nPiBonds = 0 ;
181182 for (IBond bond : bonds ) {
182- if (bond .getOther (atom ).getSymbol (). equals ( "O" ) ) continue atomloop ;
183+ if (bond .getOther (atom ).getAtomicNumber () == IElement . O ) continue atomloop ;
183184 if (IBond .Order .DOUBLE .equals (bond .getOrder ())) nPiBonds ++;
184185 }
185186
@@ -190,13 +191,13 @@ public DescriptorValue calculate(IAtomContainer atomContainer) {
190191 hBondAcceptors ++;
191192 }
192193 // looking for suitable oxygen atoms
193- else if (atom .getSymbol (). equals ( "O" ) && atom .getFormalCharge () <= 0 ) {
194+ else if (atom .getAtomicNumber () == IElement . O && atom .getFormalCharge () <= 0 ) {
194195 //excluding oxygens that are adjacent to a nitrogen or to an aromatic carbon
195196 List <IBond > neighbours = ac .getConnectedBondsList (atom );
196197 for (IBond bond : neighbours ) {
197198 IAtom neighbor = bond .getOther (atom );
198- if (neighbor .getSymbol (). equals ( "N" ) ||
199- (neighbor .getSymbol (). equals ( "C" ) &&
199+ if (neighbor .getAtomicNumber () == IElement . N ||
200+ (neighbor .getAtomicNumber () == IElement . C &&
200201 neighbor .isAromatic () &&
201202 bond .getOrder () != IBond .Order .DOUBLE ))
202203 continue atomloop ;;
0 commit comments