ScienceSoft, LLC www.ScienceSoft.net 

Shimming is the optimization of shim coil currents to maximize the magnet homogeneity in a volume of interest. The crucial question for this multiparameter optimization which makes the difference between a "black art" and a reliable shimming method is how the current magnet homogeneity is determined.
The most widely used criterion for magnet homogeneity is the "locklevel" which can be thought of as the height of the (deuterium) lock signal. The graphic shows a hypothetical magnetic field plot along the z direction of the magnet.
The goal of shimming is to obtain a constant magnetic field. Suppose the shim coil currents are changed and the following (hypothetical) magnetic field plot is obtained.
The homogeneity obviously worsened but a locklevel indicator would show an improvement because the magnetic field strength is constant over a wider z range than before causing the height of the lock signal to improve. At the same time the lineshape of the signal worsened, but this is of no relevance to the locklevel height. Choosing the locklevel as homogeneity criterion turns shimming into a highly nonlinear optimization problem resulting in a response surface which has numerous local minima likely to trap any human or automated uphill optimization approach. It is crucial however to notice that the complexity of the response surface is a function of the chosen optimization criterion and does not allow any conclusions about the intrinsic complexity of the shimming problem.
ShimIt approaches this problem as follows: Suppose we calculate the average magnetic field strength and determine the absolutevalue area between the observed and average field strength as shown in the figure.
In contrast to the locklevel this area is a true representation of the remaining field inhomogeneity. But such field plots are not easy to obtain. Fortunately, such areas can be determined from the observed lineshape. Consider a sample along the magnet z axis. Each spin in the sample resonates corresponding to the experienced magnetic field strength.
Hence the field plot can be translated into a distribution of resonance frequencies as shown for a coarse grid of positions inside the magnet.
This operation does not preserve the positional information of a field plot and hence is not reversible. But the distortion area in the onedimensional examples above as well as the threedimensional distortion integrals in real magnets are always proportional to the first absolutevalue central moment of the resonance frequency distribution obtained from the resulting NMR line.
The remaining problem is to determine this resonance frequency distribution from an observed NMR line. Unfortunately, dispersion mode signals as well as all phase insensitive methods of displaying NMR data (e.g., absolutevalue mode) cause lineshapes whose first absolutevalue central moment is infinite rendering them unusable for shimming based on lineshape moments. ShimIt determines the resonance frequency distribution from the analysis of the spectral signal using a decomposition model. See U.S. Patent 5,218,299 for details.
The "magic" of the moment criterion is that its associated response surface can be proven to be describable by a linear set of equations. Since a linear set of equations cannot have local minima, ShimIt's inhomogeneity minimization cannot get trapped with a set of shim values far from the best possible homogeneity. Instrumental instabilities determine how close ShimIt can approach this best possible homogeneity in a reasonable amount of time. Notice that the moment criterion makes no assumptions about the number of shims to be adjusted, whether or not a shim coil works, or what the actual shape of a shim's produced magnetic field is. Hence, ShimIt itself does not depend on such factors either.
ScienceSoft, LLC www.ScienceSoft.net 
