GB code: A grain boundary generation code