  We develop an algorithm for setting up initial Gaussian random density and
velocity fields containing one or more peaks or dips, in an arbitrary
cosmological scenario. The intention is to generate appropriate initial
conditions for cosmological N-body simulations that focus on the evolution of
the progenitors of the present-day galaxies and clusters. The procedure is an
application of the direct and accurate prescription of Hoffman & Ribak (1991)
for generating constrained random fields.
  For each peak a total of 21 physical characteristics can be specified,
including its scale, position, density Hessian, velocity, and velocity
gradient. The velocity (or, equivalently, gravity) field constrants are based
on a generalization of the formalism developed by Bardeen et al. (1986). The
resulting density field is sculpted such that it induces the desired amount of
net gravitational and tidal forces.
  We provide a detailed mathematical presentation of the formalism. Afterwards
we provide analytical estimates of the likelihood of the imposed constraints.
Amongst others, it is shown that the tidal field has a strong tendency to align
itself along the principal axes of the mass tensor. The method is illustrated
by means of some concrete examples. In addition to the illustration of
constraint-field correlation functions and how they add up to the mean fields,
followed by illustrations of the variance characteristics of field
realizations, we concentrate in particular on the consequences of imposing
gravitational field constraints (or, equivalent in the linear regime for
growing mode fluctuations, peculiar velocity field constraints).
