Fix spherical d functions

A segfault occurs because the loop ran one element too far.

Change-Id: I1d1cdba5a7514f83a88955970eb79a7e1328ecc9
Merge topic 'spherical-d-fix' into master

31d16711 Fix spherical d functions