Skip to content

Commit 516fb64

Browse files
committed
Merge branch 'io_cube' into io_libxc
2 parents 4d4a358 + b8974ec commit 516fb64

File tree

5 files changed

+245
-190
lines changed

5 files changed

+245
-190
lines changed

source/module_hamilt_pw/hamilt_pwdft/parallel_grid.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void Parallel_Grid::z_distribution(void)
182182

183183

184184
#ifdef __MPI
185-
void Parallel_Grid::zpiece_to_all(double *zpiece, const int &iz, double *rho)
185+
void Parallel_Grid::zpiece_to_all(double *zpiece, const int &iz, double *rho) const
186186
{
187187
if(PARAM.inp.esolver_type == "sdft")
188188
{
@@ -256,7 +256,7 @@ void Parallel_Grid::zpiece_to_all(double *zpiece, const int &iz, double *rho)
256256
#endif
257257

258258
#ifdef __MPI
259-
void Parallel_Grid::zpiece_to_stogroup(double *zpiece, const int &iz, double *rho)
259+
void Parallel_Grid::zpiece_to_stogroup(double *zpiece, const int &iz, double *rho) const
260260
{
261261
assert(allocate);
262262
//TITLE("Parallel_Grid","zpiece_to_all");

source/module_hamilt_pw/hamilt_pwdft/parallel_grid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class Parallel_Grid
2121
const int &nczp, const int &nrxx, const int &nbz, const int &bz); //LiuXh add 20180606
2222

2323
#ifdef __MPI
24-
void zpiece_to_all(double *zpiece, const int &iz, double *rho);
25-
void zpiece_to_stogroup(double *zpiece, const int &iz, double *rho); //qainrui add for sto-dft 2021-7-21
24+
void zpiece_to_all(double *zpiece, const int &iz, double *rho) const;
25+
void zpiece_to_stogroup(double *zpiece, const int &iz, double *rho) const; //qainrui add for sto-dft 2021-7-21
2626

2727
void reduce_to_fullrho(double *rhotot, double *rhoin);
2828
#endif

source/module_io/cube_io.h

Lines changed: 69 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,83 @@
88

99
namespace ModuleIO
1010
{
11-
bool read_cube(
11+
extern bool read_cube(
1212
#ifdef __MPI
13-
Parallel_Grid* Pgrid,
13+
const Parallel_Grid*const Pgrid,
1414
#endif
15-
int my_rank,
16-
std::string esolver_type,
17-
int rank_in_stogroup,
18-
const int& is,
15+
const int my_rank,
16+
const std::string esolver_type,
17+
const int rank_in_stogroup,
18+
const int is,
1919
std::ofstream& ofs_running,
20-
const int& nspin,
20+
const int nspin,
2121
const std::string& fn,
22-
double* data,
23-
const int& nx,
24-
const int& ny,
25-
const int& nz,
22+
double*const data,
23+
const int nx,
24+
const int ny,
25+
const int nz,
2626
double& ef,
27-
const UnitCell* ucell,
27+
const UnitCell*const ucell,
2828
int& prenspin,
29-
const bool& warning_flag = true);
29+
const bool warning_flag = true);
3030

31-
void write_cube(
31+
extern void write_cube(
3232
#ifdef __MPI
33-
const int& bz,
34-
const int& nbz,
35-
const int& nplane,
36-
const int& startz_current,
33+
const int bz,
34+
const int nbz,
35+
const int nplane,
36+
const int startz_current,
3737
#endif
38-
const double* data,
39-
const int& is,
40-
const int& nspin,
41-
const int& iter,
38+
const double*const data,
39+
const int is,
40+
const int nspin,
41+
const int iter,
4242
const std::string& fn,
43-
const int& nx,
44-
const int& ny,
45-
const int& nz,
46-
const double& ef,
47-
const UnitCell* ucell,
48-
const int& precision = 11,
49-
const int& out_fermi = 1); // mohan add 2007-10-17
43+
const int nx,
44+
const int ny,
45+
const int nz,
46+
const double ef,
47+
const UnitCell*const ucell,
48+
const int precision = 11,
49+
const int out_fermi = 1); // mohan add 2007-10-17
50+
51+
52+
extern void read_cube_core_match(
53+
std::ifstream &ifs,
54+
#ifdef __MPI
55+
const Parallel_Grid*const Pgrid,
56+
const bool flag_read_rank,
57+
#endif
58+
double*const data,
59+
const int nxy,
60+
const int nz);
61+
62+
extern void read_cube_core_mismatch(
63+
std::ifstream &ifs,
64+
#ifdef __MPI
65+
const Parallel_Grid*const Pgrid,
66+
const bool flag_read_rank,
67+
#endif
68+
double*const data,
69+
const int nx,
70+
const int ny,
71+
const int nz,
72+
const int nx_read,
73+
const int ny_read,
74+
const int nz_read);
75+
76+
extern void write_cube_core(
77+
std::ofstream &ofs_cube,
78+
#ifdef __MPI
79+
const int bz,
80+
const int nbz,
81+
const int nplane,
82+
const int startz_current,
83+
#endif
84+
const double*const data,
85+
const int nxy,
86+
const int nz,
87+
const int n_data_newline);
5088

5189
/**
5290
* @brief The trilinear interpolation method
@@ -78,15 +116,15 @@ void write_cube(
78116
* @param nz the dimension of grids along z
79117
* @param data the interpolated results
80118
*/
81-
void trilinear_interpolate(std::ifstream& ifs,
119+
extern void trilinear_interpolate(std::ifstream& ifs,
82120
const int& nx_read,
83121
const int& ny_read,
84122
const int& nz_read,
85123
const int& nx,
86124
const int& ny,
87125
const int& nz,
88126
#ifdef __MPI
89-
double** data
127+
std::vector<std::vector<double>> &data
90128
#else
91129
double* data
92130
#endif

0 commit comments

Comments
 (0)