  Complex absorbing potentials (CAPs) are artificial potentials added to
electronic Hamiltonians to make the wavefunction of metastable electronic
states square-integrable. This makes the electronic structure problem of
electronic resonances comparable to that of electronic bound states, thus
reducing the complexity of the problem. CAPs depend on two types of parameters:
the coupling parameter $\eta$ and a set of spatial parameters which define the
onset of the CAP. It has been a common practice over the years to minimize the
CAP perturbation on the physical electronic Hamiltonian by running an
$\eta-$trajectory, whereby one fixes the spatial parameters and varies $\eta$.
The optimal $\eta$ is chosen according to the minimum log-velocity criterion.
But the effectiveness of an $\eta-$trajectory strongly depends on the values of
the fixed spatial parameters.
  In this work, we propose a more general criterion, called the
$\xi-$criterion, which allows one to minimize any CAP parameter, including the
CAP spatial parameters. Indeed, we show that fixing $\eta$ and varying the
spatial parameters according to a scheme (i.e., running a spatial trajectory)
is a more efficient and reliable way of minimizing the CAP perturbations (which
is assessed using the $\xi-$criterion). We illustrate the method by determining
the resonance energy and width of the temporary anion of dinitrogen, at the
Hartree-Fock and EOM-EA-CCSD levels, using two different types of CAPs: the
box- and the smooth Voronoi-CAPs.
