private void findUnassignedAtoms() { unassignedAtoms = ""; for (int i = 0; i <= atomContainer.getAtomCount() - 1; i++) { if (alogpfrag[i] == 0) unassignedAtoms += (i + 1) + "(" + fragment[i] + "),"; } }
/** * Create an index of atoms for the provided {@code container}. * * @param container the container to index the atoms of * @return the index/lookup of atoms to the index they appear */ private static Map<IAtom, Integer> indexAtoms(IAtomContainer container) { Map<IAtom, Integer> map = Maps.newHashMapWithExpectedSize(container.getAtomCount()); for (int i = 0; i < container.getAtomCount(); i++) map.put(container.getAtom(i), i); return map; }
public String buildSmart() { final BitSet visited = new BitSet(molecule.getAtomCount()); for (int k=0, n = molecule.getAtomCount(); k < n; ++k) { if (!selected.get(k)) visited.set(k, true); } int atom = selected.nextSetBit(0); final StringBuilder buffer = new StringBuilder(); writeAtomWithNeighbourhood(visited, buffer, atom); return buffer.toString(); }
/**{@inheritDoc} */ @Override public Cycles find(IAtomContainer molecule) throws Intractable { return find(molecule, molecule.getAtomCount()); }
/**{@inheritDoc} */ @Override public Cycles find(IAtomContainer molecule) throws Intractable { return find(molecule, molecule.getAtomCount()); }
private void addRingFragment(IAtomContainer mol) { if (mol.getAtomCount() < minimumFragmentSize) return; long hash = generator.generate(mol); ringMap.put(hash, mol); }
private List<Bounds> generate(List<IAtomContainer> mols, RendererModel model, int atomNum) throws CDKException { List<Bounds> elems = new ArrayList<>(); int num = 0; for (IAtomContainer mol : mols) { elems.add(new Bounds(generate(mol, model, atomNum))); atomNum += mol.getAtomCount(); } return elems; }
@Override public IAtomContainer next() { Point3d[] tmp = coordinates.get(current); for (int j = 0; j < atomContainer.getAtomCount(); j++) { IAtom atom = atomContainer.getAtom(j); atom.setPoint3d(tmp[j]); } last = current++; return atomContainer; }
private Point3d[] getCoordinateList(IAtomContainer atomContainer) { Point3d[] tmp = new Point3d[atomContainer.getAtomCount()]; for (int i = 0; i < atomContainer.getAtomCount(); i++) { IAtom atom = atomContainer.getAtom(i); if (atom.getPoint3d() == null) throw new IllegalArgumentException("Molecule must have 3D coordinates"); tmp[i] = new Point3d(atom.getPoint3d()); } return tmp; }
private Point3d[] getCoordinateList(IAtomContainer atomContainer) { Point3d[] tmp = new Point3d[atomContainer.getAtomCount()]; for (int i = 0; i < atomContainer.getAtomCount(); i++) { IAtom atom = atomContainer.getAtom(i); if (atom.getPoint3d() == null) throw new IllegalArgumentException("Molecule must have 3D coordinates"); tmp[i] = new Point3d(atom.getPoint3d()); } return tmp; }
/** * Marks all the atoms in the given AtomContainer as not placed * *@param ac The AtomContainer whose atoms are to be marked */ static public void markNotPlaced(IAtomContainer ac) { for (int f = 0; f < ac.getAtomCount(); f++) { ac.getAtom(f).setFlag(CDKConstants.ISPLACED, false); } }
private static double[] listConvertion(IAtomContainer container) throws java.io.IOException, ClassNotFoundException { int natom = container.getAtomCount(); double[] scalated = new double[natom]; for (int i = 0; i < natom; i++) { scalated[i] = scaledAtomicMasses(container.getAtom(i)); } return scalated; }
@Override public IAtomType[] findMatchingAtomTypes(IAtomContainer atomContainer) throws CDKException { IAtomType[] types = new IAtomType[atomContainer.getAtomCount()]; int typeCounter = 0; for (IAtom atom : atomContainer.atoms()) { types[typeCounter] = findMatchingAtomType(atomContainer, atom); typeCounter++; } return types; }
/** * Sets the atomsToUnVisited attribute of the ModelBuilder3D object. */ private void setAtomsToUnVisited(IAtomContainer molecule) { for (int i = 0; i < molecule.getAtomCount(); i++) { molecule.getAtom(i).setFlag(CDKConstants.VISITED, false); } }
/** * Configures atoms in an AtomContainer to * carry all the correct data according to their element type. * *@param container The AtomContainer to be configured */ public void configureAtoms(IAtomContainer container) { for (int f = 0; f < container.getAtomCount(); f++) { configure(container.getAtom(f)); } }
public boolean allSaturated(IAtomContainer ac) throws CDKException { logger.debug("Are all atoms saturated?"); for (int f = 0; f < ac.getAtomCount(); f++) { if (!isSaturated(ac.getAtom(f), ac)) { return false; } } return true; }
/** * clean the flags CDKConstants.REACTIVE_CENTER from the molecule. * * @param ac */ private void cleanFlagReactiveCenter(IAtomContainer ac) { for (int j = 0; j < ac.getAtomCount(); j++) ac.getAtom(j).setFlag(CDKConstants.REACTIVE_CENTER, false); for (int j = 0; j < ac.getBondCount(); j++) ac.getBond(j).setFlag(CDKConstants.REACTIVE_CENTER, false); } }
public IAtomContainer resetFlags(IAtomContainer ac) { for (int f = 0; f < ac.getAtomCount(); f++) { ac.getAtom(f).setFlag(CDKConstants.VISITED, false); } for (int f = 0; f < ac.getElectronContainerCount(); f++) { ac.getElectronContainer(f).setFlag(CDKConstants.VISITED, false); } return ac; }
private void testShortLinesForMode(IChemObjectReader.Mode mode) throws Exception { String filename = "data/mdl/glycine-short-lines.mol"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLV2000Reader reader = new MDLV2000Reader(ins, mode); IAtomContainer mol = reader.read(new AtomContainer()); reader.close(); Assert.assertNotNull(mol); Assert.assertEquals(mol.getAtomCount(), 5); Assert.assertEquals(mol.getBondCount(), 4); }
@Test public void testDebugAtomContainer_int_int_int_int() { // create an empty container with predefined // array lengths IAtomContainer ac = new DebugAtomContainer(5, 6, 1, 2); Assert.assertEquals(0, ac.getAtomCount()); Assert.assertEquals(0, ac.getElectronContainerCount()); // test whether the ElectronContainer is correctly initialized ac.addBond(ac.getBuilder().newInstance(IBond.class, ac.getBuilder().newInstance(IAtom.class, "C"), ac.getBuilder().newInstance(IAtom.class, "C"), IBond.Order.DOUBLE)); ac.addLonePair(ac.getBuilder().newInstance(ILonePair.class, ac.getBuilder().newInstance(IAtom.class, "N"))); }