Abstract The structure of the small squash trypsin inhibitor CMTI-I is refined by directly minimizing the difference between the observed two-dimensional nuclear Overhauser enhancement (NOE) intensities and those calculated by the full relaxation matrix approach. To achieve this, a term proportional to this difference was added to the potential energy function of the molecular dynamics program X-PLOR. Derivatives with respect to atomic co-ordinates are calculated analytically. Spin diffusion effects are thus accounted for fully during the refinement. Initial structures for the refinement were those determined recently by solution nuclear magnetic resonance using the isolated two-spin approximation to derive distance range estimates. The fits to the nuclear magnetic resonance data improve significantly with only small shifts in the refined structures during a few cycles of conjugate gradient minimization. However, larger changes (≈ 1 Å) in the conformation occur during simulated annealing, which is accompanied by a further reduction of the difference between experimental and calculated two-dimensional NOE intensities. The refined structures are closer to the X-ray structure of the inhibitor complexed with trypsin than the initial structures. The root-mean-square difference for backbone atoms between the initial structures and the X-ray structure is 0.96 Å, and that between the refined structures and the X-ray structure 0.61 Å.