29 void setbxyz(
const int bx_in,
const int by_in,
const int bz_in)
51 int candidate_lists[4] = {4, 3, 5, 2};
55 int tmp = candidate_lists[i];
56 max_bz[i] = nc_size / tmp;
62 if(max_bz[i] % nproc == 0)
71 double res_temp = 0.0;
74 if(max_bz[i]==0)
continue;
75 res_temp = double(max_bz[i] % nproc) / nproc;
79 b_size = candidate_lists[i];
91 res_temp = nc_size % i;
97 else if(res < res_temp)
109 const double gridecut){
111 this->
lat0 = lat0_in;
125 int *ibox =
new int[3];
130 ibox[0] = 2 * int(sqrt(
gridecut_lat) * sqrt(lat * lat)) + 1;
135 ibox[1] = 2 * int(sqrt(
gridecut_lat) * sqrt(lat * lat)) + 1;
140 ibox[2] = 2 * int(sqrt(
gridecut_lat) * sqrt(lat * lat)) + 1;
148 for(
int igy = -ibox[1]; igy <= ibox[1]; ++igy)
150 for(
int igx = -ibox[0]; igx <= ibox[0]; ++igx)
156 double modulus = f * (this->
GGT * f);
159 if(n1 < std::abs(igx)) n1 = std::abs(igx);
160 if(n2 < std::abs(igy)) n2 = std::abs(igy);
161 if(n3 < std::abs(igz)) n3 = std::abs(igz);
170 MPI_Allreduce(MPI_IN_PLACE, ibox, 3, MPI_INT, MPI_MAX , this->
pool_world);
174 for (
int i = 0; i < 3; i++)
181 bool done_factoring =
false;
190 done_factoring =
false;
192 while (!done_factoring)
213 done_factoring =
true;
229 if(ibox[0] == ibox[2])
241 if(ibox[1] == ibox[2])
250 this->
bxyz = this->bx * this->
by * this->
bz;
251 if(ibox[0]%this->bx != 0) ibox[0] += (this->bx - ibox[0] % this->
bx);
252 if(ibox[1]%this->
by != 0) ibox[1] += (this->
by - ibox[1] % this->
by);
253 if(ibox[2]%this->bz != 0) ibox[2] += (this->bz - ibox[2] % this->
bz);
258 this->
nxy =this->
nx * this->
ny;
260 this->nbx = this->
nx /
bx;
261 this->nby = this->ny /
by;
262 this->nbz = this->nz /
bz;
270 const double lat0_in,
272 const int nx_in,
int ny_in,
int nz_in
275 this->
lat0 = lat0_in;
315 this->
bxyz = this->bx * this->
by * this->
bz;
316 if(this->
nx%this->bx != 0) this->
nx += (this->bx - this->
nx % this->
bx);
317 if(this->
ny%this->
by != 0) this->
ny += (this->
by - this->
ny % this->
by);
318 if(this->
nz%this->bz != 0) this->
nz += (this->bz - this->
nz % this->
bz);
319 this->nbx = this->
nx /
bx;
320 this->nby = this->
ny /
by;
321 this->nbz = this->
nz /
bz;
322 this->
nxy = this->
nx * this->
ny;
325 int *ibox =
new int[3];
326 ibox[0] = int((this->
nx-1)/2)+1;
327 ibox[1] = int((this->ny-1)/2)+1;
328 ibox[2] = int((this->nz-1)/2)+1;
331 for(
int igz = -ibox[2]; igz <= ibox[2]; ++igz)
333 for(
int igy = -ibox[1]; igy <= ibox[1]; ++igy)
335 for(
int igx = -ibox[0]; igx <= ibox[0]; ++igx)
339 if(std::abs(igx)<=ibox[0]-1 && std::abs(igy)<=ibox[1]-1 && std::abs(igz)<=ibox[2]-1 )
continue;
344 double modulus = f * (this->
GGT * f);
347 this->gridecut_lat = modulus;
372 for(
int ip = 0 ; ip < this->
poolnproc ; ++ip)
374 this->
numz[ip] = npbz*this->
bz;
375 if(ip < modbz) this->
numz[ip]+=this->
bz;
383 this->nbzp = this->
nplane / this->
bz;
385 this->nbxx = this->nbzp * this->nbx * this->
nby;
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:22
T x
Definition vector3.h:24
T y
Definition vector3.h:25
T z
Definition vector3.h:26
Definition pw_basis_big.h:16
void autoset_big_cell_size(int &b_size, const int &nc_size, const int nproc=0)
Definition pw_basis_big.h:44
int nbz
Definition pw_basis_big.h:39
int bx
Definition pw_basis_big.h:36
virtual void initgrids(const double lat0_in, const ModuleBase::Matrix3 latvec_in, const double gridecut)
Definition pw_basis_big.h:108
int nbx
Definition pw_basis_big.h:37
~PW_Basis_Big()
Definition pw_basis_big.h:28
virtual void distribute_r()
distribute real-space grids to different processors
Definition pw_basis_big.h:362
PW_Basis_Big()
Definition pw_basis_big.h:21
int nbzp_start
Definition pw_basis_big.h:42
PW_Basis_Big(std::string device_, std::string precision_)
Definition pw_basis_big.h:24
int by
Definition pw_basis_big.h:36
int nbxx
Definition pw_basis_big.h:41
int nby
Definition pw_basis_big.h:38
void setbxyz(const int bx_in, const int by_in, const int bz_in)
Definition pw_basis_big.h:29
int bz
Definition pw_basis_big.h:36
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:269
int bxyz
Definition pw_basis_big.h:36
int nbzp
Definition pw_basis_big.h:40
Special pw_basis class for sup girds, which is constrcuted in order to be consistent with the smooth ...
Definition pw_basis_sup.h:23
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