public static double Distance(Residue r1, Residue r2) { double minDist = double.MaxValue; foreach (Atom a1 in r1._atoms) { foreach (Atom a2 in r2._atoms) { double dist = Atom.Distance(a1, a2); minDist = Math.Min(dist, minDist); } } return(minDist); }