Is the atom terminal having only one connection.

@param atom        an atom
@param atomToIndex a map of atoms to index
@return the atom is terminal
507113
private boolean isTerminal(IAtom atom, Map<IAtom, Integer> atomToIndex) {
        return graph[atomToIndex.get(atom)].length == 1;
    }
915542
private Atom convertAtom(AtomSite atom){


		Atom a = new AtomImpl();

		a.setPDBserial(Integer.parseInt(atom.getId()));
		a.setName(atom.getLabel_atom_id());

		double x = Double.parseDouble (atom.getCartn_x());
		double y = Double.parseDouble (atom.getCartn_y());
		double z = Double.parseDouble (atom.getCartn_z());
		a.setX(x);
		a.setY(y);
		a.setZ(z);

		float occupancy = Float.parseFloat (atom.getOccupancy());
		a.setOccupancy(occupancy);

		float temp = Float.parseFloat (atom.getB_iso_or_equiv());
		a.setTempFactor(temp);

		String alt = atom.getLabel_alt_id();
		if (( alt != null ) && ( alt.length() > 0) && (! alt.equals("."))){
			a.setAltLoc(new Character(alt.charAt(0)));
		} else {
			a.setAltLoc(new Character(' '));
		}

		Element element = Element.R;
		try {
			element = Element.valueOfIgnoreCase(atom.getType_symbol());
		}  catch (IllegalArgumentException e) {
			logger.info("Element {} was not recognised as a BioJava-known element, the element will be represented as the generic element {}", atom.getType_symbol(), Element.R.name());
		}
		a.setElement(element);

		return a;

	}
391626
public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atomA, IAtom atomB) {
        List<IBond> bonds = molecule.getConnectedBondsList(atomA);
        for (IBond bond : bonds) {
            IAtom connectedAtom = bond.getOther(atomA);
            if (isPlacedHeavyAtom(connectedAtom) && !connectedAtom.equals(atomB)) {
                return connectedAtom;
            }
        }
        return null;
    }
344614
public IAtomContainer getPlacedAtomsInAtomContainer(IAtom atom, IAtomContainer ac) {

        List bonds = ac.getConnectedBondsList(atom);
        IAtomContainer connectedAtoms = atom.getBuilder().newInstance(IAtomContainer.class);
        IAtom connectedAtom = null;
        for (int i = 0; i < bonds.size(); i++) {
            connectedAtom = ((IBond) bonds.get(i)).getOther(atom);
            if (connectedAtom.getFlag(CDKConstants.ISPLACED)) {
                connectedAtoms.addAtom(connectedAtom);
            }
        }
        return connectedAtoms;
    }
639116
List<IStereoElement> recognise(Set<Projection> projections) {
        
        if (!projections.contains(Projection.Fischer))
            return Collections.emptyList();

        // build atom index and only recognize 2D depictions
        Map<IAtom,Integer> atomToIndex = new HashMap<IAtom, Integer>();
        for (IAtom atom : container.atoms()) {
            if (atom.getPoint2d() == null)
                return Collections.emptyList();
            atomToIndex.put(atom, atomToIndex.size());
        }
        
        RingSearch ringSearch = new RingSearch(container, graph);
        
        final List<IStereoElement> elements = new ArrayList<IStereoElement>(5);

        for (int v = 0; v < container.getAtomCount(); v++) {

            IAtom    focus = container.getAtom(v);
            Elements elem  = Elements.ofNumber(focus.getAtomicNumber());

            if (elem != Carbon)
                continue;
            if (ringSearch.cyclic(v))
                continue;
            if (stereocenters.elementType(v) != Tetracoordinate)
                continue;
            if (!stereocenters.isStereocenter(v))
                continue;

            ITetrahedralChirality element = newTetrahedralCenter(focus,
                                                                 neighbors(v, graph, bonds));

            if (element == null)
                continue;

            // east/west bonds must be to terminal atoms
            IAtom east = element.getLigands()[EAST];
            IAtom west = element.getLigands()[WEST];
            
            if (!east.equals(focus) && !isTerminal(east, atomToIndex))
                continue;
            if (!west.equals(focus) && !isTerminal(west, atomToIndex))
                continue;
            
            elements.add(element);
        }

        return elements;
    }
1321836
private void checkBond(IAtomContainer atomContainer, int index) throws CDKException {
        IBond bond = atomContainer.getBond(index);

        if (bond != null && bond.getFlag(CDKConstants.SINGLE_OR_DOUBLE)) {
            try {
                oldBondOrder = bond.getOrder();
                bond.setOrder(IBond.Order.SINGLE);
                setMaxBondOrder(bond, atomContainer);
            } catch (CDKException e) {
                bond.setOrder(oldBondOrder);
                logger.debug(e);
            }
        }
    }
1365662
public static Point3d[] atomsToPoints(Atom[] atoms) {
		Point3d[] points = new Point3d[atoms.length];
		for(int i = 0; i< atoms.length;i++) {
			points[i] = atoms[i].getCoordsAsPoint3d();
		}
		return points;
	}
383646
private int getHybridisationState(IAtom atom1) {

        IBond.Order maxBondOrder = atom1.getMaxBondOrder();

        //        if (atom1.getFormalNeighbourCount() == 1 || maxBondOrder > 4) {
        if (atom1.getFormalNeighbourCount() == 1) {
            // WTF??
        } else if (atom1.getFormalNeighbourCount() == 2 || maxBondOrder == IBond.Order.TRIPLE) {
            return 1; //sp
        } else if (atom1.getFormalNeighbourCount() == 3 || (maxBondOrder == IBond.Order.DOUBLE)) {
            return 2; //sp2
        } else {
            return 3; //sp3
        }
        return -1;
    }
1359226
@Override
    public Order getMinimumBondOrder(IAtom atom) {
        IBond.Order min = IBond.Order.QUADRUPLE;
        for (int i = 0; i < bondCount; i++) {
            if (bonds[i].contains(atom) && bonds[i].getOrder().ordinal() < min.ordinal()) {
                min = bonds[i].getOrder();
            }
        }
        return min;
    }
32033
private Set<String> getBooleanConditions(List<Function> atoms, AliasIndex index) {
		Set<String> conditions = new LinkedHashSet<>();
		for (Function atom : atoms) {
			if (atom.isOperation()) {  // Boolean expression
				if (atom.getFunctionSymbol() == ExpressionOperation.AND) {
					// flatten ANDs
					for (Term t : atom.getTerms()) {
						Set<String> arg = getBooleanConditions(ImmutableList.of((Function)t), index);
						conditions.addAll(arg);
					}
				}
				else {
					String condition = getSQLCondition(atom, index);
					conditions.add(condition);
				}
			}
			else if (atom.isDataTypeFunction()) {
				String condition = getSQLString(atom, index, false);
				conditions.add(condition);
			}
		}
		return conditions;
	}
1217666
public List<AtomContact> getContactsWithinDistance(double distance) {

		List<AtomContact> list = new ArrayList<AtomContact>();
		for (AtomContact contact:this.atomContacts) {
			if (contact.getDistance()<distance) {
				list.add(contact);
			}
		}
		return list;
	}
868109
@Override
    public boolean matches(IAtom atom) {
        if (mass == 0)
            return atom.getMassNumber() == null;
        else
            return atom.getMassNumber() != null && mass == atom.getMassNumber();
    }
73612
@Override
    public boolean matches(IAtom atom) {
        String symbol = atom.getSymbol();
        int group = PeriodicTable.getGroup(symbol);
        return group == this.groupNumber;
    }
924119
public static boolean match(String keyword, TargetAtom atom) {
        return atom.getSubstitutedTerms().stream()
                .anyMatch(t -> match(keyword, t));

    }
573931
private int getHalogenCount(IAtomContainer ac, IAtom atom) {
        List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
        int acounter = 0;
        for (IAtom neighbour : neighbours) {
            if (neighbour.getSymbol().equals("F") || neighbour.getSymbol().equals("I")
                    || neighbour.getSymbol().equals("Cl") || neighbour.getSymbol().equals("Br")) {
                acounter += 1;
            }
        }
        return acounter;
    }
1143590
@Override
    public boolean matches(IAtom atom) {
        return Preconditions.checkNotNull(atom.getAtomicNumber(), "Atomic number is not set.").equals(
                this.getAtomicNumber());
    }
1312611
private boolean getPresenceOfSulfat(IAtomContainer ac, IAtom atom) {
        List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
        //org.openscience.cdk.interfaces.IAtom[] second = null;
        //IBond bond = null;
        //int counter = 0;
        for (IAtom neighbour : neighbours) {
            if (neighbour.getSymbol().equals("S") && getOxygenCount(ac, neighbour) >= 2
                    && ac.getConnectedBondsCount(neighbour) == 4) {
                return true;
            }
        }
        return false;
    }