  The aim of this article is to provide a complete analysis of the behavior of
a noncontact atomic force microscope (NC-AFM). We start with a review of the
equations of motion of a tip interacting with a surface in which the stability
conditions are first revisited for tapping mode. Adding the equations of
automatic gain control (AGC), which insures constant amplitude of the
oscillations in the NC-AFM, to the equations of motion of the tip, a new
analytical stability criterion that involves proportional and integral gains of
AGC is deduced. Stationary solutions for the shift of frequency and for the
damping signal are obtained. Special attention is paid to the damping signal in
order to clarify its physical origin. The theoretical results are then compared
to those given by a virtual machine. The virtual machine is a set of equations
solved numerically without any approximation. The virtual machine is of great
help in understanding the dynamical behavior of the NC-AFM as images are
recorded. Transient responses of the shift in frequency and of the damping
signal are discussed in relation to the values of proportional and integral
gains of AGC.
