public static void makeBonds( ArrayList<Atom> atomList, ArrayList<Bond> bondList, int aLoc, int bLoc) { Atom a = atomList.get(aLoc); Atom b = atomList.get(bLoc); if (aLoc != bLoc) { // rough distance if (getRoughDist(a, b) < maxBondLength) { Double dist = getDist(a, b); if (dist < maxBondLength) { boolean skip = false; // System.out.println(atomList.get(target).connectedTo.size()); for (int i = 0; i < b.connectedTo.size(); i++) { if (b.connectedTo.get(i) == aLoc) { skip = true; } } if (!skip) { Bond newBond = new Bond(); newBond.setTargets(aLoc, bLoc); newBond.getBondAvg(a, b); if (stick && dist <= newBond.getMaxDist()) { newBond.setStick(true); } else { newBond.setStick(false); } bondList.add(newBond); bondsMade++; b.connectedTo.add(aLoc); a.connectedTo.add(bLoc); } } } } bondsChecked++; }