The relative binding thermodynamics of trimethoprim [2,4-diamino-5-(3',4',5'-methoxybenzyl)pyrimidine] congeners to E. coli dihydrofolate reductase have been determined using free energy simulation methods. The thermodynamics associated with methoxy to ethyl substitutions at the 3', 4', and 5' positions on the benzyl ring of trimethoprim have been calculated. The simulations have been carried out for both the binary DHFR/inhibitor and ternary DHFR/NADPH/inhibitor complexes to examine the effects of the cofactor on inhibitor binding. A model structure was computed for the E. coli DHFR ternary complex based upon crystallographic structures of the E. coli DHFR/trimethoprim and L. casei DHFR/NADPH/methotrexate complexes. The conformation of residues 12-25 in the modeled ternary complex, known to undergo a conformational transition upon cofactor binding, reproduces the conformation seen in a recently solved structure of the E. coli DHFR/NADP(+)/folate complex. In six of the seven tested congeners, the transformation from trimethoprim to ethylated derivative is preferred in the DHFR/inhibitor system over the DHFR/inhibitor/NADPH system. Further, the presence of cofactor and the conformational differences in residues 12-25 of the ternary complex have a significant effect on the magnitude of energetic and entropic components associated with the relative binding thermodynamics. The protein environment differences between the binary and ternary complexes affect the overall relative binding free energies in a complex manner which appears to be related to both the degree of inhibitor ethylation and the solvent exposure of the transformed functional groups.