Skip to content

Commit c80471c

Browse files
committed
chagne eigs1.txt to eig.txt, change eig.txt to eig_occ.txt
1 parent 7f459c2 commit c80471c

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ These variables are used to control the output of properties.
17811781

17821782
- **Type**: Boolean \[Integer\](optional)
17831783
- **Description**: Whether to output the eigenvalues of the Hamiltonian matrix (in eV) into the running log during electronic iterations and into a file at the end of calculations. The former can be used with the 'out_freq_elec' parameter while the latter option allows the output precision to be set via a second parameter, with a default value of 8. The output file names are:
1784-
- nspin = 1 or 4: `eigs1.txt`;
1784+
- nspin = 1 or 4: `eig.txt`;
17851785
- nspin = 2: `eigs1.txt` and `eigs2.txt`;
17861786
- For more information, refer to the [band.md](../elec_properties/band.md)
17871787
- **Default**: False

source/source_esolver/esolver_ks.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,14 +581,25 @@ void ESolver_KS<T, Device>::after_all_runners(UnitCell& ucell)
581581
const int nspin0 = (PARAM.inp.nspin == 2) ? 2 : 1;
582582
for (int is = 0; is < nspin0; is++)
583583
{
584-
std::stringstream ss2;
585-
ss2 << PARAM.globalv.global_out_dir << "eigs" << is + 1 << ".txt";
584+
std::stringstream ss;
585+
ss << PARAM.globalv.global_out_dir << "eig";
586+
587+
if(nspin0==1)
588+
{
589+
// do nothing
590+
}
591+
else if(nspin0==2)
592+
{
593+
ss << "s" << is + 1;
594+
}
595+
ss << ".txt";
596+
586597
const double eshift = 0.0;
587598
ModuleIO::nscf_band(is,
588-
ss2.str(),
599+
ss.str(),
589600
PARAM.inp.nbands,
590601
eshift,
591-
PARAM.inp.out_band[1],
602+
PARAM.inp.out_band[1], // precision
592603
this->pelec->ekb,
593604
this->kv);
594605
}

source/source_io/write_eig_occ.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,18 @@ void ModuleIO::write_eig_file(const ModuleBase::matrix &ekb,const ModuleBase::ma
205205
#endif
206206

207207
// file name to store eigenvalues
208-
std::string filename = PARAM.globalv.global_out_dir + "eig.txt";
208+
std::string filename = PARAM.globalv.global_out_dir + "eig_occ.txt";
209209
GlobalV::ofs_running << " Eigenvalues and occupations are in file: " << filename << std::endl;
210210

211211
if (GlobalV::MY_RANK == 0)
212212
{
213-
std::ofstream ofs_eig0(filename.c_str()); // clear eig.txt
213+
std::ofstream ofs_eig0(filename.c_str()); // clear eig_occ.txt
214214
ofs_eig0 << " Electronic state energy (eV) and occupations" << std::endl;
215215
ofs_eig0 << " Spin number " << nspin << std::endl;
216216
ofs_eig0.close();
217217
}
218218

219-
const int nk_fac = nspin == 2 ? 2 : 1;
219+
const int nk_fac = (nspin == 2) ? 2 : 1;
220220
const int nks_np = nks / nk_fac;
221221
const int nkstot_np = nkstot / nk_fac;
222222
const int kpar = GlobalV::KPAR;

0 commit comments

Comments
 (0)