Electromagnetic cavity

An electromagnetic cavity is a cavity that acts as a container for electromagnetic fields such as photons, in effect containing their wave function inside. The size of the cavity determines the maximum photon wavelength that can be trapped. Additionally, it produces quantized energy levels for trapped charged particles like electrons and protons. The earth's magnetic field in effect places the earth in an electromagnetic cavity.
Physical description of electromagnetic cavities.
Electromagnetic cavities are represented by potential wells, also called "boxes", which can be of limited or unlimited depth V0.
Quantum-mechanic boxes are described by the time-independent Schrödinger equation:
with the additional boundary conditions 
which leads to real solutions for the wave functions if the net energy of the particle is negative., i.e. if the particle is in a bound state.
Applications of electromagnetic cavities.
Electrons which are trapped in an electromagnetic cavity are in a bound state and thus organise themselves as they do in a regular atom, thus expressing chemical-like behaviour. Several researchers have proposed to develop programmable matter by varying the number of trapped electrons in those cavities.
The discrete energy levels of electromagnetic cavities are exploited to produce photons of desired frequencies and thus are essential for nano- or submicrometre-scale laser devices.