 	int yn = (tid - xn*N2)/Nz;
 	int zn = (tid - xn*N2 - yn*Nz);
 
-	float invdet = 2.0f*M_PI/(box.Lx*box.Lz*box.Lz);
+	float invdet = 6.28318531f/(box.Lx*box.Lz*box.Lz);
 	float3 inverse_lattice_vector, j;
+	float kappa2 = kappa*kappa;
 
 	inverse_lattice_vector.x = invdet*box.Ly*box.Lz;
 	inverse_lattice_vector.y = invdet*box.Lx*box.Lz;

    cufftExecC2C(es_data.plan, es_data.GPU_rho_real_space, es_data.GPU_rho_real_space, CUFFT_FORWARD);
    cudaThreadSynchronize();
    
    combined_green_e_kernel <<< new_gridsize, new_blockzise >>> (es_data.GPU_E_x, es_data.GPU_E_y, es_data.GPU_E_z, es_data.GPU_k_vec, es_data.GPU_rho_real_space,  es_data.Nx, es_data.Ny, es_data.Nz, es_data.GPU_green_hat);
       

    //backtransform field:

	temp =  floor(((es_data.kappa*CPU_box.Lz/(M_PI*es_data.Nz)) *  pow(-log(EPS_HOC),0.25)));
	int nbz = (int)temp;

	reset_kvec_green_hat <<< new_gridsize, new_blocksize >>>(box, es_data.Nx, es_data.Ny, es_data.Nz, es_data.interpolation_order, es_data.kappa, es_data.GPU_k_vec, es_data.GPU_green_hat, es_data.vg, nbx, nby, nbz, es_data.gf_b);
	cudaThreadSynchronize();
	CPU_box_old.Lx = CPU_box.Lx;
	CPU_box_old.Ly = CPU_box.Ly;
