Avoid common.h inclusion in CUDA code

This is solved nicer in master with I943f90f, but there is little value
in backporting that compared to the effort, since more or less all
changes from there would conflict.  This may fix compilation problems
with some nvcc/boost combinations.

Change-Id: I82a26c60d366bfe5fdbcfd8a17bffdb1139ce017
Improve analysis nbsearch grid mapping

Now the analysis neighborhood search implements its own version of
put_atoms_in_triclinic_unitcell().  While computing the index of the
correct grid cell, it is relatively easy to produce also the coordinates
that lay within that cell instead of using a separate call.  This
provides two benefits:
 - It avoids rare rounding problems if put_atoms_in_triclinic_unitcell()
   would put the atom right at the edge of the box, but the mapping code
   would consider it outside the box, causing out-of-range grid cell
   index to be generated.
 - It allows to customize the grid mapping more freely (e.g., to create
   grids that are not periodic).

Backported from master with minor changes, fixes #1611.  Kept commit
message the same; the second point will be only relevant for master.

Change-Id: Ib7602fa49a1b8f7882a63843322786b3e51e8e32
(cherry-picked from b3e2e82 in master)