We describe a methodology to calculate the relative free energies of protein-peptide complex formation. The interaction energy was decomposed into nonpolar, electrostatic and entropic contributions. A free energy-surface area relationship served to calculate the nonpolar free energy term. The electrostatic free energy was calculated with the finite difference Poisson-Boltzmann method and the entropic contribution was estimated from the loss in the conformational entropy of the peptide side chains. We applied this methodology to a series of DnaK*peptide complexes. On the basis of the single known crystal structure of the peptide-binding domain of DnaK with a bound heptapeptide, we modeled ten other DnaK*heptapeptide complexes with experimentally measured K(d) values from 0.06 microM to 11 microM, using molecular dynamics to refine the structures of the complexes. Molecular dynamic trajectories, after equilibration, were used for calculating the energies with greater accuracy. The calculated relative binding free energies were compared with the experimentally determined free energies. Linear scaling of the calculated terms was applied to fit them to the experimental values. The calculated binding free energies were between -7.1 kcal/mol and - 9.4 kcal/mol with a correlation coefficient of 0.86. The calculated nonpolar contributions are mainly due to the central hydrophobic binding pocket of DnaK for three amino acid residues. Negative electrostatic fields generated by the protein increase the binding affinity for basic residues flanking the hydrophobic core of the peptide ligand. Analysis of the individual energy contributions indicated that the nonpolar contributions are predominant compared to the other energy terms even for peptides with low affinity and that inclusion of the change in conformational entropy of the peptide side chains does not improve the discriminative power of the calculation. The method seems to be useful for predicting relative binding energies of peptide ligands of DnaK and might be applicable to other protein-peptide systems, particularly if only the structure of one protein-ligand complex is available.