GPUE  v1.0
GPU Gross-Pitaevskii Equation numerical solver for Bose-Einstein condensates
manip.cu
Go to the documentation of this file.
1 ///@endcond
2 //##############################################################################
3 /**
4  * @file manip.cu
5  * @author Lee J. O'Riordan (mlxd)
6  * @date 11/08/2015
7  * @version 0.1
8  */
9  //##############################################################################
10 #include "../include/manip.h"
11 
12 void WFC::phaseWinding(double *phi, int winding, double *x, double *y, double dx, double dy, double posx, double posy, int dim){
13  for(int ii=0; ii < dim; ++ii){
14  for(int jj=0; jj < dim; ++jj){
15  phi[ii*dim +jj] = fmod(winding*atan2(y[jj]-(posy-dim/2+1)*dx, x[ii]-(posx-dim/2+1)*dy),2*PI);
16  }
17  }
18 }
19 
20 void WFC::phaseWinding(double *phi, int winding, double *x, double *y, double dx, double dy, double* posx, double* posy, int sites, int dim){
21  memset(phi,0,dim*dim);
22  for(int a = 0; a< sites; ++a){
23  for(int ii=0; ii < dim; ++ii){
24  for(int jj=0; jj < dim; ++jj){
25  phi[ii*dim +jj] = fmod(phi[ii*dim +jj]
26  + (double)winding*(atan2(y[jj]-(posy[a]-dim/2+1)*dx,
27  x[ii]-(posx[a]-dim/2+1)*dy) ),2*PI);
28  }
29  }
30  }
31 }
32 
33 void WFC::applyPhase(double *phi, double2 *wfc, int dim){
34  for(int ii=dim-1; ii >= 0; --ii){
35  for(int jj=dim-1; jj >= 0; --jj){
36  wfc[ii*dim + jj].x *= cos(phi[ii*dim + jj]);
37  wfc[ii*dim + jj].y *= -sin(phi[ii*dim + jj]);
38  }
39  }
40 }