fixed order of loops in rokko/utility/spin_hamiltonian.hpp