Note that I moved this - it was posted in an improper thread
Reg. your question: I wouldn't even try
I would wait for 12.2 where this will be really simple to do interactively. I hope we have a preview version out in a few weeks.
Or - ok, I see the point of doing it more automated... You'll have to figure out the full Python yourself (which you seem fully capable of), but my advise is:
- Make sure that all segments you want to align have the same cell size in X and Y
- You should make sure each segment "fits" with its neighbor, i.e. when the cells align, the atoms are positioned correctly in X and Y - this is probably the most difficult part
- In Z, place the atoms on the edge, i.e. first atoms at Z=0 in each cell
- Now you can extract the coordinates and elements from each segment
- Elements are returned as lists, and lists support "+" for concatenating, so that's easy enough
- Coordinates are returned as numpy arrays, so you can add the Z cell lengths of all previous cells to make a new local origin for each segment
- Convert each coordinate array to list (array.tolist()) and again concatenate
- Final cell is the sum of all in Z and common in X and Y