         // sourcesInBlock pieces of data from global memory.
         for (unsigned t = threadIdx.x; t < sourcesInBlock; t += blockDim.x) {
             const unsigned sg = t + sourceStart; // global source index
-            lsrc[t].x = strig[sg].x;
-            lsrc[t].y = strig[sg].y;
-            lsrc[t].z = strig[sg].z;
-            lsrc[t].w = samp[sg];
+            csrc[t].x = strig[sg].x;
+            csrc[t].y = strig[sg].y;
+            csrc[t].z = strig[sg].z;
+            csrc[t].w = samp[sg];
         }
 
         // Must synchronise before computing the signal from these sources.

        // Loop over sources in block.
        for (unsigned s = 0; s < sourcesInBlock; ++s) {
            // Calculate the geometric phase from the source.
            phase = GEOMETRIC_PHASE_2D_HORIZONTAL(x, y,
                    lsrc[s].z, lsrc[s].y, lsrc[s].x, k);

            // Perform complex multiply-accumulate.
            sincosf(phase, &sinPhase, &cosPhase);
            lsignal[threadIdx.x].x += (lsrc[s].w * cosPhase);
            lsignal[threadIdx.x].y += (lsrc[s].w * sinPhase);
        }

        // Must synchronise again before loading in a new block of sources.

{
    // Get the antenna ID that this thread is working on.
    const unsigned a = blockDim.x * blockIdx.x + threadIdx.x;

    // Get the antenna position.
    // (NB. Cannot exit on index condition, as all threads are needed later).
    float x = 0.0f, y = 0.0f;
    if (a < na) {
        x = ax[a];
        y = ay[a];
    }

    // Initialise shared memory to hold complex antenna signal.
    float2* csig = smem;
    float4* csrc = (float4*) (&smem[blockDim.x]);
    csig[threadIdx.x] = make_float2(0.0f, 0.0f);

    // Divide source list up into blocks, and cache the contents of each block
    // in shared memory before using it to accumulate the antenna signal.
