void toggleMeasurement(int nAtoms) {
    countPlusIndices[0] = nAtoms;
    int iLast = -1;
    int iThis;
    for (int i = 0; i < nAtoms; i++) {
      if (iLast == (iThis = queuedAtomIndexes[i])) {
        queuedAtomCount = i;
        return;
      }
      iLast = countPlusIndices[i + 1] = iThis;
    }
    viewer.script(Measurement.getMeasurementScript(countPlusIndices));
  }