|
1 | 1 | #include "output_mat_sparse.h" |
2 | 2 |
|
3 | | -#include "cal_r_overlap_R.h" |
4 | | -#include "module_hamilt_pw/hamilt_pwdft/global.h" // for ucell |
5 | | -#include "write_HS_R.h" |
| 3 | +#include "module_io/cal_r_overlap_R.h" |
| 4 | +#include "module_io/write_HS_R.h" |
6 | 5 |
|
7 | 6 | namespace ModuleIO |
8 | 7 | { |
9 | 8 |
|
10 | | -template <typename T> |
11 | | -Output_Mat_Sparse<T>::Output_Mat_Sparse(int out_mat_hsR, |
12 | | - int out_mat_dh, |
13 | | - int out_mat_t, |
14 | | - int out_mat_r, |
15 | | - int istep, |
16 | | - const ModuleBase::matrix& v_eff, |
17 | | - const Parallel_Orbitals& pv, |
18 | | - Gint_k& gint_k, // mohan add 2024-04-01 |
19 | | - const TwoCenterBundle& two_center_bundle, |
20 | | - const LCAO_Orbitals& orb, |
21 | | - Grid_Driver& grid, // mohan add 2024-04-06 |
22 | | - const K_Vectors& kv, |
23 | | - hamilt::Hamilt<T>* p_ham) |
24 | | - : _out_mat_hsR(out_mat_hsR), _out_mat_dh(out_mat_dh), _out_mat_t(out_mat_t), _out_mat_r(out_mat_r), _istep(istep), |
25 | | - _v_eff(v_eff), _pv(pv), orb_(orb), _gint_k(gint_k), // mohan add 2024-04-01 |
26 | | - two_center_bundle_(two_center_bundle), _grid(grid), // mohan add 2024-04-06 |
27 | | - _kv(kv), _p_ham(p_ham) {} |
28 | | - |
29 | 9 | template <> |
30 | | -void Output_Mat_Sparse<double>::write() |
| 10 | +void output_mat_sparse(const bool& out_mat_hsR, |
| 11 | + const bool& out_mat_dh, |
| 12 | + const bool& out_mat_t, |
| 13 | + const bool& out_mat_r, |
| 14 | + const int& istep, |
| 15 | + const ModuleBase::matrix& v_eff, |
| 16 | + const Parallel_Orbitals& pv, |
| 17 | + Gint_k& gint_k, |
| 18 | + const TwoCenterBundle& two_center_bundle, |
| 19 | + const LCAO_Orbitals& orb, |
| 20 | + UnitCell& ucell, |
| 21 | + Grid_Driver& grid, |
| 22 | + const K_Vectors& kv, |
| 23 | + hamilt::Hamilt<double>* p_ham) |
31 | 24 | { |
32 | 25 | } |
33 | 26 |
|
34 | 27 | template <> |
35 | | -void Output_Mat_Sparse<std::complex<double>>::write() |
| 28 | +void output_mat_sparse(const bool& out_mat_hsR, |
| 29 | + const bool& out_mat_dh, |
| 30 | + const bool& out_mat_t, |
| 31 | + const bool& out_mat_r, |
| 32 | + const int& istep, |
| 33 | + const ModuleBase::matrix& v_eff, |
| 34 | + const Parallel_Orbitals& pv, |
| 35 | + Gint_k& gint_k, |
| 36 | + const TwoCenterBundle& two_center_bundle, |
| 37 | + const LCAO_Orbitals& orb, |
| 38 | + UnitCell& ucell, |
| 39 | + Grid_Driver& grid, |
| 40 | + const K_Vectors& kv, |
| 41 | + hamilt::Hamilt<std::complex<double>>* p_ham) |
36 | 42 | { |
37 | 43 | LCAO_HS_Arrays HS_Arrays; // store sparse arrays |
38 | 44 |
|
39 | 45 | //! generate a file containing the Hamiltonian and S(overlap) matrices |
40 | | - if (_out_mat_hsR) |
| 46 | + if (out_mat_hsR) |
41 | 47 | { |
42 | | - output_HSR(_istep, this->_v_eff, this->_pv, HS_Arrays, this->_grid, _kv, _p_ham); |
| 48 | + output_HSR(istep, v_eff, pv, HS_Arrays, grid, kv, p_ham); |
43 | 49 | } |
44 | 50 |
|
45 | 51 | //! generate a file containing the kinetic energy matrix |
46 | | - if (_out_mat_t) |
| 52 | + if (out_mat_t) |
47 | 53 | { |
48 | | - output_TR(_istep, |
49 | | - GlobalC::ucell, |
50 | | - this->_pv, |
51 | | - HS_Arrays, |
52 | | - this->_grid, |
53 | | - two_center_bundle_, |
54 | | - orb_ |
55 | | - ); // LiuXh add 2019-07-15 |
| 54 | + output_TR(istep, ucell, pv, HS_Arrays, grid, two_center_bundle, orb); |
56 | 55 | } |
57 | 56 |
|
58 | 57 | //! generate a file containing the derivatives of the Hamiltonian matrix (in Ry/Bohr) |
59 | | - if (_out_mat_dh) |
| 58 | + if (out_mat_dh) |
60 | 59 | { |
61 | | - output_dHR(_istep, |
62 | | - this->_v_eff, |
63 | | - this->_gint_k, // mohan add 2024-04-01 |
64 | | - this->_pv, |
| 60 | + output_dHR(istep, |
| 61 | + v_eff, |
| 62 | + gint_k, // mohan add 2024-04-01 |
| 63 | + pv, |
65 | 64 | HS_Arrays, |
66 | | - this->_grid, // mohan add 2024-04-06 |
67 | | - two_center_bundle_, |
68 | | - orb_, |
69 | | - _kv); // LiuXh add 2019-07-15 |
| 65 | + grid, // mohan add 2024-04-06 |
| 66 | + two_center_bundle, |
| 67 | + orb, |
| 68 | + kv); // LiuXh add 2019-07-15 |
70 | 69 | } |
71 | 70 |
|
72 | 71 | // add by jingan for out r_R matrix 2019.8.14 |
73 | | - if (_out_mat_r) |
| 72 | + if (out_mat_r) |
74 | 73 | { |
75 | 74 | cal_r_overlap_R r_matrix; |
76 | | - r_matrix.init(this->_pv, orb_); |
77 | | - if (_out_mat_hsR) |
| 75 | + r_matrix.init(pv, orb); |
| 76 | + if (out_mat_hsR) |
78 | 77 | { |
79 | | - r_matrix.out_rR_other(_istep, HS_Arrays.output_R_coor); |
| 78 | + r_matrix.out_rR_other(istep, HS_Arrays.output_R_coor); |
80 | 79 | } |
81 | 80 | else |
82 | 81 | { |
83 | | - r_matrix.out_rR(_istep); |
| 82 | + r_matrix.out_rR(istep); |
84 | 83 | } |
85 | 84 | } |
86 | 85 |
|
87 | 86 | return; |
88 | 87 | } |
89 | 88 |
|
90 | | -template class Output_Mat_Sparse<double>; |
91 | | -template class Output_Mat_Sparse<std::complex<double>>; |
92 | | - |
93 | 89 | } // namespace ModuleIO |
0 commit comments