private void scan() {

		if (updateList) {

			for (int i = 0; i < numberOfAtoms - 1; i++) {
				for (int j = i + 1; j < numberOfAtoms; j++) {
					xij = atom[i].rx - atom[j].rx;
					yij = atom[i].ry - atom[j].ry;
					rij = xij * xij + yij * yij;
					bondLength = getBondLength(atom[i], atom[j]);
					if (rij <= bondLength * bondLength)
						collide(i, j);
				}
			}

		}
		else {

			int i, j, jbeg, jend, jnab;
			for (i = 0; i < numberOfAtoms - 1; i++) {
				jbeg = pointer[i];
				jend = pointer[i + 1];
				if (jbeg < jend) {
					for (jnab = jbeg; jnab < jend; jnab++) {
						j = neighborList[jnab];
						xij = atom[i].rx - atom[j].rx;
						yij = atom[i].ry - atom[j].ry;
						rij = xij * xij + yij * yij;
						bondLength = getBondLength(atom[i], atom[j]);
						if (rij <= bondLength * bondLength)
							collide(i, j);
					}
				}
			}

		}

	}