Fixed the branch ordering

This PR fixes a critical bug in the ordering of the GSIM logic tree branches. As a consequence a wrong number of realizations was generated. No tests covered that bug, but it was affecting Yufang's SHARE computation, by generating 20 realizations instead of 320, so I discovered it. Since this is a serious problem I am going to give a LGTM to myself and open a ticket to add a test covering the issue: https://bugs.launchpad.net/oq-engine/+bug/1354281.
The fix is consistent with the current tests: https://ci.openquake.org/job/zdevel_oq-engine/549