code: private void bendOrStretch(Collection<AtomPair> pairs) {
  
          // without checking which bonds have been bent/stretch already we
          // could end up repeating a lot of repeated work to no avail
          Map<IBond,AtomPair> bendVisit    = new HashMap<>();
          Map<IBond,AtomPair> stretchVisit = new HashMap<>();
  
          IntStack bendStack = new IntStack(atoms.length);
          IntStack stretchStack = new IntStack(atoms.length);
  
          for (AtomPair pair : pairs) {
  
              double score = congestion.score();
  
              // each attempt will be more aggressive/distorting
              for (pair.attempt = 1; pair.attempt <= 3; pair.attempt++) {
  
                  bendStack.clear();
                  stretchStack.clear();
  
                  // attempt both bending and stretching storing the
                  // best result in the provided buffer
                  double bendScore    = bend(pair, bendStack, buffer1, bendVisit);
                  double stretchScore = stretch(pair, stretchStack, buffer2, stretchVisit);
  
                  // bending is better than stretching
                  if (bendScore < stretchScore && bendScore < score) {
                      restoreCoords(bendStack, buffer1);
                      congestion.update(bendStack.xs, bendStack.len);
                      break;
                  }
  
                  // stretching is better than bending
                  else if (bendScore > stretchScore && stretchScore < score) {
                      restoreCoords(stretchStack, buffer2);
                      congestion.update(stretchStack.xs, stretchStack.len);
                      break;
                  }
  
              }
          }
      }
docs: Resolves conflicts either by bending bonds or stretching bonds in the
  shortest path between an overlapping pair. Bending and stretch are tried
  for each pair and the best resolution is used.
  
  @param pairs pairs