ChiIndexUtils { protected static double deltavSulphur(IAtom atom, IAtomContainer atomContainer) { if (atom.getAtomicNumber() != IElement.S) return -1; List<IAtom> connected = atomContainer.getConnectedAtomsList(atom); for (IAtom connectedAtom : connected) { if (connectedAtom.getAtomicNumber() == IElement.S && atomContainer.getBond(atom, connectedAtom).getOrder() == IBond.Order.SINGLE) return .89; } int count = 0; for (IAtom connectedAtom : connected) { if (connectedAtom.getAtomicNumber() == IElement.O && atomContainer.getBond(atom, connectedAtom).getOrder() == IBond.Order.DOUBLE) count++; } if (count == 1) return 1.33; else if (count == 2) return 2.67; return -1; }  static List<List<Integer>> getFragments(IAtomContainer atomContainer, QueryAtomContainer[] queries); static double evalSimpleIndex(IAtomContainer atomContainer, List<List<Integer>> fragLists); static double evalValenceIndex(IAtomContainer atomContainer, List<List<Integer>> fragList);  }
@Test public void testDeltaVSulphurSO() { IAtom s = builder.newInstance(IAtom.class, "S"); IAtom o = builder.newInstance(IAtom.class, "O"); IBond b = builder.newInstance(IBond.class, s, o); b.setOrder(IBond.Order.DOUBLE); IAtomContainer m = builder.newInstance(IAtomContainer.class); m.addAtom(s); m.addAtom(o); m.addBond(b); double deltav = ChiIndexUtils.deltavSulphur(s, m); Assert.assertEquals(1.33, deltav, 0.01); }
@Test public void testDeltaVSulphurSO2() { IAtom s = builder.newInstance(IAtom.class, "S"); IAtom o1 = builder.newInstance(IAtom.class, "O"); IAtom o2 = builder.newInstance(IAtom.class, "O"); IBond b1 = builder.newInstance(IBond.class, s, o1); IBond b2 = builder.newInstance(IBond.class, s, o2); b1.setOrder(IBond.Order.DOUBLE); b2.setOrder(IBond.Order.DOUBLE); IAtomContainer m = builder.newInstance(IAtomContainer.class); m.addAtom(s); m.addAtom(o1); m.addBond(b1); m.addAtom(o2); m.addBond(b2); double deltav = ChiIndexUtils.deltavSulphur(s, m); Assert.assertEquals(2.67, deltav, 0.01); }