  We investigate the three dimensional lattice XY model with nearest neighbor
interaction. The vector order parameter of this system lies on the vertices of
a cubic lattice, which is embedded in a system with a film geometry. The
orientations of the vectors are fixed at the two opposite sides of the film.
The angle between the vectors at the two boundaries is $\alpha$ where $0 \le
\alpha \le \pi$. We make use of the mean field approximation to study the mean
length and orientation of the vector order parameter throughout the film---and
the Casimir force it generates---as a function of the temperature $T$, the
angle $\alpha$, and the thickness $L$ of the system. Among the results of that
calculation are a Casimir force that depends in a continuous way on both the
parameter $\alpha$ and the temperature and that can be attractive or repulsive.
In particular, by varying $\alpha$ and/or $T$ one controls \underline{both} the
sign \underline{and} the magnitude of the Casimir force in a reversible way.
Furthermore, for the case $\alpha=\pi$, we discover an additional phase
transition occurring only in the finite system associated with the variation of
the orientations of the vectors.
