24 void setbxyz(
const int bx_in,
const int by_in,
const int bz_in)
46 int candidate_lists[4] = {4, 3, 5, 2};
50 int tmp = candidate_lists[i];
51 max_bz[i] = nc_size / tmp;
57 if(max_bz[i] % nproc == 0)
66 double res_temp = 0.0;
69 if(max_bz[i]==0)
continue;
70 res_temp = double(max_bz[i] % nproc) / nproc;
74 b_size = candidate_lists[i];
86 res_temp = nc_size % i;
92 else if(res < res_temp)
104 const double gridecut){
106 this->
lat0 = lat0_in;
110 this->
G =
GT.Transpose();
120 int *ibox =
new int[3];
125 ibox[0] = 2 * int(sqrt(
gridecut_lat) * sqrt(lat * lat)) + 1;
130 ibox[1] = 2 * int(sqrt(
gridecut_lat) * sqrt(lat * lat)) + 1;
135 ibox[2] = 2 * int(sqrt(
gridecut_lat) * sqrt(lat * lat)) + 1;
143 for(
int igy = -ibox[1]; igy <= ibox[1]; ++igy)
145 for(
int igx = -ibox[0]; igx <= ibox[0]; ++igx)
151 double modulus = f * (this->
GGT * f);
154 if(n1 < std::abs(igx)) n1 = std::abs(igx);
155 if(n2 < std::abs(igy)) n2 = std::abs(igy);
156 if(n3 < std::abs(igz)) n3 = std::abs(igz);
165 MPI_Allreduce(MPI_IN_PLACE, ibox, 3, MPI_INT, MPI_MAX , this->
pool_world);
169 for (
int i = 0; i < 3; i++)
176 bool done_factoring =
false;
185 done_factoring =
false;
187 while (!done_factoring)
208 done_factoring =
true;
224 if(ibox[0] == ibox[2])
236 if(ibox[1] == ibox[2])
245 this->
bxyz = this->bx * this->
by * this->
bz;
246 if(ibox[0]%this->bx != 0) ibox[0] += (this->bx - ibox[0] % this->bx);
247 if(ibox[1]%this->
by != 0) ibox[1] += (this->
by - ibox[1] % this->
by);
248 if(ibox[2]%this->bz != 0) ibox[2] += (this->bz - ibox[2] % this->bz);
253 this->
nxy =this->
nx * this->
ny;
255 this->nbx = this->
nx /
bx;
256 this->nby = this->ny /
by;
257 this->nbz = this->nz /
bz;
265 const double lat0_in,
267 const int nx_in,
int ny_in,
int nz_in
270 this->
lat0 = lat0_in;
276 this->
G =
GT.Transpose();
310 this->
bxyz = this->bx * this->
by * this->
bz;
311 if(this->
nx%this->bx != 0) this->
nx += (this->bx - this->
nx % this->bx);
312 if(this->
ny%this->
by != 0) this->
ny += (this->
by - this->
ny % this->
by);
313 if(this->
nz%this->bz != 0) this->
nz += (this->bz - this->
nz % this->bz);
314 this->nbx = this->
nx /
bx;
315 this->nby = this->
ny /
by;
316 this->nbz = this->
nz /
bz;
317 this->
nxy = this->
nx * this->
ny;
320 int *ibox =
new int[3];
321 ibox[0] = int((this->
nx-1)/2)+1;
322 ibox[1] = int((this->ny-1)/2)+1;
323 ibox[2] = int((this->nz-1)/2)+1;
326 for(
int igz = -ibox[2]; igz <= ibox[2]; ++igz)
328 for(
int igy = -ibox[1]; igy <= ibox[1]; ++igy)
330 for(
int igx = -ibox[0]; igx <= ibox[0]; ++igx)
334 if(std::abs(igx)<=ibox[0]-1 && std::abs(igy)<=ibox[1]-1 && std::abs(igz)<=ibox[2]-1 )
continue;
339 double modulus = f * (this->
GGT * f);
342 this->gridecut_lat = modulus;
367 for(
int ip = 0 ; ip < this->
poolnproc ; ++ip)
369 this->
numz[ip] = npbz*this->
bz;
370 if(ip < modbz) this->
numz[ip]+=this->bz;
378 this->nbzp = this->
nplane / this->
bz;
380 this->nbxx = this->nbzp * this->nbx * this->nby;
3x3 matrix and related mathamatical operations
Definition matrix3.h:15
3 elements vector
Definition vector3.h:21
T x
Definition vector3.h:23
T y
Definition vector3.h:24
T z
Definition vector3.h:25
void autoset_big_cell_size(int &b_size, const int &nc_size, const int nproc=0)
Definition pw_basis_big.h:39
int nbz
Definition pw_basis_big.h:34
int bx
Definition pw_basis_big.h:31
virtual void initgrids(const double lat0_in, const ModuleBase::Matrix3 latvec_in, const double gridecut)
Definition pw_basis_big.h:103
int nbx
Definition pw_basis_big.h:32
~PW_Basis_Big()
Definition pw_basis_big.h:23
virtual void distribute_r()
distribute real-space grids to different processors
Definition pw_basis_big.h:357
PW_Basis_Big()
Definition pw_basis_big.h:16
int nbzp_start
Definition pw_basis_big.h:37
PW_Basis_Big(std::string device_, std::string precision_)
Definition pw_basis_big.h:19
int by
Definition pw_basis_big.h:31
int nbxx
Definition pw_basis_big.h:36
int nby
Definition pw_basis_big.h:33
void setbxyz(const int bx_in, const int by_in, const int bz_in)
Definition pw_basis_big.h:24
int bz
Definition pw_basis_big.h:31
virtual void initgrids(const double lat0_in, const ModuleBase::Matrix3 latvec_in, const int nx_in, int ny_in, int nz_in)
Definition pw_basis_big.h:264
int bxyz
Definition pw_basis_big.h:31
int nbzp
Definition pw_basis_big.h:35
PW_Basis_Sup()
Definition pw_basis_sup.h:25
int nrxx
Definition pw_basis.h:127
double omega
volume of the cell
Definition pw_basis.h:185
int nx
Definition pw_basis.h:246
int * numz
Definition pw_basis.h:129
ModuleBase::Matrix3 GT
traspose of G
Definition pw_basis.h:183
int nxy
Definition pw_basis.h:246
double tpiba
2pi/lat0
Definition pw_basis.h:179
int poolnproc
Definition pw_basis.h:189
int ny
Definition pw_basis.h:246
int startz_current
Definition pw_basis.h:134
double lat0
unit length for lattice, unit in bohr
Definition pw_basis.h:178
int poolrank
Definition pw_basis.h:190
int nplane
Definition pw_basis.h:135
int full_pw_dim
Definition pw_basis.h:187
ModuleBase::Matrix3 latvec
Unitcell lattice vectors, unit in lat0.
Definition pw_basis.h:181
MPI_Comm pool_world
Definition pw_basis.h:110
ModuleBase::Matrix3 G
reciprocal lattice vector, unit in 1/lat0
Definition pw_basis.h:182
int nxyz
Definition pw_basis.h:246
bool full_pw
Definition pw_basis.h:174
double tpiba2
4pi^2/lat0^2
Definition pw_basis.h:180
int * startz
Definition pw_basis.h:128
ModuleBase::Matrix3 GGT
GGT = G*GT.
Definition pw_basis.h:184
double gridecut_lat
Energy cut off for all fft grids = ecutrho(Ry)*lat0^2/4pi^2, unit in 1/lat0^2.
Definition pw_basis.h:177
int nz
Definition pw_basis.h:246
void ZEROS(std::complex< T > *u, const TI n)
Definition global_function.h:109
const double TWO_PI
Definition constants.h:21