  We develop a general methodology for numerical computations of
electromagnetic (EM) fields and forces in matter, based on solving the
macroscopic Maxwell's equations in real space and adopting the Maxwell Stress
Tensor formalism. Our approach can be applied to both dielectric and metallic
systems of frequency-dependent dielectric function; as well as to objects of
any size and geometrical properties in principle. We are particularly
interested in calculating forces on nanostructures. We find that a body reacts
to the EM field by minimising its energy, i.e. it is attracted (repelled) by
regions of lower (higher) EM energy. When travelling waves are involved, forces
can be additionally understood in terms of momentum exchange between the body
and its environment. However when evanescent waves dominate, the forces are
complicated, often become attractive and cannot be explained by means of real
momentum being exchanged. We study the EM forces induced by a laser beam on a
crysta! l of dielectric GaP spheres. We ob serve effects due to the lattice
structure, as well as due to single scattering from each sphere. In the former
case the two main features are a maximum momentum exchange when the frequency
lies within a band gap; and a multitude of force orientations when the Bragg
conditions for multiple outgoing waves are met. In the latter case the
radiation couples to the EM eigenmodes of isolated spheres (Mie resonances) and
very sharp attractive and repulsive forces occur. Depending on the intensity of
the incident radiation these forces can overcome all other interactions present
(gravitational, thermal and Van der Waals) and may provide the main mechanism
for formation of stable structures in colloidal systems.
