Generating derivative structures from multilattices: Algorithm and application to hcp alloys