Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add the output of energy for all esolver types in abacus.json #4413

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions source/module_esolver/esolver_ks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,8 @@ void ESolver_KS<T, Device>::runner(const int istep, UnitCell& ucell)

#ifdef __RAPIDJSON
// 14) add Json of efermi energy converge
Json::add_output_efermi_energy_converge(
Json::add_output_efermi_converge(
this->pelec->eferm.ef * ModuleBase::Ry_to_eV,
this->pelec->f_en.etot * ModuleBase::Ry_to_eV,
this->conv_elec
);
#endif //__RAPIDJSON
Expand Down
19 changes: 9 additions & 10 deletions source/module_io/json_output/output_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ namespace Json
}

void add_output_cell_coo_stress_force(
UnitCell *ucell,
ModuleBase::matrix force, double fac,
ModuleBase::matrix stress, double unit_transform
const UnitCell *ucell,
const ModuleBase::matrix force, const double fac,
const ModuleBase::matrix stress, const double unit_transform
) {
int iat = 0;
const double output_acc = 1.0e-8;
Expand Down Expand Up @@ -131,15 +131,14 @@ namespace Json

}

void add_output_efermi_energy_converge(double efermi, double energy ,bool scf_converge ){
void add_output_efermi_converge(const double efermi, const bool scf_converge ){
Json::AbacusJson::add_json({"output",-1,"e_fermi"}, efermi,false);
Json::AbacusJson::add_json({"output",-1,"energy"}, energy,false);
Json::AbacusJson::add_json({"output",-1,"scf_converge"}, scf_converge,false);

// Json::AbacusJson::add_Json(efermi,false,"output",-1,"e_fermi");
// Json::AbacusJson::add_Json(energy,false,"output",-1,"energy");
// Json::AbacusJson::add_Json(scf_converge,false,"output",-1,"scf_converge");

}

void add_output_energy(const double energy)
{
Json::AbacusJson::add_json({"output",-1,"energy"}, energy,false);
}

void add_output_scf_mag(
Expand Down
13 changes: 7 additions & 6 deletions source/module_io/json_output/output_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ namespace Json
void init_output_array_obj();

void add_output_cell_coo_stress_force(
UnitCell *ucell,
ModuleBase::matrix force, double fac,
ModuleBase::matrix stress, double unit_transform
const UnitCell *ucell,
const ModuleBase::matrix force, const double fac,
const ModuleBase::matrix stress, const double unit_transform
);

void add_output_efermi_energy_converge(double efermi, double energy ,bool scf_converge );
void add_output_efermi_converge(const double efermi, const bool scf_converge );
void add_output_energy(const double energy );

void add_output_scf_mag(
double total_mag, double absolute_mag,
double energy, double ediff, double drho,double time
const double total_mag, const double absolute_mag,
const double energy, const double ediff, const double drho,const double time
);

#endif
Expand Down
5 changes: 5 additions & 0 deletions source/module_relax/relax_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ void Relax_Driver::relax_driver(ModuleESolver::ESolver *p_esolver)
GlobalV::ofs_running << "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;
}
}

#ifdef __RAPIDJSON
// add the energy to outout
Json::add_output_energy(p_esolver->cal_energy() * ModuleBase::Ry_to_eV);
#endif
}
#ifdef __RAPIDJSON
//add Json of cell coo stress force
Expand Down
Loading