A structure registry condition for the interaction energy between two solids