  We present an analysis and numerical study of an optimal control problem for
the Landau-de Gennes (LdG) model of nematic liquid crystals (LCs), which is a
crucial component in modern technology. They exhibit long range orientational
order in their nematic phase, which is represented by a tensor-valued (spatial)
order parameter $Q = Q(x)$. Equilibrium LC states correspond to $Q$ functions
that (locally) minimize an LdG energy functional. Thus, we consider an
$L^2$-gradient flow of the LdG energy that allows for finding local minimizers
and leads to a semi-linear parabolic PDE, for which we develop an optimal
control framework. We then derive several a priori estimates for the forward
problem, including continuity in space-time, that allow us to prove existence
of optimal boundary and external ``force'' controls and to derive optimality
conditions through the use of an adjoint equation. Next, we present a simple
finite element scheme for the LdG model and a straightforward optimization
algorithm. We illustrate optimization of LC states through numerical
experiments in two and three dimensions that seek to place LC defects (where
$Q(x) = 0$) in desired locations, which is desirable in applications.
