Vectorises the dopair_subset function. A branched version has been implemented that only calls the vectorised version when two cells are face-on as the edge-on and corner-on cases run slower.
dopair_subset