The Evans wave equation is derived from the appropriate Lagrangian and action, identifying the origin of the Planck constant ħ in general relativity. The classical Fermat principle of least time, and the classical Hamilton principle of least action, are expressed in terms of a tetrad multiplied by a phase factor exp(iS/ħ), where S is the action in general relativity. Wave (or quantum) mechanics emerges from these classical principles of general relativity for all matter and radiation fields, giving a unified theory of quantum mechanics based on differential geometry and general relativity. The phase factor exp(iS/ħ) is an eigenfunction of the Evans wave equation and is the origin in general relativity and geometry of topological phase effects in physics, including the Aharonov-Bohm class of effects, the Berry phase, the Sagnac effect, related interferometric effects, and all physical optical effects through the Evans spin field B(3) and the Stokes theorem in differential geometry. The Planck constant ħ is thus identified as the least amount possible of action or angular momentum or spin in the universe. This is also the origin of the fundamental Evans spin field B(3), which is always observed in any physical optical effect. It originates in torsion, spin and the second (or spin) Casimir invariant of the Einstein group. Mass originates in the first Casimir invariant of the Einstein group. These two invariants define any particle.