Today's energy functions are not able yet to distinguish reliably between correct and almost correct protein models. Improving these near-native models is currently a major bottle-neck in homology modeling or experimental structure determination at low resolution. Increasingly accurate energy functions are required to complete the “last mile of the protein folding problem,” for example during a molecular dynamics simulation. We present a new approach to reach this goal. For 50 high resolution X-ray structures, the complete unit cell was reconstructed, including disordered water molecules, counter ions, and hydrogen atoms. Simulations were then run at the pH at which the crystal was solved, while force-field parameters were iteratively adjusted so that the damage done to the structures was minimal. Starting with initial parameters from the AMBER force field, the optimization procedure converged at a new force field called YAMBER (Yet Another Model Building and Energy Refinement force field), which is shown to do significantly less damage to X-ray structures, often move homology models in the right direction, and occasionally make them look like experimental structures. Application of YAMBER during the CASP5 structure prediction experiment yielded a model for target 176 that was ranked first among 150 submissions. Due to its compatibility with the well-established AMBER format, YAMBER can be used by almost any molecular dynamics program. The parameters are freely available from www.yasara.org/yamber. Proteins 2004. © 2004 Wiley-Liss, Inc.