An optimized method based on the principle of simulated annealing is presented for determining the relative position and orientation of interacting molecules. The spatial relationships of these molecules are described by intermolecular distance constraints between specific pairs of atoms, such as found in hydrogen bonds or from experimentally determined data. The method makes use of a random walk through six rotational and translational degrees of freedom where the constituent molecules are treated as rigid bodies. Van der Waals repulsions are used only to define a lower bound on distances between constrained atom pairs within the docking procedure. A cost function comprised of purely geometric constraints is optimized via simulated annealing, in order to search for the best orientation and position of the two molecules. Our docking procedure is applied to eight serine proteinase complexes from the Brookhaven Protein Data Bank. For each simulation 100 computations were performed. A typical docking computation requires only a few seconds of CPU time on a VAXserver 3500. The influence of the number of constraints on the final docked positions was studied. The sensitivity of the docking procedure to a ligand structure which is not well defined is also addressed. Possible applications of this method include using approximate distances incorporating complete energy functions.