Buil grain boundary of metal oxide

Dear all

Could you please let me know how to build grain boundary of metal oxide ( especially HfO2)

I understand that to build grain boundary we use layer to connect 2 surfaces . However , I can not solve problem to minimize total energy at grain boundary as well dangling bond between two surface .
Could you pls help me on this ?

I am very deep appreciated your help on that.

I look forward to hearing from all you soon