@@ -209,7 +209,7 @@ public int[] copyMoleculeByBonds(ExtendedMolecule destMol, boolean[] includeBond
209
209
destMol .mAllAtoms = 0 ;
210
210
for (int atom =0 ; atom <mAllAtoms ;atom ++) {
211
211
atomMap [atom ] = -1 ;
212
- for (int i =0 ; i < mConnAtoms [atom ]; i ++) {
212
+ for (int i =0 ; i <mConnAtoms [atom ]; i ++) {
213
213
if (includeBond [mConnBond [atom ][i ]]) {
214
214
atomMap [atom ] = copyAtom (destMol , atom , 0 , 0 );
215
215
@@ -291,35 +291,30 @@ && isAtomStereoCenter(atom)) {
291
291
int lostStereoBond = -1 ;
292
292
int lostAtom = -1 ;
293
293
for (int i =0 ; i <mAllConnAtoms [atom ]; i ++) {
294
- //if (mConnAtom.length>=atom || atomMap.length>=mConnAtom[atom][i])
295
- // System.out.println("mConnAtom.length:"+mConnAtom.length+" atom:"+atom+" atomMap.length:"+atomMap.length+" i:"+i+" mConnAtom[atom][i]:"+mConnAtom[atom][i]+" mAtoms:"+mAtoms+" mAllAtoms:"+mAllAtoms);
296
- if (atomMap .length >mConnAtom [atom ][i ]
297
- && atomMap [mConnAtom [atom ][i ]] != -1 )
294
+ if (bondMap [mConnBond [atom ][i ]] != -1 )
298
295
remainingNeighbours ++;
299
296
else if (mConnBondOrder [atom ][i ] == 1
300
- && isStereoBond (mConnBond [atom ][i ])
301
- && mBondAtom [0 ][mConnBond [atom ][i ]] == atom ) {
297
+ && isStereoBond (mConnBond [atom ][i ])
298
+ && mBondAtom [0 ][mConnBond [atom ][i ]] == atom ) {
302
299
lostStereoBond = mConnBond [atom ][i ];
303
300
lostAtom = mConnAtom [atom ][i ];
301
+ }
304
302
}
305
- }
306
- if (lostStereoBond != -1
307
- && remainingNeighbours >= 3 ) {
303
+ if (lostStereoBond != -1 && remainingNeighbours >= 3 ) {
308
304
double angle = getBondAngle (atom , lostAtom );
309
305
double minAngleDif = 10.0 ;
310
306
int minConnBond = -1 ;
311
307
for (int i =0 ; i <mAllConnAtoms [atom ]; i ++) {
312
308
if (mConnBondOrder [atom ][i ] == 1
313
- && (!isStereoBond (mConnBond [atom ][i ]) || mBondAtom [0 ][mConnBond [atom ][i ]] == atom )
314
- && atomMap .length >mConnAtom [atom ][i ]
315
- && atomMap [mConnAtom [atom ][i ]] != -1 ) {
309
+ && (!isStereoBond (mConnBond [atom ][i ]) || mBondAtom [0 ][mConnBond [atom ][i ]] == atom )
310
+ && bondMap [mConnBond [atom ][i ]] != -1 ) {
316
311
double angleDif = Math .abs (getAngleDif (angle , getBondAngle (atom , mConnAtom [atom ][i ])));
317
312
if (minAngleDif > angleDif ) {
318
313
minAngleDif = angleDif ;
319
314
minConnBond = mConnBond [atom ][i ];
315
+ }
320
316
}
321
317
}
322
- }
323
318
if (minConnBond != -1 ) {
324
319
int destBond = bondMap [minConnBond ];
325
320
destMol .setBondType (destBond , mBondType [minConnBond ] == cBondTypeUp ? cBondTypeDown : cBondTypeUp );
0 commit comments