Skip to content

Commit bebc462

Browse files
committed
Merge branch '20250902' into develop
2 parents d7f2f76 + d485c9f commit bebc462

22 files changed

+201
-354
lines changed

source/source_base/tool_quit.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,21 @@ void WARNING_QUIT(const std::string &file,const std::string &description,int ret
9191
std::cout << " https://github.com/deepmodeling/abacus-develop/issues" << std::endl;
9292

9393
#else
94-
std::cout << " " << std::endl;
95-
std::cout << " ---------------------------------------------------------" << std::endl;
96-
std::cout << " !NOTICE! " << std::endl;
97-
std::cout << " ---------------------------------------------------------" << std::endl;
98-
std::cout << " " << std::endl;
99-
std::cout << " " << description << std::endl;
100-
std::cout << " CHECK IN FILE : " << PARAM.globalv.global_out_dir << "warning.log" << std::endl;
101-
std::cout << " " << std::endl;
102-
std::cout << " For detailed manual of ABACUS, please see the website" << std::endl;
103-
std::cout << " https://abacus.deepmodeling.com" << std::endl;
104-
std::cout << " For any questions, propose issues on the website" << std::endl;
105-
std::cout << " https://github.com/deepmodeling/abacus-develop/issues" << std::endl;
106-
std::cout << " ---------------------------------------------------------" << std::endl;
107-
std::cout << " !NOTICE! " << std::endl;
108-
std::cout << " ---------------------------------------------------------" << std::endl;
94+
std::cout << " " << std::endl;
95+
std::cout << " ---------------------------------------------------------" << std::endl;
96+
std::cout << " !NOTICE! " << std::endl;
97+
std::cout << " ---------------------------------------------------------" << std::endl;
98+
std::cout << " " << std::endl;
99+
std::cout << " " << description << std::endl;
100+
std::cout << " CHECK IN FILE : " << PARAM.globalv.global_out_dir << "warning.log" << std::endl;
101+
std::cout << " " << std::endl;
102+
std::cout << " For detailed manual of ABACUS, please see the website" << std::endl;
103+
std::cout << " https://abacus.deepmodeling.com" << std::endl;
104+
std::cout << " For any questions, propose issues on the website" << std::endl;
105+
std::cout << " https://github.com/deepmodeling/abacus-develop/issues" << std::endl;
106+
std::cout << " ---------------------------------------------------------" << std::endl;
107+
std::cout << " !NOTICE! " << std::endl;
108+
std::cout << " ---------------------------------------------------------" << std::endl;
109109

110110

111111
GlobalV::ofs_running << " ---------------------------------------------------------" << std::endl;

source/source_esolver/esolver_ks_lcao.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#include "source_io/berryphase.h"
1414
#include "source_io/cal_ldos.h"
1515
#include "source_io/cube_io.h"
16-
#include "source_io/io_dmk.h"
17-
#include "source_io/io_npz.h"
16+
//#include "source_io/io_npz.h"
1817
#include "source_io/output_dmk.h"
1918
#include "source_io/output_log.h"
2019
#include "source_io/output_mat_sparse.h"

source/source_io/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ if(ENABLE_LCAO)
6060
read_wfc_nao.cpp
6161
read_wfc_lcao.cpp
6262
write_wfc_nao.cpp
63-
io_dmk.cpp
63+
write_dmk.cpp
6464
write_dmr.cpp
6565
sparse_matrix.cpp
6666
file_reader.cpp

source/source_io/ctrl_output_lcao.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// functions
99
#include "source_io/write_dos_lcao.h" // use ModuleIO::write_dos_lcao()
1010
#include "source_io/write_dmr.h" // use ModuleIO::write_dmr()
11-
#include "source_io/io_dmk.h" // use ModuleIO::write_dmk()
11+
#include "source_io/write_dmk.h" // use ModuleIO::write_dmk()
1212
#include "source_io/write_HS.h" // use ModuleIO::write_hsk()
1313
#include "source_io/write_wfc_nao.h" // use ModuleIO::write_wfc_nao()
1414
#include "source_io/output_mat_sparse.h" // use ModuleIO::output_mat_sparse()
@@ -92,24 +92,28 @@ void ctrl_output_lcao(UnitCell& ucell,
9292
//------------------------------------------------------------------
9393
//! 1) Output density matrix DM(R)
9494
//------------------------------------------------------------------
95-
if(PARAM.inp.out_dmr)
95+
if(PARAM.inp.out_dmr[0])
9696
{
9797
const auto& dmr_vector = pelec->get_DM()->get_DMR_vector();
98-
ModuleIO::write_dmr(dmr_vector, pv, out_app_flag,
98+
99+
const int precision = PARAM.inp.out_dmr[1];
100+
101+
ModuleIO::write_dmr(dmr_vector, precision, pv, out_app_flag,
99102
ucell.get_iat2iwt(), ucell.nat, istep);
100103
}
101104

102105
//------------------------------------------------------------------
103106
//! 2) Output density matrix DM(k)
104107
//------------------------------------------------------------------
105-
if (PARAM.inp.out_dmk)
108+
if (PARAM.inp.out_dmk[0])
106109
{
107110
std::vector<double> efermis(nspin == 2 ? 2 : 1);
108111
for (int ispin = 0; ispin < efermis.size(); ispin++)
109112
{
110113
efermis[ispin] = pelec->eferm.get_efval(ispin);
111114
}
112-
const int precision = 3;
115+
const int precision = PARAM.inp.out_dmk[1];
116+
113117
ModuleIO::write_dmk(pelec->get_DM()->get_DMK_vector(),
114118
precision, efermis, &(ucell), pv, istep);
115119
}

source/source_io/module_parameter/input_parameter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ struct Input_para
372372
bool out_mul = false; ///< qifeng add 2019-9-10
373373
bool out_proj_band = false; ///< projected band structure calculation jiyy add 2022-05-11
374374
std::string out_level = "ie"; ///< control the output information.
375-
bool out_dmk = false; ///< output density matrix DM(k)
376-
bool out_dmr = false; ///< output density matrix DM(R)
375+
std::vector<int> out_dmr = {0, 8}; ///< output density matrix in real space DM(R)
376+
std::vector<int> out_dmk = {0, 8}; ///< output density matrix in reciprocal space DM(k)
377377
bool out_bandgap = false; ///< QO added for bandgap printing
378378
std::vector<int> out_mat_hs = {0, 8}; ///< output H matrix and S matrix in local basis.
379379
std::vector<int> out_mat_tk = {0, 8}; ///< output T(k) matrix in local basis.

source/source_io/nscf_band.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ void ModuleIO::nscf_band(
2121
ModuleBase::TITLE("ModuleIO","nscf_band");
2222
ModuleBase::timer::tick("ModuleIO", "nscf_band");
2323

24+
assert(precision>0);
25+
2426
GlobalV::ofs_running << "\n";
2527
GlobalV::ofs_running << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl;
2628
GlobalV::ofs_running << " | |" << std::endl;

source/source_io/output.cpp

Lines changed: 0 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ void output::printrm(std::ofstream &ofs,const std::string &s, const ModuleBase::
1010
if (b1*b2 == 0) return;
1111
for (int i = 0;i < b1;i++)
1212
{
13-
// ofs<<"\n row = "<<i;
1413
for (int j = 0;j < b2;j++)
1514
{
1615
if (j % 8 == 0) ofs << "\n ";
@@ -41,182 +40,16 @@ void output::printrm(const std::string &s, const ModuleBase::matrix &m, const do
4140
//std::cout << "\n row=" << i;
4241
for (int j = 0;j < b2;j++)
4342
{
44-
// if (j % 4 == 0) std::cout << "\n ";
4543
if (j % 8 == 0) std::cout << "\n ";
46-
// if (std::abs(m(i,j)) > limit) std::cout << std::setprecision(15) << std::setw(20) << m(i,j);
4744
if (std::abs(m(i,j)) > limit) std::cout << std::setprecision(6) << std::setw(12) << m(i,j);
48-
// else std::cout<<std::setw(20)<<"0";
4945
else std::cout<<std::setw(12)<<"0";
5046
}
51-
// std::cout << "\n";
5247
}
5348

5449
std::cout << std::endl;
5550
return;
5651
}
5752

58-
/*
59-
void output::printcm_norm(std::ofstream &ofs, const std::string &s, const ModuleBase::ComplexMatrix &m, const double &limit)
60-
{
61-
const int b1 = m.nr;
62-
const int b2 = m.nc;
63-
ofs << "\n" << s << " nr=" << b1 << " nc=" << b2 ;
64-
65-
if (b1*b2 == 0) return;
66-
for (int i = 0;i < b1;i++)
67-
{
68-
for (int j = 0;j < b2;j++)
69-
{
70-
if (j % 8 == 0) ofs << "\n ";
71-
double norm = ( conj( m(i, j) ) * m(i, j) ).real();
72-
if (std::abs(norm) > limit) ofs<< std::setw(12) << sqrt(norm);
73-
else ofs<<std::setw(12)<<"0";
74-
}
75-
}
76-
return;
77-
}
78-
*/
79-
80-
/*
81-
void output::printcm_norm(const std::string &s, const ModuleBase::ComplexMatrix &m, const double &limit)
82-
{
83-
const int b1 = m.nr;
84-
const int b2 = m.nc;
85-
std::cout << "\n" << s << " nr=" << b1 << " nc=" << b2 ;
86-
87-
if (b1*b2 == 0) return;
88-
for (int i = 0;i < b1;i++)
89-
{
90-
for (int j = 0;j < b2;j++)
91-
{
92-
if (j % 8 == 0) std::cout << "\n ";
93-
double norm = ( conj( m(i, j) ) * m(i, j) ).real();
94-
if (std::abs(norm) > limit) std::cout<< std::setw(12) << sqrt(norm);
95-
else std::cout<<std::setw(12)<<"0";
96-
}
97-
}
98-
return;
99-
}
100-
*/
101-
102-
103-
/*
104-
void output::printcm(std::ofstream &ofs, const std::string &s, const ModuleBase::ComplexMatrix &m)
105-
{
106-
const int b1 = m.nr;
107-
const int b2 = m.nc;
108-
ofs << "\n" << s << " " << b1 << " " << b2 ;
109-
110-
if (b1*b2 == 0) return;
111-
112-
ofs.setf(std::ios::scientific, std::ios::floatfield);
113-
for (int i = 0;i < b1;i++)
114-
{
115-
for (int j = 0;j < b2;j++)
116-
{
117-
if (j%2 == 0) ofs << "\n ";
118-
ofs << std::setw(20) << m(i, j).real() << std::setw(20) << m(i, j).imag();
119-
}
120-
}
121-
ofs.unsetf(std::ios::scientific);
122-
return;
123-
}//end print cm
124-
*/
125-
126-
/*
127-
void output::printcm(const std::string &s, const ModuleBase::ComplexMatrix &m)
128-
{
129-
const int b1 = m.nr;
130-
const int b2 = m.nc;
131-
std::cout << "\n" << s << " nr = " << b1 << " nc = " << b2 ;
132-
133-
if (b1*b2 == 0) return;
134-
135-
for (int i = 0;i < b1;i++)
136-
{
137-
for (int j = 0;j < b2;j++)
138-
{
139-
if (j % 4 == 0) std::cout << "\n ";
140-
std::cout << std::setw(18) << m(i, j);
141-
}
142-
}
143-
return;
144-
}
145-
*/
146-
147-
/*
148-
void output::printcm_real_limit_hermit(const std::string &s, const ModuleBase::ComplexMatrix &m,const double &limit)
149-
{
150-
const int b1 = m.nr;
151-
const int b2 = m.nc;
152-
std::cout << "\n" << s << " nr = " << b1 << " nc = " << b2 ;
153-
154-
if (b1*b2 == 0) return;
155-
156-
for (int i = 0;i < b1;i++)
157-
{
158-
for (int j = 0;j < b2;j++)
159-
{
160-
if (j % 8 == 0) std::cout << "\n ";
161-
const double x = m(i,j).real();
162-
if (std::abs(x) < limit || i < j) std::cout<<std::setw(12)<<"0";
163-
else std::cout << std::setw(12) << x;
164-
}
165-
}
166-
return;
167-
}
168-
*/
169-
170-
/*
171-
void output::printcm_real(const std::string &s, const ModuleBase::ComplexMatrix &m,const double &limit)
172-
{
173-
const int b1 = m.nr;
174-
const int b2 = m.nc;
175-
std::cout << "\n " << s << " nr = " << b1 << " nc = " << b2 ;
176-
177-
if (b1*b2 == 0) return;
178-
179-
for (int i = 0;i < b1;i++)
180-
{
181-
for (int j = 0;j < b2;j++)
182-
{
183-
if (j % 8 == 0) std::cout << "\n ";
184-
const double x = m(i,j).real();
185-
if (std::abs(x) < limit ) std::cout<<std::setw(12)<<"0";
186-
else std::cout << std::setw(12) << x;
187-
}
188-
}
189-
return;
190-
}
191-
*/
192-
193-
194-
/*
195-
void output::printcm_imag(const std::string &s, const ModuleBase::ComplexMatrix &m,const double &limit)
196-
{
197-
const int b1 = m.nr;
198-
const int b2 = m.nc;
199-
std::cout << "\n " << s << " nr = " << b1 << " nc = " << b2 ;
200-
201-
if (b1*b2 == 0) return;
202-
203-
for (int i = 0;i < b1;i++)
204-
{
205-
for (int j = 0;j < b2;j++)
206-
{
207-
if (j % 8 == 0) std::cout << "\n ";
208-
const double x = m(i,j).imag();
209-
if (std::abs(x) < limit ) std::cout<<std::setw(12)<<"0";
210-
else std::cout << std::setw(12) << x;
211-
}
212-
}
213-
return;
214-
}
215-
*/
216-
217-
218-
219-
22053

22154
void output::printr3_d(std::ofstream &ofs, const std::string &s,const ModuleBase::realArray &u)
22255
{
@@ -241,31 +74,6 @@ void output::printr3_d(std::ofstream &ofs, const std::string &s,const ModuleBase
24174
return;
24275
}//end printr3_d
24376

244-
/*
245-
void output::printr4_d(std::ofstream &ofs, const std::string &s,const ModuleBase::realArray &u)
246-
{
247-
const int b1 = u.getBound1();
248-
const int b2 = u.getBound2();
249-
const int b3 = u.getBound3();
250-
const int b4 = u.getBound4();
251-
ofs << "\n\n " << s << " b1 = " << b1 << " b2 = " << b2
252-
<< " b3 = " << b3 << " b4 = " << b4;
253-
254-
if (u.getSize() == 0) return;
255-
256-
for (int i = 0;i < b1;i++)
257-
for (int j = 0;j < b2;j++)
258-
for (int k = 0;k < b3;k++)
259-
for (int m = 0;m < b4;m++)
260-
{
261-
if (m % 4 == 0)
262-
{
263-
ofs << "\n";
264-
}
265-
ofs << std::setw(15) << u(i, j, k, m);
266-
}
267-
}//end print4_d
268-
*/
26977

27078
void output::printM3(std::ofstream &ofs,const std::string &description, const ModuleBase::Matrix3 &m)
27179
{

source/source_io/output_mulliken.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,13 @@ void cal_mag(Parallel_Orbitals* pv,
102102
{
103103
auto cell_index
104104
= CellIndex(ucell.get_atomLabels(), ucell.get_atomCounts(), ucell.get_lnchiCounts(), PARAM.inp.nspin);
105-
auto out_sk = ModuleIO::Output_Sk<TK>(p_ham, pv, PARAM.inp.nspin, kv.get_nks());
106-
auto out_dmk = ModuleIO::Output_DMK<TK>(dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(pelec)->get_DM(),
105+
auto out_s_k = ModuleIO::Output_Sk<TK>(p_ham, pv, PARAM.inp.nspin, kv.get_nks());
106+
auto out_dm_k = ModuleIO::Output_DMK<TK>(dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(pelec)->get_DM(),
107107
pv,
108108
PARAM.inp.nspin,
109109
kv.get_nks());
110-
auto mulp = ModuleIO::Output_Mulliken<TK>(&(out_sk), &(out_dmk), pv, &cell_index, kv.isk, PARAM.inp.nspin);
110+
111+
auto mulp = ModuleIO::Output_Mulliken<TK>(&(out_s_k), &(out_dm_k), pv, &cell_index, kv.isk, PARAM.inp.nspin);
111112
auto atom_chg = mulp.get_atom_chg();
112113
/// used in updating mag info in STRU file
113114
ucell.atom_mulliken = mulp.get_atom_mulliken(atom_chg);

0 commit comments

Comments
 (0)