We propose a method to compute approximate eigenpairs of the Schrödinger operator on a bounded domain in the presence of an electromagnetic field. The method is formulated for the simplicial grids that satisfy the discrete maximum principle. It combines techniques from lattice gauge theory and finite element methods, retaining the discrete gauge invariance of the former but allowing for non-congruent space elements as in the latter. The error in the method is studied in the framework of Strang's variational crimes, comparing with a standard Galerkin approach. For a smooth electromagnetic field the crime is of order the mesh width h, for a Coulomb potential it is of order h|log h|, and for a general finite energy electromagnetic field it is of order h1/2.