Say I have a bulk FCC Pt structure obtained from Materials Project with a lattice constant a = 3.94 Å. I first did DFT to relax the bulk structure, and the optimized lattice constant becomes for example a = 3.80 Å. Then I cut it to obtain a 5-layer Pt(111) surface slab and again relaxed it using DFT. Now I have a Pt(111) surface slab with both lattice parameters and atomic positions slightly perturbed from the reference surface that one can obtain by directly cutting the bulk structure from Materials Project without any relaxation.
My question is: how can I apply a transformation directly to the perturbed surface slab, so that the cell and all atomic positions are exactly corresponding to the reference bulk Pt with a = 3.94 Å? Note that building a new surface from scratch is not an option, because the perturbed surface slab may already involve a lot of user-postprocessing (e.g. expanding/transforming cell, adding vacuum layer, cutting termination, etc) and I want to apply the transformation while keeping these postprocessing. I would like a general solution that works for all types of crystal structures, not just for FCC. Any suggestions or ideas are welcome.
Edit: my current idea is to develop an algorithm that can efficiently find a surface unit cell in the whole bulk lattice space that is the most similar to the perturbed surface unit cell (according to some topology-based similarity measure, any suggestion?). However, even though I know the orientation of the surface (i.e. the Miller index), there are still too many surface unit cells to search through.