How to make a non rectangular slab a rectangular

Hi, I am using Ru(0001) surface for my research project. Here, Ru(0001) is a non rectangular surface. I want to make it rectangular. Now, I am doing it manually but i want to do that automatically. Is there any way to do it automatically? Thanks