Increment the implicit hydrogen count of the provided atom. If the atom
was a non-pseudo atom and had an unset hydrogen count an exception is
thrown.

@param atom an atom to increment the hydrogen count of
555112
private static void incrementImplHydrogenCount(final IAtom atom) {
        Integer hCount = atom.getImplicitHydrogenCount();

        if (hCount == null) {
            if (!(atom instanceof IPseudoAtom))
                throw new IllegalArgumentException("a non-pseudo atom had an unset hydrogen count");
            hCount = 0;
        }

        atom.setImplicitHydrogenCount(hCount + 1);
    }
333944
private IAtom setAtom(IAtom atom, String ID) throws NoSuchAtomTypeException {
        IAtomType at = null;
        String key = "";
        List<?> data = null;
        Double value = null;

        at = getAtomType(ID);
        if (atom.getSymbol() == null) {
            atom.setSymbol(at.getSymbol());
        }
        atom.setAtomTypeName(at.getAtomTypeName());
        atom.setFormalNeighbourCount(at.getFormalNeighbourCount());
        key = "vdw" + ID;
        data = (List) parameterSet.get(key);
        value = (Double) data.get(0);
        key = "charge" + ID;
        if (parameterSet.containsKey(key)) {
            data = (List) parameterSet.get(key);
            value = (Double) data.get(0);
            atom.setCharge(value.doubleValue());
        }
        Object color = at.getProperty("org.openscience.cdk.renderer.color");
        if (color != null) {
            atom.setProperty("org.openscience.cdk.renderer.color", color);
        }
        if (at.getAtomicNumber() != 0) {
            atom.setAtomicNumber(at.getAtomicNumber());
        }
        if (at.getExactMass() > 0.0) {
            atom.setExactMass(at.getExactMass());
        }
        return atom;
    }
428430
@Override
    public DescriptorValue calculate(IAtom atom, IAtomContainer container) {
        double value;

        try {
            int i = container.indexOf(atom);
            if (i < 0) throw new CDKException("atom was not a memeber of the provided container");

            // don't modify the original
            container = container.clone();
            atom = container.getAtom(i);

            AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(container);
            LonePairElectronChecker lpcheck = new LonePairElectronChecker();
            lpcheck.saturate(container);
        } catch (CDKException | CloneNotSupportedException e) {
            return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(
                    Double.NaN), NAMES, null);
        }

        value = db.extractAffinity(container, atom);
        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(value),
                                   NAMES);

    }
282368
public static boolean hasNonDeuteratedEquiv(Atom atom, Group currentGroup) {
		if(atom.getElement()==Element.D && currentGroup.hasAtom(replaceFirstChar(atom.getName(),'D', 'H'))) {
			// If it's deuterated and has a non-deuterated brother
			return true;
		}
		return false;
	}
755476
@Override
    public void removeAtom(IAtom atom) {
        int position = getAtomNumber(atom);
        if (position != -1) {
            for (int i = 0; i < bondCount; i++) {
                if (bonds[i].contains(atom)) {
                    removeBond(i);
                    --i;
                }
            }
            for (int i = 0; i < lonePairCount; i++) {
                if (lonePairs[i].contains(atom)) {
                    removeLonePair(i);
                    --i;
                }
            }
            for (int i = 0; i < singleElectronCount; i++) {
                if (singleElectrons[i].contains(atom)) {
                    removeSingleElectron(i);
                    --i;
                }
            }
            removeAtomOnly(position);
        }
        notifyChanged();
    }
882457
public static double getTotalNaturalAbundance(IAtomContainer atomContainer) {
        try {
            Isotopes isotopes = Isotopes.getInstance();
            double abundance = 1.0;
            double hAbundance = isotopes.getMajorIsotope(1).getNaturalAbundance();

            int nImplH = 0;

            for (IAtom atom : atomContainer.atoms()) {
                if (atom.getImplicitHydrogenCount() == null)
                    throw new IllegalArgumentException("an atom had with unknown (null) implicit hydrogens");
                abundance *= atom.getNaturalAbundance();
                for (int h = 0; h < atom.getImplicitHydrogenCount(); h++)
                    abundance *= hAbundance;
                nImplH += atom.getImplicitHydrogenCount();
            }
            return abundance / Math.pow(100, nImplH + atomContainer.getAtomCount());
        } catch (IOException e) {
            throw new RuntimeException("Isotopes definitions could not be loaded", e);
        }
    }
1262817
private static int incrementOrOne(@SuppressWarnings("unused") Object k, Integer i) {
        return i == null ? 1 : Math.addExact(i, 1);
    }
868109
@Override
    public boolean matches(IAtom atom) {
        if (mass == 0)
            return atom.getMassNumber() == null;
        else
            return atom.getMassNumber() != null && mass == atom.getMassNumber();
    }
1199967
public void incrementCount3D(K first, K second, K third, double count) {
    if (depth != 3) {
      wrongDepth(); //throws exception
    }

    this.addToTotal(count);
    GeneralizedCounter<K> next = this.conditionalizeHelper(first);
    next.incrementCount2D(second, third, count);
  }
1366423
@Override
    public void setAtom(IAtom atom, int position) {
        if (atoms[position] == null && atom != null) atomCount++;
        if (atoms[position] != null && atom == null) atomCount--;
        atoms[position] = atom;
    }
705478
public void add(int index, double element)
    {
        if(index == size())//special case, just appending
        {
            add(element);
        }
        else
        {
            boundsCheck(index);
            enlageIfNeeded(1);
            System.arraycopy(array, index, array, index+1, size()-index);
            set(index, element);
            increasedSize(1);
        }
    }
218680
@Override
    public void add(IAtomContainer atomContainer) {
        if (atomContainer instanceof QueryAtomContainer) {
            for (int f = 0; f < atomContainer.getAtomCount(); f++) {
                if (!contains(atomContainer.getAtom(f))) {
                    addAtom(atomContainer.getAtom(f));
                }
            }
            for (int f = 0; f < atomContainer.getBondCount(); f++) {
                if (!contains(atomContainer.getBond(f))) {
                    addBond(atomContainer.getBond(f));
                }
            }
            for (int f = 0; f < atomContainer.getLonePairCount(); f++) {
                if (!contains(atomContainer.getLonePair(f))) {
                    addLonePair(atomContainer.getLonePair(f));
                }
            }
            for (int f = 0; f < atomContainer.getSingleElectronCount(); f++) {
                if (!contains(atomContainer.getSingleElectron(f))) {
                    addSingleElectron(atomContainer.getSingleElectron(f));
                }
            }
            notifyChanged();
        } else {
            throw new IllegalArgumentException("AtomContainer is not of type QueryAtomContainer");
        }
    }
651441
public void addInt(
        @DoNotSub final int index,
        final int element)
    {
        checkIndexForAdd(index);

        @DoNotSub final int requiredSize = size + 1;
        ensureCapacityPrivate(requiredSize);

        if (index < size)
        {
            System.arraycopy(elements, index, elements, index + 1, size - index);
        }

        elements[index] = element;
        size++;
    }
721173
public boolean contains(IAtom atom) {
        for (int i = 0; i < atomCount; i++) {
            if (atoms[i].equals(atom)) {
                return true;
            }
        }
        return false;
    }
439859
@Override
    public boolean matches(IAtom atom) {
        // h counts should be set before match throw runtime exception?
        if (atom.getImplicitHydrogenCount() == null)
            return false;
        return atom.getImplicitHydrogenCount() == hcount;
    }
925797
private int element(IAtom atom) {
        Integer element = atom.getAtomicNumber();
        if (element != null) return element;
        if (atom instanceof IPseudoAtom) return 0;
        throw new IllegalArgumentException("Aromaiticty model requires atomic numbers to be set");
    }
1006377
public int numberOfUnplacedHeavyAtoms(IAtomContainer ac) {
        int nUnplacedHeavyAtoms = 0;
        for (int i = 0; i < ac.getAtomCount(); i++) {
            if (isUnplacedHeavyAtom(ac.getAtom(i))) {
                nUnplacedHeavyAtoms++;
            }
        }
        return nUnplacedHeavyAtoms;
    }