30 void setbxyz(
const int bx_in,
const int by_in,
const int bz_in)
52 int candidate_lists[4] = {4, 3, 5, 2};
56 int tmp = candidate_lists[
i];
57 max_bz[
i] = nc_size / tmp;
63 if(max_bz[
i] % nproc == 0)
72 double res_temp = 0.0;
75 if(max_bz[
i]==0)
continue;
76 res_temp = double(max_bz[
i] % nproc) / nproc;
80 b_size = candidate_lists[
i];
92 res_temp = nc_size %
i;
98 else if(res < res_temp)
110 const double gridecut){
112 this->
lat0 = lat0_in;
126 int *ibox =
new int[3];
131 ibox[0] = 2 * int(sqrt(
gridecut_lat) * sqrt(lat * lat)) + 1;
136 ibox[1] = 2 * int(sqrt(
gridecut_lat) * sqrt(lat * lat)) + 1;
141 ibox[2] = 2 * int(sqrt(
gridecut_lat) * sqrt(lat * lat)) + 1;
149 for(
int igy = -ibox[1]; igy <= ibox[1]; ++igy)
151 for(
int igx = -ibox[0]; igx <= ibox[0]; ++igx)
157 double modulus = f * (this->
GGT * f);
160 if(n1 < std::abs(igx)) n1 = std::abs(igx);
161 if(n2 < std::abs(igy)) n2 = std::abs(igy);
162 if(n3 < std::abs(igz)) n3 = std::abs(igz);
171 MPI_Allreduce(MPI_IN_PLACE, ibox, 3, MPI_INT, MPI_MAX , this->
pool_world);
175 for (
int i = 0;
i < 3;
i++)
182 bool done_factoring =
false;
191 done_factoring =
false;
193 while (!done_factoring)
214 done_factoring =
true;
230 if(ibox[0] == ibox[2])
242 if(ibox[1] == ibox[2])
251 this->
bxyz = this->bx * this->
by * this->
bz;
252 if(ibox[0]%this->bx != 0) ibox[0] += (this->bx - ibox[0] % this->
bx);
253 if(ibox[1]%this->
by != 0) ibox[1] += (this->
by - ibox[1] % this->
by);
254 if(ibox[2]%this->bz != 0) ibox[2] += (this->bz - ibox[2] % this->
bz);
259 this->
nxy =this->
nx * this->
ny;
261 this->nbx = this->
nx /
bx;
262 this->nby = this->ny /
by;
263 this->nbz = this->nz /
bz;
271 const double lat0_in,
273 const int nx_in,
int ny_in,
int nz_in
276 this->
lat0 = lat0_in;
316 this->
bxyz = this->bx * this->
by * this->
bz;
317 if(this->
nx%this->bx != 0) this->
nx += (this->bx - this->
nx % this->
bx);
318 if(this->
ny%this->
by != 0) this->
ny += (this->
by - this->
ny % this->
by);
319 if(this->
nz%this->bz != 0) this->
nz += (this->bz - this->
nz % this->
bz);
320 this->nbx = this->
nx /
bx;
321 this->nby = this->
ny /
by;
322 this->nbz = this->
nz /
bz;
323 this->
nxy = this->
nx * this->
ny;
326 int *ibox =
new int[3];
327 ibox[0] = int((this->
nx-1)/2)+1;
328 ibox[1] = int((this->ny-1)/2)+1;
329 ibox[2] = int((this->nz-1)/2)+1;
332 for(
int igz = -ibox[2]; igz <= ibox[2]; ++igz)
334 for(
int igy = -ibox[1]; igy <= ibox[1]; ++igy)
336 for(
int igx = -ibox[0]; igx <= ibox[0]; ++igx)
340 if(std::abs(igx)<=ibox[0]-1 && std::abs(igy)<=ibox[1]-1 && std::abs(igz)<=ibox[2]-1 )
continue;
345 double modulus = f * (this->
GGT * f);
348 this->gridecut_lat = modulus;
373 for(
int ip = 0 ; ip < this->
poolnproc ; ++ip)
375 this->
numz[ip] = npbz*this->
bz;
376 if(ip < modbz) this->
numz[ip]+=this->
bz;
384 this->nbzp = this->
nplane / this->
bz;
386 this->nbxx = this->nbzp * this->nbx * this->
nby;
const std::complex< double > i
Definition cal_pLpR.cpp:46
3x3 matrix and related mathamatical operations
Definition matrix3.h:19
double e13
Definition matrix3.h:26
Matrix3 Inverse(void) const
Inverse a 3x3 matrix.
Definition matrix3.cpp:44
double e31
Definition matrix3.h:26
double e11
element e_ij: i_row, j_column
Definition matrix3.h:26
double e33
Definition matrix3.h:26
double e32
Definition matrix3.h:26
double e21
Definition matrix3.h:26
double e12
Definition matrix3.h:26
double Det(void) const
Calculate the determinant of a 3x3 matrix.
Definition matrix3.cpp:29
double e23
Definition matrix3.h:26
double e22
Definition matrix3.h:26
Matrix3 Transpose(void) const
Transpose a 3x3 matrix.
Definition matrix3.cpp:39
3 elements vector
Definition vector3.h:24
T x
Definition vector3.h:26
T y
Definition vector3.h:27
T z
Definition vector3.h:28
Definition pw_basis_big.h:17
void autoset_big_cell_size(int &b_size, const int &nc_size, const int nproc=0)
Definition pw_basis_big.h:45
int nbz
Definition pw_basis_big.h:40
int bx
Definition pw_basis_big.h:37
virtual void initgrids(const double lat0_in, const ModuleBase::Matrix3 latvec_in, const double gridecut)
Definition pw_basis_big.h:109
int nbx
Definition pw_basis_big.h:38
~PW_Basis_Big()
Definition pw_basis_big.h:29
virtual void distribute_r()
distribute real-space grids to different processors
Definition pw_basis_big.h:363
PW_Basis_Big()
Definition pw_basis_big.h:22
int nbzp_start
Definition pw_basis_big.h:43
PW_Basis_Big(std::string device_, std::string precision_)
Definition pw_basis_big.h:25
int by
Definition pw_basis_big.h:37
int nbxx
Definition pw_basis_big.h:42
int nby
Definition pw_basis_big.h:39
void setbxyz(const int bx_in, const int by_in, const int bz_in)
Definition pw_basis_big.h:30
int bz
Definition pw_basis_big.h:37
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:270
int bxyz
Definition pw_basis_big.h:37
int nbzp
Definition pw_basis_big.h:41
Special pw_basis class for sup girds, which is constrcuted in order to be consistent with the smooth ...
Definition pw_basis_sup.h:22
int nrxx
Definition pw_basis.h:120
double omega
volume of the cell
Definition pw_basis.h:178
int nx
Definition pw_basis.h:239
int * numz
Definition pw_basis.h:122
ModuleBase::Matrix3 GT
traspose of G
Definition pw_basis.h:176
int nxy
Definition pw_basis.h:239
double tpiba
2pi/lat0
Definition pw_basis.h:172
int poolnproc
Definition pw_basis.h:182
int ny
Definition pw_basis.h:239
int startz_current
Definition pw_basis.h:127
double lat0
unit length for lattice, unit in bohr
Definition pw_basis.h:171
int poolrank
Definition pw_basis.h:183
int nplane
Definition pw_basis.h:128
int full_pw_dim
Definition pw_basis.h:180
ModuleBase::Matrix3 latvec
Unitcell lattice vectors, unit in lat0.
Definition pw_basis.h:174
MPI_Comm pool_world
Definition pw_basis.h:103
ModuleBase::Matrix3 G
reciprocal lattice vector, unit in 1/lat0
Definition pw_basis.h:175
int nxyz
Definition pw_basis.h:239
bool full_pw
Definition pw_basis.h:167
double tpiba2
4pi^2/lat0^2
Definition pw_basis.h:173
int * startz
Definition pw_basis.h:121
ModuleBase::Matrix3 GGT
GGT = G*GT.
Definition pw_basis.h:177
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:170
int nz
Definition pw_basis.h:239
void ZEROS(std::complex< T > *u, const TI n)
Definition global_function.h:109
const double TWO_PI
Definition constants.h:21