/** * Create a new trigonal bipyramidal configuration. * @param focus the focus * @param carriers the carriers * @param order the order (1-20) */ public TrigonalBipyramidal(IAtom focus, IAtom[] carriers, int order) { super(focus, carriers, TrigonalBipyramidal | order & 0xff); if (getConfigOrder() < 0 || getConfigOrder() > 20) throw new IllegalArgumentException("Invalid configuration order," + "should be between 1-20"); }
/** * Create a new trigonal bipyramidal configuration. * @param focus the focus * @param carriers the carriers * @param order the order (1-20) */ public TrigonalBipyramidal(IAtom focus, IAtom[] carriers, int order) { super(focus, carriers, TrigonalBipyramidal | order & 0xff); if (getConfigOrder() < 0 || getConfigOrder() > 20) throw new IllegalArgumentException("Invalid configuration order," + "should be between 1-20"); }
/** * Normalize the configuration to the lowest configuration order (1) - * the axis goes from the first to last carrier, the three middle carriers * are anti-clockwise looking from the first carrier. * @return the normalized configuration */ public TrigonalBipyramidal normalize() { int cfg = getConfigOrder(); if (cfg == 1) return this; IAtom[] carriers = invapply(getCarriers().toArray(new IAtom[5]), PERMUTATIONS[cfg-1]); return new TrigonalBipyramidal(getFocus(), carriers, 1); }
/** * Normalize the configuration to the lowest configuration order (1) - * the axis goes from the first to last carrier, the three middle carriers * are anti-clockwise looking from the first carrier. * @return the normalized configuration */ public TrigonalBipyramidal normalize() { int cfg = getConfigOrder(); if (cfg == 1) return this; IAtom[] carriers = invapply(getCarriers().toArray(new IAtom[5]), PERMUTATIONS[cfg-1]); return new TrigonalBipyramidal(getFocus(), carriers, 1); }
@Test public void tbpy1() throws Exception { IAtomContainer mol = load("S[As@TB1](F)(Cl)(Br)N"); Iterator<IStereoElement> ses =mol.stereoElements().iterator(); assertTrue(ses.hasNext()); IStereoElement se = ses.next(); assertThat(se, instanceOf(TrigonalBipyramidal.class)); assertThat(((TrigonalBipyramidal) se).getConfigOrder(), is(1)); }
@Test public void tbpy2() throws Exception { IAtomContainer mol = load("S[As@TB2](F)(Cl)(Br)N"); Iterator<IStereoElement> ses =mol.stereoElements().iterator(); assertTrue(ses.hasNext()); IStereoElement se = ses.next(); assertThat(se, instanceOf(TrigonalBipyramidal.class)); assertThat(((TrigonalBipyramidal) se).getConfigOrder(), is(2)); }