Program: 17010
Project: 17010
Buggy source:
/** 
 * Returns a Jmol script which will display the axis of rotation. This consists of a cyan arrow along the axis, plus an arc showing the angle of rotation. <p>As the rotation angle gets smaller, the axis of rotation becomes poorly defined and would need to get farther and farther away from the protein. This is not particularly useful, so we arbitrarily draw it parallel to the translation and omit the arc.
 * @param atoms Some atoms from the protein, used for determining the boundsof the axis.
 * @return The Jmol script, suitable for calls to{@link org.biojava.bio.structure.align.gui.jmol.StructureAlignmentJmol#evalString() jmol.evalString()}
 */
public String getJmolScript(Atom[] atoms){
  final double width=.5;
  double min, max;
  min=max=Calc.skalarProduct(rotationAxis,atoms[0]);
  for (int i=1; i < atoms.length; i++) {
    double prod=Calc.skalarProduct(rotationAxis,atoms[i]);
    if (prod < min)     min=prod;
    if (prod > max)     max=prod;
  }
  double uLen=Calc.skalarProduct(rotationAxis,rotationAxis);
  min/=uLen;
  max/=uLen;
  Atom axialPt;
  if (rotationPos == null) {
    Atom center=Calc.centerOfMass(atoms);
    Atom centerOnAxis=Calc.scale(rotationAxis,Calc.skalarProduct(center,rotationAxis));
    axialPt=Calc.subtract(center,centerOnAxis);
  }
 else {
    axialPt=rotationPos;
  }
  Atom axisMin=(Atom)axialPt.clone();
  Calc.scaleAdd(min,rotationAxis,axisMin);
  Atom axisMax=(Atom)axialPt.clone();
  Calc.scaleAdd(max,rotationAxis,axisMax);
  StringWriter result=new StringWriter();
  result.append("String_Node_Str");
  result.append(String.format("String_Node_Str",axisMin.getX(),axisMin.getY(),axisMin.getZ(),axisMax.getX(),axisMax.getY(),axisMax.getZ(),width));
  if (rotationPos != null) {
    result.append(System.getProperty("String_Node_Str"));
    result.append(String.format("String_Node_Str",axisMin.getX(),axisMin.getY(),axisMin.getZ(),axisMax.getX(),axisMax.getY(),axisMax.getZ(),Math.toDegrees(theta),width));
  }
  return result.toString();
}

Fixed version (ground truth):
/** 
 * Returns a Jmol script which will display the axis of rotation. This consists of a cyan arrow along the axis, plus an arc showing the angle of rotation. <p>As the rotation angle gets smaller, the axis of rotation becomes poorly defined and would need to get farther and farther away from the protein. This is not particularly useful, so we arbitrarily draw it parallel to the translation and omit the arc.
 * @param atoms Some atoms from the protein, used for determining the boundsof the axis.
 * @return The Jmol script, suitable for calls to{@link org.biojava.bio.structure.align.gui.jmol.StructureAlignmentJmol#evalString() jmol.evalString()}
 */
public String getJmolScript(Atom[] atoms){
  final double width=.5;
  final double extraAxis=5.;
  final String color="String_Node_Str";
  double min, max;
  min=max=Calc.skalarProduct(rotationAxis,atoms[0]);
  for (int i=1; i < atoms.length; i++) {
    double prod=Calc.skalarProduct(rotationAxis,atoms[i]);
    if (prod < min)     min=prod;
    if (prod > max)     max=prod;
  }
  double uLen=Calc.skalarProduct(rotationAxis,rotationAxis);
  min/=uLen;
  max/=uLen;
  Atom axialPt;
  if (rotationPos == null) {
    Atom center=Calc.centerOfMass(atoms);
    Atom centerOnAxis=Calc.scale(rotationAxis,Calc.skalarProduct(center,rotationAxis));
    axialPt=Calc.subtract(center,centerOnAxis);
  }
 else {
    axialPt=rotationPos;
  }
  Atom axisMin=(Atom)axialPt.clone();
  Calc.scaleAdd(min - extraAxis,rotationAxis,axisMin);
  Atom axisMax=(Atom)axialPt.clone();
  Calc.scaleAdd(max + extraAxis,rotationAxis,axisMax);
  StringWriter result=new StringWriter();
  result.append("String_Node_Str");
  result.append(String.format("String_Node_Str",axisMin.getX(),axisMin.getY(),axisMin.getZ(),axisMax.getX(),axisMax.getY(),axisMax.getZ(),width,color));
  if (rotationPos != null) {
    result.append(System.getProperty("String_Node_Str"));
    result.append(String.format("String_Node_Str",axisMin.getX(),axisMin.getY(),axisMin.getZ(),axisMax.getX(),axisMax.getY(),axisMax.getZ(),Math.toDegrees(theta),width,color));
  }
  return result.toString();
}