We present an algorithm to build self-avoiding lattice models of chain molecules with low RMS deviation from their actual 3D structures. To find the optimal coordinates for the lattice chain model, we minimize a function that consists of three terms: (1) the sum of squared deviations of link coordinates on a lattice from their off-lattice values, (2) the sum of "short-range" terms, penalizing violation of chain connectivity, and (3) the sum of "long-range" repulsive terms, penalizing chain self-intersections. We treat this function as a chain molecule "energy" and minimize it using self-consistent field (SCF) theory to represent the pairwise link repulsions as 3D fields acting on the links. The statistical mechanics of chain molecules enables computation of the chain distribution in this field on the lattice. The field is refined by iteration to become self-consistent with the chain distribution, then dynamic programming is used to find the optimal lattice model as the "lowest-energy" chain pathway in this SCF. We have tested the method on one of the coarsest (and most difficult) lattices used for model building on proteins of all structural types and show that the method is adequate for building self-avoiding models of proteins with low RMS deviations from the actual structures.