Gets the allPlacedAtoms attribute of the AtomPlacer3D object.

@return    The allPlacedAtoms value
434238
private IAtomContainer getAllPlacedAtoms(IAtomContainer molecule) {
        IAtomContainer placedAtoms = new AtomContainer();
        for (int i = 0; i < molecule.getAtomCount(); i++) {
            if (molecule.getAtom(i).getFlag(CDKConstants.ISPLACED)) {
                placedAtoms.addAtom(molecule.getAtom(i));
            }
        }
        return placedAtoms;
    }
345542
public AtomHashGenerator atomic() {

        if (depth < 0) throw new IllegalArgumentException("no depth specified, use .depth(int)");

        List<AtomEncoder> encoders = new ArrayList<AtomEncoder>();

        // set is ordered
        for (AtomEncoder encoder : encoderSet) {
            encoders.add(encoder);
        }
        encoders.addAll(this.customEncoders);

        // check if suppression of atoms is wanted - if not use a default value
        // we also use the 'Basic' generator (see below)
        boolean suppress = suppression != AtomSuppression.unsuppressed();

        AtomEncoder encoder = new ConjugatedAtomEncoder(encoders);
        SeedGenerator seeds = new SeedGenerator(encoder, suppression);

        AbstractAtomHashGenerator simple = suppress ? new SuppressedAtomHashGenerator(seeds, new Xorshift(),
                makeStereoEncoderFactory(), suppression, depth) : new BasicAtomHashGenerator(seeds, new Xorshift(),
                makeStereoEncoderFactory(), depth);

        // if there is a finder for checking equivalent vertices then the user
        // wants to 'perturb' the hashed
        if (equivSetFinder != null) {
            return new PerturbedAtomHashGenerator(seeds, simple, new Xorshift(), makeStereoEncoderFactory(),
                    equivSetFinder, suppression);
        } else {
            // no equivalence set finder - just use the simple hash
            return simple;
        }
    }
501899
public double[] findGridBoundaries() {
        IAtom[] atoms = AtomContainerManipulator.getAtomArray(protein);
        double[] minMax = new double[6];
        minMax[0] = atoms[0].getPoint3d().x;
        minMax[1] = atoms[0].getPoint3d().x;
        minMax[2] = atoms[0].getPoint3d().y;
        minMax[3] = atoms[0].getPoint3d().y;
        minMax[4] = atoms[0].getPoint3d().z;
        minMax[5] = atoms[0].getPoint3d().z;
        for (int i = 0; i < atoms.length; i++) {
            if (atoms[i].getPoint3d().x > minMax[1]) {
                minMax[1] = atoms[i].getPoint3d().x;
            } else if (atoms[i].getPoint3d().y > minMax[3]) {
                minMax[3] = atoms[i].getPoint3d().y;
            } else if (atoms[i].getPoint3d().z > minMax[5]) {
                minMax[5] = atoms[i].getPoint3d().z;
            } else if (atoms[i].getPoint3d().x < minMax[0]) {
                minMax[0] = atoms[i].getPoint3d().x;
            } else if (atoms[i].getPoint3d().y < minMax[2]) {
                minMax[2] = atoms[i].getPoint3d().y;
            } else if (atoms[i].getPoint3d().z < minMax[4]) {
                minMax[4] = atoms[i].getPoint3d().z;
            }
        }
        return minMax;
    }
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;
    }
649179
public AtomContactSet getAtomContacts() {

		AtomContactSet contacts = new AtomContactSet(cutoff);

		List<Contact> list = getIndicesContacts();

		if (jAtomObjects == null) {
			for (Contact cont : list) {
				contacts.add(new AtomContact(new Pair<Atom>(iAtomObjects[cont.getI()],iAtomObjects[cont.getJ()]),cont.getDistance()));
			}

		} else {
			for (Contact cont : list) {
				contacts.add(new AtomContact(new Pair<Atom>(iAtomObjects[cont.getI()],jAtomObjects[cont.getJ()]),cont.getDistance()));
			}
		}

		return contacts;
	}
1290570
private double[] calculateDistanceBetweenAtomAndBond(IAtom proton, IBond theBond) {
        Point3d middlePoint = theBond.get3DCenter();
        Point3d protonPoint = proton.getPoint3d();
        double[] values = new double[4];
        values[0] = middlePoint.distance(protonPoint);
        values[1] = middlePoint.x;
        values[2] = middlePoint.y;
        values[3] = middlePoint.z;
        return values;
    }
44709
public IAtom getNextPlacedHeavyAtomWithUnplacedAliphaticNeighbour(IAtomContainer molecule) {
        Iterator<IBond> bonds = molecule.bonds().iterator();
        while (bonds.hasNext()) {
            IBond bond = bonds.next();
            IAtom atom0 = bond.getBegin();
            IAtom atom1 = bond.getEnd();
            if (atom0.getFlag(CDKConstants.ISPLACED) && !(atom1.getFlag(CDKConstants.ISPLACED))) {
                if (isAliphaticHeavyAtom(atom1) && isHeavyAtom(atom0)) {
                    return atom0;
                }
            }
            if (atom1.getFlag(CDKConstants.ISPLACED) && !(atom0.getFlag(CDKConstants.ISPLACED))) {
                if (isAliphaticHeavyAtom(atom0) && isHeavyAtom(atom1)) {
                    return atom1;
                }
            }
        }
        return null;
    }
1168875
@Override
    public DescriptorValue calculate(IAtomContainer atomContainer) {
        wienerNumbers = new DoubleArrayResult(2);
        double wienerPathNumber = 0; //wienerPath
        double wienerPolarityNumber = 0; //wienerPol

        matr = ConnectionMatrix.getMatrix(AtomContainerManipulator.removeHydrogens(atomContainer));
        int[][] distances = PathTools.computeFloydAPSP(matr);

        int partial;
        for (int i = 0; i < distances.length; i++) {
            for (int j = 0; j < distances.length; j++) {
                partial = distances[i][j];
                wienerPathNumber += partial;
                if (partial == 3) {
                    wienerPolarityNumber += 1;
                }
            }
        }
        wienerPathNumber = wienerPathNumber / 2;
        wienerPolarityNumber = wienerPolarityNumber / 2;

        wienerNumbers.add(wienerPathNumber);
        wienerNumbers.add(wienerPolarityNumber);
        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), wienerNumbers,
                getDescriptorNames());
    }
569434
private void searchAndPlaceBranches(IAtomContainer molecule, IAtomContainer chain, AtomPlacer3D ap3d,
            AtomTetrahedralLigandPlacer3D atlp3d, AtomPlacer atomPlacer) throws CDKException {
        //logger.debug("****** SEARCH AND PLACE ****** Chain length: "+chain.getAtomCount());
        List atoms = null;
        IAtomContainer branchAtoms = molecule.getBuilder().newInstance(IAtomContainer.class);
        IAtomContainer connectedAtoms = molecule.getBuilder().newInstance(IAtomContainer.class);
        for (int i = 0; i < chain.getAtomCount(); i++) {
            atoms = molecule.getConnectedAtomsList(chain.getAtom(i));
            for (int j = 0; j < atoms.size(); j++) {
                IAtom atom = (IAtom) atoms.get(j);
                if (!(atom.getSymbol()).equals("H") & !(atom.getFlag(CDKConstants.ISPLACED))
                        & !(atom.getFlag(CDKConstants.ISINRING))) {
                    //logger.debug("SEARCH PLACE AND FOUND Branch Atom "+molecule.indexOf(chain.getAtomAt(i))+
                    //		" New Atom:"+molecule.indexOf(atoms[j])+" -> STORE");
                    connectedAtoms.add(ap3d.getPlacedHeavyAtoms(molecule, chain.getAtom(i)));
                    //logger.debug("Connected atom1:"+molecule.indexOf(connectedAtoms.getAtomAt(0))+" atom2:"+
                    //molecule.indexOf(connectedAtoms.getAtomAt(1))+ " Length:"+connectedAtoms.getAtomCount());
                    try {
                        setBranchAtom(molecule, atom, chain.getAtom(i), connectedAtoms, ap3d, atlp3d);
                    } catch (CDKException ex2) {
                        logger.error("SearchAndPlaceBranchERROR: Cannot find enough neighbour atoms due to"
                                + ex2.toString());
                        throw new CDKException("SearchAndPlaceBranchERROR: Cannot find enough neighbour atoms: "
                                + ex2.getMessage(), ex2);
                    }
                    branchAtoms.addAtom(atom);
                    connectedAtoms.removeAllElements();
                }
            }

        }//for ac.getAtomCount
        placeLinearChains3D(molecule, branchAtoms, ap3d, atlp3d, atomPlacer);
    }
592705
public Partition getInitialPartition() {
        int bondCount = atomContainer.getBondCount();
        Map<String, SortedSet<Integer>> cellMap = new HashMap<String, SortedSet<Integer>>();

        // make mini-'descriptors' for bonds like "C=O" or "C#N" etc
        for (int bondIndex = 0; bondIndex < bondCount; bondIndex++) {
            IBond bond = atomContainer.getBond(bondIndex);
            String el0 = bond.getAtom(0).getSymbol();
            String el1 = bond.getAtom(1).getSymbol();
            String boS;
            if (ignoreBondOrders) {
                // doesn't matter what it is, so long as it's constant
                boS = "1";
            } else {
                boolean isArom = bond.getFlag(CDKConstants.ISAROMATIC);
                int orderNumber = (isArom) ? 5 : bond.getOrder().numeric();
                boS = String.valueOf(orderNumber);
            }
            String bondString;
            if (el0.compareTo(el1) < 0) {
                bondString = el0 + boS + el1;
            } else {
                bondString = el1 + boS + el0;
            }
            SortedSet<Integer> cell;
            if (cellMap.containsKey(bondString)) {
                cell = cellMap.get(bondString);
            } else {
                cell = new TreeSet<Integer>();
                cellMap.put(bondString, cell);
            }
            cell.add(bondIndex);
        }

        // sorting is necessary to get cells in order
        List<String> bondStrings = new ArrayList<String>(cellMap.keySet());
        Collections.sort(bondStrings);

        // the partition of the bonds by these 'descriptors'
        Partition bondPartition = new Partition();
        for (String key : bondStrings) {
            SortedSet<Integer> cell = cellMap.get(key);
            bondPartition.addCell(cell);
        }
        bondPartition.order();
        return bondPartition;
    }
994493
@Override
    public DescriptorValue calculate(IAtomContainer atomContainer) {
        int hBondDonors = 0;

        IAtomContainer ac;
        try {
            ac = (IAtomContainer) atomContainer.clone();
        } catch (CloneNotSupportedException e) {
            return getDummyDescriptorValue(e);
        }

        //org.openscience.cdk.interfaces.IAtom[] atoms = ac.getAtoms();
        // iterate over all atoms of this AtomContainer; use label atomloop to allow for labelled continue
        atomloop: for (int atomIndex = 0; atomIndex < ac.getAtomCount(); atomIndex++) {
            IAtom atom = (IAtom) ac.getAtom(atomIndex);
            // checking for O and N atoms where the formal charge is >= 0
            if ((atom.getSymbol().equals("O") || atom.getSymbol().equals("N")) && atom.getFormalCharge() >= 0) {
                // implicit hydrogens
                Integer implicitH = atom.getImplicitHydrogenCount();
                if (implicitH == CDKConstants.UNSET) implicitH = 0;
                if (implicitH > 0) {
                    hBondDonors++;
                    continue atomloop; // we skip the explicit hydrogens part cause we found implicit hydrogens
                }
                // explicit hydrogens
                java.util.List neighbours = ac.getConnectedAtomsList(atom);
                for (Object neighbour : neighbours) {
                    if (((IAtom) neighbour).getSymbol().equals("H")) {
                        hBondDonors++;
                        continue atomloop;
                    }
                }
            }
        }

        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
                hBondDonors), getDescriptorNames());
    }
173393
@Override
    public DescriptorValue calculate(IAtomContainer container) {
        IAtomContainer local = AtomContainerManipulator.removeHydrogens(container);

        int tradius = PathTools.getMolecularGraphRadius(local);
        int tdiameter = PathTools.getMolecularGraphDiameter(local);

        DoubleArrayResult retval = new DoubleArrayResult();
        retval.add((double) (tdiameter - tradius) / (double) tradius);

        // get the 3D distance matrix
        if (GeometryUtil.has3DCoordinates(container)) {
            int natom = container.getAtomCount();
            double[][] distanceMatrix = new double[natom][natom];
            for (int i = 0; i < natom; i++) {
                for (int j = 0; j < natom; j++) {
                    if (i == j) {
                        distanceMatrix[i][j] = 0.0;
                        continue;
                    }

                    Point3d a = container.getAtom(i).getPoint3d();
                    Point3d b = container.getAtom(j).getPoint3d();
                    distanceMatrix[i][j] = Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)
                            + (a.z - b.z) * (a.z - b.z));
                }
            }
            double gradius = 999999;
            double gdiameter = -999999;
            double[] geta = new double[natom];
            for (int i = 0; i < natom; i++) {
                double max = -99999;
                for (int j = 0; j < natom; j++) {
                    if (distanceMatrix[i][j] > max) max = distanceMatrix[i][j];
                }
                geta[i] = max;
            }
            for (int i = 0; i < natom; i++) {
                if (geta[i] < gradius) gradius = geta[i];
                if (geta[i] > gdiameter) gdiameter = geta[i];
            }
            retval.add((gdiameter - gradius) / gradius);
        } else {
            retval.add(Double.NaN);
        }

        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval,
                getDescriptorNames());
    }
333972
private final double[] getAprxBounds(IAtomContainer mol) {
        double maxX = -Double.MAX_VALUE;
        double maxY = -Double.MAX_VALUE;
        double minX = Double.MAX_VALUE;
        double minY = Double.MAX_VALUE;
        IAtom[] boundedAtoms = new IAtom[4];
        for (int i = 0; i < mol.getAtomCount(); i++) {
            IAtom atom = mol.getAtom(i);
            if (atom.getPoint2d() != null) {
                if (atom.getPoint2d().x < minX) {
                    minX = atom.getPoint2d().x;
                    boundedAtoms[0] = atom;
                }
                if (atom.getPoint2d().y < minY) {
                    minY = atom.getPoint2d().y;
                    boundedAtoms[1] = atom;
                }
                if (atom.getPoint2d().x > maxX) {
                    maxX = atom.getPoint2d().x;
                    boundedAtoms[2] = atom;
                }
                if (atom.getPoint2d().y > maxY) {
                    maxY = atom.getPoint2d().y;
                    boundedAtoms[3] = atom;
                }
            }
        }
        double[] minmax = new double[4];
        minmax[0] = minX;
        minmax[1] = minY;
        minmax[2] = maxX;
        minmax[3] = maxY;
        double minXAdjust = adjustForHydrogen(boundedAtoms[0], mol);
        double maxXAdjust = adjustForHydrogen(boundedAtoms[1], mol);
        if (minXAdjust < 0) minmax[0] += minXAdjust;
        if (maxXAdjust > 0) minmax[1] += maxXAdjust;
        return minmax;
    }
2425
public double getBondLength() {
        double epsilon = 1e-3;
        PharmacophoreAtom atom1 = (PharmacophoreAtom) getAtom(0);
        PharmacophoreAtom atom2 = (PharmacophoreAtom) getAtom(1);
        PharmacophoreAtom atom3 = (PharmacophoreAtom) getAtom(2);

        double a2 = atom3.getPoint3d().distanceSquared(atom1.getPoint3d());
        double b2 = atom3.getPoint3d().distanceSquared(atom2.getPoint3d());
        double c2 = atom2.getPoint3d().distanceSquared(atom1.getPoint3d());

        double cosangle = (b2 + c2 - a2) / (2 * Math.sqrt(b2) * Math.sqrt(c2));
        if (-1.0 - epsilon < cosangle && -1.0 + epsilon > cosangle) return 180.0;
        if (1.0 - epsilon < cosangle && 1.0 + epsilon > cosangle) return 0.0;

        return Math.acos(cosangle) * 180.0 / Math.PI;
    }
89588
public com.google.protobuf.ByteString
      getAllocatorNameBytes() {
    java.lang.Object ref = allocatorName_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      allocatorName_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
37133
private int getAtomTypeXCount(IAtomContainer ac, IAtom atom) {
        List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
        int nocounter = 0;
        IBond bond;
        for (IAtom neighbour : neighbours) {
            if ((neighbour.getSymbol().equals("N") || neighbour.getSymbol().equals("O"))
                    && !(Boolean) neighbour.getProperty("IS_IN_AROMATIC_RING")) {
                //if (ac.getMaximumBondOrder(neighbours[i]) == 1.0) {
                bond = ac.getBond(neighbour, atom);
                if (bond.getOrder() != IBond.Order.DOUBLE) {
                    nocounter += 1;
                }
            }
        }
        return nocounter;
    }
1318325
public static List<Point3d> atomsToPoints(Collection<Atom> atoms) {
		ArrayList<Point3d> points = new ArrayList<>(atoms.size());
		for (Atom atom : atoms) {
			points.add(atom.getCoordsAsPoint3d());
		}
		return points;
	}