public bool TryGetDistanceBetweenResidues(int pos1, int pos2, out double distance) { distance = double.MaxValue; foreach (Dictionary <int, Residue> model in _models) { if (model.ContainsKey(pos1) && model.ContainsKey(pos2)) { distance = Math.Min(distance, Residue.Distance(model[pos1], model[pos2])); } } return(distance != double.MaxValue); }