how to calculate minimum distance between two groups of atoms

Which command can calculate the minimum distance between two groups of atoms automatically?