private static GeometricParity geometric2D ( Map < IAtom , Integer > elevationMap , List < IBond > bonds , int i , int [ ] adjacent , IAtomContainer container ) { IAtom atom = container . getAtom ( i ) ; // create map of the atoms and their elevation from the center, makeElevationMap ( atom , bonds , elevationMap ) ; Point2d [ ] coordinates = new Point2d [ 4 ] ; int [ ] elevations = new int [ 4 ] ; // set the forth ligand to centre as default (overwritten if // we have 4 neighbors) if ( atom . getPoint2d ( ) != null ) coordinates [ 3 ] = atom . getPoint2d ( ) ; else return null ; for ( int j = 0 ; j < adjacent . length ; j ++ ) { IAtom neighbor = container . getAtom ( adjacent [ j ] ) ; elevations [ j ] = elevationMap . get ( neighbor ) ; if ( neighbor . getPoint2d ( ) != null ) coordinates [ j ] = neighbor . getPoint2d ( ) ; else return null ; // skip to next atom } return new Tetrahedral2DParity ( coordinates , elevations ) ; }
Create the geometric part of an encoder of 2D configurations