Recently there was a generalization of this formula for arbitrary matrix Hamiltonians that involves a Berry phase-like term stemming from spin or other internal degrees of freedom. The index formula_12 distinguishes the primitive periodic orbits: the shortest period orbits of a given set of initial conditions. formula_13 is the period of the primitive periodic orbit and formula_14 is its classical action. Each primitive orbit retraces itself, leading to a new orbit with action formula_15 and a period which is an integral multiple formula_16 of the primitive period. Hence, every repetition of a periodic orbit is another periodic orbit. These repetitions are separately classified by the intermediate sum over the indices formula_16. formula_18 is the orbit's Maslov index.