Coincidence lattice model for the structure and energy of grain boundaries