Repository navigation
Expand file tree
/
Copy pathctrl_output_fp.cpp
More file actions
133 lines (115 loc) · 3.06 KB
/
Copy pathctrl_output_fp.cpp
File metadata and controls
133 lines (115 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include "source_io/ctrl_output_fp.h" // use ctrl_output_fp()
namespace ModuleIO
{
template <typename TK, typename TR>
void ctrl_output_fp(UnitCell& ucell,
elecstate::ElecStateLCAO<TK>* pelec,
const int istep)
{
ModuleBase::TITLE("ModuleIO", "ctrl_output_fp");
ModuleBase::timer::tick("ModuleIO", "ctrl_output_fp");
const bool out_app_flag = PARAM.inp.out_app_flag;
const bool gamma_only = PARAM.globalv.gamma_only_local;
const int nspin = PARAM.inp.nspin;
const std::string global_out_dir = PARAM.globalv.global_out_dir;
// 1) write charge density
if (PARAM.inp.out_chg[0] > 0)
{
for (int is = 0; is < PARAM.inp.nspin; is++)
{
this->pw_rhod->real2recip(this->chr.rho_save[is], this->chr.rhog_save[is]);
std::string fn =PARAM.globalv.global_out_dir + "/chgs" + std::to_string(is + 1) + ".cube";
ModuleIO::write_vdata_palgrid(Pgrid,
this->chr.rho_save[is],
is,
PARAM.inp.nspin,
istep,
fn,
this->pelec->eferm.get_efval(is),
&(ucell),
PARAM.inp.out_chg[1],
1);
if (XC_Functional::get_ked_flag())
{
fn =PARAM.globalv.global_out_dir + "/taus" + std::to_string(is + 1) + ".cube";
ModuleIO::write_vdata_palgrid(Pgrid,
this->chr.kin_r_save[is],
is,
PARAM.inp.nspin,
istep,
fn,
this->pelec->eferm.get_efval(is),
&(ucell));
}
}
}
// 2) write potential
if (PARAM.inp.out_pot == 1 || PARAM.inp.out_pot == 3)
{
for (int is = 0; is < PARAM.inp.nspin; is++)
{
std::string fn =PARAM.globalv.global_out_dir + "/pots" + std::to_string(is + 1) + ".cube";
ModuleIO::write_vdata_palgrid(Pgrid,
this->pelec->pot->get_effective_v(is),
is,
PARAM.inp.nspin,
istep,
fn,
0.0, // efermi
&(ucell),
3, // precision
0); // out_fermi
}
}
else if (PARAM.inp.out_pot == 2)
{
std::string fn =PARAM.globalv.global_out_dir + "/pot_es.cube";
ModuleIO::write_elecstat_pot(
#ifdef __MPI
this->pw_big->bz,
this->pw_big->nbz,
#endif
fn,
istep,
this->pw_rhod,
&this->chr,
&(ucell),
this->pelec->pot->get_fixed_v(),
this->solvent);
}
// 3) write ELF
if (PARAM.inp.out_elf[0] > 0)
{
this->chr.cal_elf = true;
Symmetry_rho srho;
for (int is = 0; is < PARAM.inp.nspin; is++)
{
srho.begin(is, this->chr, this->pw_rhod, ucell.symm);
}
std::string out_dir =PARAM.globalv.global_out_dir;
ModuleIO::write_elf(
#ifdef __MPI
this->pw_big->bz,
this->pw_big->nbz,
#endif
out_dir,
istep,
PARAM.inp.nspin,
this->chr.rho,
this->chr.kin_r,
this->pw_rhod,
this->Pgrid,
&(ucell),
PARAM.inp.out_elf[1]);
}
ModuleBase::timer::tick("ModuleIO", "ctrl_output_fp");
}
} // End ModuleIO
// For gamma only
template void ModuleIO::ctrl_output_lcao<double, double>(UnitCell& ucell,
const int istep);
// For multiple k-points
template void ModuleIO::ctrl_output_lcao<std::complex<double>, double>(UnitCell& ucell,
const int istep);
template void ModuleIO::ctrl_output_lcao<std::complex<double>, std::complex<double>>(UnitCell& ucell,
const int istep);