Isolated and deposited potassium clusters: Energetic and structural properties