Skip to content

Commit 47eca79

Browse files
committed
change ucell in module_io/write_dos_lcao.cpp
1 parent 4a56549 commit 47eca79

File tree

3 files changed

+34
-31
lines changed

3 files changed

+34
-31
lines changed

source/module_io/dos_nao.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
namespace ModuleIO
77
{
88
/// @brief manege the output of dos in numerical atomic basis case
9-
/// @param[in] psi
10-
/// @param[in] pv
11-
/// @param[in] ekb
12-
/// @param[in] wg
13-
/// @param[in] dos_edelta_ev
14-
/// @param[in] dos_scale
15-
/// @param[in] dos_sigma
16-
/// @param[in] kv
17-
/// @param[in] Pkpoints
18-
/// @param[in] ucell
19-
/// @param[in] eferm
20-
/// @param[in] nbands
9+
/// @param[in] psi
10+
/// @param[in] pv
11+
/// @param[in] ekb
12+
/// @param[in] wg
13+
/// @param[in] dos_edelta_ev
14+
/// @param[in] dos_scale
15+
/// @param[in] dos_sigma
16+
/// @param[in] kv
17+
/// @param[in] Pkpoints
18+
/// @param[in] ucell
19+
/// @param[in] eferm
20+
/// @param[in] nbands
2121
template<typename T>
2222
void out_dos_nao(
2323
const psi::Psi<T>* psi,
@@ -36,7 +36,7 @@ namespace ModuleIO
3636
{
3737
ModuleBase::TITLE("Module_IO", "out_dos_nao");
3838

39-
write_dos_lcao(psi, pv, ekb, wg, dos_edelta_ev, dos_scale, dos_sigma, kv, p_ham);
39+
write_dos_lcao(ucell,psi, pv, ekb, wg, dos_edelta_ev, dos_scale, dos_sigma, kv, p_ham);
4040

4141
int nspin0 = (PARAM.inp.nspin == 2) ? 2 : 1;
4242
if (PARAM.inp.out_dos == 3)

source/module_io/write_dos_lcao.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
#include "module_base/scalapack_connector.h"
2828

2929
template <>
30-
void ModuleIO::write_dos_lcao(const psi::Psi<double>* psi,
30+
void ModuleIO::write_dos_lcao(const UnitCell& ucell,
31+
const psi::Psi<double>* psi,
3132
const Parallel_Orbitals& pv,
3233
const ModuleBase::matrix& ekb,
3334
const ModuleBase::matrix& wg,
@@ -254,24 +255,24 @@ void ModuleIO::write_dos_lcao(const psi::Psi<double>* psi,
254255
out << std::setw(20) << en << std::endl;
255256
}
256257
out << "</energy_values>" << std::endl;
257-
for (int i = 0; i < GlobalC::ucell.nat; i++)
258+
for (int i = 0; i < ucell.nat; i++)
258259
{
259-
int a = GlobalC::ucell.iat2ia[i];
260-
int t = GlobalC::ucell.iat2it[i];
261-
Atom* atom1 = &GlobalC::ucell.atoms[t];
262-
const int s0 = GlobalC::ucell.itiaiw2iwt(t, a, 0);
260+
int a = ucell.iat2ia[i];
261+
int t = ucell.iat2it[i];
262+
Atom* atom1 = &ucell.atoms[t];
263+
const int s0 = ucell.itiaiw2iwt(t, a, 0);
263264
for (int j = 0; j < atom1->nw; ++j)
264265
{
265266
const int L1 = atom1->iw2l[j];
266267
const int N1 = atom1->iw2n[j];
267268
const int m1 = atom1->iw2m[j];
268-
const int w = GlobalC::ucell.itiaiw2iwt(t, a, j);
269+
const int w = ucell.itiaiw2iwt(t, a, j);
269270

270271
// out << "</energy_values>" <<std::endl;
271272
out << "<orbital" << std::endl;
272273
out << std::setw(6) << "index=\"" << std::setw(40) << w + 1 << "\"" << std::endl;
273274
out << std::setw(5) << "atom_index=\"" << std::setw(40) << i + 1 << "\"" << std::endl;
274-
out << std::setw(8) << "species=\"" << GlobalC::ucell.atoms[t].label << "\"" << std::endl;
275+
out << std::setw(8) << "species=\"" << ucell.atoms[t].label << "\"" << std::endl;
275276
out << std::setw(2) << "l=\"" << std::setw(40) << L1 << "\"" << std::endl;
276277
out << std::setw(2) << "m=\"" << std::setw(40) << m1 << "\"" << std::endl;
277278
out << std::setw(2) << "z=\"" << std::setw(40) << N1 + 1 << "\"" << std::endl;
@@ -309,7 +310,7 @@ void ModuleIO::write_dos_lcao(const psi::Psi<double>* psi,
309310
out << "</pdos>" << std::endl;
310311
out.close();
311312
}
312-
ModuleIO::write_orb_info(&(GlobalC::ucell));
313+
ModuleIO::write_orb_info(&(ucell));
313314
}
314315
delete[] pdos;
315316

@@ -341,7 +342,8 @@ void ModuleIO::write_dos_lcao(const psi::Psi<double>* psi,
341342
}
342343

343344
template <>
344-
void ModuleIO::write_dos_lcao(const psi::Psi<std::complex<double>>* psi,
345+
void ModuleIO::write_dos_lcao(const UnitCell& ucell,
346+
const psi::Psi<std::complex<double>>* psi,
345347
const Parallel_Orbitals& pv,
346348
const ModuleBase::matrix& ekb,
347349
const ModuleBase::matrix& wg,
@@ -604,24 +606,24 @@ void ModuleIO::write_dos_lcao(const psi::Psi<std::complex<double>>* psi,
604606
out << std::setw(20) << en << std::endl;
605607
}
606608
out << "</energy_values>" << std::endl;
607-
for (int i = 0; i < GlobalC::ucell.nat; i++)
609+
for (int i = 0; i < ucell.nat; i++)
608610
{
609-
int a = GlobalC::ucell.iat2ia[i];
610-
int t = GlobalC::ucell.iat2it[i];
611-
Atom* atom1 = &GlobalC::ucell.atoms[t];
612-
const int s0 = GlobalC::ucell.itiaiw2iwt(t, a, 0);
611+
int a = ucell.iat2ia[i];
612+
int t = ucell.iat2it[i];
613+
Atom* atom1 = &ucell.atoms[t];
614+
const int s0 = ucell.itiaiw2iwt(t, a, 0);
613615
for (int j = 0; j < atom1->nw; ++j)
614616
{
615617
const int L1 = atom1->iw2l[j];
616618
const int N1 = atom1->iw2n[j];
617619
const int m1 = atom1->iw2m[j];
618-
const int w = GlobalC::ucell.itiaiw2iwt(t, a, j);
620+
const int w = ucell.itiaiw2iwt(t, a, j);
619621

620622
// out << "</energy_values>" <<std::endl;
621623
out << "<orbital" << std::endl;
622624
out << std::setw(6) << "index=\"" << std::setw(40) << w + 1 << "\"" << std::endl;
623625
out << std::setw(5) << "atom_index=\"" << std::setw(40) << i + 1 << "\"" << std::endl;
624-
out << std::setw(8) << "species=\"" << GlobalC::ucell.atoms[t].label << "\"" << std::endl;
626+
out << std::setw(8) << "species=\"" << ucell.atoms[t].label << "\"" << std::endl;
625627
out << std::setw(2) << "l=\"" << std::setw(40) << L1 << "\"" << std::endl;
626628
out << std::setw(2) << "m=\"" << std::setw(40) << m1 << "\"" << std::endl;
627629
out << std::setw(2) << "z=\"" << std::setw(40) << N1 + 1 << "\"" << std::endl;
@@ -658,7 +660,7 @@ void ModuleIO::write_dos_lcao(const psi::Psi<std::complex<double>>* psi,
658660
out << "</pdos>" << std::endl;
659661
out.close();
660662
}
661-
ModuleIO::write_orb_info(&(GlobalC::ucell));
663+
ModuleIO::write_orb_info(&(ucell));
662664
}
663665
delete[] pdos;
664666
}

source/module_io/write_dos_lcao.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace ModuleIO
1212
/// @brief calculate density of states(DOS) and partial density of states(PDOS) and mulliken charge for LCAO base
1313
template <typename T>
1414
void write_dos_lcao(
15+
const UnitCell& ucell,
1516
const psi::Psi<T>* psi,
1617
const Parallel_Orbitals &pv,
1718
const ModuleBase::matrix& ekb,

0 commit comments

Comments
 (0)