/** * 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); }
private void modifyAndLabel(TrigonalBipyramidal se) { List<IAtom> atoms = se.normalize().getCarriers(); List<IBond> bonds = new ArrayList<>(4); double blen = 0; for (IAtom atom : atoms) { IBond bond = container.getBond(se.getFocus(), atom); IAtom focus = se.getFocus(); Point2d fp = focus.getPoint2d(); for (IAtom atom : container.atoms())
@Test public void normalize() throws InvalidSmilesException { SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer mol = smipar.parseSmiles("C[As@TB3](Cl)(Cl)(C)Cl"); Iterator<IStereoElement> ses = mol.stereoElements().iterator(); assertTrue(ses.hasNext()); IStereoElement se = ses.next(); assertThat(se, instanceOf(TrigonalBipyramidal.class)); assertThat(se.getConfigOrder(), is(3)); TrigonalBipyramidal tb = (TrigonalBipyramidal) se; TrigonalBipyramidal tbNorm = tb.normalize(); assertThat(tbNorm.getCarriers(), is(Arrays.asList( mol.getAtom(0), mol.getAtom(2), mol.getAtom(3), mol.getAtom(5), mol.getAtom(4) ))); }
/** * {@inheritDoc} */ @Override protected TrigonalBipyramidal create(IAtom focus, List<IAtom> carriers, int cfg) { return new TrigonalBipyramidal(focus, carriers.toArray(new IAtom[5]), cfg); } }
/** * 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"); }
private void modifyAndLabel(TrigonalBipyramidal se) { List<IAtom> atoms = se.normalize().getCarriers(); List<IBond> bonds = new ArrayList<>(4); double blen = 0; for (IAtom atom : atoms) { IBond bond = container.getBond(se.getFocus(), atom); IAtom focus = se.getFocus(); Point2d fp = focus.getPoint2d(); for (IAtom atom : container.atoms())
/** * {@inheritDoc} */ @Override protected TrigonalBipyramidal create(IAtom focus, List<IAtom> carriers, int cfg) { return new TrigonalBipyramidal(focus, carriers.toArray(new IAtom[5]), cfg); } }
/** * 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); }
private IStereoElement newTrigonalBipyramidal(int u, int[] vs, IAtom[] atoms, Configuration c) { if (vs.length != 5) return null; int order = 1 + c.ordinal() - Configuration.TB1.ordinal(); if (order < 1 || order > 20) return null; return new TrigonalBipyramidal(atoms[u], new IAtom[]{atoms[vs[0]], atoms[vs[1]], atoms[vs[2]], atoms[vs[3]], atoms[vs[4]]}, order); }
@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(expected = IllegalArgumentException.class) public void badConfigurationOrder() { IAtom a0 = Mockito.mock(IAtom.class); IAtom a1 = Mockito.mock(IAtom.class); IAtom a2 = Mockito.mock(IAtom.class); IAtom a3 = Mockito.mock(IAtom.class); IAtom a4 = Mockito.mock(IAtom.class); IAtom a5 = Mockito.mock(IAtom.class); new TrigonalBipyramidal(a0, new IAtom[]{a1,a2,a3,a4,a5}, 32); } }
@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)); }
@Test(expected = IllegalArgumentException.class) public void tooManyCarriers() { IAtom a0 = Mockito.mock(IAtom.class); IAtom a1 = Mockito.mock(IAtom.class); IAtom a2 = Mockito.mock(IAtom.class); IAtom a3 = Mockito.mock(IAtom.class); IAtom a4 = Mockito.mock(IAtom.class); IAtom a5 = Mockito.mock(IAtom.class); IAtom a6 = Mockito.mock(IAtom.class); new TrigonalBipyramidal(a0, new IAtom[]{a1,a2,a3,a4,a5,a6}, 1); }