                                                                       (cuDoubleComplex*)psi_it,
                                                                       wt,
                                                                       it_density_matrix);
-        }
-    }
-}
-
-
+            cuda_check_last_error(__FILE__, __LINE__);
+        }
+    }
+}
+
+


extern "C" void cufft_set_work_area(void* work_area)
{
    if (cufftSetWorkArea(plan, work_area) != CUFFT_SUCCESS)
    {
        printf("failed to execute cufftSetWorkArea()\n");
        exit(0);
    }
}

extern "C" void cufft_destroy_batch_plan()
{
    cufftDestroy(plan);
}

//= __global__ void cufft_batch_apply_v_kernel(int fft_size, cuDoubleComplex* v_r, cuDoubleComplex* fft_buffer)

                                                                      (cuDoubleComplex*)psi_it,
                                                                      wt,
                                                                      it_density_matrix);
            cuda_check_last_error(__FILE__, __LINE__);
        }
        case 0:
        {
