From f82f18c3703e2c9d3897262b56662940d4804b28 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Fri, 17 Nov 2023 19:16:52 +0800 Subject: [PATCH 01/27] Refactor(output-json): Implement the json namespace of abacus parameter, design the parameter json structure and parameter Jsonization code of input_file module. (The json parameters added this time are all the parameters mentioned in the input file file in /docs/advance/input_files. The recently modified or added parameters are not added to the json class parameters) -- issue #3104 --- source/module_io/CMakeLists.txt | 1 + source/module_io/input.cpp | 357 +++++++- source/module_io/para_json.cpp | 983 +++++++++++++++++++++++ source/module_io/para_json.h | 568 +++++++++++++ source/module_io/test/CMakeLists.txt | 7 + source/module_io/test/para_json_test.cpp | 71 ++ 6 files changed, 1985 insertions(+), 2 deletions(-) create mode 100644 source/module_io/para_json.cpp create mode 100644 source/module_io/para_json.h create mode 100644 source/module_io/test/para_json_test.cpp diff --git a/source/module_io/CMakeLists.txt b/source/module_io/CMakeLists.txt index 364d075d0b..2b467f1f59 100644 --- a/source/module_io/CMakeLists.txt +++ b/source/module_io/CMakeLists.txt @@ -26,6 +26,7 @@ list(APPEND objects output_rho.cpp output_potential.cpp parameter_pool.cpp + para_json.cpp ) list(APPEND objects_advanced diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index a474d6f076..f88dd048d2 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -22,6 +22,8 @@ #include "module_base/global_variable.h" #include "module_base/parallel_common.h" #include "module_base/timer.h" + +#include "module_io/para_json.h" #include "version.h" Input INPUT; @@ -617,6 +619,12 @@ void Input::Default(void) return; } + + +/** +* guhongyaoxing modify 2023-11-16 +* Added code to convert the data read from the input file into a json object +*/ bool Input::Read(const std::string &fn) { ModuleBase::TITLE("Input", "Read"); @@ -673,14 +681,18 @@ bool Input::Read(const std::string &fn) if (strcmp("suffix", word) == 0) // out dir { read_value(ifs, suffix); + Para_Json::set_json_value(Para_Json::suffix,&suffix); + //Para_Json::set_json_value(Para_Json::suffix,&suffix); } else if (strcmp("stru_file", word) == 0) // xiaohui modify 2015-02-01 { read_value(ifs, stru_file); // xiaohui modify 2015-02-01 + Para_Json::set_json_value(Para_Json::stru_file,&stru_file); } else if (strcmp("pseudo_dir", word) == 0) { read_value(ifs, pseudo_dir); + Para_Json::set_json_value(Para_Json::pseudo_dir,&pseudo_dir); } // else if (strcmp("pseudo_type", word) == 0) // mohan add 2013-05-20 (xiaohui add 2013-06-23) // { @@ -689,63 +701,82 @@ bool Input::Read(const std::string &fn) else if (strcmp("orbital_dir", word) == 0) // liuyu add 2021-08-14 { read_value(ifs, orbital_dir); + Para_Json::set_json_value(Para_Json::orbital_dir,&orbital_dir); } else if (strcmp("kpoint_file", word) == 0) // xiaohui modify 2015-02-01 { read_value(ifs, kpoint_file); // xiaohui modify 2015-02-01 + Para_Json::set_json_value(Para_Json::kpoint_file,&kpoint_file); } else if (strcmp("wannier_card", word) == 0) // mohan add 2009-12-25 { read_value(ifs, wannier_card); + Para_Json::set_json_value(Para_Json::kpoint_file,&kpoint_file); } else if (strcmp("latname", word) == 0) // which material { read_value(ifs, latname); + Para_Json::set_json_value(Para_Json::latname,&latname); } else if (strcmp("pseudo_rcut", word) == 0) // { read_value(ifs, pseudo_rcut); + + Para_Json::set_json_value(Para_Json::pseudo_rcut,&pseudo_rcut); } else if (strcmp("pseudo_mesh", word) == 0) // { read_bool(ifs, pseudo_mesh); + Para_Json::set_json_value(Para_Json::pseudo_mesh,&pseudo_mesh); } else if (strcmp("calculation", word) == 0) // which type calculation { read_value(ifs, calculation); + Para_Json::set_json_value(Para_Json::calculation,&calculation); } else if (strcmp("esolver_type", word) == 0) { read_value(ifs, esolver_type); + Para_Json::set_json_value(Para_Json::esolver_type,&esolver_type); } else if (strcmp("ntype", word) == 0) // number of atom types { read_value(ifs, ntype); + Para_Json::set_json_value(Para_Json::ntype,&ntype); } else if (strcmp("nbands", word) == 0) // number of atom bands { read_value(ifs, nbands); + Para_Json::set_json_value(Para_Json::nbands,&nbands); } else if (strcmp("nbands_sto", word) == 0) // number of stochastic bands { std::string nbsto_str; read_value(ifs, nbndsto_str); + + if (nbndsto_str != "all") { nbands_sto = std::stoi(nbndsto_str); } + Para_Json::set_json_value(Para_Json::nbands_sto,&nbands_sto); } else if (strcmp("kspacing", word) == 0) { read_kspacing(ifs); + for(int i=0;i<3;i++){ + Para_Json::kspacing.PushBack(kspacing[i],Para_Json::doc.GetAllocator()); + } } else if (strcmp("min_dist_coef", word) == 0) { read_value(ifs, min_dist_coef); + Para_Json::set_json_value(Para_Json::min_dist_coef,&min_dist_coef); } else if (strcmp("nbands_istate", word) == 0) // number of atom bands { read_value(ifs, nbands_istate); + Para_Json::set_json_value(Para_Json::nbands_istate,&nbands_istate); // Originally disabled in line 2401. // if (nbands_istate < 0) // ModuleBase::WARNING_QUIT("Input", "NBANDS_ISTATE must > 0"); @@ -753,10 +784,12 @@ bool Input::Read(const std::string &fn) else if (strcmp("nche_sto", word) == 0) // Chebyshev expansion order { read_value(ifs, nche_sto); + Para_Json::set_json_value(Para_Json::nche_sto,&nche_sto); } else if (strcmp("seed_sto", word) == 0) { read_value(ifs, seed_sto); + Para_Json::set_json_value(Para_Json::seed_sto,&seed_sto); } else if (strcmp("initsto_ecut", word) == 0) { @@ -765,88 +798,109 @@ bool Input::Read(const std::string &fn) else if (strcmp("pw_seed", word) == 0) { read_value(ifs, pw_seed); + Para_Json::set_json_value(Para_Json::pw_seed,&pw_seed); } else if (strcmp("emax_sto", word) == 0) { read_value(ifs, emax_sto); + Para_Json::set_json_value(Para_Json::emax_sto,&emax_sto); } else if (strcmp("emin_sto", word) == 0) { read_value(ifs, emin_sto); + Para_Json::set_json_value(Para_Json::emin_sto,&emin_sto); } else if (strcmp("initsto_freq", word) == 0) { read_value(ifs, initsto_freq); + Para_Json::set_json_value(Para_Json::initsto_freq,&initsto_freq); } else if (strcmp("method_sto", word) == 0) { read_value(ifs, method_sto); + Para_Json::set_json_value(Para_Json::method_sto,&method_sto); } else if (strcmp("npart_sto", word) == 0) { read_value(ifs, npart_sto); + Para_Json::set_json_value(Para_Json::npart_sto,&npart_sto); } else if (strcmp("cal_cond", word) == 0) { read_bool(ifs, cal_cond); + Para_Json::set_json_value(Para_Json::cal_cond,&cal_cond); } else if (strcmp("cond_che_thr", word) == 0) { read_value(ifs, cond_che_thr); + Para_Json::set_json_value(Para_Json::cond_nche,&cond_che_thr); } else if (strcmp("cond_dw", word) == 0) { read_value(ifs, cond_dw); + Para_Json::set_json_value(Para_Json::cond_dw,&cond_dw); } else if (strcmp("cond_wcut", word) == 0) { read_value(ifs, cond_wcut); + Para_Json::set_json_value(Para_Json::cond_wcut,&cond_wcut); } else if (strcmp("cond_dt", word) == 0) { read_value(ifs, cond_dt); + Para_Json::set_json_value(Para_Json::cond_dt,&cond_dt); } else if (strcmp("cond_dtbatch", word) == 0) { read_value(ifs, cond_dtbatch); + Para_Json::set_json_value(Para_Json::cond_dtbatch,&cond_dtbatch); } else if (strcmp("cond_fwhm", word) == 0) { read_value(ifs, cond_fwhm); + Para_Json::set_json_value(Para_Json::cond_fwhm,&cond_fwhm); } else if (strcmp("cond_nonlocal", word) == 0) { read_bool(ifs, cond_nonlocal); + Para_Json::set_json_value(Para_Json::cond_nonlocal,&cond_nonlocal); } else if (strcmp("bndpar", word) == 0) { read_value(ifs, bndpar); + Para_Json::set_json_value(Para_Json::bndpar,&bndpar); } else if (strcmp("kpar", word) == 0) // number of pools { read_value(ifs, kpar); + Para_Json::set_json_value(Para_Json::kpar,&kpar); } else if (strcmp("berry_phase", word) == 0) // berry phase calculation { read_bool(ifs, berry_phase); + Para_Json::set_json_value(Para_Json::berry_phase,&berry_phase); } else if (strcmp("gdir", word) == 0) // berry phase calculation { read_value(ifs, gdir); + Para_Json::set_json_value(Para_Json::gdir,&gdir); } else if (strcmp("towannier90", word) == 0) // add by jingan for wannier90 { read_bool(ifs, towannier90); + Para_Json::set_json_value(Para_Json::towannier90,&towannier90); } else if (strcmp("nnkpfile", word) == 0) // add by jingan for wannier90 { read_value(ifs, nnkpfile); + Para_Json::set_json_value(Para_Json::nnkpfile,&nnkpfile); } else if (strcmp("wannier_spin", word) == 0) // add by jingan for wannier90 { read_value(ifs, wannier_spin); + Para_Json::set_json_value(Para_Json::wannier_spin,&wannier_spin); } - else if (strcmp("out_wannier_mmn", word) == 0) // add by renxi for wannier90 + else if (strcmp("out_wannier_mmn", word) == 0) // add by renxi for wannier90 { read_bool(ifs, out_wannier_mmn); } @@ -872,26 +926,32 @@ bool Input::Read(const std::string &fn) else if (strcmp("dft_functional", word) == 0) { read_value(ifs, dft_functional); + Para_Json::set_json_value(Para_Json::dft_functional,&dft_functional); } else if (strcmp("xc_temperature", word) == 0) { read_value(ifs, xc_temperature); + Para_Json::set_json_value(Para_Json::xc_temperature,&xc_temperature); } else if (strcmp("nspin", word) == 0) { read_value(ifs, nspin); + Para_Json::set_json_value(Para_Json::nspin,&nspin); } else if (strcmp("nelec", word) == 0) { read_value(ifs, nelec); + Para_Json::set_json_value(Para_Json::nelec,&nelec); } else if (strcmp("nupdown", word) == 0) { read_value(ifs, nupdown); + Para_Json::set_json_value(Para_Json::nupdown,&nupdown); } else if (strcmp("lmaxmax", word) == 0) { read_value(ifs, lmaxmax); + Para_Json::set_json_value(Para_Json::lmaxmax,&lmaxmax); } //---------------------------------------------------------- // new function @@ -899,34 +959,42 @@ bool Input::Read(const std::string &fn) else if (strcmp("basis_type", word) == 0) { read_value(ifs, basis_type); + Para_Json::set_json_value(Para_Json::basis_type,&basis_type); } // xiaohui add 2013-09-01 else if (strcmp("ks_solver", word) == 0) { read_value(ifs, ks_solver); + Para_Json::set_json_value(Para_Json::ks_solver,&ks_solver); } // xiaohui add 2013-09-01 else if (strcmp("search_radius", word) == 0) { read_value(ifs, search_radius); + Para_Json::set_json_value(Para_Json::search_radius,&search_radius); } else if (strcmp("search_pbc", word) == 0) { read_bool(ifs, search_pbc); + Para_Json::set_json_value(Para_Json::search_pbc,&search_pbc); } else if (strcmp("symmetry", word) == 0) { read_value(ifs, symmetry); + Para_Json::set_json_value(Para_Json::symmetry,&symmetry); } else if (strcmp("init_vel", word) == 0) { read_bool(ifs, init_vel); + Para_Json::set_json_value(Para_Json::init_vel,&init_vel); } else if (strcmp("ref_cell_factor", word) == 0) { read_value(ifs, ref_cell_factor); + Para_Json::set_json_value(Para_Json::ref_cell_factor,&ref_cell_factor); } else if (strcmp("symmetry_prec", word) == 0) // LiuXh add 2021-08-12, accuracy for symmetry { read_value(ifs, symmetry_prec); + Para_Json::set_json_value(Para_Json::symmetry_precfield,&symmetry_prec); } else if (strcmp("symmetry_autoclose", word) == 0) { @@ -935,92 +1003,114 @@ bool Input::Read(const std::string &fn) else if (strcmp("cal_force", word) == 0) { read_bool(ifs, cal_force); + Para_Json::set_json_value(Para_Json::cal_force,&cal_force); } else if (strcmp("force_thr", word) == 0) { read_value(ifs, force_thr); + Para_Json::set_json_value(Para_Json::force_thr,&force_thr); } else if (strcmp("force_thr_ev", word) == 0) { read_value(ifs, force_thr); + Para_Json::set_json_value(Para_Json::force_thr_ev,&force_thr); force_thr = force_thr / 13.6058 * 0.529177; } else if (strcmp("force_thr_ev2", word) == 0) { read_value(ifs, force_thr_ev2); + Para_Json::set_json_value(Para_Json::force_thr_ev2,&force_thr_ev2); } else if (strcmp("stress_thr", word) == 0) { read_value(ifs, stress_thr); + Para_Json::set_json_value(Para_Json::stress_thr,&stress_thr); } else if (strcmp("press1", word) == 0) { read_value(ifs, press1); + Para_Json::set_json_value(Para_Json::press1,&press1); } else if (strcmp("press2", word) == 0) { read_value(ifs, press2); + Para_Json::set_json_value(Para_Json::press2,&press2); } else if (strcmp("press3", word) == 0) { read_value(ifs, press3); + Para_Json::set_json_value(Para_Json::press3,&press3); } else if (strcmp("cal_stress", word) == 0) { read_bool(ifs, cal_stress); + Para_Json::set_json_value(Para_Json::cal_stress,&cal_stress); } else if (strcmp("fixed_axes", word) == 0) { read_value(ifs, fixed_axes); + Para_Json::set_json_value(Para_Json::fixed_axes,&fixed_axes); } else if (strcmp("fixed_ibrav", word) == 0) { read_bool(ifs, fixed_ibrav); + Para_Json::set_json_value(Para_Json::fixed_ibrav,&fixed_ibrav); } else if (strcmp("fixed_atoms", word) == 0) { read_bool(ifs, fixed_atoms); + Para_Json::set_json_value(Para_Json::fixed_atoms,&fixed_atoms); } else if (strcmp("relax_method", word) == 0) { read_value(ifs, relax_method); + Para_Json::set_json_value(Para_Json::relax_method,&relax_method); } else if (strcmp("relax_cg_thr", word) == 0) // pengfei add 2013-08-15 { read_value(ifs, relax_cg_thr); + Para_Json::set_json_value(Para_Json::relax_cg_thr,&relax_cg_thr); } else if (strcmp("out_level", word) == 0) { read_value(ifs, out_level); out_md_control = true; + Para_Json::set_json_value(Para_Json::out_level,&out_level); } else if (strcmp("relax_bfgs_w1", word) == 0) { read_value(ifs, relax_bfgs_w1); + Para_Json::set_json_value(Para_Json::relax_bfgs_w1,&relax_bfgs_w1); } else if (strcmp("relax_bfgs_w2", word) == 0) { read_value(ifs, relax_bfgs_w2); + Para_Json::set_json_value(Para_Json::relax_bfgs_w2,&relax_bfgs_w2); } else if (strcmp("relax_bfgs_rmax", word) == 0) { read_value(ifs, relax_bfgs_rmax); + Para_Json::set_json_value(Para_Json::relax_bfgs_rmax,&relax_bfgs_rmax); } else if (strcmp("relax_bfgs_rmin", word) == 0) { read_value(ifs, relax_bfgs_rmin); + Para_Json::set_json_value(Para_Json::relax_bfgs_rmin,&relax_bfgs_rmin); } else if (strcmp("relax_bfgs_init", word) == 0) { read_value(ifs, relax_bfgs_init); + Para_Json::set_json_value(Para_Json::relax_bfgs_init,&relax_bfgs_init); } else if (strcmp("relax_scale_force", word) == 0) { read_value(ifs, relax_scale_force); + Para_Json::set_json_value(Para_Json::relax_scale_force,&relax_scale_force); } else if (strcmp("relax_new", word) == 0) { read_bool(ifs, relax_new); + Para_Json::set_json_value(Para_Json::relax_new,&relax_new); } else if (strcmp("use_paw", word) == 0) { @@ -1032,6 +1122,8 @@ bool Input::Read(const std::string &fn) else if (strcmp("gamma_only", word) == 0) { read_bool(ifs, gamma_only); + + Para_Json::set_json_value(Para_Json::gamma_only,&gamma_only); } else if (strcmp("fft_mode", word) == 0) { @@ -1040,6 +1132,8 @@ bool Input::Read(const std::string &fn) else if (strcmp("ecutwfc", word) == 0) { read_value(ifs, ecutwfc); + Para_Json::set_json_value(Para_Json::ecutwfc,&ecutwfc); + ecutrho = 4.0 * ecutwfc; } else if (strcmp("ecutrho", word) == 0) { @@ -1048,29 +1142,36 @@ bool Input::Read(const std::string &fn) else if (strcmp("nx", word) == 0) { read_value(ifs, nx); + Para_Json::set_json_value(Para_Json::nx,&nx); + ncx = nx; } else if (strcmp("ny", word) == 0) { read_value(ifs, ny); + Para_Json::set_json_value(Para_Json::ny,&ny); ncy = ny; } else if (strcmp("nz", word) == 0) { read_value(ifs, nz); + Para_Json::set_json_value(Para_Json::nz,&nz); ncz = nz; } else if (strcmp("bx", word) == 0) { read_value(ifs, bx); + Para_Json::set_json_value(Para_Json::bx,&bx); } else if (strcmp("by", word) == 0) { read_value(ifs, by); + Para_Json::set_json_value(Para_Json::by,&by); } else if (strcmp("bz", word) == 0) { read_value(ifs, bz); + Para_Json::set_json_value(Para_Json::bz,&bz); } else if (strcmp("ndx", word) == 0) { @@ -1106,66 +1207,82 @@ bool Input::Read(const std::string &fn) else if (strcmp("diago_proc", word) == 0) { read_value(ifs, diago_proc); + Para_Json::set_json_value(Para_Json::diago_proc,&diago_proc); } else if (strcmp("pw_diag_nmax", word) == 0) { read_value(ifs, pw_diag_nmax); + Para_Json::set_json_value(Para_Json::pw_diag_nmax,&pw_diag_nmax); } else if (strcmp("diago_cg_prec", word) == 0) // mohan add 2012-03-31 { read_value(ifs, diago_cg_prec); + //Para_Json::set_json_value(Para_Json::diago_cg_prec,&diago_cg_prec); } else if (strcmp("pw_diag_ndim", word) == 0) { read_value(ifs, pw_diag_ndim); + Para_Json::set_json_value(Para_Json::pw_diag_ndim,&pw_diag_ndim); } else if (strcmp("pw_diag_thr", word) == 0) { read_value(ifs, pw_diag_thr); + Para_Json::set_json_value(Para_Json::pw_diag_thr,&pw_diag_thr); } else if (strcmp("nb2d", word) == 0) { read_value(ifs, nb2d); + Para_Json::set_json_value(Para_Json::nb2d,&nb2d); } else if (strcmp("nurse", word) == 0) { read_value(ifs, nurse); + //Para_Json::set_json_value(Para_Json::nurse,&nurse); } else if (strcmp("colour", word) == 0) { read_bool(ifs, colour); + Para_Json::set_json_value(Para_Json::colour,&colour); } else if (strcmp("nbspline", word) == 0) { read_value(ifs, nbspline); + Para_Json::set_json_value(Para_Json::nbspline, line); } else if (strcmp("t_in_h", word) == 0) { read_bool(ifs, t_in_h); + Para_Json::set_json_value(Para_Json::t_in_h,&t_in_h); } else if (strcmp("vl_in_h", word) == 0) { read_bool(ifs, vl_in_h); + Para_Json::set_json_value(Para_Json::vl_in_h,&vl_in_h); } else if (strcmp("vnl_in_h", word) == 0) { read_bool(ifs, vnl_in_h); + Para_Json::set_json_value(Para_Json::vnl_in_h,&vnl_in_h); } else if (strcmp("vh_in_h", word) == 0) { read_bool(ifs, vh_in_h); + Para_Json::set_json_value(Para_Json::vh_in_h,&vh_in_h); } else if (strcmp("vion_in_h", word) == 0) { read_bool(ifs, vion_in_h); + Para_Json::set_json_value(Para_Json::vion_in_h,&vion_in_h); } else if (strcmp("test_force", word) == 0) { read_bool(ifs, test_force); + Para_Json::set_json_value(Para_Json::test_force,&test_force); } else if (strcmp("test_stress", word) == 0) { read_bool(ifs, test_stress); + Para_Json::set_json_value(Para_Json::test_stress,&test_stress); } //---------------------------------------------------------- // iteration @@ -1173,22 +1290,27 @@ bool Input::Read(const std::string &fn) else if (strcmp("scf_thr", word) == 0) { read_value(ifs, scf_thr); + Para_Json::set_json_value(Para_Json::scf_thr,&scf_thr); } else if (strcmp("scf_thr_type", word) == 0) { read_value(ifs, scf_thr_type); + Para_Json::set_json_value(Para_Json::scf_thr_type,&scf_thr_type); } else if (strcmp("scf_nmax", word) == 0) { read_value(ifs, scf_nmax); + Para_Json::set_json_value(Para_Json::scf_nmax,&scf_nmax); } else if (strcmp("relax_nmax", word) == 0) { read_value(ifs, this->relax_nmax); + Para_Json::set_json_value(Para_Json::relax_nmax,&relax_nmax); } else if (strcmp("out_stru", word) == 0) { read_bool(ifs, out_stru); + Para_Json::set_json_value(Para_Json::out_stru,&out_stru); } //---------------------------------------------------------- // occupation @@ -1200,10 +1322,12 @@ bool Input::Read(const std::string &fn) else if (strcmp("smearing_method", word) == 0) { read_value(ifs, smearing_method); + Para_Json::set_json_value(Para_Json::smearing_method,&smearing_method); } else if (strcmp("smearing_sigma", word) == 0) { read_value(ifs, smearing_sigma); + Para_Json::set_json_value(Para_Json::smearing_sigma,&smearing_sigma); } else if (strcmp("smearing_sigma_temp", word) == 0) { @@ -1217,26 +1341,32 @@ bool Input::Read(const std::string &fn) else if (strcmp("mixing_type", word) == 0) { read_value(ifs, mixing_mode); + Para_Json::set_json_value(Para_Json::mixing_type,&mixing_mode); } else if (strcmp("mixing_beta", word) == 0) { read_value(ifs, mixing_beta); + Para_Json::set_json_value(Para_Json::mixing_beta,&mixing_beta); } else if (strcmp("mixing_ndim", word) == 0) { read_value(ifs, mixing_ndim); + Para_Json::set_json_value(Para_Json::mixing_ndim,&mixing_ndim); } else if (strcmp("mixing_gg0", word) == 0) // mohan add 2014-09-27 { read_value(ifs, mixing_gg0); + Para_Json::set_json_value(Para_Json::mixing_gg0,&mixing_gg0); } else if (strcmp("mixing_tau", word) == 0) { read_bool(ifs, mixing_tau); + Para_Json::set_json_value(Para_Json::mixing_tau,&mixing_tau); } else if (strcmp("mixing_dftu", word) == 0) { read_bool(ifs, mixing_dftu); + Para_Json::set_json_value(Para_Json::mixing_dftu,&mixing_dftu); } //---------------------------------------------------------- // charge / potential / wavefunction @@ -1244,10 +1374,12 @@ bool Input::Read(const std::string &fn) else if (strcmp("read_file_dir", word) == 0) { read_value(ifs, read_file_dir); + Para_Json::set_json_value(Para_Json::read_file_dir,&read_file_dir); } else if (strcmp("init_wfc", word) == 0) { read_value(ifs, init_wfc); + Para_Json::set_json_value(Para_Json::init_wfc,&init_wfc); } else if (strcmp("psi_initializer", word) == 0) { @@ -1256,155 +1388,192 @@ bool Input::Read(const std::string &fn) else if (strcmp("mem_saver", word) == 0) { read_value(ifs, mem_saver); + Para_Json::set_json_value(Para_Json::mem_saver,&mem_saver); } else if (strcmp("printe", word) == 0) { read_value(ifs, printe); + Para_Json::set_json_value(Para_Json::printe,&printe); } else if (strcmp("init_chg", word) == 0) { read_value(ifs, init_chg); + Para_Json::set_json_value(Para_Json::init_chg,&init_chg); } else if (strcmp("chg_extrap", word) == 0) // xiaohui modify 2015-02-01 { read_value(ifs, chg_extrap); // xiaohui modify 2015-02-01 + Para_Json::set_json_value(Para_Json::chg_extrap,&chg_extrap); } else if (strcmp("out_freq_elec", word) == 0) { read_value(ifs, out_freq_elec); + Para_Json::set_json_value(Para_Json::out_freq_elec,&out_freq_elec); } else if (strcmp("out_freq_ion", word) == 0) { read_value(ifs, out_freq_ion); + Para_Json::set_json_value(Para_Json::out_freq_ion,&out_freq_ion); } else if (strcmp("out_chg", word) == 0) { read_bool(ifs, out_chg); + Para_Json::set_json_value(Para_Json::out_chg,&out_chg); } else if (strcmp("out_dm", word) == 0) { read_bool(ifs, out_dm); + Para_Json::set_json_value(Para_Json::out_dm,&out_dm); } else if (strcmp("out_dm1", word) == 0) { read_bool(ifs, out_dm1); + Para_Json::set_json_value(Para_Json::out_dm1,&out_dm1); } else if (strcmp("out_bandgap", word) == 0) // for bandgap printing { read_bool(ifs, out_bandgap); + Para_Json::set_json_value(Para_Json::out_bandgap,&out_bandgap); } else if (strcmp("deepks_out_labels", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_out_labels); + Para_Json::set_json_value(Para_Json::deepks_out_labels,&deepks_out_labels); } else if (strcmp("deepks_scf", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_scf); + Para_Json::set_json_value(Para_Json::deepks_scf,&deepks_scf); } else if (strcmp("deepks_bandgap", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_bandgap); + Para_Json::set_json_value(Para_Json::deepks_bandgap,&deepks_bandgap); } else if (strcmp("deepks_out_unittest", word) == 0) // mohan added 2021-01-03 { read_bool(ifs, deepks_out_unittest); + Para_Json::set_json_value(Para_Json::deepks_out_unittest,&deepks_out_unittest); } else if (strcmp("deepks_model", word) == 0) // caoyu added 2021-06-03 { read_value(ifs, deepks_model); + Para_Json::set_json_value(Para_Json::deepks_model,&deepks_model); } else if (strcmp("out_pot", word) == 0) { read_value(ifs, out_pot); + Para_Json::set_json_value(Para_Json::out_pot,&out_pot); } else if (strcmp("out_wfc_pw", word) == 0) { read_value(ifs, out_wfc_pw); + Para_Json::set_json_value(Para_Json::out_wfc_pw,&out_wfc_pw); } else if (strcmp("out_wfc_r", word) == 0) { read_bool(ifs, out_wfc_r); + Para_Json::set_json_value(Para_Json::out_wfc_r,&out_wfc_r); } // mohan add 20090909 else if (strcmp("out_dos", word) == 0) { read_value(ifs, out_dos); + Para_Json::set_json_value(Para_Json::out_dos,&out_dos); } else if (strcmp("out_band", word) == 0) { read_bool(ifs, out_band); + Para_Json::set_json_value(Para_Json::out_band,&out_band); } else if (strcmp("out_proj_band", word) == 0) { read_bool(ifs, out_proj_band); + Para_Json::set_json_value(Para_Json::out_proj_band,&out_proj_band); } else if (strcmp("out_mat_hs", word) == 0) { read_bool(ifs, out_mat_hs); + Para_Json::set_json_value(Para_Json::out_mat_hs,&out_mat_hs); } // LiuXh add 2019-07-15 else if (strcmp("out_mat_hs2", word) == 0) { read_bool(ifs, out_mat_hs2); + Para_Json::set_json_value(Para_Json::out_mat_hs2,&out_mat_hs2); } else if (strcmp("out_mat_t", word) == 0) { read_bool(ifs, out_mat_t); + Para_Json::set_json_value(Para_Json::out_mat_t,&out_mat_t); } else if (strcmp("out_mat_dh", word) == 0) { read_bool(ifs, out_mat_dh); + Para_Json::set_json_value(Para_Json::out_mat_dh,&out_mat_dh); } else if (strcmp("out_interval", word) == 0) { read_value(ifs, out_interval); + Para_Json::set_json_value(Para_Json::out_interval,&out_interval); } else if (strcmp("out_app_flag", word) == 0) { read_bool(ifs, out_app_flag); + Para_Json::set_json_value(Para_Json::out_app_flag,&out_app_flag); } else if (strcmp("out_mat_r", word) == 0) { read_bool(ifs, out_mat_r); + Para_Json::set_json_value(Para_Json::out_mat_r,&out_mat_r); } else if (strcmp("out_wfc_lcao", word) == 0) { read_value(ifs, out_wfc_lcao); + Para_Json::set_json_value(Para_Json::out_wfc_lcao,&out_wfc_lcao); } else if (strcmp("out_alllog", word) == 0) { read_bool(ifs, out_alllog); + Para_Json::set_json_value(Para_Json::out_alllog,&out_alllog); } else if (strcmp("out_element_info", word) == 0) { read_bool(ifs, out_element_info); + Para_Json::set_json_value(Para_Json::out_element_info,&out_element_info); } else if (strcmp("dos_emin_ev", word) == 0) { read_value(ifs, dos_emin_ev); dos_setemin = true; + Para_Json::set_json_value(Para_Json::dos_emin_ev,&dos_emin_ev); } else if (strcmp("dos_emax_ev", word) == 0) { read_value(ifs, dos_emax_ev); + Para_Json::set_json_value(Para_Json::dos_emax_ev,&dos_emax_ev); dos_setemax = true; } else if (strcmp("dos_edelta_ev", word) == 0) { read_value(ifs, dos_edelta_ev); + Para_Json::set_json_value(Para_Json::dos_edelta_ev,&dos_edelta_ev); } else if (strcmp("dos_scale", word) == 0) { read_value(ifs, dos_scale); + Para_Json::set_json_value(Para_Json::dos_scale,&dos_scale); } else if (strcmp("dos_sigma", word) == 0) { read_value(ifs, dos_sigma); + Para_Json::set_json_value(Para_Json::dos_sigma,&dos_sigma); } else if (strcmp("dos_nche", word) == 0) { read_value(ifs, dos_nche); + Para_Json::set_json_value(Para_Json::dos_nche,&dos_nche); } //---------------------------------------------------------- @@ -1414,18 +1583,22 @@ bool Input::Read(const std::string &fn) else if (strcmp("lcao_ecut", word) == 0) { read_value(ifs, lcao_ecut); + Para_Json::set_json_value(Para_Json::lcao_ecut,&lcao_ecut); } else if (strcmp("lcao_dk", word) == 0) { read_value(ifs, lcao_dk); + Para_Json::set_json_value(Para_Json::lcao_dk,&lcao_dk); } else if (strcmp("lcao_dr", word) == 0) { read_value(ifs, lcao_dr); + Para_Json::set_json_value(Para_Json::lcao_dr,&lcao_dr); } else if (strcmp("lcao_rmax", word) == 0) { read_value(ifs, lcao_rmax); + Para_Json::set_json_value(Para_Json::lcao_rmax,&lcao_rmax); } //---------------------------------------------------------- // Molecule Dynamics @@ -1434,146 +1607,183 @@ bool Input::Read(const std::string &fn) else if (strcmp("md_type", word) == 0) { read_value(ifs, mdp.md_type); + Para_Json::set_json_value(Para_Json::md_type,&mdp.md_type); + } else if (strcmp("md_thermostat", word) == 0) { read_value(ifs, mdp.md_thermostat); + Para_Json::set_json_value(Para_Json::md_thermostat,&mdp.md_thermostat); } else if (strcmp("md_nraise", word) == 0) { read_value(ifs, mdp.md_nraise); + Para_Json::set_json_value(Para_Json::md_nraise,&mdp.md_nraise); } else if (strcmp("cal_syns", word) == 0) { read_value(ifs, cal_syns); + Para_Json::set_json_value(Para_Json::cal_syns,&cal_syns); } else if (strcmp("dmax", word) == 0) { read_value(ifs, dmax); + Para_Json::set_json_value(Para_Json::dmax,&dmax); } else if (strcmp("md_tolerance", word) == 0) { read_value(ifs, mdp.md_tolerance); + Para_Json::set_json_value(Para_Json::md_tolerance,&mdp.md_tolerance); } else if (strcmp("md_nstep", word) == 0) { read_value(ifs, mdp.md_nstep); + Para_Json::set_json_value(Para_Json::md_nstep,&mdp.md_nstep); } else if (strcmp("md_dt", word) == 0) { read_value(ifs, mdp.md_dt); + Para_Json::set_json_value(Para_Json::md_dt,&mdp.md_dt); } else if (strcmp("md_tchain", word) == 0) { read_value(ifs, mdp.md_tchain); + Para_Json::set_json_value(Para_Json::md_tchain,&mdp.md_tchain); } else if (strcmp("md_tfirst", word) == 0) { read_value(ifs, mdp.md_tfirst); + Para_Json::set_json_value(Para_Json::md_tfirst,&mdp.md_tfirst); } else if (strcmp("md_tlast", word) == 0) { read_value(ifs, mdp.md_tlast); + Para_Json::set_json_value(Para_Json::md_tlast,&mdp.md_tlast); } else if (strcmp("md_dumpfreq", word) == 0) { read_value(ifs, mdp.md_dumpfreq); + Para_Json::set_json_value(Para_Json::md_dumpfreq,&mdp.md_dumpfreq); } else if (strcmp("md_restartfreq", word) == 0) { read_value(ifs, mdp.md_restartfreq); + Para_Json::set_json_value(Para_Json::md_restartfreq,&mdp.md_restartfreq); } else if (strcmp("md_seed", word) == 0) { read_value(ifs, mdp.md_seed); + Para_Json::set_json_value(Para_Json::md_seed,&mdp.md_seed); } else if (strcmp("md_prec_level", word) == 0) { read_value(ifs, mdp.md_prec_level); + Para_Json::set_json_value(Para_Json::md_prec_level,&mdp.md_prec_level); } else if (strcmp("md_restart", word) == 0) { read_bool(ifs, mdp.md_restart); + Para_Json::set_json_value(Para_Json::md_restart,&mdp.md_restart); } else if (strcmp("md_pmode", word) == 0) { read_value(ifs, mdp.md_pmode); + Para_Json::set_json_value(Para_Json::md_pmode,&mdp.md_pmode); } else if (strcmp("md_pcouple", word) == 0) { read_value(ifs, mdp.md_pcouple); + Para_Json::set_json_value(Para_Json::md_pcouple,&mdp.md_pcouple); } else if (strcmp("md_pchain", word) == 0) { read_value(ifs, mdp.md_pchain); + Para_Json::set_json_value(Para_Json::md_pchain,&mdp.md_pchain); } else if (strcmp("md_pfirst", word) == 0) { read_value(ifs, mdp.md_pfirst); + Para_Json::set_json_value(Para_Json::md_pfirst,&mdp.md_pfirst); } else if (strcmp("md_plast", word) == 0) { read_value(ifs, mdp.md_plast); + Para_Json::set_json_value(Para_Json::md_plast,&mdp.md_plast); } else if (strcmp("md_pfreq", word) == 0) { read_value(ifs, mdp.md_pfreq); + Para_Json::set_json_value(Para_Json::md_pfreq,&mdp.md_pfreq); } else if (strcmp("lj_rcut", word) == 0) { read_value(ifs, mdp.lj_rcut); + Para_Json::set_json_value(Para_Json::lj_rcut,&mdp.lj_rcut); } else if (strcmp("lj_epsilon", word) == 0) { read_value(ifs, mdp.lj_epsilon); + Para_Json::set_json_value(Para_Json::lj_epsilon,&mdp.lj_epsilon); } else if (strcmp("lj_sigma", word) == 0) { read_value(ifs, mdp.lj_sigma); + Para_Json::set_json_value(Para_Json::lj_sigma,&mdp.lj_sigma); } else if (strcmp("msst_direction", word) == 0) { read_value(ifs, mdp.msst_direction); + Para_Json::set_json_value(Para_Json::msst_direction,&mdp.msst_direction); } else if (strcmp("msst_vel", word) == 0) { read_value(ifs, mdp.msst_vel); + Para_Json::set_json_value(Para_Json::msst_vel,&mdp.msst_vel); } else if (strcmp("msst_vis", word) == 0) { read_value(ifs, mdp.msst_vis); + Para_Json::set_json_value(Para_Json::msst_vis,&mdp.msst_vis); } else if (strcmp("msst_tscale", word) == 0) { read_value(ifs, mdp.msst_tscale); + Para_Json::set_json_value(Para_Json::msst_tscale,&mdp.msst_tscale); } else if (strcmp("msst_qmass", word) == 0) { read_value(ifs, mdp.msst_qmass); + Para_Json::set_json_value(Para_Json::msst_qmass,&mdp.msst_qmass); } else if (strcmp("md_tfreq", word) == 0) { read_value(ifs, mdp.md_tfreq); + Para_Json::set_json_value(Para_Json::md_tfreq,&mdp.md_tfreq); } else if (strcmp("md_damp", word) == 0) { read_value(ifs, mdp.md_damp); + Para_Json::set_json_value(Para_Json::md_damp,&mdp.md_damp); } else if (strcmp("pot_file", word) == 0) { read_value(ifs, mdp.pot_file); + Para_Json::set_json_value(Para_Json::pot_file,&mdp.pot_file); } else if (strcmp("dump_force", word) == 0) { read_bool(ifs, mdp.dump_force); + Para_Json::set_json_value(Para_Json::dump_force,&mdp.dump_force); } else if (strcmp("dump_vel", word) == 0) { read_bool(ifs, mdp.dump_vel); + Para_Json::set_json_value(Para_Json::dump_vel,&mdp.dump_vel); } else if (strcmp("dump_virial", word) == 0) { read_bool(ifs, mdp.dump_virial); + Para_Json::set_json_value(Para_Json::dump_virial,&mdp.dump_virial); } //---------------------------------------------------------- // efield and dipole correction @@ -1582,26 +1792,32 @@ bool Input::Read(const std::string &fn) else if (strcmp("efield_flag", word) == 0) { read_bool(ifs, efield_flag); + Para_Json::set_json_value(Para_Json::efield_flag,&efield_flag); } else if (strcmp("dip_cor_flag", word) == 0) { read_bool(ifs, dip_cor_flag); + Para_Json::set_json_value(Para_Json::dip_cor_flag,&dip_cor_flag); } else if (strcmp("efield_dir", word) == 0) { read_value(ifs, efield_dir); + Para_Json::set_json_value(Para_Json::efield_dir,&efield_dir); } else if (strcmp("efield_pos_max", word) == 0) { read_value(ifs, efield_pos_max); + Para_Json::set_json_value(Para_Json::efield_pos_max,&efield_pos_max); } else if (strcmp("efield_pos_dec", word) == 0) { read_value(ifs, efield_pos_dec); + Para_Json::set_json_value(Para_Json::efield_pos_dec,&efield_pos_dec); } else if (strcmp("efield_amp", word) == 0) { read_value(ifs, efield_amp); + Para_Json::set_json_value(Para_Json::efield_amp,&efield_amp); } //---------------------------------------------------------- // gatefield (compensating charge) @@ -1610,30 +1826,37 @@ bool Input::Read(const std::string &fn) else if (strcmp("gate_flag", word) == 0) { read_bool(ifs, gate_flag); + Para_Json::set_json_value(Para_Json::gate_flag,&gate_flag); } else if (strcmp("zgate", word) == 0) { read_value(ifs, zgate); + Para_Json::set_json_value(Para_Json::zgate,&zgate); } else if (strcmp("relax", word) == 0) { read_bool(ifs, relax); + //Para_Json::set_json_value(Para_Json::relax,&relax); } else if (strcmp("block", word) == 0) { read_bool(ifs, block); + Para_Json::set_json_value(Para_Json::block,&block); } else if (strcmp("block_down", word) == 0) { read_value(ifs, block_down); + Para_Json::set_json_value(Para_Json::block_down,&block_down); } else if (strcmp("block_up", word) == 0) { read_value(ifs, block_up); + Para_Json::set_json_value(Para_Json::block_up,&block_up); } else if (strcmp("block_height", word) == 0) { read_value(ifs, block_height); + Para_Json::set_json_value(Para_Json::block_height,&block_height); } //---------------------------------------------------------- // tddft @@ -1642,130 +1865,162 @@ bool Input::Read(const std::string &fn) else if (strcmp("td_force_dt", word) == 0) { read_value(ifs, td_force_dt); + //Para_Json::set_json_value(Para_Json::td_force_dt,&td_force_dt); } else if (strcmp("td_vext", word) == 0) { read_value(ifs, td_vext); + Para_Json::set_json_value(Para_Json::td_vext,&td_vext); } else if (strcmp("td_vext_dire", word) == 0) { getline(ifs, td_vext_dire); + Para_Json::set_json_value(Para_Json::td_vext_dire,&td_vext_dire); } else if (strcmp("out_dipole", word) == 0) { read_value(ifs, out_dipole); + Para_Json::set_json_value(Para_Json::td_out_dipole,&out_dipole); } else if (strcmp("out_efield", word) == 0) { read_value(ifs, out_efield); + Para_Json::set_json_value(Para_Json::td_out_efield,&out_efield); } else if (strcmp("td_print_eij", word) == 0) { read_value(ifs, td_print_eij); + Para_Json::set_json_value(Para_Json::td_print_eij,&td_print_eij); } else if (strcmp("td_edm", word) == 0) { read_value(ifs, td_edm); + Para_Json::set_json_value(Para_Json::td_edm,&td_edm); } else if (strcmp("td_propagator", word) == 0) { read_value(ifs, propagator); + Para_Json::set_json_value(Para_Json::td_propagator,&propagator); } else if (strcmp("td_stype", word) == 0) { read_value(ifs, td_stype); + Para_Json::set_json_value(Para_Json::td_stype,&td_stype); } else if (strcmp("td_ttype", word) == 0) { getline(ifs, td_ttype); + Para_Json::set_json_value(Para_Json::td_ttype,&td_ttype); } else if (strcmp("td_tstart", word) == 0) { read_value(ifs, td_tstart); + Para_Json::set_json_value(Para_Json::td_tstart,&td_tstart); } else if (strcmp("td_tend", word) == 0) { read_value(ifs, td_tend); + Para_Json::set_json_value(Para_Json::td_tend,&td_tend); } else if (strcmp("td_lcut1", word) == 0) { read_value(ifs, td_lcut1); + Para_Json::set_json_value(Para_Json::td_lcut1,&td_lcut1); } else if (strcmp("td_lcut2", word) == 0) { read_value(ifs, td_lcut2); + Para_Json::set_json_value(Para_Json::td_lcut2,&td_lcut2); } else if (strcmp("td_gauss_freq", word) == 0) { getline(ifs, td_gauss_freq); + Para_Json::set_json_value(Para_Json::td_gauss_freq,&td_gauss_freq); } else if (strcmp("td_gauss_phase", word) == 0) { getline(ifs, td_gauss_phase); + Para_Json::set_json_value(Para_Json::td_gauss_phase,&td_gauss_phase); } else if (strcmp("td_gauss_sigma", word) == 0) { getline(ifs, td_gauss_sigma); + Para_Json::set_json_value(Para_Json::td_gauss_sigma,&td_gauss_sigma); } else if (strcmp("td_gauss_t0", word) == 0) { getline(ifs, td_gauss_t0); + Para_Json::set_json_value(Para_Json::td_gauss_t0,&td_gauss_t0); } else if (strcmp("td_gauss_amp", word) == 0) { getline(ifs, td_gauss_amp); + Para_Json::set_json_value(Para_Json::td_gauss_amp,&td_gauss_amp); } else if (strcmp("td_trape_freq", word) == 0) { getline(ifs, td_trape_freq); + Para_Json::set_json_value(Para_Json::td_trape_freq,&td_gauss_freq); } else if (strcmp("td_trape_phase", word) == 0) { getline(ifs, td_trape_phase); + Para_Json::set_json_value(Para_Json::td_trape_phase,&td_trape_phase); } else if (strcmp("td_trape_t1", word) == 0) { getline(ifs, td_trape_t1); + Para_Json::set_json_value(Para_Json::td_trape_t1,&td_trape_t1); } else if (strcmp("td_trape_t2", word) == 0) { getline(ifs, td_trape_t2); + Para_Json::set_json_value(Para_Json::td_trape_t2,&td_trape_t2); } else if (strcmp("td_trape_t3", word) == 0) { getline(ifs, td_trape_t3); + Para_Json::set_json_value(Para_Json::td_trape_t3,&td_trape_t3); } else if (strcmp("td_trape_amp", word) == 0) { getline(ifs, td_trape_amp); + Para_Json::set_json_value(Para_Json::td_trape_amp,&td_trape_amp); } else if (strcmp("td_trigo_freq1", word) == 0) { getline(ifs, td_trigo_freq1); + Para_Json::set_json_value(Para_Json::td_trigo_freq1,&td_trigo_freq1); } else if (strcmp("td_trigo_freq2", word) == 0) { getline(ifs, td_trigo_freq2); + Para_Json::set_json_value(Para_Json::td_trigo_freq2,&td_trigo_freq2); } else if (strcmp("td_trigo_phase1", word) == 0) { getline(ifs, td_trigo_phase1); + Para_Json::set_json_value(Para_Json::td_trigo_phase1,&td_trigo_phase1); } else if (strcmp("td_trigo_phase2", word) == 0) { getline(ifs, td_trigo_phase2); + Para_Json::set_json_value(Para_Json::td_trigo_phase2,&td_trigo_phase2); } else if (strcmp("td_trigo_amp", word) == 0) { getline(ifs, td_trigo_amp); + Para_Json::set_json_value(Para_Json::td_trigo_amp,&td_trigo_amp); } else if (strcmp("td_heavi_t0", word) == 0) { getline(ifs, td_heavi_t0); + Para_Json::set_json_value(Para_Json::td_heavi_t0,&td_heavi_t0); } else if (strcmp("td_heavi_amp", word) == 0) { getline(ifs, td_heavi_amp); + Para_Json::set_json_value(Para_Json::td_heavi_amp,&td_heavi_amp); } // else if (strcmp("td_hhg_amp1", word) == 0) // { @@ -1806,71 +2061,91 @@ bool Input::Read(const std::string &fn) else if (strcmp("vdw_method", word) == 0) { read_value(ifs, vdw_method); + Para_Json::set_json_value(Para_Json::vdw_method,&vdw_method); } else if (strcmp("vdw_s6", word) == 0) { read_value(ifs, vdw_s6); + Para_Json::set_json_value(Para_Json::vdw_s6,&vdw_s6); } else if (strcmp("vdw_s8", word) == 0) { read_value(ifs, vdw_s8); + Para_Json::set_json_value(Para_Json::vdw_s8,&vdw_s8); } else if (strcmp("vdw_a1", word) == 0) { read_value(ifs, vdw_a1); + Para_Json::set_json_value(Para_Json::vdw_a1,&vdw_a1); } else if (strcmp("vdw_a2", word) == 0) { read_value(ifs, vdw_a2); + Para_Json::set_json_value(Para_Json::vdw_a2,&vdw_a2); } else if (strcmp("vdw_d", word) == 0) { read_value(ifs, vdw_d); + Para_Json::set_json_value(Para_Json::vdw_d,&vdw_d); } else if (strcmp("vdw_abc", word) == 0) { read_bool(ifs, vdw_abc); + Para_Json::set_json_value(Para_Json::vdw_abc,&vdw_abc); } else if (strcmp("vdw_cutoff_radius", word) == 0) { read_value(ifs, vdw_cutoff_radius); + Para_Json::set_json_value(Para_Json::vdw_cutoff_radius,&vdw_cutoff_radius); } else if (strcmp("vdw_radius_unit", word) == 0) { read_value(ifs, vdw_radius_unit); + Para_Json::set_json_value(Para_Json::vdw_radius_unit,&vdw_radius_unit); } else if (strcmp("vdw_cn_thr", word) == 0) { read_value(ifs, vdw_cn_thr); + Para_Json::set_json_value(Para_Json::vdw_cn_thr,&vdw_cn_thr); } else if (strcmp("vdw_cn_thr_unit", word) == 0) { read_value(ifs, vdw_cn_thr_unit); + Para_Json::set_json_value(Para_Json::vdw_cn_thr_unit,&vdw_cn_thr_unit); } else if (strcmp("vdw_c6_file", word) == 0) { read_value(ifs, vdw_C6_file); + Para_Json::set_json_value(Para_Json::vdw_C6_file,&vdw_C6_file); } else if (strcmp("vdw_c6_unit", word) == 0) { read_value(ifs, vdw_C6_unit); + Para_Json::set_json_value(Para_Json::vdw_C6_unit,&vdw_C6_unit); } else if (strcmp("vdw_r0_file", word) == 0) { read_value(ifs, vdw_R0_file); + Para_Json::set_json_value(Para_Json::vdw_R0_file,&vdw_R0_file); } else if (strcmp("vdw_r0_unit", word) == 0) { read_value(ifs, vdw_R0_unit); + Para_Json::set_json_value(Para_Json::vdw_R0_unit,&vdw_R0_unit); } else if (strcmp("vdw_cutoff_type", word) == 0) { read_value(ifs, vdw_cutoff_type); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("vdw_cutoff_period", word) == 0) { ifs >> vdw_cutoff_period.x >> vdw_cutoff_period.y; read_value(ifs, vdw_cutoff_period.z); + + Para_Json::vdw_cutoff_period.PushBack(vdw_cutoff_period.x,Para_Json::doc.GetAllocator()); + Para_Json::vdw_cutoff_period.PushBack(vdw_cutoff_period.y,Para_Json::doc.GetAllocator()); + Para_Json::vdw_cutoff_period.PushBack(vdw_cutoff_period.z,Para_Json::doc.GetAllocator()); } //-------------------------------------------------------- // restart Peize Lin 2020-04-04 @@ -1878,23 +2153,28 @@ bool Input::Read(const std::string &fn) else if (strcmp("restart_save", word) == 0) { read_bool(ifs, restart_save); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("restart_load", word) == 0) { read_bool(ifs, restart_load); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("ocp", word) == 0) { read_bool(ifs, ocp); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("ocp_set", word) == 0) { getline(ifs, ocp_set); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); // ifs.ignore(150, '\n'); } else if (strcmp("out_mul", word) == 0) { read_bool(ifs, out_mul); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } // qifeng add 2019/9/10 //---------------------------------------------------------- // exx @@ -1903,114 +2183,143 @@ bool Input::Read(const std::string &fn) else if (strcmp("exx_hybrid_alpha", word) == 0) { read_value(ifs, exx_hybrid_alpha); + Para_Json::set_json_value(Para_Json::exx_hybrid_alpha,&exx_hybrid_alpha); } else if (strcmp("exx_hse_omega", word) == 0) { read_value(ifs, exx_hse_omega); + Para_Json::set_json_value(Para_Json::exx_hse_omega,&exx_hse_omega); } else if (strcmp("exx_separate_loop", word) == 0) { read_bool(ifs, exx_separate_loop); + Para_Json::set_json_value(Para_Json::exx_separate_loop,&exx_separate_loop); } else if (strcmp("exx_hybrid_step", word) == 0) { read_value(ifs, exx_hybrid_step); + Para_Json::set_json_value(Para_Json::exx_hybrid_step,&exx_hybrid_step); } else if (strcmp("exx_mixing_beta", word) == 0) { read_value(ifs, exx_mixing_beta); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("exx_lambda", word) == 0) { read_value(ifs, exx_lambda); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("exx_real_number", word) == 0) { read_value(ifs, exx_real_number); + // printf("exx_real_number = %s\n",exx_real_number.c_str()); + Para_Json::set_json_value(Para_Json::exx_real_number,&exx_real_number); } else if (strcmp("exx_pca_threshold", word) == 0) { read_value(ifs, exx_pca_threshold); + Para_Json::set_json_value(Para_Json::exx_pca_threshold,&exx_pca_threshold); } else if (strcmp("exx_c_threshold", word) == 0) { read_value(ifs, exx_c_threshold); + Para_Json::set_json_value(Para_Json::exx_c_threshold,&exx_c_threshold); } else if (strcmp("exx_v_threshold", word) == 0) { read_value(ifs, exx_v_threshold); + Para_Json::set_json_value(Para_Json::exx_v_threshold,&exx_v_threshold); } else if (strcmp("exx_dm_threshold", word) == 0) { read_value(ifs, exx_dm_threshold); + Para_Json::set_json_value(Para_Json::exx_dm_threshold,&exx_dm_threshold); } else if (strcmp("exx_schwarz_threshold", word) == 0) { read_value(ifs, exx_schwarz_threshold); + Para_Json::set_json_value(Para_Json::exx_schwarz_threshold,&exx_schwarz_threshold); } else if (strcmp("exx_cauchy_threshold", word) == 0) { read_value(ifs, exx_cauchy_threshold); + Para_Json::set_json_value(Para_Json::exx_cauchy_threshold,&exx_cauchy_threshold); } else if (strcmp("exx_c_grad_threshold", word) == 0) { read_value(ifs, exx_c_grad_threshold); + Para_Json::set_json_value(Para_Json::exx_c_grad_threshold,&exx_c_grad_threshold); } else if (strcmp("exx_v_grad_threshold", word) == 0) { read_value(ifs, exx_v_grad_threshold); + Para_Json::set_json_value(Para_Json::exx_v_grad_threshold,&exx_v_grad_threshold); } else if (strcmp("exx_cauchy_force_threshold", word) == 0) { read_value(ifs, exx_cauchy_force_threshold); + Para_Json::set_json_value(Para_Json::exx_cauchy_force_threshold,&exx_cauchy_force_threshold); } else if (strcmp("exx_cauchy_stress_threshold", word) == 0) { read_value(ifs, exx_cauchy_stress_threshold); + Para_Json::set_json_value(Para_Json::exx_cauchy_stress_threshold,&exx_cauchy_stress_threshold); } else if (strcmp("exx_ccp_threshold", word) == 0) { read_value(ifs, exx_ccp_threshold); + Para_Json::set_json_value(Para_Json::exx_ccp_threshold,&exx_ccp_threshold); } else if (strcmp("exx_ccp_rmesh_times", word) == 0) { read_value(ifs, exx_ccp_rmesh_times); + Para_Json::set_json_value(Para_Json::exx_ccp_rmesh_times,&exx_ccp_rmesh_times); } else if (strcmp("exx_distribute_type", word) == 0) { read_value(ifs, exx_distribute_type); + Para_Json::set_json_value(Para_Json::exx_distribute_type,&exx_distribute_type); } else if (strcmp("exx_opt_orb_lmax", word) == 0) { read_value(ifs, exx_opt_orb_lmax); + Para_Json::set_json_value(Para_Json::exx_opt_orb_lmax,&exx_opt_orb_lmax); } else if (strcmp("exx_opt_orb_ecut", word) == 0) { read_value(ifs, exx_opt_orb_ecut); + Para_Json::set_json_value(Para_Json::exx_opt_orb_ecut,&exx_opt_orb_ecut); } else if (strcmp("exx_opt_orb_tolerence", word) == 0) { read_value(ifs, exx_opt_orb_tolerence); + Para_Json::set_json_value(Para_Json::exx_opt_orb_tolerence,&exx_opt_orb_tolerence); } else if (strcmp("noncolin", word) == 0) { read_bool(ifs, noncolin); + Para_Json::set_json_value(Para_Json::noncolin,&noncolin); } else if (strcmp("lspinorb", word) == 0) { read_bool(ifs, lspinorb); + Para_Json::set_json_value(Para_Json::lspinorb,&lspinorb); } else if (strcmp("soc_lambda", word) == 0) { read_value(ifs, soc_lambda); + Para_Json::set_json_value(Para_Json::soc_lambda,&soc_lambda); } else if (strcmp("cell_factor", word) == 0) { read_value(ifs, cell_factor); + Para_Json::set_json_value(Para_Json::cell_factor,&cell_factor); } else if (strcmp("test_skip_ewald", word) == 0) { read_bool(ifs, test_skip_ewald); + Para_Json::set_json_value(Para_Json::test_skip_ewald,&test_skip_ewald); } //-------------- //---------------------------------------------------------------------------------- @@ -2019,6 +2328,7 @@ bool Input::Read(const std::string &fn) else if (strcmp("dft_plus_u", word) == 0) { read_bool(ifs, dft_plus_u); + //Para_Json::set_json_value(Para_Json::dft_plus_u,&dft_plus_u); } else if (strcmp("yukawa_potential", word) == 0) ifs.ignore(150, '\n'); @@ -2036,6 +2346,7 @@ bool Input::Read(const std::string &fn) else if (strcmp("dft_plus_dmft", word) == 0) { read_bool(ifs, dft_plus_dmft); + //Para_Json::set_json_value(Para_Json::dft_plus_dmft,&dft_plus_dmft); } //---------------------------------------------------------------------------------- // Rong Shi added for RPA @@ -2043,6 +2354,7 @@ bool Input::Read(const std::string &fn) else if (strcmp("rpa", word) == 0) { read_bool(ifs, rpa); + Para_Json::set_json_value(Para_Json::rpa,&rpa); if (rpa) GlobalV::rpa_setorb = true; } @@ -2052,22 +2364,27 @@ bool Input::Read(const std::string &fn) else if (strcmp("imp_sol", word) == 0) { read_bool(ifs, imp_sol); + Para_Json::set_json_value(Para_Json::imp_sol,&imp_sol); } else if (strcmp("eb_k", word) == 0) { read_value(ifs, eb_k); + Para_Json::set_json_value(Para_Json::eb_k,&eb_k); } else if (strcmp("tau", word) == 0) { read_value(ifs, tau); + Para_Json::set_json_value(Para_Json::tau,&tau); } else if (strcmp("sigma_k", word) == 0) { read_value(ifs, sigma_k); + Para_Json::set_json_value(Para_Json::sigma_k,&sigma_k); } else if (strcmp("nc_k", word) == 0) { read_value(ifs, nc_k); + Para_Json::set_json_value(Para_Json::nc_k,&nc_k); } //---------------------------------------------------------------------------------- // OFDFT sunliang added on 2022-05-05 @@ -2075,110 +2392,137 @@ bool Input::Read(const std::string &fn) else if (strcmp("of_kinetic", word) == 0) { read_value(ifs, of_kinetic); + Para_Json::set_json_value(Para_Json::of_kinetic,&of_kinetic); } else if (strcmp("of_method", word) == 0) { read_value(ifs, of_method); + Para_Json::set_json_value(Para_Json::of_method,&of_method); } else if (strcmp("of_conv", word) == 0) { read_value(ifs, of_conv); + Para_Json::set_json_value(Para_Json::of_conv,&of_conv); } else if (strcmp("of_tole", word) == 0) { read_value(ifs, of_tole); + Para_Json::set_json_value(Para_Json::of_tole,&of_tole); } else if (strcmp("of_tolp", word) == 0) { read_value(ifs, of_tolp); + Para_Json::set_json_value(Para_Json::of_tolp,&of_tolp); } else if (strcmp("of_tf_weight", word) == 0) { read_value(ifs, of_tf_weight); + Para_Json::set_json_value(Para_Json::of_tf_weight,&of_tf_weight); } else if (strcmp("of_vw_weight", word) == 0) { read_value(ifs, of_vw_weight); + Para_Json::set_json_value(Para_Json::of_vw_weight,&of_vw_weight); } else if (strcmp("of_wt_alpha", word) == 0) { read_value(ifs, of_wt_alpha); + Para_Json::set_json_value(Para_Json::of_wt_alpha,&of_wt_alpha); } else if (strcmp("of_wt_beta", word) == 0) { read_value(ifs, of_wt_beta); + Para_Json::set_json_value(Para_Json::of_wt_beta,&of_wt_beta); } else if (strcmp("of_wt_rho0", word) == 0) { read_value(ifs, of_wt_rho0); + Para_Json::set_json_value(Para_Json::of_wt_rho0,&of_wt_rho0); } else if (strcmp("of_hold_rho0", word) == 0) { read_bool(ifs, of_hold_rho0); + Para_Json::set_json_value(Para_Json::of_hold_rho0,&of_hold_rho0); } else if (strcmp("of_lkt_a", word) == 0) { read_value(ifs, of_lkt_a); + Para_Json::set_json_value(Para_Json::of_lkt_a,&of_lkt_a); } else if (strcmp("of_full_pw", word) == 0) { read_bool(ifs, of_full_pw); + Para_Json::set_json_value(Para_Json::of_full_pw,&of_full_pw); } else if (strcmp("of_full_pw_dim", word) == 0) { read_value(ifs, of_full_pw_dim); + Para_Json::set_json_value(Para_Json::of_full_pw_dim,&of_full_pw_dim); } else if (strcmp("of_read_kernel", word) == 0) { read_bool(ifs, of_read_kernel); + Para_Json::set_json_value(Para_Json::of_read_kernel,&of_read_kernel); } else if (strcmp("of_kernel_file", word) == 0) { read_value(ifs, of_kernel_file); + Para_Json::set_json_value(Para_Json::of_kernel_file,&of_kernel_file); } else if (strcmp("bessel_nao_smooth", word) == 0) { read_value(ifs, bessel_nao_smooth); + Para_Json::set_json_value(Para_Json::bessel_nao_smooth,&bessel_nao_smooth); } else if (strcmp("bessel_nao_sigma", word) == 0) { read_value(ifs, bessel_nao_sigma); + Para_Json::set_json_value(Para_Json::bessel_nao_sigma,&bessel_nao_sigma); } else if (strcmp("bessel_nao_ecut", word) == 0) { read_value(ifs, bessel_nao_ecut); + Para_Json::set_json_value(Para_Json::bessel_nao_ecut,&bessel_nao_ecut); } else if (strcmp("bessel_nao_rcut", word) == 0) { read_value(ifs, bessel_nao_rcut); + Para_Json::set_json_value(Para_Json::bessel_nao_rcut,&bessel_nao_rcut); } else if (strcmp("bessel_nao_tolerence", word) == 0) { read_value(ifs, bessel_nao_tolerence); + Para_Json::set_json_value(Para_Json::bessel_nao_tolerence,&bessel_nao_tolerence); } else if (strcmp("bessel_descriptor_lmax", word) == 0) { read_value(ifs, bessel_descriptor_lmax); + Para_Json::set_json_value(Para_Json::bessel_descriptor_lmax,&bessel_descriptor_lmax); } else if (strcmp("bessel_descriptor_smooth", word) == 0) { read_value(ifs, bessel_descriptor_smooth); + Para_Json::set_json_value(Para_Json::bessel_descriptor_smooth,&bessel_descriptor_smooth); } else if (strcmp("bessel_descriptor_sigma", word) == 0) { read_value(ifs, bessel_descriptor_sigma); + Para_Json::set_json_value(Para_Json::bessel_descriptor_sigma,&bessel_descriptor_sigma); } else if (strcmp("bessel_descriptor_ecut", word) == 0) { read_value(ifs, bessel_descriptor_ecut); + Para_Json::set_json_value(Para_Json::bessel_descriptor_ecut,&bessel_descriptor_ecut); } else if (strcmp("bessel_descriptor_rcut", word) == 0) { read_value(ifs, bessel_descriptor_rcut); + Para_Json::set_json_value(Para_Json::bessel_descriptor_rcut,&bessel_descriptor_rcut); } else if (strcmp("bessel_descriptor_tolerence", word) == 0) { read_value(ifs, bessel_descriptor_tolerence); + Para_Json::set_json_value(Para_Json::bessel_descriptor_tolerence,&bessel_descriptor_tolerence); } //---------------------------------------------------------------------------------- // device control denghui added on 2022-11-05 @@ -2186,14 +2530,16 @@ bool Input::Read(const std::string &fn) else if (strcmp("device", word) == 0) { read_value(ifs, device); + Para_Json::set_json_value(Para_Json::device,&device); } //---------------------------------------------------------------------------------- // precision control denghui added on 2023-01-01 //---------------------------------------------------------------------------------- else if (strcmp("precision", word) == 0) { read_value(ifs, precision); + //Para_Json::set_json_value(Para_Json::precision,&precision); } - //---------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------- // Deltaspin //---------------------------------------------------------------------------------- else if (strcmp("sc_mag_switch", word) == 0){ @@ -2314,16 +2660,19 @@ bool Input::Read(const std::string &fn) if (strcmp("yukawa_potential", word) == 0) { read_bool(ifs, yukawa_potential); + Para_Json::set_json_value(Para_Json::yukawa_potential,&yukawa_potential); } else if (strcmp("yukawa_lambda", word) == 0) { ifs >> yukawa_lambda; + Para_Json::set_json_value(Para_Json::yukawa_lambda,&yukawa_lambda); } else if (strcmp("hubbard_u", word) == 0) { for (int i = 0; i < ntype; i++) { ifs >> hubbard_u[i]; + Para_Json::hubbard_u.PushBack(hubbard_u[i],Para_Json::doc.GetAllocator()); hubbard_u[i] /= ModuleBase::Ry_to_eV; } } @@ -2332,6 +2681,7 @@ bool Input::Read(const std::string &fn) for (int i = 0; i < ntype; i++) { ifs >> orbital_corr[i]; + Para_Json::orbital_corr.PushBack(orbital_corr[i],Para_Json::doc.GetAllocator()); } } else if (strcmp("omc", word) == 0) @@ -2406,6 +2756,7 @@ bool Input::Read(const std::string &fn) for (int i = 0; i < ntype; i++) { ifs >> hubbard_u[i]; + Para_Json::hubbard_u.PushBack(hubbard_u[i],Para_Json::doc.GetAllocator()); hubbard_u[i] /= ModuleBase::Ry_to_eV; } } @@ -2414,6 +2765,7 @@ bool Input::Read(const std::string &fn) for (int i = 0; i < ntype; i++) { ifs >> orbital_corr[i]; + Para_Json::orbital_corr.PushBack(orbital_corr[i],Para_Json::doc.GetAllocator()); } } else @@ -2510,6 +2862,7 @@ bool Input::Read(const std::string &fn) return true; } // end read_parameters + void Input::Default_2(void) // jiyy add 2019-08-04 { if (GlobalV::MY_RANK != 0) diff --git a/source/module_io/para_json.cpp b/source/module_io/para_json.cpp new file mode 100644 index 0000000000..a8c26a5368 --- /dev/null +++ b/source/module_io/para_json.cpp @@ -0,0 +1,983 @@ + +#include "module_io/para_json.h" + + + +namespace Para_Json +{ + int test=4; + // @param doc: the output json file + rapidjson::Document doc; + rapidjson::Value abacus(rapidjson::kObjectType); + + // @param general_info : + rapidjson::Value general_info(rapidjson::kObjectType); + rapidjson::Value version; + rapidjson::Value commit; + rapidjson::Value begin_time; + rapidjson::Value begin_date; + rapidjson::Value device_g; + // @param general_info -- parallel: + rapidjson::Value parallel(rapidjson::kObjectType); + rapidjson::Value drank; + rapidjson::Value dsize; + rapidjson::Value dcolor ; + // @param general_info -- path + rapidjson::Value path(rapidjson::kObjectType); + rapidjson::Value global_out_dir; + rapidjson::Value global_in_card; + rapidjson::Value pseudo_dir_path ; + rapidjson::Value orbital_dir_path; + + + // @param reading_information: + rapidjson::Value readin_info(rapidjson::kObjectType); + // @param reading_information -- input_para: + + // @param reading_information -- input_para -- system_variables: + rapidjson::Value system_variables(rapidjson::kObjectType); + rapidjson::Value suffix; + rapidjson::Value ntype; + rapidjson::Value calculation; + rapidjson::Value esolver_type; + rapidjson::Value symmetry; + rapidjson::Value symmetry_precfield; + rapidjson::Value symmetry_autoclose; + rapidjson::Value kpar; + rapidjson::Value bndpar; + rapidjson::Value latname; + rapidjson::Value init_wfc; + rapidjson::Value init_chg; + rapidjson::Value init_vel; + rapidjson::Value nelec; + rapidjson::Value nupdown; + rapidjson::Value dft_functional; + rapidjson::Value xc_temperature; + rapidjson::Value pseudo_rcut(rapidjson::kNumberType ); + rapidjson::Value pseudo_mesh; + rapidjson::Value mem_saver; + rapidjson::Value diago_proc; + rapidjson::Value nbspline; + rapidjson::Value kspacing(rapidjson::kArrayType); + rapidjson::Value min_dist_coef(rapidjson::kNumberType); + rapidjson::Value device; + // @param reading_information -- input_para -- files_related + rapidjson::Value files_related(rapidjson::kObjectType); + rapidjson::Value stru_file; + rapidjson::Value kpoint_file; + rapidjson::Value pseudo_dir; + rapidjson::Value orbital_dir; + rapidjson::Value read_file_dir; + rapidjson::Value wannier_card; + // @param reading_information -- input_para -- planewave_related + rapidjson::Value planewave_related(rapidjson::kObjectType); + rapidjson::Value ecutwfc; + rapidjson::Value nx; + rapidjson::Value ny; + rapidjson::Value nz; + rapidjson::Value pw_seed; + rapidjson::Value pw_diag_thr; + rapidjson::Value pw_diag_nmax; + rapidjson::Value pw_diag_ndim; + // @param reading_information -- input_para -- numerical_atomic_orbitals_related + rapidjson::Value numerical_atomic_orbitals_related(rapidjson::kObjectType); + rapidjson::Value nb2d; + rapidjson::Value lmaxmax; + rapidjson::Value lcao_ecut; + rapidjson::Value lcao_dk; + rapidjson::Value lcao_dr; + rapidjson::Value lcao_rmax; + rapidjson::Value search_radius; + rapidjson::Value search_pbc; + rapidjson::Value bx; + rapidjson::Value by; + rapidjson::Value bz; + // @param reading_information -- input_para -- electronic_structure + rapidjson::Value electronic_structure(rapidjson::kObjectType); + rapidjson::Value basis_type; + rapidjson::Value ks_solver; + rapidjson::Value nbands; + rapidjson::Value nbands_istate; + rapidjson::Value nspin; + rapidjson::Value smearing_method; + rapidjson::Value smearing_sigma; + rapidjson::Value smearing_sigma_temp; + rapidjson::Value mixing_type; + rapidjson::Value mixing_beta; + rapidjson::Value mixing_ndim; + rapidjson::Value mixing_gg0; + rapidjson::Value mixing_tau; + rapidjson::Value mixing_dftu; + rapidjson::Value gamma_only; + rapidjson::Value printe; + rapidjson::Value scf_nmax; + rapidjson::Value scf_thr; + rapidjson::Value scf_thr_type; + rapidjson::Value chg_extrap; + rapidjson::Value lspinorb; + rapidjson::Value noncolin; + rapidjson::Value soc_lambda; + // @param reading_information -- input_para -- electronic_structure_SDFT + rapidjson::Value electronic_structure_SDFT(rapidjson::kObjectType); + rapidjson::Value method_sto; + rapidjson::Value nbands_sto; + rapidjson::Value nche_sto(rapidjson::kNumberType); + rapidjson::Value emin_sto; + rapidjson::Value emax_sto; + rapidjson::Value seed_sto; + rapidjson::Value initsto_freq; + rapidjson::Value npart_sto; + // @param reading_information -- input_para -- geometry_relaxation + rapidjson::Value geometry_relaxation(rapidjson::kObjectType); + rapidjson::Value relax_method; + rapidjson::Value relax_new; + rapidjson::Value relax_scale_force; + rapidjson::Value relax_nmax; + rapidjson::Value relax_cg_thr; + rapidjson::Value cal_force; + rapidjson::Value force_thr; + rapidjson::Value force_thr_ev; + rapidjson::Value force_thr_ev2; + rapidjson::Value relax_bfgs_w1; + rapidjson::Value relax_bfgs_w2; + rapidjson::Value relax_bfgs_rmax; + rapidjson::Value relax_bfgs_rmin; + rapidjson::Value relax_bfgs_init; + rapidjson::Value cal_stress; + rapidjson::Value stress_thr; + rapidjson::Value press1; + rapidjson::Value press2; + rapidjson::Value press3; + rapidjson::Value fixed_axes; + rapidjson::Value fixed_ibrav; + rapidjson::Value fixed_atoms; + rapidjson::Value cell_factor; + + // @param reading_information -- input_para -- output_information_related + rapidjson::Value output_information_related(rapidjson::kObjectType); + rapidjson::Value out_mul; + rapidjson::Value out_freq_elec; + rapidjson::Value out_freq_ion; + rapidjson::Value out_chg; + rapidjson::Value out_pot; + rapidjson::Value out_dm; + rapidjson::Value out_dm1; + rapidjson::Value out_wfc_pw; + rapidjson::Value out_wfc_r; + rapidjson::Value out_wfc_lcao; + rapidjson::Value out_dos; + rapidjson::Value out_band; + rapidjson::Value out_proj_band; + rapidjson::Value out_stru; + rapidjson::Value out_bandgap; + rapidjson::Value out_level; + rapidjson::Value out_alllog; + rapidjson::Value out_mat_hs; + rapidjson::Value out_mat_r; + rapidjson::Value out_mat_hs2; + rapidjson::Value out_mat_t; + rapidjson::Value out_mat_dh; + rapidjson::Value out_app_flag; + rapidjson::Value out_interval; + rapidjson::Value out_element_info; + rapidjson::Value restart_save; + rapidjson::Value restart_load; + rapidjson::Value rpa; + + // @param reading_information -- input_para -- density_of_states + rapidjson::Value density_of_states(rapidjson::kObjectType); + rapidjson::Value dos_edelta_ev; + rapidjson::Value dos_sigma; + rapidjson::Value dos_scale; + rapidjson::Value dos_emin_ev; + rapidjson::Value dos_emax_ev; + rapidjson::Value dos_nche; + // @param reading_information -- input_para -- naos + rapidjson::Value naos(rapidjson::kObjectType); + rapidjson::Value bessel_nao_ecut; + rapidjson::Value bessel_nao_tolerence; + rapidjson::Value bessel_nao_rcut; + rapidjson::Value bessel_nao_smooth; + rapidjson::Value bessel_nao_sigma; + // @param reading_information -- input_para -- deepks + rapidjson::Value deepks(rapidjson::kObjectType); + rapidjson::Value deepks_out_labels; + rapidjson::Value deepks_scf; + rapidjson::Value deepks_model; + rapidjson::Value bessel_descriptor_lmax; + rapidjson::Value bessel_descriptor_ecut; + rapidjson::Value bessel_descriptor_tolerence; + rapidjson::Value bessel_descriptor_rcut; + rapidjson::Value bessel_descriptor_smooth; + rapidjson::Value bessel_descriptor_sigma; + rapidjson::Value deepks_bandgap; + rapidjson::Value deepks_out_unittest; + // @param reading_information -- input_para -- ofdft + rapidjson::Value ofdft(rapidjson::kObjectType); + rapidjson::Value of_kinetic; + rapidjson::Value of_method; + rapidjson::Value of_conv; + rapidjson::Value of_tole; + rapidjson::Value of_tolp; + rapidjson::Value of_tf_weight; + rapidjson::Value of_vw_weight; + rapidjson::Value of_wt_alpha; + rapidjson::Value of_wt_beta; + rapidjson::Value of_wt_rho0; + rapidjson::Value of_hold_rho0; + rapidjson::Value of_lkt_a; + rapidjson::Value of_read_kernel; + rapidjson::Value of_kernel_file; + rapidjson::Value of_full_pw; + rapidjson::Value of_full_pw_dim; + + // @param reading_information -- input_para -- electric_field_and_dipole_correction + rapidjson::Value electric_field_and_dipole_correction(rapidjson::kObjectType); + rapidjson::Value efield_flag; + rapidjson::Value dip_cor_flag; + rapidjson::Value efield_dir; + rapidjson::Value efield_pos_max; + rapidjson::Value efield_pos_dec; + rapidjson::Value efield_amp; + // @param reading_information -- input_para -- gate_field + rapidjson::Value gate_field(rapidjson::kObjectType); + rapidjson::Value gate_flag; + rapidjson::Value zgate; + rapidjson::Value block; + rapidjson::Value block_down; + rapidjson::Value block_up; + rapidjson::Value block_height; + // @param reading_information -- input_para -- exact_exchange + rapidjson::Value exact_exchange(rapidjson::kObjectType); + rapidjson::Value exx_hybrid_alpha; + rapidjson::Value exx_hse_omega; + rapidjson::Value exx_separate_loop; + rapidjson::Value exx_hybrid_step; + rapidjson::Value exx_mixing_beta; + rapidjson::Value exx_lambda; + rapidjson::Value exx_pca_threshold; + rapidjson::Value exx_c_threshold; + rapidjson::Value exx_v_threshold; + rapidjson::Value exx_dm_threshold; + rapidjson::Value exx_c_grad_threshold; + rapidjson::Value exx_v_grad_threshold; + rapidjson::Value exx_schwarz_threshold; + rapidjson::Value exx_cauchy_threshold; + rapidjson::Value exx_cauchy_force_threshold; + rapidjson::Value exx_cauchy_stress_threshold; + rapidjson::Value exx_ccp_threshold; + rapidjson::Value exx_ccp_rmesh_times; + rapidjson::Value exx_distribute_type; + rapidjson::Value exx_opt_orb_lmax; + rapidjson::Value exx_opt_orb_ecut; + rapidjson::Value exx_opt_orb_tolerence; + rapidjson::Value exx_real_number; + + // @param reading_information -- input_para -- molecular_dynamics + rapidjson::Value molecular_dynamics(rapidjson::kObjectType); + rapidjson::Value md_type; + rapidjson::Value md_nstep; + rapidjson::Value md_dt; + rapidjson::Value md_thermostat; + rapidjson::Value md_tlast; + rapidjson::Value md_tfirst; + rapidjson::Value md_restart; + rapidjson::Value md_restartfreq; + rapidjson::Value md_dumpfreq; + rapidjson::Value dump_force; + rapidjson::Value dump_vel; + rapidjson::Value dump_virial; + rapidjson::Value md_seed; + rapidjson::Value md_tfreq; + rapidjson::Value md_tchain; + rapidjson::Value md_pmode; + rapidjson::Value md_prec_level; + rapidjson::Value ref_cell_factor; + rapidjson::Value md_pcouple; + rapidjson::Value md_pfirst; + rapidjson::Value md_plast; + rapidjson::Value md_pfreq; + rapidjson::Value md_pchain; + rapidjson::Value lj_rcut; + rapidjson::Value lj_epsilon; + rapidjson::Value lj_sigma; + rapidjson::Value pot_file; + rapidjson::Value msst_direction; + rapidjson::Value msst_vel; + rapidjson::Value msst_vis; + rapidjson::Value msst_tscale; + rapidjson::Value msst_qmass; + rapidjson::Value md_damp; + rapidjson::Value md_tolerance; + rapidjson::Value md_nraise; + rapidjson::Value cal_syns; + rapidjson::Value dmax; + + // @param reading_information -- input_para -- dft_plus_u + rapidjson::Value dft_plus_u(rapidjson::kObjectType); + rapidjson::Value orbital_corr(rapidjson::kArrayType); + rapidjson::Value hubbard_u(rapidjson::kArrayType); + rapidjson::Value yukawa_potential; + rapidjson::Value yukawa_lambda; + rapidjson::Value omc; + + // @param reading_information -- input_para -- vdw_correction + rapidjson::Value vdw_correction(rapidjson::kObjectType); + rapidjson::Value vdw_method; + rapidjson::Value vdw_s6; + rapidjson::Value vdw_s8; + rapidjson::Value vdw_a1; + rapidjson::Value vdw_a2; + rapidjson::Value vdw_d; + rapidjson::Value vdw_abc; + rapidjson::Value vdw_C6_file; + rapidjson::Value vdw_C6_unit; + rapidjson::Value vdw_R0_file; + rapidjson::Value vdw_R0_unit; + rapidjson::Value vdw_cutoff_type; + rapidjson::Value vdw_cutoff_radius; + rapidjson::Value vdw_radius_unit; + rapidjson::Value vdw_cutoff_period(rapidjson::kArrayType); + rapidjson::Value vdw_cn_thr; + rapidjson::Value vdw_cn_thr_unit; + + // @param reading_information -- input_para -- berry_phase_and_wannier90_interface + rapidjson::Value berry_phase_and_wannier90_interface(rapidjson::kObjectType); + rapidjson::Value berry_phase; + rapidjson::Value gdir; + rapidjson::Value towannier90; + rapidjson::Value nnkpfile; + rapidjson::Value wannier_spin; + + // @param reading_information -- input_para -- tddft + rapidjson::Value tddft(rapidjson::kObjectType); + rapidjson::Value td_edm; + rapidjson::Value td_print_eij; + rapidjson::Value td_propagator; + rapidjson::Value td_vext; + rapidjson::Value td_vext_dire; + rapidjson::Value td_stype; + rapidjson::Value td_ttype; + rapidjson::Value td_tstart; + rapidjson::Value td_tend; + rapidjson::Value td_lcut1; + rapidjson::Value td_lcut2; + rapidjson::Value td_gauss_freq; + rapidjson::Value td_gauss_phase; + rapidjson::Value td_gauss_sigma; + rapidjson::Value td_gauss_t0; + rapidjson::Value td_gauss_amp; + rapidjson::Value td_trape_freq; + rapidjson::Value td_trape_phase; + rapidjson::Value td_trape_t1; + rapidjson::Value td_trape_t2; + rapidjson::Value td_trape_t3; + rapidjson::Value td_trape_amp; + rapidjson::Value td_trigo_freq1; + rapidjson::Value td_trigo_freq2; + rapidjson::Value td_trigo_phase1; + rapidjson::Value td_trigo_phase2; + rapidjson::Value td_trigo_amp; + rapidjson::Value td_heavi_t0; + rapidjson::Value td_heavi_amp; + rapidjson::Value td_out_dipole; + rapidjson::Value td_out_efield; + rapidjson::Value ocp; + rapidjson::Value ocp_set; + + // @param reading_information -- input_para -- debuging_related + rapidjson::Value debuging_related(rapidjson::kObjectType); + rapidjson::Value t_in_h; + rapidjson::Value vl_in_h; + rapidjson::Value vnl_in_h; + rapidjson::Value vh_in_h; + rapidjson::Value vion_in_h; + rapidjson::Value test_force; + rapidjson::Value test_stress; + rapidjson::Value colour; + rapidjson::Value test_skip_ewald; + + // @param reading_information -- input_para -- electronic_conductivities + rapidjson::Value electronic_conductivities(rapidjson::kObjectType); + rapidjson::Value cal_cond; + rapidjson::Value cond_nche; + rapidjson::Value cond_dw; + rapidjson::Value cond_wcut; + rapidjson::Value cond_dt; + rapidjson::Value cond_dtbatch; + rapidjson::Value cond_fwhm; + rapidjson::Value cond_nonlocal; + + // @param reading_information -- input_para -- implicit_solvation_model + rapidjson::Value implicit_solvation_model(rapidjson::kObjectType); + rapidjson::Value imp_sol; + rapidjson::Value eb_k; + rapidjson::Value tau; + rapidjson::Value sigma_k; + rapidjson::Value nc_k; + + // @param reading_information -- stru_infos: + rapidjson::Value stru_infos(rapidjson::kObjectType); + rapidjson::Value ATOMIC_SPECIES(rapidjson::kArrayType); + rapidjson::Value NUMERICAL_ORBITAL; + rapidjson::Value LATTICE_CONSTANT(rapidjson::kArrayType); + rapidjson::Value ATOMIC_POSITIONS(rapidjson::kArrayType); + + // @param reading_information -- KPT_infos + rapidjson::Value KPT_infos(rapidjson::kObjectType); + rapidjson::Value total_number; + rapidjson::Value mode; + rapidjson::Value vectors(rapidjson::kArrayType); + + // @param reading_information -- orb_infos + rapidjson::Value orb_infos(rapidjson::kObjectType); + + // @param reading_information -- pp + rapidjson::Value pp(rapidjson::kObjectType); + + // @param init + rapidjson::Value init(rapidjson::kObjectType); + // @param init -- general + // rapidjson::Value calculation; + // rapidjson::Value esolver_type; + // rapidjson::Value basis_type; + // rapidjson::Value gamma_only; + // rapidjson::Value ks_solver; + // rapidjson::Value ntype; + // rapidjson::Value nspin; + // rapidjson::Value ecutwfc; + // rapidjson::Value scf_thr; + // rapidjson::Value scf_nmax; + + // @param init -- symmetry + // rapidjson::Value symmetry(rapidjson::kObjectType); + // rapidjson::Value BRAVAIS_TYPE; + // rapidjson::Value BRAVAIS_LATTICE_NAME; + // rapidjson::Value IBRAV; + // rapidjson::Value LATTICE_CONSTANT_A; + // rapidjson::Value right_hand_lattice; + + // @param init -- Kpoints + rapidjson::Value kpoints(rapidjson::kObjectType); + rapidjson::Value nkstot; + rapidjson::Value nkstot_ibz; + rapidjson::Value coordinates(rapidjson::kArrayType); + rapidjson::Value weight(rapidjson::kArrayType); + + // @param init -- grid + rapidjson::Value grid(rapidjson::kObjectType); + rapidjson::Value energy_cutoff_for_wavefunc; + rapidjson::Value fft_grid_for_wave_functions(rapidjson::kArrayType); + rapidjson::Value number_of_plane_waves; + rapidjson::Value number_of_sticks; + + // @param init -- Smearing + // rapidjson::Value smearing_method; + // rapidjson::Value smearing_sigma; + + // @param init -- mixing + rapidjson::Value mixing; + + + // @param output + rapidjson::Value output(rapidjson::kArrayType); + + + + // @param final_stru + rapidjson::Value final_stru(rapidjson::kObjectType); + rapidjson::Value cell; + rapidjson::Value coordinate; + + + + + /** + * The functions below initialize the json output parameter + * tree to connect the nodes of the module + */ + + /** + * @brief add Top stage:parameter in Abacus: + */ + void Init_json_abacus() + { + + + // add First stage:parameter in abcus: + + abacus.AddMember("general_info", general_info, doc.GetAllocator()); + + abacus.AddMember("readin_info", readin_info, doc.GetAllocator()); + + abacus.AddMember("init", init, doc.GetAllocator()); + + abacus.AddMember("output", output, doc.GetAllocator()); + + abacus.AddMember("final_stru", final_stru, doc.GetAllocator()); + + doc.SetObject(); + // abacus.SetObject(); + doc.AddMember("ABACUS", abacus, doc.GetAllocator()); + /** + * . + * . + * . + * . + * . + * . + * . + * */ + } + /** + * @brief add Second stage:parameter in Abacus - general_info: + */ + void Init_json_abacus_generalInfo(){ + general_info.AddMember("version", version, doc.GetAllocator()); + + general_info.AddMember("commit", commit, doc.GetAllocator()); + + general_info.AddMember("begin_time", begin_time, doc.GetAllocator()); + + general_info.AddMember("begin_date", begin_date, doc.GetAllocator()); + + general_info.AddMember("device_g", device_g, doc.GetAllocator()); + + // add Third stage:parameter in parallel: + general_info.AddMember("parallel", parallel, doc.GetAllocator()); + + parallel.AddMember("drank", drank, doc.GetAllocator()); + + parallel.AddMember("dsize", dsize, doc.GetAllocator()); + + parallel.AddMember("dcolor", dcolor, doc.GetAllocator()); + + } + + + + /** + * @brief add Second stage:parameter in Abacus - readin_info: + */ + void Init_json_abacus_readinInfo(){ + //add Third stage:parameter in system_variables: + system_variables.AddMember("suffix", suffix, doc.GetAllocator()); + system_variables.AddMember("ntype", ntype, doc.GetAllocator()); + system_variables.AddMember("calculation", calculation, doc.GetAllocator()); + system_variables.AddMember("esolver_type", esolver_type, doc.GetAllocator()); + system_variables.AddMember("symmetry", symmetry, doc.GetAllocator()); + system_variables.AddMember("symmetry_precfield", symmetry_precfield, doc.GetAllocator()); + system_variables.AddMember("symmetry_autoclose", symmetry_autoclose, doc.GetAllocator()); + system_variables.AddMember("kpar", kpar, doc.GetAllocator()); + system_variables.AddMember("bndpar", bndpar, doc.GetAllocator()); + system_variables.AddMember("latname", latname, doc.GetAllocator()); + system_variables.AddMember("init_wfc", init_wfc, doc.GetAllocator()); + system_variables.AddMember("init_chg", init_chg, doc.GetAllocator()); + system_variables.AddMember("init_vel", init_vel, doc.GetAllocator()); + system_variables.AddMember("nelec", nelec, doc.GetAllocator()); + system_variables.AddMember("nupdown", nupdown, doc.GetAllocator()); + system_variables.AddMember("dft_functional", dft_functional, doc.GetAllocator()); + system_variables.AddMember("xc_temperature", xc_temperature, doc.GetAllocator()); + system_variables.AddMember("pseudo_rcut", pseudo_rcut, doc.GetAllocator()); + system_variables.AddMember("pseudo_mesh", pseudo_mesh, doc.GetAllocator()); + system_variables.AddMember("mem_saver", mem_saver, doc.GetAllocator()); + system_variables.AddMember("diago_proc", diago_proc, doc.GetAllocator()); + system_variables.AddMember("nbspline", nbspline, doc.GetAllocator()); + system_variables.AddMember("kspacing", kspacing, doc.GetAllocator()); + system_variables.AddMember("min_dist_coef", min_dist_coef, doc.GetAllocator()); + system_variables.AddMember("device", device, doc.GetAllocator()); + + //add Third stage:parameter in files_related: + files_related.AddMember("stru_file", stru_file, doc.GetAllocator()); + files_related.AddMember("kpoint_file", kpoint_file, doc.GetAllocator()); + files_related.AddMember("pseudo_dir", pseudo_dir, doc.GetAllocator()); + files_related.AddMember("orbital_dir", orbital_dir, doc.GetAllocator()); + files_related.AddMember("read_file_dir", read_file_dir, doc.GetAllocator()); + files_related.AddMember("wannier_card", wannier_card, doc.GetAllocator()); + + //add Third stage:parameter in planewave_related: + planewave_related.AddMember("ecutwfc", ecutwfc, doc.GetAllocator()); + planewave_related.AddMember("nx", nx, doc.GetAllocator()); + planewave_related.AddMember("ny", ny, doc.GetAllocator()); + planewave_related.AddMember("nz", nz, doc.GetAllocator()); + planewave_related.AddMember("pw_seed", pw_seed, doc.GetAllocator()); + planewave_related.AddMember("pw_diag_thr", pw_diag_thr, doc.GetAllocator()); + planewave_related.AddMember("pw_diag_nmax", pw_diag_nmax, doc.GetAllocator()); + planewave_related.AddMember("pw_diag_ndim", pw_diag_ndim, doc.GetAllocator()); + + + //add Third stage:parameter in numerical_atomic_orbitals_related: + numerical_atomic_orbitals_related.AddMember("nb2d", nb2d, doc.GetAllocator()); + numerical_atomic_orbitals_related.AddMember("lmaxmax", lmaxmax, doc.GetAllocator()); + numerical_atomic_orbitals_related.AddMember("lcao_ecut", lcao_ecut, doc.GetAllocator()); + numerical_atomic_orbitals_related.AddMember("lcao_dk", lcao_dk, doc.GetAllocator()); + numerical_atomic_orbitals_related.AddMember("lcao_dr", lcao_dr, doc.GetAllocator()); + numerical_atomic_orbitals_related.AddMember("lcao_rmax", lcao_rmax, doc.GetAllocator()); + numerical_atomic_orbitals_related.AddMember("search_radius", search_radius, doc.GetAllocator()); + numerical_atomic_orbitals_related.AddMember("search_pbc", search_pbc, doc.GetAllocator()); + numerical_atomic_orbitals_related.AddMember("bx", bx, doc.GetAllocator()); + numerical_atomic_orbitals_related.AddMember("by", by, doc.GetAllocator()); + numerical_atomic_orbitals_related.AddMember("bz", bz, doc.GetAllocator()); + + //add Third stage:parameter in electronic_structure: + electronic_structure.AddMember("basis_type", basis_type, doc.GetAllocator()); + electronic_structure.AddMember("ks_solver", ks_solver, doc.GetAllocator()); + electronic_structure.AddMember("nbands", nbands, doc.GetAllocator()); + electronic_structure.AddMember("nbands_istate", nbands_istate, doc.GetAllocator()); + electronic_structure.AddMember("nspin", nspin, doc.GetAllocator()); + electronic_structure.AddMember("smearing_method", smearing_method, doc.GetAllocator()); + electronic_structure.AddMember("smearing_sigma", smearing_sigma, doc.GetAllocator()); + electronic_structure.AddMember("smearing_sigma_temp", smearing_sigma_temp, doc.GetAllocator()); + electronic_structure.AddMember("mixing_type", mixing_type, doc.GetAllocator()); + electronic_structure.AddMember("mixing_beta", mixing_beta, doc.GetAllocator()); + electronic_structure.AddMember("mixing_ndim", mixing_ndim, doc.GetAllocator()); + electronic_structure.AddMember("mixing_gg0", mixing_gg0, doc.GetAllocator()); + electronic_structure.AddMember("mixing_tau", mixing_tau, doc.GetAllocator()); + electronic_structure.AddMember("mixing_dftu", mixing_dftu, doc.GetAllocator()); + electronic_structure.AddMember("gamma_only", gamma_only, doc.GetAllocator()); + electronic_structure.AddMember("printe", printe, doc.GetAllocator()); + electronic_structure.AddMember("scf_nmax", scf_nmax, doc.GetAllocator()); + electronic_structure.AddMember("scf_thr", scf_thr, doc.GetAllocator()); + electronic_structure.AddMember("scf_thr_type", scf_thr_type, doc.GetAllocator()); + electronic_structure.AddMember("chg_extrap", chg_extrap, doc.GetAllocator()); + electronic_structure.AddMember("lspinorb", lspinorb, doc.GetAllocator()); + electronic_structure.AddMember("noncolin", noncolin, doc.GetAllocator()); + electronic_structure.AddMember("soc_lambda", soc_lambda, doc.GetAllocator()); + + + //add Third stage:parameter in electronic_structure_SDFT: + electronic_structure_SDFT.AddMember("method_sto", method_sto, doc.GetAllocator()); + electronic_structure_SDFT.AddMember("nbands_sto", nbands_sto, doc.GetAllocator()); + electronic_structure_SDFT.AddMember("nche_sto", nche_sto, doc.GetAllocator()); + electronic_structure_SDFT.AddMember("emin_sto", emin_sto, doc.GetAllocator()); + electronic_structure_SDFT.AddMember("emax_sto", emax_sto, doc.GetAllocator()); + electronic_structure_SDFT.AddMember("seed_sto", seed_sto, doc.GetAllocator()); + electronic_structure_SDFT.AddMember("initsto_freq", initsto_freq, doc.GetAllocator()); + electronic_structure_SDFT.AddMember("npart_sto", npart_sto, doc.GetAllocator()); + + + //add Third stage:parameter in geometry_relaxation: + geometry_relaxation.AddMember("relax_method", relax_method, doc.GetAllocator()); + geometry_relaxation.AddMember("relax_new", relax_new, doc.GetAllocator()); + geometry_relaxation.AddMember("relax_scale_force", relax_scale_force, doc.GetAllocator()); + geometry_relaxation.AddMember("relax_nmax", relax_nmax, doc.GetAllocator()); + geometry_relaxation.AddMember("relax_cg_thr", relax_cg_thr, doc.GetAllocator()); + geometry_relaxation.AddMember("cal_force", cal_force, doc.GetAllocator()); + geometry_relaxation.AddMember("force_thr", force_thr, doc.GetAllocator()); + geometry_relaxation.AddMember("force_thr_ev", force_thr_ev, doc.GetAllocator()); + geometry_relaxation.AddMember("force_thr_ev2", force_thr_ev2, doc.GetAllocator()); + geometry_relaxation.AddMember("relax_bfgs_w1", relax_bfgs_w1, doc.GetAllocator()); + geometry_relaxation.AddMember("relax_bfgs_w2", relax_bfgs_w2, doc.GetAllocator()); + geometry_relaxation.AddMember("relax_bfgs_rmax", relax_bfgs_rmax, doc.GetAllocator()); + geometry_relaxation.AddMember("relax_bfgs_rmin", relax_bfgs_rmin, doc.GetAllocator()); + geometry_relaxation.AddMember("relax_bfgs_init", relax_bfgs_init, doc.GetAllocator()); + geometry_relaxation.AddMember("cal_stress", cal_stress, doc.GetAllocator()); + geometry_relaxation.AddMember("stress_thr", stress_thr, doc.GetAllocator()); + geometry_relaxation.AddMember("press1", press1, doc.GetAllocator()); + geometry_relaxation.AddMember("press2", press2, doc.GetAllocator()); + geometry_relaxation.AddMember("press3", press3, doc.GetAllocator()); + geometry_relaxation.AddMember("fixed_axes", fixed_axes, doc.GetAllocator()); + geometry_relaxation.AddMember("fixed_ibrav", fixed_ibrav, doc.GetAllocator()); + geometry_relaxation.AddMember("fixed_atoms", fixed_atoms, doc.GetAllocator()); + geometry_relaxation.AddMember("cell_factor", cell_factor, doc.GetAllocator()); + + + //add Third stage:parameter in output_information_related: + output_information_related.AddMember("out_mul", out_mul, doc.GetAllocator()); + output_information_related.AddMember("out_freq_elec", out_freq_elec, doc.GetAllocator()); + output_information_related.AddMember("out_freq_ion", out_freq_ion, doc.GetAllocator()); + output_information_related.AddMember("out_chg", out_chg, doc.GetAllocator()); + output_information_related.AddMember("out_pot", out_pot, doc.GetAllocator()); + output_information_related.AddMember("out_dm", out_dm, doc.GetAllocator()); + output_information_related.AddMember("out_dm1", out_dm1, doc.GetAllocator()); + output_information_related.AddMember("out_wfc_pw", out_wfc_pw, doc.GetAllocator()); + output_information_related.AddMember("out_wfc_r", out_wfc_r, doc.GetAllocator()); + output_information_related.AddMember("out_wfc_lcao", out_wfc_lcao, doc.GetAllocator()); + output_information_related.AddMember("out_dos", out_dos, doc.GetAllocator()); + output_information_related.AddMember("out_band", out_band, doc.GetAllocator()); + output_information_related.AddMember("out_proj_band", out_proj_band, doc.GetAllocator()); + output_information_related.AddMember("out_stru", out_stru, doc.GetAllocator()); + output_information_related.AddMember("out_bandgap", out_bandgap, doc.GetAllocator()); + output_information_related.AddMember("out_level", out_level, doc.GetAllocator()); + output_information_related.AddMember("out_alllog", out_alllog, doc.GetAllocator()); + output_information_related.AddMember("out_mat_hs", out_mat_hs, doc.GetAllocator()); + output_information_related.AddMember("out_mat_r", out_mat_r, doc.GetAllocator()); + output_information_related.AddMember("out_mat_hs2", out_mat_hs2, doc.GetAllocator()); + output_information_related.AddMember("out_mat_t", out_mat_t, doc.GetAllocator()); + output_information_related.AddMember("out_mat_dh", out_mat_dh, doc.GetAllocator()); + output_information_related.AddMember("out_app_flag", out_app_flag, doc.GetAllocator()); + output_information_related.AddMember("out_interval", out_interval, doc.GetAllocator()); + output_information_related.AddMember("out_element_info", out_element_info, doc.GetAllocator()); + output_information_related.AddMember("restart_save", restart_save, doc.GetAllocator()); + output_information_related.AddMember("restart_load", restart_load, doc.GetAllocator()); + output_information_related.AddMember("rpa", rpa, doc.GetAllocator()); + + //add Third stage:parameter in density_of_states: + density_of_states.AddMember("dos_edelta_ev", dos_edelta_ev, doc.GetAllocator()); + density_of_states.AddMember("dos_sigma", dos_sigma, doc.GetAllocator()); + density_of_states.AddMember("dos_scale", dos_scale, doc.GetAllocator()); + density_of_states.AddMember("dos_emin_ev", dos_emin_ev, doc.GetAllocator()); + density_of_states.AddMember("dos_emax_ev", dos_emax_ev, doc.GetAllocator()); + density_of_states.AddMember("dos_nche", dos_nche, doc.GetAllocator()); + + //add Third stage:parameter in naos: + naos.AddMember("bessel_nao_ecut", bessel_nao_ecut, doc.GetAllocator()); + naos.AddMember("bessel_nao_tolerence", bessel_nao_tolerence, doc.GetAllocator()); + naos.AddMember("bessel_nao_rcut", bessel_nao_rcut, doc.GetAllocator()); + naos.AddMember("bessel_nao_smooth", bessel_nao_smooth, doc.GetAllocator()); + naos.AddMember("bessel_nao_sigma", bessel_nao_sigma, doc.GetAllocator()); + + //add Third stage:parameter in deepks: + deepks.AddMember("deepks_out_labels", deepks_out_labels, doc.GetAllocator()); + deepks.AddMember("deepks_scf", deepks_scf, doc.GetAllocator()); + deepks.AddMember("deepks_model", deepks_model, doc.GetAllocator()); + deepks.AddMember("bessel_descriptor_lmax", bessel_descriptor_lmax, doc.GetAllocator()); + deepks.AddMember("bessel_descriptor_ecut", bessel_descriptor_ecut, doc.GetAllocator()); + deepks.AddMember("bessel_descriptor_tolerence", bessel_descriptor_tolerence, doc.GetAllocator()); + deepks.AddMember("bessel_descriptor_rcut", bessel_descriptor_rcut, doc.GetAllocator()); + deepks.AddMember("bessel_descriptor_smooth", bessel_descriptor_smooth, doc.GetAllocator()); + deepks.AddMember("bessel_descriptor_sigma", bessel_descriptor_sigma, doc.GetAllocator()); + deepks.AddMember("deepks_bandgap", deepks_bandgap, doc.GetAllocator()); + deepks.AddMember("deepks_out_unittest", deepks_out_unittest, doc.GetAllocator()); + + //add Third stage:parameter in ofdft: + ofdft.AddMember("of_kinetic", of_kinetic, doc.GetAllocator()); + ofdft.AddMember("of_method", of_method, doc.GetAllocator()); + ofdft.AddMember("of_conv", of_conv, doc.GetAllocator()); + ofdft.AddMember("of_tole", of_tole, doc.GetAllocator()); + ofdft.AddMember("of_tolp", of_tolp, doc.GetAllocator()); + ofdft.AddMember("of_tf_weight", of_tf_weight, doc.GetAllocator()); + ofdft.AddMember("of_vw_weight", of_vw_weight, doc.GetAllocator()); + ofdft.AddMember("of_wt_alpha", of_wt_alpha, doc.GetAllocator()); + ofdft.AddMember("of_wt_beta", of_wt_beta, doc.GetAllocator()); + ofdft.AddMember("of_wt_rho0", of_wt_rho0, doc.GetAllocator()); + ofdft.AddMember("of_hold_rho0", of_hold_rho0, doc.GetAllocator()); + ofdft.AddMember("of_lkt_a", of_lkt_a, doc.GetAllocator()); + ofdft.AddMember("of_read_kernel", of_read_kernel, doc.GetAllocator()); + ofdft.AddMember("of_kernel_file", of_kernel_file, doc.GetAllocator()); + ofdft.AddMember("of_full_pw", of_full_pw, doc.GetAllocator()); + ofdft.AddMember("of_full_pw_dim", of_full_pw_dim, doc.GetAllocator()); + + + //add Third stage:parameter in electric_field_and_dipole_correction: + electric_field_and_dipole_correction.AddMember("efield_flag", efield_flag, doc.GetAllocator()); + electric_field_and_dipole_correction.AddMember("dip_cor_flag", dip_cor_flag, doc.GetAllocator()); + electric_field_and_dipole_correction.AddMember("efield_dir", efield_dir, doc.GetAllocator()); + electric_field_and_dipole_correction.AddMember("efield_pos_max", efield_pos_max, doc.GetAllocator()); + electric_field_and_dipole_correction.AddMember("efield_pos_dec", efield_pos_dec, doc.GetAllocator()); + electric_field_and_dipole_correction.AddMember("efield_amp", efield_amp, doc.GetAllocator()); + + //add Third stage:parameter in gate_field: + gate_field.AddMember("gate_flag", gate_flag, doc.GetAllocator()); + gate_field.AddMember("zgate", zgate, doc.GetAllocator()); + gate_field.AddMember("block", block, doc.GetAllocator()); + gate_field.AddMember("block_down", block_down, doc.GetAllocator()); + gate_field.AddMember("block_up", block_up, doc.GetAllocator()); + gate_field.AddMember("block_height", block_height, doc.GetAllocator()); + + //add Third stage:parameter in exact_exchange: + exact_exchange.AddMember("exx_hybrid_alpha", exx_hybrid_alpha, doc.GetAllocator()); + exact_exchange.AddMember("exx_hse_omega", exx_hse_omega, doc.GetAllocator()); + exact_exchange.AddMember("exx_separate_loop", exx_separate_loop, doc.GetAllocator()); + exact_exchange.AddMember("exx_hybrid_step", exx_hybrid_step, doc.GetAllocator()); + exact_exchange.AddMember("exx_mixing_beta", exx_mixing_beta, doc.GetAllocator()); + exact_exchange.AddMember("exx_lambda", exx_lambda, doc.GetAllocator()); + exact_exchange.AddMember("exx_pca_threshold", exx_pca_threshold, doc.GetAllocator()); + exact_exchange.AddMember("exx_c_threshold", exx_c_threshold, doc.GetAllocator()); + exact_exchange.AddMember("exx_v_threshold", exx_v_threshold, doc.GetAllocator()); + exact_exchange.AddMember("exx_dm_threshold", exx_dm_threshold, doc.GetAllocator()); + exact_exchange.AddMember("exx_c_grad_threshold", exx_c_grad_threshold, doc.GetAllocator()); + exact_exchange.AddMember("exx_v_grad_threshold", exx_v_grad_threshold, doc.GetAllocator()); + exact_exchange.AddMember("exx_schwarz_threshold", exx_schwarz_threshold, doc.GetAllocator()); + exact_exchange.AddMember("exx_cauchy_threshold", exx_cauchy_threshold, doc.GetAllocator()); + exact_exchange.AddMember("exx_cauchy_force_threshold", exx_cauchy_force_threshold, doc.GetAllocator()); + exact_exchange.AddMember("exx_cauchy_stress_threshold", exx_cauchy_stress_threshold, doc.GetAllocator()); + exact_exchange.AddMember("exx_ccp_threshold", exx_ccp_threshold, doc.GetAllocator()); + exact_exchange.AddMember("exx_ccp_rmesh_times", exx_ccp_rmesh_times, doc.GetAllocator()); + exact_exchange.AddMember("exx_distribute_type", exx_distribute_type, doc.GetAllocator()); + exact_exchange.AddMember("exx_opt_orb_lmax", exx_opt_orb_lmax, doc.GetAllocator()); + exact_exchange.AddMember("exx_opt_orb_ecut", exx_opt_orb_ecut, doc.GetAllocator()); + exact_exchange.AddMember("exx_opt_orb_tolerence", exx_opt_orb_tolerence, doc.GetAllocator()); + exact_exchange.AddMember("exx_real_number", exx_real_number, doc.GetAllocator()); + + + //add Third stage:parameter in molecular_dynamics: + molecular_dynamics.AddMember("md_type", md_type, doc.GetAllocator()); + molecular_dynamics.AddMember("md_nstep", md_nstep, doc.GetAllocator()); + molecular_dynamics.AddMember("md_dt", md_dt, doc.GetAllocator()); + molecular_dynamics.AddMember("md_thermostat", md_thermostat, doc.GetAllocator()); + molecular_dynamics.AddMember("md_tlast", md_tlast, doc.GetAllocator()); + molecular_dynamics.AddMember("md_tfirst", md_tfirst, doc.GetAllocator()); + molecular_dynamics.AddMember("md_restart", md_restart, doc.GetAllocator()); + molecular_dynamics.AddMember("md_restartfreq", md_restartfreq, doc.GetAllocator()); + molecular_dynamics.AddMember("md_dumpfreq", md_dumpfreq, doc.GetAllocator()); + molecular_dynamics.AddMember("dump_force", dump_force, doc.GetAllocator()); + molecular_dynamics.AddMember("dump_vel", dump_vel, doc.GetAllocator()); + molecular_dynamics.AddMember("dump_virial", dump_virial, doc.GetAllocator()); + molecular_dynamics.AddMember("md_seed", md_seed, doc.GetAllocator()); + molecular_dynamics.AddMember("md_tfreq", md_tfreq, doc.GetAllocator()); + molecular_dynamics.AddMember("md_tchain", md_tchain, doc.GetAllocator()); + molecular_dynamics.AddMember("md_pmode", md_pmode, doc.GetAllocator()); + molecular_dynamics.AddMember("md_prec_level", md_prec_level, doc.GetAllocator()); + molecular_dynamics.AddMember("ref_cell_factor", ref_cell_factor, doc.GetAllocator()); + molecular_dynamics.AddMember("md_pcouple", md_pcouple, doc.GetAllocator()); + molecular_dynamics.AddMember("md_pfirst", md_pfirst, doc.GetAllocator()); + molecular_dynamics.AddMember("md_plast", md_plast, doc.GetAllocator()); + molecular_dynamics.AddMember("md_pfreq", md_pfreq, doc.GetAllocator()); + molecular_dynamics.AddMember("md_pchain", md_pchain, doc.GetAllocator()); + molecular_dynamics.AddMember("lj_rcut", lj_rcut, doc.GetAllocator()); + molecular_dynamics.AddMember("lj_epsilon", lj_epsilon, doc.GetAllocator()); + molecular_dynamics.AddMember("lj_sigma", lj_sigma, doc.GetAllocator()); + molecular_dynamics.AddMember("pot_file", pot_file, doc.GetAllocator()); + molecular_dynamics.AddMember("msst_direction", msst_direction, doc.GetAllocator()); + molecular_dynamics.AddMember("msst_vel", msst_vel, doc.GetAllocator()); + molecular_dynamics.AddMember("msst_vis", msst_vis, doc.GetAllocator()); + molecular_dynamics.AddMember("msst_tscale", msst_tscale, doc.GetAllocator()); + molecular_dynamics.AddMember("msst_qmass", msst_qmass, doc.GetAllocator()); + molecular_dynamics.AddMember("md_damp", md_damp, doc.GetAllocator()); + molecular_dynamics.AddMember("md_tolerance", md_tolerance, doc.GetAllocator()); + molecular_dynamics.AddMember("md_nraise", md_nraise, doc.GetAllocator()); + molecular_dynamics.AddMember("cal_syns", cal_syns, doc.GetAllocator()); + molecular_dynamics.AddMember("dmax", dmax, doc.GetAllocator()); + + //add Third stage:parameter in dft_plus_u: + dft_plus_u.AddMember("orbital_corr", orbital_corr, doc.GetAllocator()); + dft_plus_u.AddMember("hubbard_u", hubbard_u, doc.GetAllocator()); + dft_plus_u.AddMember("yukawa_potential", yukawa_potential, doc.GetAllocator()); + dft_plus_u.AddMember("yukawa_lambda", yukawa_lambda, doc.GetAllocator()); + dft_plus_u.AddMember("omc", omc, doc.GetAllocator()); + + //add Third stage:parameter in vdw_correction: + vdw_correction.AddMember("vdw_method", vdw_method, doc.GetAllocator()); + vdw_correction.AddMember("vdw_s6", vdw_s6, doc.GetAllocator()); + vdw_correction.AddMember("vdw_s8", vdw_s8, doc.GetAllocator()); + vdw_correction.AddMember("vdw_a1", vdw_a1, doc.GetAllocator()); + vdw_correction.AddMember("vdw_a2", vdw_a2, doc.GetAllocator()); + vdw_correction.AddMember("vdw_d", vdw_d, doc.GetAllocator()); + vdw_correction.AddMember("vdw_abc", vdw_abc, doc.GetAllocator()); + vdw_correction.AddMember("vdw_C6_file", vdw_C6_file, doc.GetAllocator()); + vdw_correction.AddMember("vdw_C6_unit", vdw_C6_unit, doc.GetAllocator()); + vdw_correction.AddMember("vdw_R0_file", vdw_R0_file, doc.GetAllocator()); + vdw_correction.AddMember("vdw_R0_unit", vdw_R0_unit, doc.GetAllocator()); + vdw_correction.AddMember("vdw_cutoff_type", vdw_cutoff_type, doc.GetAllocator()); + vdw_correction.AddMember("vdw_cutoff_radius", vdw_cutoff_radius, doc.GetAllocator()); + vdw_correction.AddMember("vdw_radius_unit", vdw_radius_unit, doc.GetAllocator()); + vdw_correction.AddMember("vdw_cutoff_period", vdw_cutoff_period, doc.GetAllocator()); + vdw_correction.AddMember("vdw_cn_thr", vdw_cn_thr, doc.GetAllocator()); + vdw_correction.AddMember("vdw_cn_thr_unit", vdw_cn_thr_unit, doc.GetAllocator()); + + //add Third stage:parameter in berry_phase_and_wannier90_interface: + berry_phase_and_wannier90_interface.AddMember("berry_phase", berry_phase, doc.GetAllocator()); + berry_phase_and_wannier90_interface.AddMember("gdir", gdir, doc.GetAllocator()); + berry_phase_and_wannier90_interface.AddMember("towannier90", towannier90, doc.GetAllocator()); + berry_phase_and_wannier90_interface.AddMember("nnkpfile", nnkpfile, doc.GetAllocator()); + berry_phase_and_wannier90_interface.AddMember("wannier_spin", wannier_spin, doc.GetAllocator()); + + //add Third stage:parameter in tddft: + tddft.AddMember("td_edm", td_edm, doc.GetAllocator()); + tddft.AddMember("td_print_eij", td_print_eij, doc.GetAllocator()); + tddft.AddMember("td_propagator", td_propagator, doc.GetAllocator()); + tddft.AddMember("td_vext", td_vext, doc.GetAllocator()); + tddft.AddMember("td_vext_dire", td_vext_dire, doc.GetAllocator()); + tddft.AddMember("td_stype", td_stype, doc.GetAllocator()); + tddft.AddMember("td_ttype", td_ttype, doc.GetAllocator()); + tddft.AddMember("td_tstart", td_tstart, doc.GetAllocator()); + tddft.AddMember("td_tend", td_tend, doc.GetAllocator()); + tddft.AddMember("td_lcut1", td_lcut1, doc.GetAllocator()); + tddft.AddMember("td_lcut2", td_lcut2, doc.GetAllocator()); + tddft.AddMember("td_gauss_freq", td_gauss_freq, doc.GetAllocator()); + tddft.AddMember("td_gauss_phase", td_gauss_phase, doc.GetAllocator()); + tddft.AddMember("td_gauss_sigma", td_gauss_sigma, doc.GetAllocator()); + tddft.AddMember("td_gauss_t0", td_gauss_t0, doc.GetAllocator()); + tddft.AddMember("td_gauss_amp", td_gauss_amp, doc.GetAllocator()); + tddft.AddMember("td_trape_freq", td_trape_freq, doc.GetAllocator()); + tddft.AddMember("td_trape_phase", td_trape_phase, doc.GetAllocator()); + tddft.AddMember("td_trape_t1", td_trape_t1, doc.GetAllocator()); + tddft.AddMember("td_trape_t2", td_trape_t2, doc.GetAllocator()); + tddft.AddMember("td_trape_t3", td_trape_t3, doc.GetAllocator()); + tddft.AddMember("td_trape_amp", td_trape_amp, doc.GetAllocator()); + tddft.AddMember("td_trigo_freq1", td_trigo_freq1, doc.GetAllocator()); + tddft.AddMember("td_trigo_freq2", td_trigo_freq2, doc.GetAllocator()); + tddft.AddMember("td_trigo_phase1", td_trigo_phase1, doc.GetAllocator()); + tddft.AddMember("td_trigo_phase2", td_trigo_phase2, doc.GetAllocator()); + tddft.AddMember("td_trigo_amp", td_trigo_amp, doc.GetAllocator()); + tddft.AddMember("td_heavi_t0", td_heavi_t0, doc.GetAllocator()); + tddft.AddMember("td_heavi_amp", td_heavi_amp, doc.GetAllocator()); + tddft.AddMember("td_out_dipole", td_out_dipole, doc.GetAllocator()); + tddft.AddMember("td_out_efield", td_out_efield, doc.GetAllocator()); + tddft.AddMember("ocp", ocp, doc.GetAllocator()); + tddft.AddMember("ocp_set", ocp_set, doc.GetAllocator()); + + //add Third stage:parameter in debuging_related: + debuging_related.AddMember("t_in_h", t_in_h, doc.GetAllocator()); + debuging_related.AddMember("vl_in_h", vl_in_h, doc.GetAllocator()); + debuging_related.AddMember("vnl_in_h", vnl_in_h, doc.GetAllocator()); + debuging_related.AddMember("vh_in_h", vh_in_h, doc.GetAllocator()); + debuging_related.AddMember("vion_in_h", vion_in_h, doc.GetAllocator()); + debuging_related.AddMember("test_force", test_force, doc.GetAllocator()); + debuging_related.AddMember("test_stress", test_stress, doc.GetAllocator()); + debuging_related.AddMember("colour", colour, doc.GetAllocator()); + debuging_related.AddMember("test_skip_ewald", test_skip_ewald, doc.GetAllocator()); + + //add Third stage:parameter in electronic_conductivities: + electronic_conductivities.AddMember("cal_cond", cal_cond, doc.GetAllocator()); + electronic_conductivities.AddMember("cond_nche", cond_nche, doc.GetAllocator()); + electronic_conductivities.AddMember("cond_dw", cond_dw, doc.GetAllocator()); + electronic_conductivities.AddMember("cond_wcut", cond_wcut, doc.GetAllocator()); + electronic_conductivities.AddMember("cond_dt", cond_dt, doc.GetAllocator()); + electronic_conductivities.AddMember("cond_dtbatch", cond_dtbatch, doc.GetAllocator()); + electronic_conductivities.AddMember("cond_fwhm", cond_fwhm, doc.GetAllocator()); + electronic_conductivities.AddMember("cond_nonlocal", cond_nonlocal, doc.GetAllocator()); + + //add Third stage:parameter in implicit_solvation_model: + implicit_solvation_model.AddMember("imp_sol", imp_sol, doc.GetAllocator()); + implicit_solvation_model.AddMember("eb_k", eb_k, doc.GetAllocator()); + implicit_solvation_model.AddMember("tau", tau, doc.GetAllocator()); + implicit_solvation_model.AddMember("sigma_k", sigma_k, doc.GetAllocator()); + implicit_solvation_model.AddMember("nc_k", nc_k, doc.GetAllocator()); + + + // after add child_node's node in readin_info, add child node + // add parameters in readin_info: + readin_info.AddMember("system_variables", system_variables, doc.GetAllocator()); + readin_info.AddMember("files_related", files_related, doc.GetAllocator()); + readin_info.AddMember("planewave_related", planewave_related, doc.GetAllocator()); + readin_info.AddMember("numerical_atomic_orbitals_related", numerical_atomic_orbitals_related, doc.GetAllocator()); + readin_info.AddMember("electronic_structure", electronic_structure, doc.GetAllocator()); + readin_info.AddMember("electronic_structure_SDFT", electronic_structure_SDFT, doc.GetAllocator()); + readin_info.AddMember("geometry_relaxation", geometry_relaxation, doc.GetAllocator()); + readin_info.AddMember("output_information_related", output_information_related, doc.GetAllocator()); + readin_info.AddMember("density_of_states", density_of_states, doc.GetAllocator()); + readin_info.AddMember("naos", naos, doc.GetAllocator()); + readin_info.AddMember("deepks", deepks, doc.GetAllocator()); + readin_info.AddMember("ofdft", ofdft, doc.GetAllocator()); + readin_info.AddMember("electric_field_and_dipole_correction", electric_field_and_dipole_correction, doc.GetAllocator()); + readin_info.AddMember("gate_field", gate_field, doc.GetAllocator()); + readin_info.AddMember("exact_exchange", exact_exchange, doc.GetAllocator()); + readin_info.AddMember("molecular_dynamics", molecular_dynamics, doc.GetAllocator()); + readin_info.AddMember("dft_plus_u", dft_plus_u, doc.GetAllocator()); + readin_info.AddMember("vdw_correction", vdw_correction, doc.GetAllocator()); + readin_info.AddMember("berry_phase_and_wannier90_interface", berry_phase_and_wannier90_interface, doc.GetAllocator()); + readin_info.AddMember("tddft", tddft, doc.GetAllocator()); + readin_info.AddMember("debuging_related", debuging_related, doc.GetAllocator()); + readin_info.AddMember("electronic_conductivities", electronic_conductivities, doc.GetAllocator()); + readin_info.AddMember("implicit_solvation_model", implicit_solvation_model, doc.GetAllocator()); + } + + + void Finish_json_tree(){ + // Converts a json object to a string + rapidjson::StringBuffer buffer; + rapidjson::Writer writer(buffer); + doc.Accept(writer); + + // Output the json string to a file + std::ofstream ofs(GlobalV::global_out_dir.c_str()+"out_para.json"); + ofs << buffer.GetString() << std::endl; + ofs.close(); + } + + + + +} \ No newline at end of file diff --git a/source/module_io/para_json.h b/source/module_io/para_json.h new file mode 100644 index 0000000000..0171e47186 --- /dev/null +++ b/source/module_io/para_json.h @@ -0,0 +1,568 @@ + +#include +#include +#include +#include +#include + +#include +#include +#include + + +/** + * @brief This namespace is used to store the json object of the + * abacus parameter and its handlers. Used to read the parameters + * at run time and finally organize them into json format files + * +*/ +namespace Para_Json +{ + + extern int test; + // @param doc: the output json file + extern rapidjson::Document doc; + extern rapidjson::Value abacus; + + // @param general_info : + extern rapidjson::Value general_info; + extern rapidjson::Value version; + extern rapidjson::Value commit; + extern rapidjson::Value begin_time; + extern rapidjson::Value begin_date; + extern rapidjson::Value device_g; + // @param general_info -- parallel: + extern rapidjson::Value parallel; + extern rapidjson::Value drank; + extern rapidjson::Value dsize; + extern rapidjson::Value dcolor ; + // @param general_info -- path + extern rapidjson::Value path; + extern rapidjson::Value global_out_dir; + extern rapidjson::Value global_in_card; + extern rapidjson::Value pseudo_dir_path ; + extern rapidjson::Value orbital_dir_path; + + + // @param reading_information: + extern rapidjson::Value readin_info; + // @param reading_information -- input_para: + + // @param reading_information -- input_para -- system_variables: + extern rapidjson::Value system_variables; + extern rapidjson::Value suffix; + extern rapidjson::Value ntype; + extern rapidjson::Value calculation; + extern rapidjson::Value esolver_type; + extern rapidjson::Value symmetry; + extern rapidjson::Value symmetry_precfield; + extern rapidjson::Value symmetry_autoclose; + extern rapidjson::Value kpar; + extern rapidjson::Value bndpar; + extern rapidjson::Value latname; + extern rapidjson::Value init_wfc; + extern rapidjson::Value init_chg; + extern rapidjson::Value init_vel; + extern rapidjson::Value nelec; + extern rapidjson::Value nupdown; + extern rapidjson::Value dft_functional; + extern rapidjson::Value xc_temperature; + extern rapidjson::Value pseudo_rcut; + extern rapidjson::Value pseudo_mesh; + extern rapidjson::Value mem_saver; + extern rapidjson::Value diago_proc; + extern rapidjson::Value nbspline; + extern rapidjson::Value kspacing; + extern rapidjson::Value min_dist_coef; + extern rapidjson::Value device; + // @param reading_information -- input_para -- files_related + extern rapidjson::Value files_related; + extern rapidjson::Value stru_file; + extern rapidjson::Value kpoint_file; + extern rapidjson::Value pseudo_dir; + extern rapidjson::Value orbital_dir; + extern rapidjson::Value read_file_dir; + extern rapidjson::Value wannier_card; + // @param reading_information -- input_para -- planewave_related + extern rapidjson::Value planewave_related; + extern rapidjson::Value ecutwfc; + extern rapidjson::Value nx; + extern rapidjson::Value ny; + extern rapidjson::Value nz; + extern rapidjson::Value pw_seed; + extern rapidjson::Value pw_diag_thr; + extern rapidjson::Value pw_diag_nmax; + extern rapidjson::Value pw_diag_ndim; + // @param reading_information -- input_para -- numerical_atomic_orbitals_related + extern rapidjson::Value numerical_atomic_orbitals_related; + extern rapidjson::Value nb2d; + extern rapidjson::Value lmaxmax; + extern rapidjson::Value lcao_ecut; + extern rapidjson::Value lcao_dk; + extern rapidjson::Value lcao_dr; + extern rapidjson::Value lcao_rmax; + extern rapidjson::Value search_radius; + extern rapidjson::Value search_pbc; + extern rapidjson::Value bx; + extern rapidjson::Value by; + extern rapidjson::Value bz; + // @param reading_information -- input_para -- electronic_structure + extern rapidjson::Value electronic_structure; + extern rapidjson::Value basis_type; + extern rapidjson::Value ks_solver; + extern rapidjson::Value nbands; + extern rapidjson::Value nbands_istate; + extern rapidjson::Value nspin; + extern rapidjson::Value smearing_method; + extern rapidjson::Value smearing_sigma; + extern rapidjson::Value smearing_sigma_temp; + extern rapidjson::Value mixing_type; + extern rapidjson::Value mixing_beta; + extern rapidjson::Value mixing_ndim; + extern rapidjson::Value mixing_gg0; + extern rapidjson::Value mixing_tau; + extern rapidjson::Value mixing_dftu; + extern rapidjson::Value gamma_only; + extern rapidjson::Value printe; + extern rapidjson::Value scf_nmax; + extern rapidjson::Value scf_thr; + extern rapidjson::Value scf_thr_type; + extern rapidjson::Value chg_extrap; + extern rapidjson::Value lspinorb; + extern rapidjson::Value noncolin; + extern rapidjson::Value soc_lambda; + // @param reading_information -- input_para -- electronic_structure_SDFT + extern rapidjson::Value electronic_structure_SDFT; + extern rapidjson::Value method_sto; + extern rapidjson::Value nbands_sto; + extern rapidjson::Value nche_sto; + extern rapidjson::Value emin_sto; + extern rapidjson::Value emax_sto; + extern rapidjson::Value seed_sto; + extern rapidjson::Value initsto_freq; + extern rapidjson::Value npart_sto; + // @param reading_information -- input_para -- geometry_relaxation + extern rapidjson::Value geometry_relaxation; + extern rapidjson::Value relax_method; + extern rapidjson::Value relax_new; + extern rapidjson::Value relax_scale_force; + extern rapidjson::Value relax_nmax; + extern rapidjson::Value relax_cg_thr; + extern rapidjson::Value cal_force; + extern rapidjson::Value force_thr; + extern rapidjson::Value force_thr_ev; + extern rapidjson::Value force_thr_ev2; + extern rapidjson::Value relax_bfgs_w1; + extern rapidjson::Value relax_bfgs_w2; + extern rapidjson::Value relax_bfgs_rmax; + extern rapidjson::Value relax_bfgs_rmin; + extern rapidjson::Value relax_bfgs_init; + extern rapidjson::Value cal_stress; + extern rapidjson::Value stress_thr; + extern rapidjson::Value press1; + extern rapidjson::Value press2; + extern rapidjson::Value press3; + extern rapidjson::Value fixed_axes; + extern rapidjson::Value fixed_ibrav; + extern rapidjson::Value fixed_atoms; + extern rapidjson::Value cell_factor; + + // @param reading_information -- input_para -- output_information_related + extern rapidjson::Value output_information_related; + extern rapidjson::Value out_mul; + extern rapidjson::Value out_freq_elec; + extern rapidjson::Value out_freq_ion; + extern rapidjson::Value out_chg; + extern rapidjson::Value out_pot; + extern rapidjson::Value out_dm; + extern rapidjson::Value out_dm1; + extern rapidjson::Value out_wfc_pw; + extern rapidjson::Value out_wfc_r; + extern rapidjson::Value out_wfc_lcao; + extern rapidjson::Value out_dos; + extern rapidjson::Value out_band; + extern rapidjson::Value out_proj_band; + extern rapidjson::Value out_stru; + extern rapidjson::Value out_bandgap; + extern rapidjson::Value out_level; + extern rapidjson::Value out_alllog; + extern rapidjson::Value out_mat_hs; + extern rapidjson::Value out_mat_r; + extern rapidjson::Value out_mat_hs2; + extern rapidjson::Value out_mat_t; + extern rapidjson::Value out_mat_dh; + extern rapidjson::Value out_app_flag; + extern rapidjson::Value out_interval; + extern rapidjson::Value out_element_info; + extern rapidjson::Value restart_save; + extern rapidjson::Value restart_load; + extern rapidjson::Value rpa; + + // @param reading_information -- input_para -- density_of_states + extern rapidjson::Value density_of_states; + extern rapidjson::Value dos_edelta_ev; + extern rapidjson::Value dos_sigma; + extern rapidjson::Value dos_scale; + extern rapidjson::Value dos_emin_ev; + extern rapidjson::Value dos_emax_ev; + extern rapidjson::Value dos_nche; + // @param reading_information -- input_para -- naos + extern rapidjson::Value naos; + extern rapidjson::Value bessel_nao_ecut; + extern rapidjson::Value bessel_nao_tolerence; + extern rapidjson::Value bessel_nao_rcut; + extern rapidjson::Value bessel_nao_smooth; + extern rapidjson::Value bessel_nao_sigma; + // @param reading_information -- input_para -- deepks + extern rapidjson::Value deepks; + extern rapidjson::Value deepks_out_labels; + extern rapidjson::Value deepks_scf; + extern rapidjson::Value deepks_model; + extern rapidjson::Value bessel_descriptor_lmax; + extern rapidjson::Value bessel_descriptor_ecut; + extern rapidjson::Value bessel_descriptor_tolerence; + extern rapidjson::Value bessel_descriptor_rcut; + extern rapidjson::Value bessel_descriptor_smooth; + extern rapidjson::Value bessel_descriptor_sigma; + extern rapidjson::Value deepks_bandgap; + extern rapidjson::Value deepks_out_unittest; + // @param reading_information -- input_para -- ofdft + extern rapidjson::Value ofdft; + extern rapidjson::Value of_kinetic; + extern rapidjson::Value of_method; + extern rapidjson::Value of_conv; + extern rapidjson::Value of_tole; + extern rapidjson::Value of_tolp; + extern rapidjson::Value of_tf_weight; + extern rapidjson::Value of_vw_weight; + extern rapidjson::Value of_wt_alpha; + extern rapidjson::Value of_wt_beta; + extern rapidjson::Value of_wt_rho0; + extern rapidjson::Value of_hold_rho0; + extern rapidjson::Value of_lkt_a; + extern rapidjson::Value of_read_kernel; + extern rapidjson::Value of_kernel_file; + extern rapidjson::Value of_full_pw; + extern rapidjson::Value of_full_pw_dim; + + // @param reading_information -- input_para -- electric_field_and_dipole_correction + extern rapidjson::Value electric_field_and_dipole_correction; + extern rapidjson::Value efield_flag; + extern rapidjson::Value dip_cor_flag; + extern rapidjson::Value efield_dir; + extern rapidjson::Value efield_pos_max; + extern rapidjson::Value efield_pos_dec; + extern rapidjson::Value efield_amp; + // @param reading_information -- input_para -- gate_field + extern rapidjson::Value gate_field; + extern rapidjson::Value gate_flag; + extern rapidjson::Value zgate; + extern rapidjson::Value block; + extern rapidjson::Value block_down; + extern rapidjson::Value block_up; + extern rapidjson::Value block_height; + // @param reading_information -- input_para -- exact_exchange + extern rapidjson::Value exact_exchange; + extern rapidjson::Value exx_hybrid_alpha; + extern rapidjson::Value exx_hse_omega; + extern rapidjson::Value exx_separate_loop; + extern rapidjson::Value exx_hybrid_step; + extern rapidjson::Value exx_mixing_beta; + extern rapidjson::Value exx_lambda; + extern rapidjson::Value exx_pca_threshold; + extern rapidjson::Value exx_c_threshold; + extern rapidjson::Value exx_v_threshold; + extern rapidjson::Value exx_dm_threshold; + extern rapidjson::Value exx_c_grad_threshold; + extern rapidjson::Value exx_v_grad_threshold; + extern rapidjson::Value exx_schwarz_threshold; + extern rapidjson::Value exx_cauchy_threshold; + extern rapidjson::Value exx_cauchy_force_threshold; + extern rapidjson::Value exx_cauchy_stress_threshold; + extern rapidjson::Value exx_ccp_threshold; + extern rapidjson::Value exx_ccp_rmesh_times; + extern rapidjson::Value exx_distribute_type; + extern rapidjson::Value exx_opt_orb_lmax; + extern rapidjson::Value exx_opt_orb_ecut; + extern rapidjson::Value exx_opt_orb_tolerence; + extern rapidjson::Value exx_real_number; + + // @param reading_information -- input_para -- molecular_dynamics + extern rapidjson::Value molecular_dynamics; + extern rapidjson::Value md_type; + extern rapidjson::Value md_nstep; + extern rapidjson::Value md_dt; + extern rapidjson::Value md_thermostat; + extern rapidjson::Value md_tlast; + extern rapidjson::Value md_tfirst; + extern rapidjson::Value md_restart; + extern rapidjson::Value md_restartfreq; + extern rapidjson::Value md_dumpfreq; + extern rapidjson::Value dump_force; + extern rapidjson::Value dump_vel; + extern rapidjson::Value dump_virial; + extern rapidjson::Value md_seed; + extern rapidjson::Value md_tfreq; + extern rapidjson::Value md_tchain; + extern rapidjson::Value md_pmode; + extern rapidjson::Value md_prec_level; + extern rapidjson::Value ref_cell_factor; + extern rapidjson::Value md_pcouple; + extern rapidjson::Value md_pfirst; + extern rapidjson::Value md_plast; + extern rapidjson::Value md_pfreq; + extern rapidjson::Value md_pchain; + extern rapidjson::Value lj_rcut; + extern rapidjson::Value lj_epsilon; + extern rapidjson::Value lj_sigma; + extern rapidjson::Value pot_file; + extern rapidjson::Value msst_direction; + extern rapidjson::Value msst_vel; + extern rapidjson::Value msst_vis; + extern rapidjson::Value msst_tscale; + extern rapidjson::Value msst_qmass; + extern rapidjson::Value md_damp; + extern rapidjson::Value md_tolerance; + extern rapidjson::Value md_nraise; + extern rapidjson::Value cal_syns; + extern rapidjson::Value dmax; + + // @param reading_information -- input_para -- dft_plus_u + extern rapidjson::Value dft_plus_u; + extern rapidjson::Value orbital_corr; + extern rapidjson::Value hubbard_u; + extern rapidjson::Value yukawa_potential; + extern rapidjson::Value yukawa_lambda; + extern rapidjson::Value omc; + + // @param reading_information -- input_para -- vdw_correction + extern rapidjson::Value vdw_correction; + extern rapidjson::Value vdw_method; + extern rapidjson::Value vdw_s6; + extern rapidjson::Value vdw_s8; + extern rapidjson::Value vdw_a1; + extern rapidjson::Value vdw_a2; + extern rapidjson::Value vdw_d; + extern rapidjson::Value vdw_abc; + extern rapidjson::Value vdw_C6_file; + extern rapidjson::Value vdw_C6_unit; + extern rapidjson::Value vdw_R0_file; + extern rapidjson::Value vdw_R0_unit; + extern rapidjson::Value vdw_cutoff_type; + extern rapidjson::Value vdw_cutoff_radius; + extern rapidjson::Value vdw_radius_unit; + extern rapidjson::Value vdw_cutoff_period; + extern rapidjson::Value vdw_cn_thr; + extern rapidjson::Value vdw_cn_thr_unit; + + // @param reading_information -- input_para -- berry_phase_and_wannier90_interface + extern rapidjson::Value berry_phase_and_wannier90_interface; + extern rapidjson::Value berry_phase; + extern rapidjson::Value gdir; + extern rapidjson::Value towannier90; + extern rapidjson::Value nnkpfile; + extern rapidjson::Value wannier_spin; + + // @param reading_information -- input_para -- tddft + extern rapidjson::Value tddft; + extern rapidjson::Value td_edm; + extern rapidjson::Value td_print_eij; + extern rapidjson::Value td_propagator; + extern rapidjson::Value td_vext; + extern rapidjson::Value td_vext_dire; + extern rapidjson::Value td_stype; + extern rapidjson::Value td_ttype; + extern rapidjson::Value td_tstart; + extern rapidjson::Value td_tend; + extern rapidjson::Value td_lcut1; + extern rapidjson::Value td_lcut2; + extern rapidjson::Value td_gauss_freq; + extern rapidjson::Value td_gauss_phase; + extern rapidjson::Value td_gauss_sigma; + extern rapidjson::Value td_gauss_t0; + extern rapidjson::Value td_gauss_amp; + extern rapidjson::Value td_trape_freq; + extern rapidjson::Value td_trape_phase; + extern rapidjson::Value td_trape_t1; + extern rapidjson::Value td_trape_t2; + extern rapidjson::Value td_trape_t3; + extern rapidjson::Value td_trape_amp; + extern rapidjson::Value td_trigo_freq1; + extern rapidjson::Value td_trigo_freq2; + extern rapidjson::Value td_trigo_phase1; + extern rapidjson::Value td_trigo_phase2; + extern rapidjson::Value td_trigo_amp; + extern rapidjson::Value td_heavi_t0; + extern rapidjson::Value td_heavi_amp; + extern rapidjson::Value td_out_dipole; + extern rapidjson::Value td_out_efield; + extern rapidjson::Value ocp; + extern rapidjson::Value ocp_set; + + // @param reading_information -- input_para -- debuging_related + extern rapidjson::Value debuging_related; + extern rapidjson::Value t_in_h; + extern rapidjson::Value vl_in_h; + extern rapidjson::Value vnl_in_h; + extern rapidjson::Value vh_in_h; + extern rapidjson::Value vion_in_h; + extern rapidjson::Value test_force; + extern rapidjson::Value test_stress; + extern rapidjson::Value colour; + extern rapidjson::Value test_skip_ewald; + + // @param reading_information -- input_para -- electronic_conductivities + extern rapidjson::Value electronic_conductivities; + extern rapidjson::Value cal_cond; + extern rapidjson::Value cond_nche; + extern rapidjson::Value cond_dw; + extern rapidjson::Value cond_wcut; + extern rapidjson::Value cond_dt; + extern rapidjson::Value cond_dtbatch; + extern rapidjson::Value cond_fwhm; + extern rapidjson::Value cond_nonlocal; + + // @param reading_information -- input_para -- implicit_solvation_model + extern rapidjson::Value implicit_solvation_model; + extern rapidjson::Value imp_sol; + extern rapidjson::Value eb_k; + extern rapidjson::Value tau; + extern rapidjson::Value sigma_k; + extern rapidjson::Value nc_k; + + // @param reading_information -- stru_infos: + extern rapidjson::Value stru_infos; + extern rapidjson::Value ATOMIC_SPECIES; + extern rapidjson::Value NUMERICAL_ORBITAL; + extern rapidjson::Value LATTICE_CONSTANT; + extern rapidjson::Value ATOMIC_POSITIONS; + + // @param reading_information -- KPT_infos + extern rapidjson::Value KPT_infos; + extern rapidjson::Value total_number; + extern rapidjson::Value mode; + extern rapidjson::Value vectors; + + // @param reading_information -- orb_infos + extern rapidjson::Value orb_infos; + + // @param reading_information -- pp + extern rapidjson::Value pp; + + // @param init + extern rapidjson::Value init; + // @param init -- general + // extern rapidjson::Value calculation; + // extern rapidjson::Value esolver_type; + // extern rapidjson::Value basis_type; + // extern rapidjson::Value gamma_only; + // extern rapidjson::Value ks_solver; + // extern rapidjson::Value ntype; + // extern rapidjson::Value nspin; + // extern rapidjson::Value ecutwfc; + // extern rapidjson::Value scf_thr; + // extern rapidjson::Value scf_nmax; + + // @param init -- symmetry + // extern rapidjson::Value symmetry; + // extern rapidjson::Value BRAVAIS_TYPE; + // extern rapidjson::Value BRAVAIS_LATTICE_NAME; + // extern rapidjson::Value IBRAV; + // extern rapidjson::Value LATTICE_CONSTANT_A; + // extern rapidjson::Value right_hand_lattice; + + // @param init -- Kpoints + extern rapidjson::Value kpoints; + extern rapidjson::Value nkstot; + extern rapidjson::Value nkstot_ibz; + extern rapidjson::Value coordinates; + extern rapidjson::Value weight; + + // @param init -- grid + extern rapidjson::Value grid; + extern rapidjson::Value energy_cutoff_for_wavefunc; + extern rapidjson::Value fft_grid_for_wave_functions; + extern rapidjson::Value number_of_plane_waves; + extern rapidjson::Value number_of_sticks; + + // @param init -- Smearing + // extern rapidjson::Value smearing_method; + // extern rapidjson::Value smearing_sigma; + + // @param init -- mixing + extern rapidjson::Value mixing; + + + // @param output + extern rapidjson::Value output; + + + + // @param final_stru + extern rapidjson::Value final_stru; + extern rapidjson::Value cell; + extern rapidjson::Value coordinate; + + + + + /** + * The functions below initialize the json output parameter + * tree to connect the nodes of the module + */ + + /** + * @brief add Top stage:parameter in Abacus: + */ + void Init_json_abacus(); + + + /** + * @brief add Second stage:parameter in Abacus - general_info: + */ + void Init_json_abacus_generalInfo(); + + + /** + * @brief add Second stage:parameter in Abacus - readin_info: + */ + void Init_json_abacus_readinInfo(); + + + /** + * @brief finish json tree build + */ + void Finish_json_tree(); + + + + /** + * @brief This function is used to populate the template type parameter + * values into rapidjson's Value object + */ + template + void set_json_value(rapidjson::Value &json_v,T *para){ + if(std::is_same::value) + { + json_v.SetInt(*reinterpret_cast(para)); + } + else if(std::is_same::value) + { + json_v.SetDouble(*reinterpret_cast(para)); + } + else if(std::is_same::value) + { + json_v.SetBool(*reinterpret_cast(para)); + } + else if(std::is_same::value) + { + // json_v.SetString(rapidjson::StringRef((*reinterpret_cast(para)).c_str())); + + json_v.SetString((*reinterpret_cast(para)).c_str(), std::strlen((*reinterpret_cast(para)).c_str()), doc.GetAllocator()); + + + //printf("exx_real_number = %s\n",(*reinterpret_cast(para)).c_str()); + } + } +} + diff --git a/source/module_io/test/CMakeLists.txt b/source/module_io/test/CMakeLists.txt index face26e88f..3d3d5e8b26 100644 --- a/source/module_io/test/CMakeLists.txt +++ b/source/module_io/test/CMakeLists.txt @@ -141,3 +141,10 @@ AddTest( LIBS base ${math_libs} device SOURCES csr_reader_test.cpp ../csr_reader.cpp ../file_reader.cpp ../sparse_matrix.cpp ) + + +AddTest( + TARGET io_para_json_test + LIBS ${math_libs} base device + SOURCES para_json_test.cpp ../para_json.cpp ../input.cpp +) diff --git a/source/module_io/test/para_json_test.cpp b/source/module_io/test/para_json_test.cpp new file mode 100644 index 0000000000..946c50bd91 --- /dev/null +++ b/source/module_io/test/para_json_test.cpp @@ -0,0 +1,71 @@ +#include "gtest/gtest.h" +#include "module_base/global_variable.h" +#include "module_io/para_json.h" +#ifdef __MPI +#include "mpi.h" +#endif +#include + +/************************************************ + * unit test of Input::bcast + ***********************************************/ + +/** + * - Tested Functions: + * - bcast() + * - bcast input parameters to all processes + */ + +#define private public +#include "module_io/input.h" + +class ParaJsonTest : public ::testing::Test +{ +protected: +}; + +#ifdef __MPI + +TEST_F(ParaJsonTest,Init) +{ + std::string input_file = "./support/INPUT"; + Input input_tmp; + EXPECT_NO_THROW(input_tmp.Init(input_file)); + + + if(GlobalV::MY_RANK==0) + { + + // int status = system("rm -r ./OUT.autotest/"); + // EXPECT_EQ(status,0); + Para_Json::Init_json_abacus_readinInfo(); + Para_Json::Init_json_abacus(); + Para_Json::Finish_json_tree(); + + + rapidjson::StringBuffer buffer; + rapidjson::Writer writer(buffer); + Para_Json::doc.Accept(writer); + + printf("%s\n",buffer.GetString()); + + } +} + + + + +int main(int argc, char **argv) +{ + MPI_Init(&argc, &argv); + testing::InitGoogleTest(&argc, argv); + + MPI_Comm_size(MPI_COMM_WORLD,&GlobalV::NPROC); + MPI_Comm_rank(MPI_COMM_WORLD,&GlobalV::MY_RANK); + + int result = RUN_ALL_TESTS(); + MPI_Finalize(); + return result; +} +#endif +#undef private From ba3f612affb50ce196328d75234afb2e7e334273 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Fri, 17 Nov 2023 20:45:04 +0800 Subject: [PATCH 02/27] move para_json from module _io into module_base in last commit --- source/module_base/CMakeLists.txt | 1 + .../{module_io => module_base}/para_json.cpp | 11 +- source/{module_io => module_base}/para_json.h | 0 source/module_io/CMakeLists.txt | 1 - source/module_io/input.cpp | 357 +----------------- 5 files changed, 10 insertions(+), 360 deletions(-) rename source/{module_io => module_base}/para_json.cpp (99%) rename source/{module_io => module_base}/para_json.h (100%) diff --git a/source/module_base/CMakeLists.txt b/source/module_base/CMakeLists.txt index 5fb8bd0dd5..92aa6a59bc 100644 --- a/source/module_base/CMakeLists.txt +++ b/source/module_base/CMakeLists.txt @@ -54,6 +54,7 @@ add_library( formatter_table.cpp formatter_contextfmt.cpp module_mixing/mixing_data.cpp + para_json.cpp ${LIBM_SRC} ) diff --git a/source/module_io/para_json.cpp b/source/module_base/para_json.cpp similarity index 99% rename from source/module_io/para_json.cpp rename to source/module_base/para_json.cpp index a8c26a5368..721c236124 100644 --- a/source/module_io/para_json.cpp +++ b/source/module_base/para_json.cpp @@ -1,6 +1,6 @@ -#include "module_io/para_json.h" - +#include "module_base/para_json.h" +#include "module_base/global_variable.h" namespace Para_Json @@ -9,7 +9,7 @@ namespace Para_Json // @param doc: the output json file rapidjson::Document doc; rapidjson::Value abacus(rapidjson::kObjectType); - + // @param general_info : rapidjson::Value general_info(rapidjson::kObjectType); rapidjson::Value version; @@ -972,7 +972,10 @@ namespace Para_Json doc.Accept(writer); // Output the json string to a file - std::ofstream ofs(GlobalV::global_out_dir.c_str()+"out_para.json"); + std::string json_path; + json_path.append(GlobalV::global_out_dir +"out_para.json"); + + std::ofstream ofs(json_path); ofs << buffer.GetString() << std::endl; ofs.close(); } diff --git a/source/module_io/para_json.h b/source/module_base/para_json.h similarity index 100% rename from source/module_io/para_json.h rename to source/module_base/para_json.h diff --git a/source/module_io/CMakeLists.txt b/source/module_io/CMakeLists.txt index 2b467f1f59..364d075d0b 100644 --- a/source/module_io/CMakeLists.txt +++ b/source/module_io/CMakeLists.txt @@ -26,7 +26,6 @@ list(APPEND objects output_rho.cpp output_potential.cpp parameter_pool.cpp - para_json.cpp ) list(APPEND objects_advanced diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index f88dd048d2..a474d6f076 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -22,8 +22,6 @@ #include "module_base/global_variable.h" #include "module_base/parallel_common.h" #include "module_base/timer.h" - -#include "module_io/para_json.h" #include "version.h" Input INPUT; @@ -619,12 +617,6 @@ void Input::Default(void) return; } - - -/** -* guhongyaoxing modify 2023-11-16 -* Added code to convert the data read from the input file into a json object -*/ bool Input::Read(const std::string &fn) { ModuleBase::TITLE("Input", "Read"); @@ -681,18 +673,14 @@ bool Input::Read(const std::string &fn) if (strcmp("suffix", word) == 0) // out dir { read_value(ifs, suffix); - Para_Json::set_json_value(Para_Json::suffix,&suffix); - //Para_Json::set_json_value(Para_Json::suffix,&suffix); } else if (strcmp("stru_file", word) == 0) // xiaohui modify 2015-02-01 { read_value(ifs, stru_file); // xiaohui modify 2015-02-01 - Para_Json::set_json_value(Para_Json::stru_file,&stru_file); } else if (strcmp("pseudo_dir", word) == 0) { read_value(ifs, pseudo_dir); - Para_Json::set_json_value(Para_Json::pseudo_dir,&pseudo_dir); } // else if (strcmp("pseudo_type", word) == 0) // mohan add 2013-05-20 (xiaohui add 2013-06-23) // { @@ -701,82 +689,63 @@ bool Input::Read(const std::string &fn) else if (strcmp("orbital_dir", word) == 0) // liuyu add 2021-08-14 { read_value(ifs, orbital_dir); - Para_Json::set_json_value(Para_Json::orbital_dir,&orbital_dir); } else if (strcmp("kpoint_file", word) == 0) // xiaohui modify 2015-02-01 { read_value(ifs, kpoint_file); // xiaohui modify 2015-02-01 - Para_Json::set_json_value(Para_Json::kpoint_file,&kpoint_file); } else if (strcmp("wannier_card", word) == 0) // mohan add 2009-12-25 { read_value(ifs, wannier_card); - Para_Json::set_json_value(Para_Json::kpoint_file,&kpoint_file); } else if (strcmp("latname", word) == 0) // which material { read_value(ifs, latname); - Para_Json::set_json_value(Para_Json::latname,&latname); } else if (strcmp("pseudo_rcut", word) == 0) // { read_value(ifs, pseudo_rcut); - - Para_Json::set_json_value(Para_Json::pseudo_rcut,&pseudo_rcut); } else if (strcmp("pseudo_mesh", word) == 0) // { read_bool(ifs, pseudo_mesh); - Para_Json::set_json_value(Para_Json::pseudo_mesh,&pseudo_mesh); } else if (strcmp("calculation", word) == 0) // which type calculation { read_value(ifs, calculation); - Para_Json::set_json_value(Para_Json::calculation,&calculation); } else if (strcmp("esolver_type", word) == 0) { read_value(ifs, esolver_type); - Para_Json::set_json_value(Para_Json::esolver_type,&esolver_type); } else if (strcmp("ntype", word) == 0) // number of atom types { read_value(ifs, ntype); - Para_Json::set_json_value(Para_Json::ntype,&ntype); } else if (strcmp("nbands", word) == 0) // number of atom bands { read_value(ifs, nbands); - Para_Json::set_json_value(Para_Json::nbands,&nbands); } else if (strcmp("nbands_sto", word) == 0) // number of stochastic bands { std::string nbsto_str; read_value(ifs, nbndsto_str); - - if (nbndsto_str != "all") { nbands_sto = std::stoi(nbndsto_str); } - Para_Json::set_json_value(Para_Json::nbands_sto,&nbands_sto); } else if (strcmp("kspacing", word) == 0) { read_kspacing(ifs); - for(int i=0;i<3;i++){ - Para_Json::kspacing.PushBack(kspacing[i],Para_Json::doc.GetAllocator()); - } } else if (strcmp("min_dist_coef", word) == 0) { read_value(ifs, min_dist_coef); - Para_Json::set_json_value(Para_Json::min_dist_coef,&min_dist_coef); } else if (strcmp("nbands_istate", word) == 0) // number of atom bands { read_value(ifs, nbands_istate); - Para_Json::set_json_value(Para_Json::nbands_istate,&nbands_istate); // Originally disabled in line 2401. // if (nbands_istate < 0) // ModuleBase::WARNING_QUIT("Input", "NBANDS_ISTATE must > 0"); @@ -784,12 +753,10 @@ bool Input::Read(const std::string &fn) else if (strcmp("nche_sto", word) == 0) // Chebyshev expansion order { read_value(ifs, nche_sto); - Para_Json::set_json_value(Para_Json::nche_sto,&nche_sto); } else if (strcmp("seed_sto", word) == 0) { read_value(ifs, seed_sto); - Para_Json::set_json_value(Para_Json::seed_sto,&seed_sto); } else if (strcmp("initsto_ecut", word) == 0) { @@ -798,109 +765,88 @@ bool Input::Read(const std::string &fn) else if (strcmp("pw_seed", word) == 0) { read_value(ifs, pw_seed); - Para_Json::set_json_value(Para_Json::pw_seed,&pw_seed); } else if (strcmp("emax_sto", word) == 0) { read_value(ifs, emax_sto); - Para_Json::set_json_value(Para_Json::emax_sto,&emax_sto); } else if (strcmp("emin_sto", word) == 0) { read_value(ifs, emin_sto); - Para_Json::set_json_value(Para_Json::emin_sto,&emin_sto); } else if (strcmp("initsto_freq", word) == 0) { read_value(ifs, initsto_freq); - Para_Json::set_json_value(Para_Json::initsto_freq,&initsto_freq); } else if (strcmp("method_sto", word) == 0) { read_value(ifs, method_sto); - Para_Json::set_json_value(Para_Json::method_sto,&method_sto); } else if (strcmp("npart_sto", word) == 0) { read_value(ifs, npart_sto); - Para_Json::set_json_value(Para_Json::npart_sto,&npart_sto); } else if (strcmp("cal_cond", word) == 0) { read_bool(ifs, cal_cond); - Para_Json::set_json_value(Para_Json::cal_cond,&cal_cond); } else if (strcmp("cond_che_thr", word) == 0) { read_value(ifs, cond_che_thr); - Para_Json::set_json_value(Para_Json::cond_nche,&cond_che_thr); } else if (strcmp("cond_dw", word) == 0) { read_value(ifs, cond_dw); - Para_Json::set_json_value(Para_Json::cond_dw,&cond_dw); } else if (strcmp("cond_wcut", word) == 0) { read_value(ifs, cond_wcut); - Para_Json::set_json_value(Para_Json::cond_wcut,&cond_wcut); } else if (strcmp("cond_dt", word) == 0) { read_value(ifs, cond_dt); - Para_Json::set_json_value(Para_Json::cond_dt,&cond_dt); } else if (strcmp("cond_dtbatch", word) == 0) { read_value(ifs, cond_dtbatch); - Para_Json::set_json_value(Para_Json::cond_dtbatch,&cond_dtbatch); } else if (strcmp("cond_fwhm", word) == 0) { read_value(ifs, cond_fwhm); - Para_Json::set_json_value(Para_Json::cond_fwhm,&cond_fwhm); } else if (strcmp("cond_nonlocal", word) == 0) { read_bool(ifs, cond_nonlocal); - Para_Json::set_json_value(Para_Json::cond_nonlocal,&cond_nonlocal); } else if (strcmp("bndpar", word) == 0) { read_value(ifs, bndpar); - Para_Json::set_json_value(Para_Json::bndpar,&bndpar); } else if (strcmp("kpar", word) == 0) // number of pools { read_value(ifs, kpar); - Para_Json::set_json_value(Para_Json::kpar,&kpar); } else if (strcmp("berry_phase", word) == 0) // berry phase calculation { read_bool(ifs, berry_phase); - Para_Json::set_json_value(Para_Json::berry_phase,&berry_phase); } else if (strcmp("gdir", word) == 0) // berry phase calculation { read_value(ifs, gdir); - Para_Json::set_json_value(Para_Json::gdir,&gdir); } else if (strcmp("towannier90", word) == 0) // add by jingan for wannier90 { read_bool(ifs, towannier90); - Para_Json::set_json_value(Para_Json::towannier90,&towannier90); } else if (strcmp("nnkpfile", word) == 0) // add by jingan for wannier90 { read_value(ifs, nnkpfile); - Para_Json::set_json_value(Para_Json::nnkpfile,&nnkpfile); } else if (strcmp("wannier_spin", word) == 0) // add by jingan for wannier90 { read_value(ifs, wannier_spin); - Para_Json::set_json_value(Para_Json::wannier_spin,&wannier_spin); } - else if (strcmp("out_wannier_mmn", word) == 0) // add by renxi for wannier90 + else if (strcmp("out_wannier_mmn", word) == 0) // add by renxi for wannier90 { read_bool(ifs, out_wannier_mmn); } @@ -926,32 +872,26 @@ bool Input::Read(const std::string &fn) else if (strcmp("dft_functional", word) == 0) { read_value(ifs, dft_functional); - Para_Json::set_json_value(Para_Json::dft_functional,&dft_functional); } else if (strcmp("xc_temperature", word) == 0) { read_value(ifs, xc_temperature); - Para_Json::set_json_value(Para_Json::xc_temperature,&xc_temperature); } else if (strcmp("nspin", word) == 0) { read_value(ifs, nspin); - Para_Json::set_json_value(Para_Json::nspin,&nspin); } else if (strcmp("nelec", word) == 0) { read_value(ifs, nelec); - Para_Json::set_json_value(Para_Json::nelec,&nelec); } else if (strcmp("nupdown", word) == 0) { read_value(ifs, nupdown); - Para_Json::set_json_value(Para_Json::nupdown,&nupdown); } else if (strcmp("lmaxmax", word) == 0) { read_value(ifs, lmaxmax); - Para_Json::set_json_value(Para_Json::lmaxmax,&lmaxmax); } //---------------------------------------------------------- // new function @@ -959,42 +899,34 @@ bool Input::Read(const std::string &fn) else if (strcmp("basis_type", word) == 0) { read_value(ifs, basis_type); - Para_Json::set_json_value(Para_Json::basis_type,&basis_type); } // xiaohui add 2013-09-01 else if (strcmp("ks_solver", word) == 0) { read_value(ifs, ks_solver); - Para_Json::set_json_value(Para_Json::ks_solver,&ks_solver); } // xiaohui add 2013-09-01 else if (strcmp("search_radius", word) == 0) { read_value(ifs, search_radius); - Para_Json::set_json_value(Para_Json::search_radius,&search_radius); } else if (strcmp("search_pbc", word) == 0) { read_bool(ifs, search_pbc); - Para_Json::set_json_value(Para_Json::search_pbc,&search_pbc); } else if (strcmp("symmetry", word) == 0) { read_value(ifs, symmetry); - Para_Json::set_json_value(Para_Json::symmetry,&symmetry); } else if (strcmp("init_vel", word) == 0) { read_bool(ifs, init_vel); - Para_Json::set_json_value(Para_Json::init_vel,&init_vel); } else if (strcmp("ref_cell_factor", word) == 0) { read_value(ifs, ref_cell_factor); - Para_Json::set_json_value(Para_Json::ref_cell_factor,&ref_cell_factor); } else if (strcmp("symmetry_prec", word) == 0) // LiuXh add 2021-08-12, accuracy for symmetry { read_value(ifs, symmetry_prec); - Para_Json::set_json_value(Para_Json::symmetry_precfield,&symmetry_prec); } else if (strcmp("symmetry_autoclose", word) == 0) { @@ -1003,114 +935,92 @@ bool Input::Read(const std::string &fn) else if (strcmp("cal_force", word) == 0) { read_bool(ifs, cal_force); - Para_Json::set_json_value(Para_Json::cal_force,&cal_force); } else if (strcmp("force_thr", word) == 0) { read_value(ifs, force_thr); - Para_Json::set_json_value(Para_Json::force_thr,&force_thr); } else if (strcmp("force_thr_ev", word) == 0) { read_value(ifs, force_thr); - Para_Json::set_json_value(Para_Json::force_thr_ev,&force_thr); force_thr = force_thr / 13.6058 * 0.529177; } else if (strcmp("force_thr_ev2", word) == 0) { read_value(ifs, force_thr_ev2); - Para_Json::set_json_value(Para_Json::force_thr_ev2,&force_thr_ev2); } else if (strcmp("stress_thr", word) == 0) { read_value(ifs, stress_thr); - Para_Json::set_json_value(Para_Json::stress_thr,&stress_thr); } else if (strcmp("press1", word) == 0) { read_value(ifs, press1); - Para_Json::set_json_value(Para_Json::press1,&press1); } else if (strcmp("press2", word) == 0) { read_value(ifs, press2); - Para_Json::set_json_value(Para_Json::press2,&press2); } else if (strcmp("press3", word) == 0) { read_value(ifs, press3); - Para_Json::set_json_value(Para_Json::press3,&press3); } else if (strcmp("cal_stress", word) == 0) { read_bool(ifs, cal_stress); - Para_Json::set_json_value(Para_Json::cal_stress,&cal_stress); } else if (strcmp("fixed_axes", word) == 0) { read_value(ifs, fixed_axes); - Para_Json::set_json_value(Para_Json::fixed_axes,&fixed_axes); } else if (strcmp("fixed_ibrav", word) == 0) { read_bool(ifs, fixed_ibrav); - Para_Json::set_json_value(Para_Json::fixed_ibrav,&fixed_ibrav); } else if (strcmp("fixed_atoms", word) == 0) { read_bool(ifs, fixed_atoms); - Para_Json::set_json_value(Para_Json::fixed_atoms,&fixed_atoms); } else if (strcmp("relax_method", word) == 0) { read_value(ifs, relax_method); - Para_Json::set_json_value(Para_Json::relax_method,&relax_method); } else if (strcmp("relax_cg_thr", word) == 0) // pengfei add 2013-08-15 { read_value(ifs, relax_cg_thr); - Para_Json::set_json_value(Para_Json::relax_cg_thr,&relax_cg_thr); } else if (strcmp("out_level", word) == 0) { read_value(ifs, out_level); out_md_control = true; - Para_Json::set_json_value(Para_Json::out_level,&out_level); } else if (strcmp("relax_bfgs_w1", word) == 0) { read_value(ifs, relax_bfgs_w1); - Para_Json::set_json_value(Para_Json::relax_bfgs_w1,&relax_bfgs_w1); } else if (strcmp("relax_bfgs_w2", word) == 0) { read_value(ifs, relax_bfgs_w2); - Para_Json::set_json_value(Para_Json::relax_bfgs_w2,&relax_bfgs_w2); } else if (strcmp("relax_bfgs_rmax", word) == 0) { read_value(ifs, relax_bfgs_rmax); - Para_Json::set_json_value(Para_Json::relax_bfgs_rmax,&relax_bfgs_rmax); } else if (strcmp("relax_bfgs_rmin", word) == 0) { read_value(ifs, relax_bfgs_rmin); - Para_Json::set_json_value(Para_Json::relax_bfgs_rmin,&relax_bfgs_rmin); } else if (strcmp("relax_bfgs_init", word) == 0) { read_value(ifs, relax_bfgs_init); - Para_Json::set_json_value(Para_Json::relax_bfgs_init,&relax_bfgs_init); } else if (strcmp("relax_scale_force", word) == 0) { read_value(ifs, relax_scale_force); - Para_Json::set_json_value(Para_Json::relax_scale_force,&relax_scale_force); } else if (strcmp("relax_new", word) == 0) { read_bool(ifs, relax_new); - Para_Json::set_json_value(Para_Json::relax_new,&relax_new); } else if (strcmp("use_paw", word) == 0) { @@ -1122,8 +1032,6 @@ bool Input::Read(const std::string &fn) else if (strcmp("gamma_only", word) == 0) { read_bool(ifs, gamma_only); - - Para_Json::set_json_value(Para_Json::gamma_only,&gamma_only); } else if (strcmp("fft_mode", word) == 0) { @@ -1132,8 +1040,6 @@ bool Input::Read(const std::string &fn) else if (strcmp("ecutwfc", word) == 0) { read_value(ifs, ecutwfc); - Para_Json::set_json_value(Para_Json::ecutwfc,&ecutwfc); - ecutrho = 4.0 * ecutwfc; } else if (strcmp("ecutrho", word) == 0) { @@ -1142,36 +1048,29 @@ bool Input::Read(const std::string &fn) else if (strcmp("nx", word) == 0) { read_value(ifs, nx); - Para_Json::set_json_value(Para_Json::nx,&nx); - ncx = nx; } else if (strcmp("ny", word) == 0) { read_value(ifs, ny); - Para_Json::set_json_value(Para_Json::ny,&ny); ncy = ny; } else if (strcmp("nz", word) == 0) { read_value(ifs, nz); - Para_Json::set_json_value(Para_Json::nz,&nz); ncz = nz; } else if (strcmp("bx", word) == 0) { read_value(ifs, bx); - Para_Json::set_json_value(Para_Json::bx,&bx); } else if (strcmp("by", word) == 0) { read_value(ifs, by); - Para_Json::set_json_value(Para_Json::by,&by); } else if (strcmp("bz", word) == 0) { read_value(ifs, bz); - Para_Json::set_json_value(Para_Json::bz,&bz); } else if (strcmp("ndx", word) == 0) { @@ -1207,82 +1106,66 @@ bool Input::Read(const std::string &fn) else if (strcmp("diago_proc", word) == 0) { read_value(ifs, diago_proc); - Para_Json::set_json_value(Para_Json::diago_proc,&diago_proc); } else if (strcmp("pw_diag_nmax", word) == 0) { read_value(ifs, pw_diag_nmax); - Para_Json::set_json_value(Para_Json::pw_diag_nmax,&pw_diag_nmax); } else if (strcmp("diago_cg_prec", word) == 0) // mohan add 2012-03-31 { read_value(ifs, diago_cg_prec); - //Para_Json::set_json_value(Para_Json::diago_cg_prec,&diago_cg_prec); } else if (strcmp("pw_diag_ndim", word) == 0) { read_value(ifs, pw_diag_ndim); - Para_Json::set_json_value(Para_Json::pw_diag_ndim,&pw_diag_ndim); } else if (strcmp("pw_diag_thr", word) == 0) { read_value(ifs, pw_diag_thr); - Para_Json::set_json_value(Para_Json::pw_diag_thr,&pw_diag_thr); } else if (strcmp("nb2d", word) == 0) { read_value(ifs, nb2d); - Para_Json::set_json_value(Para_Json::nb2d,&nb2d); } else if (strcmp("nurse", word) == 0) { read_value(ifs, nurse); - //Para_Json::set_json_value(Para_Json::nurse,&nurse); } else if (strcmp("colour", word) == 0) { read_bool(ifs, colour); - Para_Json::set_json_value(Para_Json::colour,&colour); } else if (strcmp("nbspline", word) == 0) { read_value(ifs, nbspline); - Para_Json::set_json_value(Para_Json::nbspline, line); } else if (strcmp("t_in_h", word) == 0) { read_bool(ifs, t_in_h); - Para_Json::set_json_value(Para_Json::t_in_h,&t_in_h); } else if (strcmp("vl_in_h", word) == 0) { read_bool(ifs, vl_in_h); - Para_Json::set_json_value(Para_Json::vl_in_h,&vl_in_h); } else if (strcmp("vnl_in_h", word) == 0) { read_bool(ifs, vnl_in_h); - Para_Json::set_json_value(Para_Json::vnl_in_h,&vnl_in_h); } else if (strcmp("vh_in_h", word) == 0) { read_bool(ifs, vh_in_h); - Para_Json::set_json_value(Para_Json::vh_in_h,&vh_in_h); } else if (strcmp("vion_in_h", word) == 0) { read_bool(ifs, vion_in_h); - Para_Json::set_json_value(Para_Json::vion_in_h,&vion_in_h); } else if (strcmp("test_force", word) == 0) { read_bool(ifs, test_force); - Para_Json::set_json_value(Para_Json::test_force,&test_force); } else if (strcmp("test_stress", word) == 0) { read_bool(ifs, test_stress); - Para_Json::set_json_value(Para_Json::test_stress,&test_stress); } //---------------------------------------------------------- // iteration @@ -1290,27 +1173,22 @@ bool Input::Read(const std::string &fn) else if (strcmp("scf_thr", word) == 0) { read_value(ifs, scf_thr); - Para_Json::set_json_value(Para_Json::scf_thr,&scf_thr); } else if (strcmp("scf_thr_type", word) == 0) { read_value(ifs, scf_thr_type); - Para_Json::set_json_value(Para_Json::scf_thr_type,&scf_thr_type); } else if (strcmp("scf_nmax", word) == 0) { read_value(ifs, scf_nmax); - Para_Json::set_json_value(Para_Json::scf_nmax,&scf_nmax); } else if (strcmp("relax_nmax", word) == 0) { read_value(ifs, this->relax_nmax); - Para_Json::set_json_value(Para_Json::relax_nmax,&relax_nmax); } else if (strcmp("out_stru", word) == 0) { read_bool(ifs, out_stru); - Para_Json::set_json_value(Para_Json::out_stru,&out_stru); } //---------------------------------------------------------- // occupation @@ -1322,12 +1200,10 @@ bool Input::Read(const std::string &fn) else if (strcmp("smearing_method", word) == 0) { read_value(ifs, smearing_method); - Para_Json::set_json_value(Para_Json::smearing_method,&smearing_method); } else if (strcmp("smearing_sigma", word) == 0) { read_value(ifs, smearing_sigma); - Para_Json::set_json_value(Para_Json::smearing_sigma,&smearing_sigma); } else if (strcmp("smearing_sigma_temp", word) == 0) { @@ -1341,32 +1217,26 @@ bool Input::Read(const std::string &fn) else if (strcmp("mixing_type", word) == 0) { read_value(ifs, mixing_mode); - Para_Json::set_json_value(Para_Json::mixing_type,&mixing_mode); } else if (strcmp("mixing_beta", word) == 0) { read_value(ifs, mixing_beta); - Para_Json::set_json_value(Para_Json::mixing_beta,&mixing_beta); } else if (strcmp("mixing_ndim", word) == 0) { read_value(ifs, mixing_ndim); - Para_Json::set_json_value(Para_Json::mixing_ndim,&mixing_ndim); } else if (strcmp("mixing_gg0", word) == 0) // mohan add 2014-09-27 { read_value(ifs, mixing_gg0); - Para_Json::set_json_value(Para_Json::mixing_gg0,&mixing_gg0); } else if (strcmp("mixing_tau", word) == 0) { read_bool(ifs, mixing_tau); - Para_Json::set_json_value(Para_Json::mixing_tau,&mixing_tau); } else if (strcmp("mixing_dftu", word) == 0) { read_bool(ifs, mixing_dftu); - Para_Json::set_json_value(Para_Json::mixing_dftu,&mixing_dftu); } //---------------------------------------------------------- // charge / potential / wavefunction @@ -1374,12 +1244,10 @@ bool Input::Read(const std::string &fn) else if (strcmp("read_file_dir", word) == 0) { read_value(ifs, read_file_dir); - Para_Json::set_json_value(Para_Json::read_file_dir,&read_file_dir); } else if (strcmp("init_wfc", word) == 0) { read_value(ifs, init_wfc); - Para_Json::set_json_value(Para_Json::init_wfc,&init_wfc); } else if (strcmp("psi_initializer", word) == 0) { @@ -1388,192 +1256,155 @@ bool Input::Read(const std::string &fn) else if (strcmp("mem_saver", word) == 0) { read_value(ifs, mem_saver); - Para_Json::set_json_value(Para_Json::mem_saver,&mem_saver); } else if (strcmp("printe", word) == 0) { read_value(ifs, printe); - Para_Json::set_json_value(Para_Json::printe,&printe); } else if (strcmp("init_chg", word) == 0) { read_value(ifs, init_chg); - Para_Json::set_json_value(Para_Json::init_chg,&init_chg); } else if (strcmp("chg_extrap", word) == 0) // xiaohui modify 2015-02-01 { read_value(ifs, chg_extrap); // xiaohui modify 2015-02-01 - Para_Json::set_json_value(Para_Json::chg_extrap,&chg_extrap); } else if (strcmp("out_freq_elec", word) == 0) { read_value(ifs, out_freq_elec); - Para_Json::set_json_value(Para_Json::out_freq_elec,&out_freq_elec); } else if (strcmp("out_freq_ion", word) == 0) { read_value(ifs, out_freq_ion); - Para_Json::set_json_value(Para_Json::out_freq_ion,&out_freq_ion); } else if (strcmp("out_chg", word) == 0) { read_bool(ifs, out_chg); - Para_Json::set_json_value(Para_Json::out_chg,&out_chg); } else if (strcmp("out_dm", word) == 0) { read_bool(ifs, out_dm); - Para_Json::set_json_value(Para_Json::out_dm,&out_dm); } else if (strcmp("out_dm1", word) == 0) { read_bool(ifs, out_dm1); - Para_Json::set_json_value(Para_Json::out_dm1,&out_dm1); } else if (strcmp("out_bandgap", word) == 0) // for bandgap printing { read_bool(ifs, out_bandgap); - Para_Json::set_json_value(Para_Json::out_bandgap,&out_bandgap); } else if (strcmp("deepks_out_labels", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_out_labels); - Para_Json::set_json_value(Para_Json::deepks_out_labels,&deepks_out_labels); } else if (strcmp("deepks_scf", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_scf); - Para_Json::set_json_value(Para_Json::deepks_scf,&deepks_scf); } else if (strcmp("deepks_bandgap", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_bandgap); - Para_Json::set_json_value(Para_Json::deepks_bandgap,&deepks_bandgap); } else if (strcmp("deepks_out_unittest", word) == 0) // mohan added 2021-01-03 { read_bool(ifs, deepks_out_unittest); - Para_Json::set_json_value(Para_Json::deepks_out_unittest,&deepks_out_unittest); } else if (strcmp("deepks_model", word) == 0) // caoyu added 2021-06-03 { read_value(ifs, deepks_model); - Para_Json::set_json_value(Para_Json::deepks_model,&deepks_model); } else if (strcmp("out_pot", word) == 0) { read_value(ifs, out_pot); - Para_Json::set_json_value(Para_Json::out_pot,&out_pot); } else if (strcmp("out_wfc_pw", word) == 0) { read_value(ifs, out_wfc_pw); - Para_Json::set_json_value(Para_Json::out_wfc_pw,&out_wfc_pw); } else if (strcmp("out_wfc_r", word) == 0) { read_bool(ifs, out_wfc_r); - Para_Json::set_json_value(Para_Json::out_wfc_r,&out_wfc_r); } // mohan add 20090909 else if (strcmp("out_dos", word) == 0) { read_value(ifs, out_dos); - Para_Json::set_json_value(Para_Json::out_dos,&out_dos); } else if (strcmp("out_band", word) == 0) { read_bool(ifs, out_band); - Para_Json::set_json_value(Para_Json::out_band,&out_band); } else if (strcmp("out_proj_band", word) == 0) { read_bool(ifs, out_proj_band); - Para_Json::set_json_value(Para_Json::out_proj_band,&out_proj_band); } else if (strcmp("out_mat_hs", word) == 0) { read_bool(ifs, out_mat_hs); - Para_Json::set_json_value(Para_Json::out_mat_hs,&out_mat_hs); } // LiuXh add 2019-07-15 else if (strcmp("out_mat_hs2", word) == 0) { read_bool(ifs, out_mat_hs2); - Para_Json::set_json_value(Para_Json::out_mat_hs2,&out_mat_hs2); } else if (strcmp("out_mat_t", word) == 0) { read_bool(ifs, out_mat_t); - Para_Json::set_json_value(Para_Json::out_mat_t,&out_mat_t); } else if (strcmp("out_mat_dh", word) == 0) { read_bool(ifs, out_mat_dh); - Para_Json::set_json_value(Para_Json::out_mat_dh,&out_mat_dh); } else if (strcmp("out_interval", word) == 0) { read_value(ifs, out_interval); - Para_Json::set_json_value(Para_Json::out_interval,&out_interval); } else if (strcmp("out_app_flag", word) == 0) { read_bool(ifs, out_app_flag); - Para_Json::set_json_value(Para_Json::out_app_flag,&out_app_flag); } else if (strcmp("out_mat_r", word) == 0) { read_bool(ifs, out_mat_r); - Para_Json::set_json_value(Para_Json::out_mat_r,&out_mat_r); } else if (strcmp("out_wfc_lcao", word) == 0) { read_value(ifs, out_wfc_lcao); - Para_Json::set_json_value(Para_Json::out_wfc_lcao,&out_wfc_lcao); } else if (strcmp("out_alllog", word) == 0) { read_bool(ifs, out_alllog); - Para_Json::set_json_value(Para_Json::out_alllog,&out_alllog); } else if (strcmp("out_element_info", word) == 0) { read_bool(ifs, out_element_info); - Para_Json::set_json_value(Para_Json::out_element_info,&out_element_info); } else if (strcmp("dos_emin_ev", word) == 0) { read_value(ifs, dos_emin_ev); dos_setemin = true; - Para_Json::set_json_value(Para_Json::dos_emin_ev,&dos_emin_ev); } else if (strcmp("dos_emax_ev", word) == 0) { read_value(ifs, dos_emax_ev); - Para_Json::set_json_value(Para_Json::dos_emax_ev,&dos_emax_ev); dos_setemax = true; } else if (strcmp("dos_edelta_ev", word) == 0) { read_value(ifs, dos_edelta_ev); - Para_Json::set_json_value(Para_Json::dos_edelta_ev,&dos_edelta_ev); } else if (strcmp("dos_scale", word) == 0) { read_value(ifs, dos_scale); - Para_Json::set_json_value(Para_Json::dos_scale,&dos_scale); } else if (strcmp("dos_sigma", word) == 0) { read_value(ifs, dos_sigma); - Para_Json::set_json_value(Para_Json::dos_sigma,&dos_sigma); } else if (strcmp("dos_nche", word) == 0) { read_value(ifs, dos_nche); - Para_Json::set_json_value(Para_Json::dos_nche,&dos_nche); } //---------------------------------------------------------- @@ -1583,22 +1414,18 @@ bool Input::Read(const std::string &fn) else if (strcmp("lcao_ecut", word) == 0) { read_value(ifs, lcao_ecut); - Para_Json::set_json_value(Para_Json::lcao_ecut,&lcao_ecut); } else if (strcmp("lcao_dk", word) == 0) { read_value(ifs, lcao_dk); - Para_Json::set_json_value(Para_Json::lcao_dk,&lcao_dk); } else if (strcmp("lcao_dr", word) == 0) { read_value(ifs, lcao_dr); - Para_Json::set_json_value(Para_Json::lcao_dr,&lcao_dr); } else if (strcmp("lcao_rmax", word) == 0) { read_value(ifs, lcao_rmax); - Para_Json::set_json_value(Para_Json::lcao_rmax,&lcao_rmax); } //---------------------------------------------------------- // Molecule Dynamics @@ -1607,183 +1434,146 @@ bool Input::Read(const std::string &fn) else if (strcmp("md_type", word) == 0) { read_value(ifs, mdp.md_type); - Para_Json::set_json_value(Para_Json::md_type,&mdp.md_type); - } else if (strcmp("md_thermostat", word) == 0) { read_value(ifs, mdp.md_thermostat); - Para_Json::set_json_value(Para_Json::md_thermostat,&mdp.md_thermostat); } else if (strcmp("md_nraise", word) == 0) { read_value(ifs, mdp.md_nraise); - Para_Json::set_json_value(Para_Json::md_nraise,&mdp.md_nraise); } else if (strcmp("cal_syns", word) == 0) { read_value(ifs, cal_syns); - Para_Json::set_json_value(Para_Json::cal_syns,&cal_syns); } else if (strcmp("dmax", word) == 0) { read_value(ifs, dmax); - Para_Json::set_json_value(Para_Json::dmax,&dmax); } else if (strcmp("md_tolerance", word) == 0) { read_value(ifs, mdp.md_tolerance); - Para_Json::set_json_value(Para_Json::md_tolerance,&mdp.md_tolerance); } else if (strcmp("md_nstep", word) == 0) { read_value(ifs, mdp.md_nstep); - Para_Json::set_json_value(Para_Json::md_nstep,&mdp.md_nstep); } else if (strcmp("md_dt", word) == 0) { read_value(ifs, mdp.md_dt); - Para_Json::set_json_value(Para_Json::md_dt,&mdp.md_dt); } else if (strcmp("md_tchain", word) == 0) { read_value(ifs, mdp.md_tchain); - Para_Json::set_json_value(Para_Json::md_tchain,&mdp.md_tchain); } else if (strcmp("md_tfirst", word) == 0) { read_value(ifs, mdp.md_tfirst); - Para_Json::set_json_value(Para_Json::md_tfirst,&mdp.md_tfirst); } else if (strcmp("md_tlast", word) == 0) { read_value(ifs, mdp.md_tlast); - Para_Json::set_json_value(Para_Json::md_tlast,&mdp.md_tlast); } else if (strcmp("md_dumpfreq", word) == 0) { read_value(ifs, mdp.md_dumpfreq); - Para_Json::set_json_value(Para_Json::md_dumpfreq,&mdp.md_dumpfreq); } else if (strcmp("md_restartfreq", word) == 0) { read_value(ifs, mdp.md_restartfreq); - Para_Json::set_json_value(Para_Json::md_restartfreq,&mdp.md_restartfreq); } else if (strcmp("md_seed", word) == 0) { read_value(ifs, mdp.md_seed); - Para_Json::set_json_value(Para_Json::md_seed,&mdp.md_seed); } else if (strcmp("md_prec_level", word) == 0) { read_value(ifs, mdp.md_prec_level); - Para_Json::set_json_value(Para_Json::md_prec_level,&mdp.md_prec_level); } else if (strcmp("md_restart", word) == 0) { read_bool(ifs, mdp.md_restart); - Para_Json::set_json_value(Para_Json::md_restart,&mdp.md_restart); } else if (strcmp("md_pmode", word) == 0) { read_value(ifs, mdp.md_pmode); - Para_Json::set_json_value(Para_Json::md_pmode,&mdp.md_pmode); } else if (strcmp("md_pcouple", word) == 0) { read_value(ifs, mdp.md_pcouple); - Para_Json::set_json_value(Para_Json::md_pcouple,&mdp.md_pcouple); } else if (strcmp("md_pchain", word) == 0) { read_value(ifs, mdp.md_pchain); - Para_Json::set_json_value(Para_Json::md_pchain,&mdp.md_pchain); } else if (strcmp("md_pfirst", word) == 0) { read_value(ifs, mdp.md_pfirst); - Para_Json::set_json_value(Para_Json::md_pfirst,&mdp.md_pfirst); } else if (strcmp("md_plast", word) == 0) { read_value(ifs, mdp.md_plast); - Para_Json::set_json_value(Para_Json::md_plast,&mdp.md_plast); } else if (strcmp("md_pfreq", word) == 0) { read_value(ifs, mdp.md_pfreq); - Para_Json::set_json_value(Para_Json::md_pfreq,&mdp.md_pfreq); } else if (strcmp("lj_rcut", word) == 0) { read_value(ifs, mdp.lj_rcut); - Para_Json::set_json_value(Para_Json::lj_rcut,&mdp.lj_rcut); } else if (strcmp("lj_epsilon", word) == 0) { read_value(ifs, mdp.lj_epsilon); - Para_Json::set_json_value(Para_Json::lj_epsilon,&mdp.lj_epsilon); } else if (strcmp("lj_sigma", word) == 0) { read_value(ifs, mdp.lj_sigma); - Para_Json::set_json_value(Para_Json::lj_sigma,&mdp.lj_sigma); } else if (strcmp("msst_direction", word) == 0) { read_value(ifs, mdp.msst_direction); - Para_Json::set_json_value(Para_Json::msst_direction,&mdp.msst_direction); } else if (strcmp("msst_vel", word) == 0) { read_value(ifs, mdp.msst_vel); - Para_Json::set_json_value(Para_Json::msst_vel,&mdp.msst_vel); } else if (strcmp("msst_vis", word) == 0) { read_value(ifs, mdp.msst_vis); - Para_Json::set_json_value(Para_Json::msst_vis,&mdp.msst_vis); } else if (strcmp("msst_tscale", word) == 0) { read_value(ifs, mdp.msst_tscale); - Para_Json::set_json_value(Para_Json::msst_tscale,&mdp.msst_tscale); } else if (strcmp("msst_qmass", word) == 0) { read_value(ifs, mdp.msst_qmass); - Para_Json::set_json_value(Para_Json::msst_qmass,&mdp.msst_qmass); } else if (strcmp("md_tfreq", word) == 0) { read_value(ifs, mdp.md_tfreq); - Para_Json::set_json_value(Para_Json::md_tfreq,&mdp.md_tfreq); } else if (strcmp("md_damp", word) == 0) { read_value(ifs, mdp.md_damp); - Para_Json::set_json_value(Para_Json::md_damp,&mdp.md_damp); } else if (strcmp("pot_file", word) == 0) { read_value(ifs, mdp.pot_file); - Para_Json::set_json_value(Para_Json::pot_file,&mdp.pot_file); } else if (strcmp("dump_force", word) == 0) { read_bool(ifs, mdp.dump_force); - Para_Json::set_json_value(Para_Json::dump_force,&mdp.dump_force); } else if (strcmp("dump_vel", word) == 0) { read_bool(ifs, mdp.dump_vel); - Para_Json::set_json_value(Para_Json::dump_vel,&mdp.dump_vel); } else if (strcmp("dump_virial", word) == 0) { read_bool(ifs, mdp.dump_virial); - Para_Json::set_json_value(Para_Json::dump_virial,&mdp.dump_virial); } //---------------------------------------------------------- // efield and dipole correction @@ -1792,32 +1582,26 @@ bool Input::Read(const std::string &fn) else if (strcmp("efield_flag", word) == 0) { read_bool(ifs, efield_flag); - Para_Json::set_json_value(Para_Json::efield_flag,&efield_flag); } else if (strcmp("dip_cor_flag", word) == 0) { read_bool(ifs, dip_cor_flag); - Para_Json::set_json_value(Para_Json::dip_cor_flag,&dip_cor_flag); } else if (strcmp("efield_dir", word) == 0) { read_value(ifs, efield_dir); - Para_Json::set_json_value(Para_Json::efield_dir,&efield_dir); } else if (strcmp("efield_pos_max", word) == 0) { read_value(ifs, efield_pos_max); - Para_Json::set_json_value(Para_Json::efield_pos_max,&efield_pos_max); } else if (strcmp("efield_pos_dec", word) == 0) { read_value(ifs, efield_pos_dec); - Para_Json::set_json_value(Para_Json::efield_pos_dec,&efield_pos_dec); } else if (strcmp("efield_amp", word) == 0) { read_value(ifs, efield_amp); - Para_Json::set_json_value(Para_Json::efield_amp,&efield_amp); } //---------------------------------------------------------- // gatefield (compensating charge) @@ -1826,37 +1610,30 @@ bool Input::Read(const std::string &fn) else if (strcmp("gate_flag", word) == 0) { read_bool(ifs, gate_flag); - Para_Json::set_json_value(Para_Json::gate_flag,&gate_flag); } else if (strcmp("zgate", word) == 0) { read_value(ifs, zgate); - Para_Json::set_json_value(Para_Json::zgate,&zgate); } else if (strcmp("relax", word) == 0) { read_bool(ifs, relax); - //Para_Json::set_json_value(Para_Json::relax,&relax); } else if (strcmp("block", word) == 0) { read_bool(ifs, block); - Para_Json::set_json_value(Para_Json::block,&block); } else if (strcmp("block_down", word) == 0) { read_value(ifs, block_down); - Para_Json::set_json_value(Para_Json::block_down,&block_down); } else if (strcmp("block_up", word) == 0) { read_value(ifs, block_up); - Para_Json::set_json_value(Para_Json::block_up,&block_up); } else if (strcmp("block_height", word) == 0) { read_value(ifs, block_height); - Para_Json::set_json_value(Para_Json::block_height,&block_height); } //---------------------------------------------------------- // tddft @@ -1865,162 +1642,130 @@ bool Input::Read(const std::string &fn) else if (strcmp("td_force_dt", word) == 0) { read_value(ifs, td_force_dt); - //Para_Json::set_json_value(Para_Json::td_force_dt,&td_force_dt); } else if (strcmp("td_vext", word) == 0) { read_value(ifs, td_vext); - Para_Json::set_json_value(Para_Json::td_vext,&td_vext); } else if (strcmp("td_vext_dire", word) == 0) { getline(ifs, td_vext_dire); - Para_Json::set_json_value(Para_Json::td_vext_dire,&td_vext_dire); } else if (strcmp("out_dipole", word) == 0) { read_value(ifs, out_dipole); - Para_Json::set_json_value(Para_Json::td_out_dipole,&out_dipole); } else if (strcmp("out_efield", word) == 0) { read_value(ifs, out_efield); - Para_Json::set_json_value(Para_Json::td_out_efield,&out_efield); } else if (strcmp("td_print_eij", word) == 0) { read_value(ifs, td_print_eij); - Para_Json::set_json_value(Para_Json::td_print_eij,&td_print_eij); } else if (strcmp("td_edm", word) == 0) { read_value(ifs, td_edm); - Para_Json::set_json_value(Para_Json::td_edm,&td_edm); } else if (strcmp("td_propagator", word) == 0) { read_value(ifs, propagator); - Para_Json::set_json_value(Para_Json::td_propagator,&propagator); } else if (strcmp("td_stype", word) == 0) { read_value(ifs, td_stype); - Para_Json::set_json_value(Para_Json::td_stype,&td_stype); } else if (strcmp("td_ttype", word) == 0) { getline(ifs, td_ttype); - Para_Json::set_json_value(Para_Json::td_ttype,&td_ttype); } else if (strcmp("td_tstart", word) == 0) { read_value(ifs, td_tstart); - Para_Json::set_json_value(Para_Json::td_tstart,&td_tstart); } else if (strcmp("td_tend", word) == 0) { read_value(ifs, td_tend); - Para_Json::set_json_value(Para_Json::td_tend,&td_tend); } else if (strcmp("td_lcut1", word) == 0) { read_value(ifs, td_lcut1); - Para_Json::set_json_value(Para_Json::td_lcut1,&td_lcut1); } else if (strcmp("td_lcut2", word) == 0) { read_value(ifs, td_lcut2); - Para_Json::set_json_value(Para_Json::td_lcut2,&td_lcut2); } else if (strcmp("td_gauss_freq", word) == 0) { getline(ifs, td_gauss_freq); - Para_Json::set_json_value(Para_Json::td_gauss_freq,&td_gauss_freq); } else if (strcmp("td_gauss_phase", word) == 0) { getline(ifs, td_gauss_phase); - Para_Json::set_json_value(Para_Json::td_gauss_phase,&td_gauss_phase); } else if (strcmp("td_gauss_sigma", word) == 0) { getline(ifs, td_gauss_sigma); - Para_Json::set_json_value(Para_Json::td_gauss_sigma,&td_gauss_sigma); } else if (strcmp("td_gauss_t0", word) == 0) { getline(ifs, td_gauss_t0); - Para_Json::set_json_value(Para_Json::td_gauss_t0,&td_gauss_t0); } else if (strcmp("td_gauss_amp", word) == 0) { getline(ifs, td_gauss_amp); - Para_Json::set_json_value(Para_Json::td_gauss_amp,&td_gauss_amp); } else if (strcmp("td_trape_freq", word) == 0) { getline(ifs, td_trape_freq); - Para_Json::set_json_value(Para_Json::td_trape_freq,&td_gauss_freq); } else if (strcmp("td_trape_phase", word) == 0) { getline(ifs, td_trape_phase); - Para_Json::set_json_value(Para_Json::td_trape_phase,&td_trape_phase); } else if (strcmp("td_trape_t1", word) == 0) { getline(ifs, td_trape_t1); - Para_Json::set_json_value(Para_Json::td_trape_t1,&td_trape_t1); } else if (strcmp("td_trape_t2", word) == 0) { getline(ifs, td_trape_t2); - Para_Json::set_json_value(Para_Json::td_trape_t2,&td_trape_t2); } else if (strcmp("td_trape_t3", word) == 0) { getline(ifs, td_trape_t3); - Para_Json::set_json_value(Para_Json::td_trape_t3,&td_trape_t3); } else if (strcmp("td_trape_amp", word) == 0) { getline(ifs, td_trape_amp); - Para_Json::set_json_value(Para_Json::td_trape_amp,&td_trape_amp); } else if (strcmp("td_trigo_freq1", word) == 0) { getline(ifs, td_trigo_freq1); - Para_Json::set_json_value(Para_Json::td_trigo_freq1,&td_trigo_freq1); } else if (strcmp("td_trigo_freq2", word) == 0) { getline(ifs, td_trigo_freq2); - Para_Json::set_json_value(Para_Json::td_trigo_freq2,&td_trigo_freq2); } else if (strcmp("td_trigo_phase1", word) == 0) { getline(ifs, td_trigo_phase1); - Para_Json::set_json_value(Para_Json::td_trigo_phase1,&td_trigo_phase1); } else if (strcmp("td_trigo_phase2", word) == 0) { getline(ifs, td_trigo_phase2); - Para_Json::set_json_value(Para_Json::td_trigo_phase2,&td_trigo_phase2); } else if (strcmp("td_trigo_amp", word) == 0) { getline(ifs, td_trigo_amp); - Para_Json::set_json_value(Para_Json::td_trigo_amp,&td_trigo_amp); } else if (strcmp("td_heavi_t0", word) == 0) { getline(ifs, td_heavi_t0); - Para_Json::set_json_value(Para_Json::td_heavi_t0,&td_heavi_t0); } else if (strcmp("td_heavi_amp", word) == 0) { getline(ifs, td_heavi_amp); - Para_Json::set_json_value(Para_Json::td_heavi_amp,&td_heavi_amp); } // else if (strcmp("td_hhg_amp1", word) == 0) // { @@ -2061,91 +1806,71 @@ bool Input::Read(const std::string &fn) else if (strcmp("vdw_method", word) == 0) { read_value(ifs, vdw_method); - Para_Json::set_json_value(Para_Json::vdw_method,&vdw_method); } else if (strcmp("vdw_s6", word) == 0) { read_value(ifs, vdw_s6); - Para_Json::set_json_value(Para_Json::vdw_s6,&vdw_s6); } else if (strcmp("vdw_s8", word) == 0) { read_value(ifs, vdw_s8); - Para_Json::set_json_value(Para_Json::vdw_s8,&vdw_s8); } else if (strcmp("vdw_a1", word) == 0) { read_value(ifs, vdw_a1); - Para_Json::set_json_value(Para_Json::vdw_a1,&vdw_a1); } else if (strcmp("vdw_a2", word) == 0) { read_value(ifs, vdw_a2); - Para_Json::set_json_value(Para_Json::vdw_a2,&vdw_a2); } else if (strcmp("vdw_d", word) == 0) { read_value(ifs, vdw_d); - Para_Json::set_json_value(Para_Json::vdw_d,&vdw_d); } else if (strcmp("vdw_abc", word) == 0) { read_bool(ifs, vdw_abc); - Para_Json::set_json_value(Para_Json::vdw_abc,&vdw_abc); } else if (strcmp("vdw_cutoff_radius", word) == 0) { read_value(ifs, vdw_cutoff_radius); - Para_Json::set_json_value(Para_Json::vdw_cutoff_radius,&vdw_cutoff_radius); } else if (strcmp("vdw_radius_unit", word) == 0) { read_value(ifs, vdw_radius_unit); - Para_Json::set_json_value(Para_Json::vdw_radius_unit,&vdw_radius_unit); } else if (strcmp("vdw_cn_thr", word) == 0) { read_value(ifs, vdw_cn_thr); - Para_Json::set_json_value(Para_Json::vdw_cn_thr,&vdw_cn_thr); } else if (strcmp("vdw_cn_thr_unit", word) == 0) { read_value(ifs, vdw_cn_thr_unit); - Para_Json::set_json_value(Para_Json::vdw_cn_thr_unit,&vdw_cn_thr_unit); } else if (strcmp("vdw_c6_file", word) == 0) { read_value(ifs, vdw_C6_file); - Para_Json::set_json_value(Para_Json::vdw_C6_file,&vdw_C6_file); } else if (strcmp("vdw_c6_unit", word) == 0) { read_value(ifs, vdw_C6_unit); - Para_Json::set_json_value(Para_Json::vdw_C6_unit,&vdw_C6_unit); } else if (strcmp("vdw_r0_file", word) == 0) { read_value(ifs, vdw_R0_file); - Para_Json::set_json_value(Para_Json::vdw_R0_file,&vdw_R0_file); } else if (strcmp("vdw_r0_unit", word) == 0) { read_value(ifs, vdw_R0_unit); - Para_Json::set_json_value(Para_Json::vdw_R0_unit,&vdw_R0_unit); } else if (strcmp("vdw_cutoff_type", word) == 0) { read_value(ifs, vdw_cutoff_type); - Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("vdw_cutoff_period", word) == 0) { ifs >> vdw_cutoff_period.x >> vdw_cutoff_period.y; read_value(ifs, vdw_cutoff_period.z); - - Para_Json::vdw_cutoff_period.PushBack(vdw_cutoff_period.x,Para_Json::doc.GetAllocator()); - Para_Json::vdw_cutoff_period.PushBack(vdw_cutoff_period.y,Para_Json::doc.GetAllocator()); - Para_Json::vdw_cutoff_period.PushBack(vdw_cutoff_period.z,Para_Json::doc.GetAllocator()); } //-------------------------------------------------------- // restart Peize Lin 2020-04-04 @@ -2153,28 +1878,23 @@ bool Input::Read(const std::string &fn) else if (strcmp("restart_save", word) == 0) { read_bool(ifs, restart_save); - Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("restart_load", word) == 0) { read_bool(ifs, restart_load); - Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("ocp", word) == 0) { read_bool(ifs, ocp); - Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("ocp_set", word) == 0) { getline(ifs, ocp_set); - Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); // ifs.ignore(150, '\n'); } else if (strcmp("out_mul", word) == 0) { read_bool(ifs, out_mul); - Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } // qifeng add 2019/9/10 //---------------------------------------------------------- // exx @@ -2183,143 +1903,114 @@ bool Input::Read(const std::string &fn) else if (strcmp("exx_hybrid_alpha", word) == 0) { read_value(ifs, exx_hybrid_alpha); - Para_Json::set_json_value(Para_Json::exx_hybrid_alpha,&exx_hybrid_alpha); } else if (strcmp("exx_hse_omega", word) == 0) { read_value(ifs, exx_hse_omega); - Para_Json::set_json_value(Para_Json::exx_hse_omega,&exx_hse_omega); } else if (strcmp("exx_separate_loop", word) == 0) { read_bool(ifs, exx_separate_loop); - Para_Json::set_json_value(Para_Json::exx_separate_loop,&exx_separate_loop); } else if (strcmp("exx_hybrid_step", word) == 0) { read_value(ifs, exx_hybrid_step); - Para_Json::set_json_value(Para_Json::exx_hybrid_step,&exx_hybrid_step); } else if (strcmp("exx_mixing_beta", word) == 0) { read_value(ifs, exx_mixing_beta); - Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("exx_lambda", word) == 0) { read_value(ifs, exx_lambda); - Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("exx_real_number", word) == 0) { read_value(ifs, exx_real_number); - // printf("exx_real_number = %s\n",exx_real_number.c_str()); - Para_Json::set_json_value(Para_Json::exx_real_number,&exx_real_number); } else if (strcmp("exx_pca_threshold", word) == 0) { read_value(ifs, exx_pca_threshold); - Para_Json::set_json_value(Para_Json::exx_pca_threshold,&exx_pca_threshold); } else if (strcmp("exx_c_threshold", word) == 0) { read_value(ifs, exx_c_threshold); - Para_Json::set_json_value(Para_Json::exx_c_threshold,&exx_c_threshold); } else if (strcmp("exx_v_threshold", word) == 0) { read_value(ifs, exx_v_threshold); - Para_Json::set_json_value(Para_Json::exx_v_threshold,&exx_v_threshold); } else if (strcmp("exx_dm_threshold", word) == 0) { read_value(ifs, exx_dm_threshold); - Para_Json::set_json_value(Para_Json::exx_dm_threshold,&exx_dm_threshold); } else if (strcmp("exx_schwarz_threshold", word) == 0) { read_value(ifs, exx_schwarz_threshold); - Para_Json::set_json_value(Para_Json::exx_schwarz_threshold,&exx_schwarz_threshold); } else if (strcmp("exx_cauchy_threshold", word) == 0) { read_value(ifs, exx_cauchy_threshold); - Para_Json::set_json_value(Para_Json::exx_cauchy_threshold,&exx_cauchy_threshold); } else if (strcmp("exx_c_grad_threshold", word) == 0) { read_value(ifs, exx_c_grad_threshold); - Para_Json::set_json_value(Para_Json::exx_c_grad_threshold,&exx_c_grad_threshold); } else if (strcmp("exx_v_grad_threshold", word) == 0) { read_value(ifs, exx_v_grad_threshold); - Para_Json::set_json_value(Para_Json::exx_v_grad_threshold,&exx_v_grad_threshold); } else if (strcmp("exx_cauchy_force_threshold", word) == 0) { read_value(ifs, exx_cauchy_force_threshold); - Para_Json::set_json_value(Para_Json::exx_cauchy_force_threshold,&exx_cauchy_force_threshold); } else if (strcmp("exx_cauchy_stress_threshold", word) == 0) { read_value(ifs, exx_cauchy_stress_threshold); - Para_Json::set_json_value(Para_Json::exx_cauchy_stress_threshold,&exx_cauchy_stress_threshold); } else if (strcmp("exx_ccp_threshold", word) == 0) { read_value(ifs, exx_ccp_threshold); - Para_Json::set_json_value(Para_Json::exx_ccp_threshold,&exx_ccp_threshold); } else if (strcmp("exx_ccp_rmesh_times", word) == 0) { read_value(ifs, exx_ccp_rmesh_times); - Para_Json::set_json_value(Para_Json::exx_ccp_rmesh_times,&exx_ccp_rmesh_times); } else if (strcmp("exx_distribute_type", word) == 0) { read_value(ifs, exx_distribute_type); - Para_Json::set_json_value(Para_Json::exx_distribute_type,&exx_distribute_type); } else if (strcmp("exx_opt_orb_lmax", word) == 0) { read_value(ifs, exx_opt_orb_lmax); - Para_Json::set_json_value(Para_Json::exx_opt_orb_lmax,&exx_opt_orb_lmax); } else if (strcmp("exx_opt_orb_ecut", word) == 0) { read_value(ifs, exx_opt_orb_ecut); - Para_Json::set_json_value(Para_Json::exx_opt_orb_ecut,&exx_opt_orb_ecut); } else if (strcmp("exx_opt_orb_tolerence", word) == 0) { read_value(ifs, exx_opt_orb_tolerence); - Para_Json::set_json_value(Para_Json::exx_opt_orb_tolerence,&exx_opt_orb_tolerence); } else if (strcmp("noncolin", word) == 0) { read_bool(ifs, noncolin); - Para_Json::set_json_value(Para_Json::noncolin,&noncolin); } else if (strcmp("lspinorb", word) == 0) { read_bool(ifs, lspinorb); - Para_Json::set_json_value(Para_Json::lspinorb,&lspinorb); } else if (strcmp("soc_lambda", word) == 0) { read_value(ifs, soc_lambda); - Para_Json::set_json_value(Para_Json::soc_lambda,&soc_lambda); } else if (strcmp("cell_factor", word) == 0) { read_value(ifs, cell_factor); - Para_Json::set_json_value(Para_Json::cell_factor,&cell_factor); } else if (strcmp("test_skip_ewald", word) == 0) { read_bool(ifs, test_skip_ewald); - Para_Json::set_json_value(Para_Json::test_skip_ewald,&test_skip_ewald); } //-------------- //---------------------------------------------------------------------------------- @@ -2328,7 +2019,6 @@ bool Input::Read(const std::string &fn) else if (strcmp("dft_plus_u", word) == 0) { read_bool(ifs, dft_plus_u); - //Para_Json::set_json_value(Para_Json::dft_plus_u,&dft_plus_u); } else if (strcmp("yukawa_potential", word) == 0) ifs.ignore(150, '\n'); @@ -2346,7 +2036,6 @@ bool Input::Read(const std::string &fn) else if (strcmp("dft_plus_dmft", word) == 0) { read_bool(ifs, dft_plus_dmft); - //Para_Json::set_json_value(Para_Json::dft_plus_dmft,&dft_plus_dmft); } //---------------------------------------------------------------------------------- // Rong Shi added for RPA @@ -2354,7 +2043,6 @@ bool Input::Read(const std::string &fn) else if (strcmp("rpa", word) == 0) { read_bool(ifs, rpa); - Para_Json::set_json_value(Para_Json::rpa,&rpa); if (rpa) GlobalV::rpa_setorb = true; } @@ -2364,27 +2052,22 @@ bool Input::Read(const std::string &fn) else if (strcmp("imp_sol", word) == 0) { read_bool(ifs, imp_sol); - Para_Json::set_json_value(Para_Json::imp_sol,&imp_sol); } else if (strcmp("eb_k", word) == 0) { read_value(ifs, eb_k); - Para_Json::set_json_value(Para_Json::eb_k,&eb_k); } else if (strcmp("tau", word) == 0) { read_value(ifs, tau); - Para_Json::set_json_value(Para_Json::tau,&tau); } else if (strcmp("sigma_k", word) == 0) { read_value(ifs, sigma_k); - Para_Json::set_json_value(Para_Json::sigma_k,&sigma_k); } else if (strcmp("nc_k", word) == 0) { read_value(ifs, nc_k); - Para_Json::set_json_value(Para_Json::nc_k,&nc_k); } //---------------------------------------------------------------------------------- // OFDFT sunliang added on 2022-05-05 @@ -2392,137 +2075,110 @@ bool Input::Read(const std::string &fn) else if (strcmp("of_kinetic", word) == 0) { read_value(ifs, of_kinetic); - Para_Json::set_json_value(Para_Json::of_kinetic,&of_kinetic); } else if (strcmp("of_method", word) == 0) { read_value(ifs, of_method); - Para_Json::set_json_value(Para_Json::of_method,&of_method); } else if (strcmp("of_conv", word) == 0) { read_value(ifs, of_conv); - Para_Json::set_json_value(Para_Json::of_conv,&of_conv); } else if (strcmp("of_tole", word) == 0) { read_value(ifs, of_tole); - Para_Json::set_json_value(Para_Json::of_tole,&of_tole); } else if (strcmp("of_tolp", word) == 0) { read_value(ifs, of_tolp); - Para_Json::set_json_value(Para_Json::of_tolp,&of_tolp); } else if (strcmp("of_tf_weight", word) == 0) { read_value(ifs, of_tf_weight); - Para_Json::set_json_value(Para_Json::of_tf_weight,&of_tf_weight); } else if (strcmp("of_vw_weight", word) == 0) { read_value(ifs, of_vw_weight); - Para_Json::set_json_value(Para_Json::of_vw_weight,&of_vw_weight); } else if (strcmp("of_wt_alpha", word) == 0) { read_value(ifs, of_wt_alpha); - Para_Json::set_json_value(Para_Json::of_wt_alpha,&of_wt_alpha); } else if (strcmp("of_wt_beta", word) == 0) { read_value(ifs, of_wt_beta); - Para_Json::set_json_value(Para_Json::of_wt_beta,&of_wt_beta); } else if (strcmp("of_wt_rho0", word) == 0) { read_value(ifs, of_wt_rho0); - Para_Json::set_json_value(Para_Json::of_wt_rho0,&of_wt_rho0); } else if (strcmp("of_hold_rho0", word) == 0) { read_bool(ifs, of_hold_rho0); - Para_Json::set_json_value(Para_Json::of_hold_rho0,&of_hold_rho0); } else if (strcmp("of_lkt_a", word) == 0) { read_value(ifs, of_lkt_a); - Para_Json::set_json_value(Para_Json::of_lkt_a,&of_lkt_a); } else if (strcmp("of_full_pw", word) == 0) { read_bool(ifs, of_full_pw); - Para_Json::set_json_value(Para_Json::of_full_pw,&of_full_pw); } else if (strcmp("of_full_pw_dim", word) == 0) { read_value(ifs, of_full_pw_dim); - Para_Json::set_json_value(Para_Json::of_full_pw_dim,&of_full_pw_dim); } else if (strcmp("of_read_kernel", word) == 0) { read_bool(ifs, of_read_kernel); - Para_Json::set_json_value(Para_Json::of_read_kernel,&of_read_kernel); } else if (strcmp("of_kernel_file", word) == 0) { read_value(ifs, of_kernel_file); - Para_Json::set_json_value(Para_Json::of_kernel_file,&of_kernel_file); } else if (strcmp("bessel_nao_smooth", word) == 0) { read_value(ifs, bessel_nao_smooth); - Para_Json::set_json_value(Para_Json::bessel_nao_smooth,&bessel_nao_smooth); } else if (strcmp("bessel_nao_sigma", word) == 0) { read_value(ifs, bessel_nao_sigma); - Para_Json::set_json_value(Para_Json::bessel_nao_sigma,&bessel_nao_sigma); } else if (strcmp("bessel_nao_ecut", word) == 0) { read_value(ifs, bessel_nao_ecut); - Para_Json::set_json_value(Para_Json::bessel_nao_ecut,&bessel_nao_ecut); } else if (strcmp("bessel_nao_rcut", word) == 0) { read_value(ifs, bessel_nao_rcut); - Para_Json::set_json_value(Para_Json::bessel_nao_rcut,&bessel_nao_rcut); } else if (strcmp("bessel_nao_tolerence", word) == 0) { read_value(ifs, bessel_nao_tolerence); - Para_Json::set_json_value(Para_Json::bessel_nao_tolerence,&bessel_nao_tolerence); } else if (strcmp("bessel_descriptor_lmax", word) == 0) { read_value(ifs, bessel_descriptor_lmax); - Para_Json::set_json_value(Para_Json::bessel_descriptor_lmax,&bessel_descriptor_lmax); } else if (strcmp("bessel_descriptor_smooth", word) == 0) { read_value(ifs, bessel_descriptor_smooth); - Para_Json::set_json_value(Para_Json::bessel_descriptor_smooth,&bessel_descriptor_smooth); } else if (strcmp("bessel_descriptor_sigma", word) == 0) { read_value(ifs, bessel_descriptor_sigma); - Para_Json::set_json_value(Para_Json::bessel_descriptor_sigma,&bessel_descriptor_sigma); } else if (strcmp("bessel_descriptor_ecut", word) == 0) { read_value(ifs, bessel_descriptor_ecut); - Para_Json::set_json_value(Para_Json::bessel_descriptor_ecut,&bessel_descriptor_ecut); } else if (strcmp("bessel_descriptor_rcut", word) == 0) { read_value(ifs, bessel_descriptor_rcut); - Para_Json::set_json_value(Para_Json::bessel_descriptor_rcut,&bessel_descriptor_rcut); } else if (strcmp("bessel_descriptor_tolerence", word) == 0) { read_value(ifs, bessel_descriptor_tolerence); - Para_Json::set_json_value(Para_Json::bessel_descriptor_tolerence,&bessel_descriptor_tolerence); } //---------------------------------------------------------------------------------- // device control denghui added on 2022-11-05 @@ -2530,16 +2186,14 @@ bool Input::Read(const std::string &fn) else if (strcmp("device", word) == 0) { read_value(ifs, device); - Para_Json::set_json_value(Para_Json::device,&device); } //---------------------------------------------------------------------------------- // precision control denghui added on 2023-01-01 //---------------------------------------------------------------------------------- else if (strcmp("precision", word) == 0) { read_value(ifs, precision); - //Para_Json::set_json_value(Para_Json::precision,&precision); } - //---------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------- // Deltaspin //---------------------------------------------------------------------------------- else if (strcmp("sc_mag_switch", word) == 0){ @@ -2660,19 +2314,16 @@ bool Input::Read(const std::string &fn) if (strcmp("yukawa_potential", word) == 0) { read_bool(ifs, yukawa_potential); - Para_Json::set_json_value(Para_Json::yukawa_potential,&yukawa_potential); } else if (strcmp("yukawa_lambda", word) == 0) { ifs >> yukawa_lambda; - Para_Json::set_json_value(Para_Json::yukawa_lambda,&yukawa_lambda); } else if (strcmp("hubbard_u", word) == 0) { for (int i = 0; i < ntype; i++) { ifs >> hubbard_u[i]; - Para_Json::hubbard_u.PushBack(hubbard_u[i],Para_Json::doc.GetAllocator()); hubbard_u[i] /= ModuleBase::Ry_to_eV; } } @@ -2681,7 +2332,6 @@ bool Input::Read(const std::string &fn) for (int i = 0; i < ntype; i++) { ifs >> orbital_corr[i]; - Para_Json::orbital_corr.PushBack(orbital_corr[i],Para_Json::doc.GetAllocator()); } } else if (strcmp("omc", word) == 0) @@ -2756,7 +2406,6 @@ bool Input::Read(const std::string &fn) for (int i = 0; i < ntype; i++) { ifs >> hubbard_u[i]; - Para_Json::hubbard_u.PushBack(hubbard_u[i],Para_Json::doc.GetAllocator()); hubbard_u[i] /= ModuleBase::Ry_to_eV; } } @@ -2765,7 +2414,6 @@ bool Input::Read(const std::string &fn) for (int i = 0; i < ntype; i++) { ifs >> orbital_corr[i]; - Para_Json::orbital_corr.PushBack(orbital_corr[i],Para_Json::doc.GetAllocator()); } } else @@ -2862,7 +2510,6 @@ bool Input::Read(const std::string &fn) return true; } // end read_parameters - void Input::Default_2(void) // jiyy add 2019-08-04 { if (GlobalV::MY_RANK != 0) From 5008eab9f50d57803a0fe33d5af67bb4ae680a1f Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Fri, 17 Nov 2023 20:47:03 +0800 Subject: [PATCH 03/27] fix a bug --- source/module_io/test/CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source/module_io/test/CMakeLists.txt b/source/module_io/test/CMakeLists.txt index 3d3d5e8b26..cafe897eb8 100644 --- a/source/module_io/test/CMakeLists.txt +++ b/source/module_io/test/CMakeLists.txt @@ -143,8 +143,3 @@ AddTest( ) -AddTest( - TARGET io_para_json_test - LIBS ${math_libs} base device - SOURCES para_json_test.cpp ../para_json.cpp ../input.cpp -) From 4a6ca573c4d34f315320522af3a8f55dd103f213 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Mon, 20 Nov 2023 11:21:57 +0800 Subject: [PATCH 04/27] fix some bug --- source/module_base/CMakeLists.txt | 1 + source/module_base/test/data/INPUT | 382 ++++++++++++++++++ .../test/para_json_test.cpp | 4 +- source/module_io/input.cpp | 356 +++++++++++++++- source/module_io/input.h | 1 + source/module_io/test/CMakeLists.txt | 5 + 6 files changed, 745 insertions(+), 4 deletions(-) create mode 100644 source/module_base/test/data/INPUT rename source/{module_io => module_base}/test/para_json_test.cpp (94%) diff --git a/source/module_base/CMakeLists.txt b/source/module_base/CMakeLists.txt index 92aa6a59bc..c4e351bfdc 100644 --- a/source/module_base/CMakeLists.txt +++ b/source/module_base/CMakeLists.txt @@ -54,6 +54,7 @@ add_library( formatter_table.cpp formatter_contextfmt.cpp module_mixing/mixing_data.cpp + para_json.cpp ${LIBM_SRC} ) diff --git a/source/module_base/test/data/INPUT b/source/module_base/test/data/INPUT new file mode 100644 index 0000000000..5a62b2416e --- /dev/null +++ b/source/module_base/test/data/INPUT @@ -0,0 +1,382 @@ +INPUT_PARAMETERS +#Parameters (1.General) +suffix autotest #the name of main output directory +latname none #the name of lattice name +stru_file ./support/STRU #the filename of file containing atom positions +kpoint_file KPT #the name of file containing k points +pseudo_dir ../../PP_ORB/ #the directory containing pseudo files +orbital_dir ../../PP_ORB/ #the directory containing orbital files +pseudo_rcut 15 #cut-off radius for radial integration +pseudo_mesh 0 #0: use our own mesh to do radial renormalization; 1: use mesh as in QE +lmaxmax 2 #maximum of l channels used +dft_functional hse #exchange correlation functional +xc_temperature 0 #temperature for finite temperature functionals +calculation scf #test; scf; relax; nscf; get_wf; get_pchg +esolver_type ksdft #the energy solver: ksdft, sdft, ofdft, tddft, lj, dp +ntype 1 #atom species number +nspin 1 #1: single spin; 2: up and down spin; 4: noncollinear spin +kspacing 0 #unit in 1/bohr, should be > 0, default is 0 which means read KPT file +min_dist_coef 0.2 #factor related to the allowed minimum distance between two atoms +nbands 8 #number of bands +nbands_sto 256 #number of stochastic bands +nbands_istate 5 #number of bands around Fermi level for get_pchg calulation +symmetry 1 #the control of symmetry +init_vel False #read velocity from STRU or not +symmetry_prec 1e-06 #accuracy for symmetry +nelec 0 #input number of electrons +out_mul 0 # mulliken charge or not +noncolin 0 #using non-collinear-spin +lspinorb 0 #consider the spin-orbit interaction +kpar 1 #devide all processors into kpar groups and k points will be distributed among each group +bndpar 1 #devide all processors into bndpar groups and bands will be distributed among each group +out_freq_elec 0 #the frequency ( >= 0) of electronic iter to output charge density and wavefunction. 0: output only when converged +dft_plus_dmft 0 #true:DFT+DMFT; false: standard DFT calcullation(default) +rpa 0 #true:generate output files used in rpa calculation; false:(default) +printe 100 #Print out energy for each band for every printe steps +mem_saver 0 #Only for nscf calculations. if set to 1, then a memory saving technique will be used for many k point calculations. +diago_proc 4 #the number of procs used to do diagonalization +nbspline -1 #the order of B-spline basis +wannier_card none #input card for wannier functions +soc_lambda 1 #The fraction of averaged SOC pseudopotential is given by (1-soc_lambda) +cal_force 0 #if calculate the force at the end of the electronic iteration +out_freq_ion 0 #the frequency ( >= 0 ) of ionic step to output charge density and wavefunction. 0: output only when ion steps are finished +device cpu #the computing device for ABACUS + +#Parameters (2.PW) +ecutwfc 20 ##energy cutoff for wave functions +erf_ecut 20 #the value of the constant energy cutoff +erf_height 20 #the height of the energy step for reciprocal vectors +erf_sigma 4 #the width of the energy step for reciprocal vectors +fft_mode 0 #mode of FFTW +pw_diag_thr 0.01 #threshold for eigenvalues is cg electron iterations +scf_thr 1e-08 #charge density error +scf_thr_type 2 #type of the criterion of scf_thr, 1: reci drho for pw, 2: real drho for lcao +init_wfc atomic #start wave functions are from 'atomic', 'atomic+random', 'random' or 'file' +init_chg atomic #start charge is from 'atomic' or file +chg_extrap atomic #atomic; first-order; second-order; dm:coefficients of SIA +out_chg FALSE #>0 output charge density for selected electron steps +out_pot 2 #output realspace potential +out_wfc_pw 0 #output wave functions +out_wfc_r 0 #output wave functions in realspace +out_dos 0 #output energy and dos +out_band false #output energy and band structure +out_proj_band FaLse #output projected band structure +restart_save f #print to disk every step for restart +restart_load F #restart from disk +read_file_dir auto #directory of files for reading +nx 0 #number of points along x axis for FFT grid +ny 0 #number of points along y axis for FFT grid +nz 0 #number of points along z axis for FFT grid +cell_factor 1.2 #used in the construction of the pseudopotential tables +pw_seed 1 #random seed for initializing wave functions + +#Parameters (3.Stochastic DFT) +method_sto 3 #1: slow and save memory, 2: fast and waste memory +npart_sto 1 #Reduce memory when calculating Stochastic DOS +nbands_sto 256 #number of stochstic orbitals +nche_sto 100 #Chebyshev expansion orders +emin_sto 0 #trial energy to guess the lower bound of eigen energies of the Hamitonian operator +emax_sto 0 #trial energy to guess the upper bound of eigen energies of the Hamitonian operator +seed_sto 0 #the random seed to generate stochastic orbitals +initsto_ecut 0 #maximum ecut to init stochastic bands +initsto_freq 0 #frequency to generate new stochastic orbitals when running md +cal_cond 0 #calculate electronic conductivities +cond_che_thr 1e-08 #control the error of Chebyshev expansions for conductivities +cond_dw 0.1 #frequency interval for conductivities +cond_wcut 10 #cutoff frequency (omega) for conductivities +cond_dt 0.07 #control the t interval +cond_dtbatch 2 #control dt batch +cond_fwhm 0.3 #FWHM for conductivities +cond_nonlocal 1 #Nonlocal effects for conductivities + +#Parameters (4.Relaxation) +ks_solver genelpa #cg; dav; lapack; genelpa; scalapack_gvx; cusolver +scf_nmax 50 ##number of electron iterations +relax_nmax 1 #number of ion iteration steps +out_stru 0 #output the structure files after each ion step +force_thr 0.001 #force threshold, unit: Ry/Bohr +force_thr_ev 0.0257112 #force threshold, unit: eV/Angstrom +force_thr_ev2 0 #force invalid threshold, unit: eV/Angstrom +relax_cg_thr 0.5 #threshold for switching from cg to bfgs, unit: eV/Angstrom +stress_thr 0.01 #stress threshold +press1 0 #target pressure, unit: KBar +press2 0 #target pressure, unit: KBar +press3 0 #target pressure, unit: KBar +relax_bfgs_w1 0.01 #wolfe condition 1 for bfgs +relax_bfgs_w2 0.5 #wolfe condition 2 for bfgs +relax_bfgs_rmax 0.8 #maximal trust radius, unit: Bohr +relax_bfgs_rmin 1e-05 #minimal trust radius, unit: Bohr +relax_bfgs_init 0.5 #initial trust radius, unit: Bohr +cal_stress 0 #calculate the stress or not +fixed_axes None #which axes are fixed +fixed_ibrav 0 #whether to preseve lattice type during relaxation +fixed_atoms 0 #whether to preseve direct coordinates of atoms during relaxation +relax_method cg #bfgs; sd; cg; cg_bfgs; +relax_new TRUE #whether to use the new relaxation method +relax_scale_force 0.5 #controls the size of the first CG step if relax_new is true +out_level ie #ie(for electrons); i(for ions); +out_dm 0 #>0 output density matrix +deepks_out_labels 0 #>0 compute descriptor for deepks +deepks_scf 0 #>0 add V_delta to Hamiltonian +deepks_bandgap 0 #>0 for bandgap label +deepks_out_unittest 0 #if set 1, prints intermediate quantities that shall be used for making unit test +deepks_model #file dir of traced pytorch model: 'model.ptg + +#Parameters (5.LCAO) +basis_type lcao #PW; LCAO in pw; LCAO +nb2d 0 #2d distribution of atoms +gamma_only T #Only for localized orbitals set and gamma point. If set to 1, a fast algorithm is used +search_radius -1 #input search radius (Bohr) +search_pbc 1 #input periodic boundary condition +lcao_ecut 20 #energy cutoff for LCAO +lcao_dk 0.01 #delta k for 1D integration in LCAO +lcao_dr 0.01 #delta r for 1D integration in LCAO +lcao_rmax 30 #max R for 1D two-center integration table +out_mat_hs 0 #output H and S matrix +out_mat_hs2 0 #output H(R) and S(R) matrix +out_interval 1 #interval for printing H(R) and S(R) matrix during MD +out_app_flag 0 #whether output r(R), H(R), S(R), T(R), and dH(R) matrices in an append manner during MD +out_element_info 0 #output (projected) wavefunction of each element +out_mat_r 0 #output r(R) matrix +out_wfc_lcao 0 #ouput LCAO wave functions +bx 2 #division of an element grid in FFT grid along x +by 2 #division of an element grid in FFT grid along y +bz 2 #division of an element grid in FFT grid along z + +bessel_nao_smooth 1 +bessel_nao_sigma 0.1 +bessel_nao_ecut default +bessel_nao_rcut 6.0 #-1.0 for forcing manual setting +bessel_nao_tolerence 1E-12 + +bessel_descriptor_lmax 2 # -1 for forcing manual setting +bessel_descriptor_smooth 1 +bessel_descriptor_sigma 0.1 +bessel_descriptor_ecut default +bessel_descriptor_rcut 6.0 #-1.0 for forcing manual setting +bessel_descriptor_tolerence 1E-12 + +#Parameters (6.Smearing) +smearing_method gauss #type of smearing_method: gauss; fd; fixed; mp; mp2; mv +smearing_sigma 0.002 #energy range for smearing + +#Parameters (7.Charge Mixing) +mixing_type broyden #plain; pulay; broyden +mixing_beta 0.7 #mixing parameter: 0 means no new charge +mixing_ndim 8 #mixing dimension in pulay or broyden +mixing_gg0 0 #mixing parameter in kerker + +#Parameters (8.DOS) +dos_emin_ev -15 #minimal range for dos +dos_emax_ev 15 #maximal range for dos +dos_edelta_ev 0.01 #delta energy for dos +dos_scale 0.01 #scale dos range by +dos_sigma 0.07 #gauss b coefficeinet(default=0.07) +dos_nche 100 #orders of Chebyshev expansions for dos + +#Parameters (9.Molecular dynamics) +md_type nvt #choose ensemble +md_thermostat nhc #choose thermostat +md_nstep 10 #md steps +md_dt 1 #time step +md_tchain 1 #number of Nose-Hoover chains +md_tfirst -1 #temperature first +md_tlast -1 #temperature last +md_dumpfreq 1 #The period to dump MD information +md_restartfreq 5 #The period to output MD restart information +md_seed -1 #random seed for MD +md_prec_level 2 #precision level for vc-md +ref_cell_factor 1.2 #construct a reference cell bigger than the initial cell +md_restart 0 #whether restart +lj_rcut 8.5 #cutoff radius of LJ potential +lj_epsilon 0.01032 #the value of epsilon for LJ potential +lj_sigma 3.405 #the value of sigma for LJ potential +pot_file graph.pb #the filename of potential files for CMD such as DP +msst_direction 2 #the direction of shock wave +msst_vel 0 #the velocity of shock wave +msst_vis 0 #artificial viscosity +msst_tscale 0.01 #reduction in initial temperature +msst_qmass -1 #mass of thermostat +md_tfreq 0 #oscillation frequency, used to determine qmass of NHC +md_damp 1 #damping parameter (time units) used to add force in Langevin method +md_nraise 1 #parameters used when md_type=nvt +cal_syns 0 #calculate asynchronous overlap matrix to output for Hefei-NAMD +dmax 0.01 #maximum displacement of all atoms in one step (bohr) +md_tolerance 100 #tolerance for velocity rescaling (K) +md_pmode iso #NPT ensemble mode: iso, aniso, tri +md_pcouple none #whether couple different components: xyz, xy, yz, xz, none +md_pchain 1 #num of thermostats coupled with barostat +md_pfirst -1 #initial target pressure +md_plast -1 #final target pressure +md_pfreq 0 #oscillation frequency, used to determine qmass of thermostats coupled with barostat +dump_force 0 #output atomic forces into the file MD_dump or not. +dump_vel 0 #output atomic velocities into the file MD_dump or not +dump_virial 0 #output lattice virial into the file MD_dump or not + +#Parameters (10.Electric field and dipole correction) +efield_flag 0 #add electric field +dip_cor_flag 0 #dipole correction +efield_dir 2 #the direction of the electric field or dipole correction +efield_pos_max 0.5 #position of the maximum of the saw-like potential along crystal axis efield_dir +efield_pos_dec 0.1 #zone in the unit cell where the saw-like potential decreases +efield_amp 0 #amplitude of the electric field + +#Parameters (11.Gate field) +gate_flag 0 #compensating charge or not +zgate 0.5 #position of charged plate +relax 0 #allow relaxation along the specific direction +block 0 #add a block potential or not +block_down 0.45 #low bound of the block +block_up 0.55 #high bound of the block +block_height 0.1 #height of the block + +#Parameters (12.Test) +out_alllog F #output information for each processor, when parallel +nurse 0 #for coders +colour 0 #for coders, make their live colourful +t_in_h 1 #calculate the kinetic energy or not +vl_in_h 1 #calculate the local potential or not +vnl_in_h 1 #calculate the nonlocal potential or not +vh_in_h 1 #calculate the hartree potential or not +vion_in_h 1 #calculate the local ionic potential or not +test_force 0 #test the force +test_stress 0 #test the force +test_skip_ewald 0 #skip ewald energy + +#Parameters (13.vdW Correction) +vdw_method d2 #the method of calculating vdw (none ; d2 ; d3_0 ; d3_bj +vdw_s6 default #scale parameter of d2/d3_0/d3_bj +vdw_s8 default #scale parameter of d3_0/d3_bj +vdw_a1 default #damping parameter of d3_0/d3_bj +vdw_a2 default #damping parameter of d3_bj +vdw_d 20 #damping parameter of d2 +vdw_abc 0 #third-order term? +vdw_C6_file default #filename of C6 +vdw_C6_unit Jnm6/mol #unit of C6, Jnm6/mol or eVA6 +vdw_R0_file default #filename of R0 +vdw_R0_unit A #unit of R0, A or Bohr +vdw_cutoff_type radius #expression model of periodic structure, radius or period +vdw_cutoff_radius default #radius cutoff for periodic structure +vdw_radius_unit Bohr #unit of radius cutoff for periodic structure +vdw_cn_thr 40 #radius cutoff for cn +vdw_cn_thr_unit Bohr #unit of cn_thr, Bohr or Angstrom +vdw_cutoff_period 3 3 3 #periods of periodic structure + +#Parameters (14.exx) +exx_hybrid_alpha default # +exx_hse_omega 0.11 # +exx_separate_loop 1 #0 or 1 +exx_hybrid_step 100 # +exx_mixing_beta 1.0 # +exx_lambda 0.3 # +exx_real_number default #0 or 1 +exx_pca_threshold 0 # +exx_c_threshold 0 # +exx_v_threshold 0 # +exx_dm_threshold 0 # +exx_schwarz_threshold 0 # +exx_cauchy_threshold 0 # +exx_c_grad_threshold 0 # +exx_v_grad_threshold 0 # +exx_cauchy_force_threshold 0 # +exx_cauchy_stress_threshold 0 # +exx_ccp_threshold 1e-08 # +exx_ccp_rmesh_times default # +exx_distribute_type htime #htime or kmeans1 or kmeans2 +exx_opt_orb_lmax 0 # +exx_opt_orb_ecut 0 # +exx_opt_orb_tolerence 0 # + +#Parameters (16.tddft) +td_force_dt 0.02 #time of force change +td_vext 0 #add extern potential or not +td_vext_dire 1 #extern potential direction +td_propagator 0 # method of propagator +td_stype 0 #space domain type +td_ttype 0 #time domain type +td_tstart 1 #the start step of electric field +td_tend 1000 #the start step of electric field +td_lcut1 0.05 # separator in length gauge +td_lcut2 0.95 # separator in length gauge +# parameters of Gauss electric field +td_gauss_freq 22.13 # fs^-1 +td_gauss_phase 0.0 +td_gauss_sigma 30.0 # fs +td_gauss_t0 100.0 +td_gauss_amp 0.25 # V/A +# parameters of Trapezoid electric field +td_trape_freq 1.60 # fs^-1 +td_trape_phase 0.0 +td_trape_t1 1875 +td_trape_t2 5625 +td_trape_t3 7500 +td_trape_amp 2.74 # V/A +#parameters of Trigonometric electric field +td_trigo_freq1 1.164656 # fs^-1 +td_trigo_freq2 0.029116 # fs^-1 +td_trigo_phase1 0.0 +td_trigo_phase2 0.0 +td_trigo_amp 2.74 # V/A +#parameters of Heaviside electric field +td_heavi_t0 100 +td_heavi_amp 1.0 # V/A +td_print_eij -1.0 # threshold to output Eij elements +td_edm 0 # 0: new edm method 1: old edm method +out_dipole 0 #output dipole or not +out_efield 0 #output efield or not +ocp 0 #change occupation or not +ocp_set none #set occupation + +#Parameters (17.berry_wannier) +berry_phase 0 #calculate berry phase or not +gdir 3 #calculate the polarization in the direction of the lattice vector +towannier90 0 #use wannier90 code interface or not +nnkpfile seedname.nnkp #the wannier90 code nnkp file name +wannier_spin up #calculate spin in wannier90 code interface +out_wannier_mmn 1 #output .mmn file or not +out_wannier_amn 1 #output .amn file or not +out_wannier_unk 1 #output UNK. file or not +out_wannier_eig 1 #output .eig file or not +out_wannier_wvfn_formatted 1 #output UNK. file in text format or in binary format + +#Parameters (18.implicit_solvation) +imp_sol 0 #calculate implicit solvation correction or not +eb_k 80 #the relative permittivity of the bulk solvent +tau 1.0798e-05 #the effective surface tension parameter +sigma_k 0.6 # the width of the diffuse cavity +nc_k 0.00037 # the cut-off charge density + +#Parameters (19.orbital free density functional theory) +of_kinetic vw #kinetic energy functional, such as tf, vw, wt +of_method tn #optimization method used in OFDFT, including cg1, cg2, tn (default) +of_conv energy #the convergence criterion, potential, energy (default), or both +of_tole 1e-06 #tolerance of the energy change (in Ry) for determining the convergence, default=2e-6 Ry +of_tolp 1e-05 #tolerance of potential for determining the convergence, default=1e-5 in a.u. +of_tf_weight 1 #weight of TF KEDF +of_vw_weight 1 #weight of vW KEDF +of_wt_alpha 0.833333 #parameter alpha of WT KEDF +of_wt_beta 0.833333 #parameter beta of WT KEDF +of_wt_rho0 1 #the average density of system, used in WT KEDF, in Bohr^-3 +of_hold_rho0 0 #If set to 1, the rho0 will be fixed even if the volume of system has changed, it will be set to 1 automaticly if of_wt_rho0 is not zero +of_full_pw 0 #If set to 1, ecut will be ignored when collect planewaves, so that all planewaves will be used +of_full_pw_dim 0 #If of_full_pw = true, dimention of FFT is testricted to be (0) either odd or even; (1) odd only; (2) even only +of_read_kernel 0 #If set to 1, the kernel of WT KEDF will be filled from file of_kernel_file, not from formula. Only usable for WT KEDF +of_kernel_file WTkernel.txt #The name of WT kernel file. + +#Parameters (20.dft+u) +dft_plus_u 0 #true:DFT+U correction; false: standard DFT calcullation(default) +yukawa_lambda -1 #default:0.0 +yukawa_potential 0 #default: false +omc 0 #the mode of occupation matrix control +hubbard_u 0 #Hubbard Coulomb interaction parameter U(ev) +orbital_corr -1 #which correlated orbitals need corrected ; d:2 ,f:3, do not need correction:-1 + +#Parameters (22.non-collinear spin-constrained DFT) +sc_mag_switch 0 #0: no spin-constrained DFT; 1: constrain atomic magnetization via values at xyz; 3: via spin value and angles +decay_grad_switch 1 # +sc_thr 1e-04 #Convergence criterion of spin-constrained iteration (RMS) in uB +nsc 50 #Maximal number of spin-constrained iteration +nsc_min 4 #Minimum number of spin-constrained iteration +alpha_trial 0.02 #Initial trial step size for lambda in eV/uB^2 +sccut 4 #Maximal step size for lambda in eV/uB +sc_file sc.json #file name for parameters used in non-collinear spin-constrained DFT (json format) diff --git a/source/module_io/test/para_json_test.cpp b/source/module_base/test/para_json_test.cpp similarity index 94% rename from source/module_io/test/para_json_test.cpp rename to source/module_base/test/para_json_test.cpp index 946c50bd91..f8ebe43e9b 100644 --- a/source/module_io/test/para_json_test.cpp +++ b/source/module_base/test/para_json_test.cpp @@ -1,6 +1,6 @@ #include "gtest/gtest.h" #include "module_base/global_variable.h" -#include "module_io/para_json.h" +#include "module_base/para_json.h" #ifdef __MPI #include "mpi.h" #endif @@ -28,7 +28,7 @@ class ParaJsonTest : public ::testing::Test TEST_F(ParaJsonTest,Init) { - std::string input_file = "./support/INPUT"; + std::string input_file = "./data/INPUT"; Input input_tmp; EXPECT_NO_THROW(input_tmp.Init(input_file)); diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index a474d6f076..0bbe6cfb77 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -22,6 +22,7 @@ #include "module_base/global_variable.h" #include "module_base/parallel_common.h" #include "module_base/timer.h" + #include "version.h" Input INPUT; @@ -617,6 +618,12 @@ void Input::Default(void) return; } + + +/** +* guhongyaoxing modify 2023-11-16 +* Added code to convert the data read from the input file into a json object +*/ bool Input::Read(const std::string &fn) { ModuleBase::TITLE("Input", "Read"); @@ -673,14 +680,18 @@ bool Input::Read(const std::string &fn) if (strcmp("suffix", word) == 0) // out dir { read_value(ifs, suffix); + Para_Json::set_json_value(Para_Json::suffix,&suffix); + //Para_Json::set_json_value(Para_Json::suffix,&suffix); } else if (strcmp("stru_file", word) == 0) // xiaohui modify 2015-02-01 { read_value(ifs, stru_file); // xiaohui modify 2015-02-01 + Para_Json::set_json_value(Para_Json::stru_file,&stru_file); } else if (strcmp("pseudo_dir", word) == 0) { read_value(ifs, pseudo_dir); + Para_Json::set_json_value(Para_Json::pseudo_dir,&pseudo_dir); } // else if (strcmp("pseudo_type", word) == 0) // mohan add 2013-05-20 (xiaohui add 2013-06-23) // { @@ -689,63 +700,82 @@ bool Input::Read(const std::string &fn) else if (strcmp("orbital_dir", word) == 0) // liuyu add 2021-08-14 { read_value(ifs, orbital_dir); + Para_Json::set_json_value(Para_Json::orbital_dir,&orbital_dir); } else if (strcmp("kpoint_file", word) == 0) // xiaohui modify 2015-02-01 { read_value(ifs, kpoint_file); // xiaohui modify 2015-02-01 + Para_Json::set_json_value(Para_Json::kpoint_file,&kpoint_file); } else if (strcmp("wannier_card", word) == 0) // mohan add 2009-12-25 { read_value(ifs, wannier_card); + Para_Json::set_json_value(Para_Json::kpoint_file,&kpoint_file); } else if (strcmp("latname", word) == 0) // which material { read_value(ifs, latname); + Para_Json::set_json_value(Para_Json::latname,&latname); } else if (strcmp("pseudo_rcut", word) == 0) // { read_value(ifs, pseudo_rcut); + + Para_Json::set_json_value(Para_Json::pseudo_rcut,&pseudo_rcut); } else if (strcmp("pseudo_mesh", word) == 0) // { read_bool(ifs, pseudo_mesh); + Para_Json::set_json_value(Para_Json::pseudo_mesh,&pseudo_mesh); } else if (strcmp("calculation", word) == 0) // which type calculation { read_value(ifs, calculation); + Para_Json::set_json_value(Para_Json::calculation,&calculation); } else if (strcmp("esolver_type", word) == 0) { read_value(ifs, esolver_type); + Para_Json::set_json_value(Para_Json::esolver_type,&esolver_type); } else if (strcmp("ntype", word) == 0) // number of atom types { read_value(ifs, ntype); + Para_Json::set_json_value(Para_Json::ntype,&ntype); } else if (strcmp("nbands", word) == 0) // number of atom bands { read_value(ifs, nbands); + Para_Json::set_json_value(Para_Json::nbands,&nbands); } else if (strcmp("nbands_sto", word) == 0) // number of stochastic bands { std::string nbsto_str; read_value(ifs, nbndsto_str); + + if (nbndsto_str != "all") { nbands_sto = std::stoi(nbndsto_str); } + Para_Json::set_json_value(Para_Json::nbands_sto,&nbands_sto); } else if (strcmp("kspacing", word) == 0) { read_kspacing(ifs); + for(int i=0;i<3;i++){ + Para_Json::kspacing.PushBack(kspacing[i],Para_Json::doc.GetAllocator()); + } } else if (strcmp("min_dist_coef", word) == 0) { read_value(ifs, min_dist_coef); + Para_Json::set_json_value(Para_Json::min_dist_coef,&min_dist_coef); } else if (strcmp("nbands_istate", word) == 0) // number of atom bands { read_value(ifs, nbands_istate); + Para_Json::set_json_value(Para_Json::nbands_istate,&nbands_istate); // Originally disabled in line 2401. // if (nbands_istate < 0) // ModuleBase::WARNING_QUIT("Input", "NBANDS_ISTATE must > 0"); @@ -753,10 +783,12 @@ bool Input::Read(const std::string &fn) else if (strcmp("nche_sto", word) == 0) // Chebyshev expansion order { read_value(ifs, nche_sto); + Para_Json::set_json_value(Para_Json::nche_sto,&nche_sto); } else if (strcmp("seed_sto", word) == 0) { read_value(ifs, seed_sto); + Para_Json::set_json_value(Para_Json::seed_sto,&seed_sto); } else if (strcmp("initsto_ecut", word) == 0) { @@ -765,88 +797,109 @@ bool Input::Read(const std::string &fn) else if (strcmp("pw_seed", word) == 0) { read_value(ifs, pw_seed); + Para_Json::set_json_value(Para_Json::pw_seed,&pw_seed); } else if (strcmp("emax_sto", word) == 0) { read_value(ifs, emax_sto); + Para_Json::set_json_value(Para_Json::emax_sto,&emax_sto); } else if (strcmp("emin_sto", word) == 0) { read_value(ifs, emin_sto); + Para_Json::set_json_value(Para_Json::emin_sto,&emin_sto); } else if (strcmp("initsto_freq", word) == 0) { read_value(ifs, initsto_freq); + Para_Json::set_json_value(Para_Json::initsto_freq,&initsto_freq); } else if (strcmp("method_sto", word) == 0) { read_value(ifs, method_sto); + Para_Json::set_json_value(Para_Json::method_sto,&method_sto); } else if (strcmp("npart_sto", word) == 0) { read_value(ifs, npart_sto); + Para_Json::set_json_value(Para_Json::npart_sto,&npart_sto); } else if (strcmp("cal_cond", word) == 0) { read_bool(ifs, cal_cond); + Para_Json::set_json_value(Para_Json::cal_cond,&cal_cond); } else if (strcmp("cond_che_thr", word) == 0) { read_value(ifs, cond_che_thr); + Para_Json::set_json_value(Para_Json::cond_nche,&cond_che_thr); } else if (strcmp("cond_dw", word) == 0) { read_value(ifs, cond_dw); + Para_Json::set_json_value(Para_Json::cond_dw,&cond_dw); } else if (strcmp("cond_wcut", word) == 0) { read_value(ifs, cond_wcut); + Para_Json::set_json_value(Para_Json::cond_wcut,&cond_wcut); } else if (strcmp("cond_dt", word) == 0) { read_value(ifs, cond_dt); + Para_Json::set_json_value(Para_Json::cond_dt,&cond_dt); } else if (strcmp("cond_dtbatch", word) == 0) { read_value(ifs, cond_dtbatch); + Para_Json::set_json_value(Para_Json::cond_dtbatch,&cond_dtbatch); } else if (strcmp("cond_fwhm", word) == 0) { read_value(ifs, cond_fwhm); + Para_Json::set_json_value(Para_Json::cond_fwhm,&cond_fwhm); } else if (strcmp("cond_nonlocal", word) == 0) { read_bool(ifs, cond_nonlocal); + Para_Json::set_json_value(Para_Json::cond_nonlocal,&cond_nonlocal); } else if (strcmp("bndpar", word) == 0) { read_value(ifs, bndpar); + Para_Json::set_json_value(Para_Json::bndpar,&bndpar); } else if (strcmp("kpar", word) == 0) // number of pools { read_value(ifs, kpar); + Para_Json::set_json_value(Para_Json::kpar,&kpar); } else if (strcmp("berry_phase", word) == 0) // berry phase calculation { read_bool(ifs, berry_phase); + Para_Json::set_json_value(Para_Json::berry_phase,&berry_phase); } else if (strcmp("gdir", word) == 0) // berry phase calculation { read_value(ifs, gdir); + Para_Json::set_json_value(Para_Json::gdir,&gdir); } else if (strcmp("towannier90", word) == 0) // add by jingan for wannier90 { read_bool(ifs, towannier90); + Para_Json::set_json_value(Para_Json::towannier90,&towannier90); } else if (strcmp("nnkpfile", word) == 0) // add by jingan for wannier90 { read_value(ifs, nnkpfile); + Para_Json::set_json_value(Para_Json::nnkpfile,&nnkpfile); } else if (strcmp("wannier_spin", word) == 0) // add by jingan for wannier90 { read_value(ifs, wannier_spin); + Para_Json::set_json_value(Para_Json::wannier_spin,&wannier_spin); } - else if (strcmp("out_wannier_mmn", word) == 0) // add by renxi for wannier90 + else if (strcmp("out_wannier_mmn", word) == 0) // add by renxi for wannier90 { read_bool(ifs, out_wannier_mmn); } @@ -872,26 +925,32 @@ bool Input::Read(const std::string &fn) else if (strcmp("dft_functional", word) == 0) { read_value(ifs, dft_functional); + Para_Json::set_json_value(Para_Json::dft_functional,&dft_functional); } else if (strcmp("xc_temperature", word) == 0) { read_value(ifs, xc_temperature); + Para_Json::set_json_value(Para_Json::xc_temperature,&xc_temperature); } else if (strcmp("nspin", word) == 0) { read_value(ifs, nspin); + Para_Json::set_json_value(Para_Json::nspin,&nspin); } else if (strcmp("nelec", word) == 0) { read_value(ifs, nelec); + Para_Json::set_json_value(Para_Json::nelec,&nelec); } else if (strcmp("nupdown", word) == 0) { read_value(ifs, nupdown); + Para_Json::set_json_value(Para_Json::nupdown,&nupdown); } else if (strcmp("lmaxmax", word) == 0) { read_value(ifs, lmaxmax); + Para_Json::set_json_value(Para_Json::lmaxmax,&lmaxmax); } //---------------------------------------------------------- // new function @@ -899,34 +958,42 @@ bool Input::Read(const std::string &fn) else if (strcmp("basis_type", word) == 0) { read_value(ifs, basis_type); + Para_Json::set_json_value(Para_Json::basis_type,&basis_type); } // xiaohui add 2013-09-01 else if (strcmp("ks_solver", word) == 0) { read_value(ifs, ks_solver); + Para_Json::set_json_value(Para_Json::ks_solver,&ks_solver); } // xiaohui add 2013-09-01 else if (strcmp("search_radius", word) == 0) { read_value(ifs, search_radius); + Para_Json::set_json_value(Para_Json::search_radius,&search_radius); } else if (strcmp("search_pbc", word) == 0) { read_bool(ifs, search_pbc); + Para_Json::set_json_value(Para_Json::search_pbc,&search_pbc); } else if (strcmp("symmetry", word) == 0) { read_value(ifs, symmetry); + Para_Json::set_json_value(Para_Json::symmetry,&symmetry); } else if (strcmp("init_vel", word) == 0) { read_bool(ifs, init_vel); + Para_Json::set_json_value(Para_Json::init_vel,&init_vel); } else if (strcmp("ref_cell_factor", word) == 0) { read_value(ifs, ref_cell_factor); + Para_Json::set_json_value(Para_Json::ref_cell_factor,&ref_cell_factor); } else if (strcmp("symmetry_prec", word) == 0) // LiuXh add 2021-08-12, accuracy for symmetry { read_value(ifs, symmetry_prec); + Para_Json::set_json_value(Para_Json::symmetry_precfield,&symmetry_prec); } else if (strcmp("symmetry_autoclose", word) == 0) { @@ -935,92 +1002,114 @@ bool Input::Read(const std::string &fn) else if (strcmp("cal_force", word) == 0) { read_bool(ifs, cal_force); + Para_Json::set_json_value(Para_Json::cal_force,&cal_force); } else if (strcmp("force_thr", word) == 0) { read_value(ifs, force_thr); + Para_Json::set_json_value(Para_Json::force_thr,&force_thr); } else if (strcmp("force_thr_ev", word) == 0) { read_value(ifs, force_thr); + Para_Json::set_json_value(Para_Json::force_thr_ev,&force_thr); force_thr = force_thr / 13.6058 * 0.529177; } else if (strcmp("force_thr_ev2", word) == 0) { read_value(ifs, force_thr_ev2); + Para_Json::set_json_value(Para_Json::force_thr_ev2,&force_thr_ev2); } else if (strcmp("stress_thr", word) == 0) { read_value(ifs, stress_thr); + Para_Json::set_json_value(Para_Json::stress_thr,&stress_thr); } else if (strcmp("press1", word) == 0) { read_value(ifs, press1); + Para_Json::set_json_value(Para_Json::press1,&press1); } else if (strcmp("press2", word) == 0) { read_value(ifs, press2); + Para_Json::set_json_value(Para_Json::press2,&press2); } else if (strcmp("press3", word) == 0) { read_value(ifs, press3); + Para_Json::set_json_value(Para_Json::press3,&press3); } else if (strcmp("cal_stress", word) == 0) { read_bool(ifs, cal_stress); + Para_Json::set_json_value(Para_Json::cal_stress,&cal_stress); } else if (strcmp("fixed_axes", word) == 0) { read_value(ifs, fixed_axes); + Para_Json::set_json_value(Para_Json::fixed_axes,&fixed_axes); } else if (strcmp("fixed_ibrav", word) == 0) { read_bool(ifs, fixed_ibrav); + Para_Json::set_json_value(Para_Json::fixed_ibrav,&fixed_ibrav); } else if (strcmp("fixed_atoms", word) == 0) { read_bool(ifs, fixed_atoms); + Para_Json::set_json_value(Para_Json::fixed_atoms,&fixed_atoms); } else if (strcmp("relax_method", word) == 0) { read_value(ifs, relax_method); + Para_Json::set_json_value(Para_Json::relax_method,&relax_method); } else if (strcmp("relax_cg_thr", word) == 0) // pengfei add 2013-08-15 { read_value(ifs, relax_cg_thr); + Para_Json::set_json_value(Para_Json::relax_cg_thr,&relax_cg_thr); } else if (strcmp("out_level", word) == 0) { read_value(ifs, out_level); out_md_control = true; + Para_Json::set_json_value(Para_Json::out_level,&out_level); } else if (strcmp("relax_bfgs_w1", word) == 0) { read_value(ifs, relax_bfgs_w1); + Para_Json::set_json_value(Para_Json::relax_bfgs_w1,&relax_bfgs_w1); } else if (strcmp("relax_bfgs_w2", word) == 0) { read_value(ifs, relax_bfgs_w2); + Para_Json::set_json_value(Para_Json::relax_bfgs_w2,&relax_bfgs_w2); } else if (strcmp("relax_bfgs_rmax", word) == 0) { read_value(ifs, relax_bfgs_rmax); + Para_Json::set_json_value(Para_Json::relax_bfgs_rmax,&relax_bfgs_rmax); } else if (strcmp("relax_bfgs_rmin", word) == 0) { read_value(ifs, relax_bfgs_rmin); + Para_Json::set_json_value(Para_Json::relax_bfgs_rmin,&relax_bfgs_rmin); } else if (strcmp("relax_bfgs_init", word) == 0) { read_value(ifs, relax_bfgs_init); + Para_Json::set_json_value(Para_Json::relax_bfgs_init,&relax_bfgs_init); } else if (strcmp("relax_scale_force", word) == 0) { read_value(ifs, relax_scale_force); + Para_Json::set_json_value(Para_Json::relax_scale_force,&relax_scale_force); } else if (strcmp("relax_new", word) == 0) { read_bool(ifs, relax_new); + Para_Json::set_json_value(Para_Json::relax_new,&relax_new); } else if (strcmp("use_paw", word) == 0) { @@ -1032,6 +1121,8 @@ bool Input::Read(const std::string &fn) else if (strcmp("gamma_only", word) == 0) { read_bool(ifs, gamma_only); + + Para_Json::set_json_value(Para_Json::gamma_only,&gamma_only); } else if (strcmp("fft_mode", word) == 0) { @@ -1040,6 +1131,8 @@ bool Input::Read(const std::string &fn) else if (strcmp("ecutwfc", word) == 0) { read_value(ifs, ecutwfc); + Para_Json::set_json_value(Para_Json::ecutwfc,&ecutwfc); + ecutrho = 4.0 * ecutwfc; } else if (strcmp("ecutrho", word) == 0) { @@ -1048,29 +1141,36 @@ bool Input::Read(const std::string &fn) else if (strcmp("nx", word) == 0) { read_value(ifs, nx); + Para_Json::set_json_value(Para_Json::nx,&nx); + ncx = nx; } else if (strcmp("ny", word) == 0) { read_value(ifs, ny); + Para_Json::set_json_value(Para_Json::ny,&ny); ncy = ny; } else if (strcmp("nz", word) == 0) { read_value(ifs, nz); + Para_Json::set_json_value(Para_Json::nz,&nz); ncz = nz; } else if (strcmp("bx", word) == 0) { read_value(ifs, bx); + Para_Json::set_json_value(Para_Json::bx,&bx); } else if (strcmp("by", word) == 0) { read_value(ifs, by); + Para_Json::set_json_value(Para_Json::by,&by); } else if (strcmp("bz", word) == 0) { read_value(ifs, bz); + Para_Json::set_json_value(Para_Json::bz,&bz); } else if (strcmp("ndx", word) == 0) { @@ -1106,66 +1206,82 @@ bool Input::Read(const std::string &fn) else if (strcmp("diago_proc", word) == 0) { read_value(ifs, diago_proc); + Para_Json::set_json_value(Para_Json::diago_proc,&diago_proc); } else if (strcmp("pw_diag_nmax", word) == 0) { read_value(ifs, pw_diag_nmax); + Para_Json::set_json_value(Para_Json::pw_diag_nmax,&pw_diag_nmax); } else if (strcmp("diago_cg_prec", word) == 0) // mohan add 2012-03-31 { read_value(ifs, diago_cg_prec); + //Para_Json::set_json_value(Para_Json::diago_cg_prec,&diago_cg_prec); } else if (strcmp("pw_diag_ndim", word) == 0) { read_value(ifs, pw_diag_ndim); + Para_Json::set_json_value(Para_Json::pw_diag_ndim,&pw_diag_ndim); } else if (strcmp("pw_diag_thr", word) == 0) { read_value(ifs, pw_diag_thr); + Para_Json::set_json_value(Para_Json::pw_diag_thr,&pw_diag_thr); } else if (strcmp("nb2d", word) == 0) { read_value(ifs, nb2d); + Para_Json::set_json_value(Para_Json::nb2d,&nb2d); } else if (strcmp("nurse", word) == 0) { read_value(ifs, nurse); + //Para_Json::set_json_value(Para_Json::nurse,&nurse); } else if (strcmp("colour", word) == 0) { read_bool(ifs, colour); + Para_Json::set_json_value(Para_Json::colour,&colour); } else if (strcmp("nbspline", word) == 0) { read_value(ifs, nbspline); + Para_Json::set_json_value(Para_Json::nbspline, line); } else if (strcmp("t_in_h", word) == 0) { read_bool(ifs, t_in_h); + Para_Json::set_json_value(Para_Json::t_in_h,&t_in_h); } else if (strcmp("vl_in_h", word) == 0) { read_bool(ifs, vl_in_h); + Para_Json::set_json_value(Para_Json::vl_in_h,&vl_in_h); } else if (strcmp("vnl_in_h", word) == 0) { read_bool(ifs, vnl_in_h); + Para_Json::set_json_value(Para_Json::vnl_in_h,&vnl_in_h); } else if (strcmp("vh_in_h", word) == 0) { read_bool(ifs, vh_in_h); + Para_Json::set_json_value(Para_Json::vh_in_h,&vh_in_h); } else if (strcmp("vion_in_h", word) == 0) { read_bool(ifs, vion_in_h); + Para_Json::set_json_value(Para_Json::vion_in_h,&vion_in_h); } else if (strcmp("test_force", word) == 0) { read_bool(ifs, test_force); + Para_Json::set_json_value(Para_Json::test_force,&test_force); } else if (strcmp("test_stress", word) == 0) { read_bool(ifs, test_stress); + Para_Json::set_json_value(Para_Json::test_stress,&test_stress); } //---------------------------------------------------------- // iteration @@ -1173,22 +1289,27 @@ bool Input::Read(const std::string &fn) else if (strcmp("scf_thr", word) == 0) { read_value(ifs, scf_thr); + Para_Json::set_json_value(Para_Json::scf_thr,&scf_thr); } else if (strcmp("scf_thr_type", word) == 0) { read_value(ifs, scf_thr_type); + Para_Json::set_json_value(Para_Json::scf_thr_type,&scf_thr_type); } else if (strcmp("scf_nmax", word) == 0) { read_value(ifs, scf_nmax); + Para_Json::set_json_value(Para_Json::scf_nmax,&scf_nmax); } else if (strcmp("relax_nmax", word) == 0) { read_value(ifs, this->relax_nmax); + Para_Json::set_json_value(Para_Json::relax_nmax,&relax_nmax); } else if (strcmp("out_stru", word) == 0) { read_bool(ifs, out_stru); + Para_Json::set_json_value(Para_Json::out_stru,&out_stru); } //---------------------------------------------------------- // occupation @@ -1200,10 +1321,12 @@ bool Input::Read(const std::string &fn) else if (strcmp("smearing_method", word) == 0) { read_value(ifs, smearing_method); + Para_Json::set_json_value(Para_Json::smearing_method,&smearing_method); } else if (strcmp("smearing_sigma", word) == 0) { read_value(ifs, smearing_sigma); + Para_Json::set_json_value(Para_Json::smearing_sigma,&smearing_sigma); } else if (strcmp("smearing_sigma_temp", word) == 0) { @@ -1217,26 +1340,32 @@ bool Input::Read(const std::string &fn) else if (strcmp("mixing_type", word) == 0) { read_value(ifs, mixing_mode); + Para_Json::set_json_value(Para_Json::mixing_type,&mixing_mode); } else if (strcmp("mixing_beta", word) == 0) { read_value(ifs, mixing_beta); + Para_Json::set_json_value(Para_Json::mixing_beta,&mixing_beta); } else if (strcmp("mixing_ndim", word) == 0) { read_value(ifs, mixing_ndim); + Para_Json::set_json_value(Para_Json::mixing_ndim,&mixing_ndim); } else if (strcmp("mixing_gg0", word) == 0) // mohan add 2014-09-27 { read_value(ifs, mixing_gg0); + Para_Json::set_json_value(Para_Json::mixing_gg0,&mixing_gg0); } else if (strcmp("mixing_tau", word) == 0) { read_bool(ifs, mixing_tau); + Para_Json::set_json_value(Para_Json::mixing_tau,&mixing_tau); } else if (strcmp("mixing_dftu", word) == 0) { read_bool(ifs, mixing_dftu); + Para_Json::set_json_value(Para_Json::mixing_dftu,&mixing_dftu); } //---------------------------------------------------------- // charge / potential / wavefunction @@ -1244,10 +1373,12 @@ bool Input::Read(const std::string &fn) else if (strcmp("read_file_dir", word) == 0) { read_value(ifs, read_file_dir); + Para_Json::set_json_value(Para_Json::read_file_dir,&read_file_dir); } else if (strcmp("init_wfc", word) == 0) { read_value(ifs, init_wfc); + Para_Json::set_json_value(Para_Json::init_wfc,&init_wfc); } else if (strcmp("psi_initializer", word) == 0) { @@ -1256,155 +1387,192 @@ bool Input::Read(const std::string &fn) else if (strcmp("mem_saver", word) == 0) { read_value(ifs, mem_saver); + Para_Json::set_json_value(Para_Json::mem_saver,&mem_saver); } else if (strcmp("printe", word) == 0) { read_value(ifs, printe); + Para_Json::set_json_value(Para_Json::printe,&printe); } else if (strcmp("init_chg", word) == 0) { read_value(ifs, init_chg); + Para_Json::set_json_value(Para_Json::init_chg,&init_chg); } else if (strcmp("chg_extrap", word) == 0) // xiaohui modify 2015-02-01 { read_value(ifs, chg_extrap); // xiaohui modify 2015-02-01 + Para_Json::set_json_value(Para_Json::chg_extrap,&chg_extrap); } else if (strcmp("out_freq_elec", word) == 0) { read_value(ifs, out_freq_elec); + Para_Json::set_json_value(Para_Json::out_freq_elec,&out_freq_elec); } else if (strcmp("out_freq_ion", word) == 0) { read_value(ifs, out_freq_ion); + Para_Json::set_json_value(Para_Json::out_freq_ion,&out_freq_ion); } else if (strcmp("out_chg", word) == 0) { read_bool(ifs, out_chg); + Para_Json::set_json_value(Para_Json::out_chg,&out_chg); } else if (strcmp("out_dm", word) == 0) { read_bool(ifs, out_dm); + Para_Json::set_json_value(Para_Json::out_dm,&out_dm); } else if (strcmp("out_dm1", word) == 0) { read_bool(ifs, out_dm1); + Para_Json::set_json_value(Para_Json::out_dm1,&out_dm1); } else if (strcmp("out_bandgap", word) == 0) // for bandgap printing { read_bool(ifs, out_bandgap); + Para_Json::set_json_value(Para_Json::out_bandgap,&out_bandgap); } else if (strcmp("deepks_out_labels", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_out_labels); + Para_Json::set_json_value(Para_Json::deepks_out_labels,&deepks_out_labels); } else if (strcmp("deepks_scf", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_scf); + Para_Json::set_json_value(Para_Json::deepks_scf,&deepks_scf); } else if (strcmp("deepks_bandgap", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_bandgap); + Para_Json::set_json_value(Para_Json::deepks_bandgap,&deepks_bandgap); } else if (strcmp("deepks_out_unittest", word) == 0) // mohan added 2021-01-03 { read_bool(ifs, deepks_out_unittest); + Para_Json::set_json_value(Para_Json::deepks_out_unittest,&deepks_out_unittest); } else if (strcmp("deepks_model", word) == 0) // caoyu added 2021-06-03 { read_value(ifs, deepks_model); + Para_Json::set_json_value(Para_Json::deepks_model,&deepks_model); } else if (strcmp("out_pot", word) == 0) { read_value(ifs, out_pot); + Para_Json::set_json_value(Para_Json::out_pot,&out_pot); } else if (strcmp("out_wfc_pw", word) == 0) { read_value(ifs, out_wfc_pw); + Para_Json::set_json_value(Para_Json::out_wfc_pw,&out_wfc_pw); } else if (strcmp("out_wfc_r", word) == 0) { read_bool(ifs, out_wfc_r); + Para_Json::set_json_value(Para_Json::out_wfc_r,&out_wfc_r); } // mohan add 20090909 else if (strcmp("out_dos", word) == 0) { read_value(ifs, out_dos); + Para_Json::set_json_value(Para_Json::out_dos,&out_dos); } else if (strcmp("out_band", word) == 0) { read_bool(ifs, out_band); + Para_Json::set_json_value(Para_Json::out_band,&out_band); } else if (strcmp("out_proj_band", word) == 0) { read_bool(ifs, out_proj_band); + Para_Json::set_json_value(Para_Json::out_proj_band,&out_proj_band); } else if (strcmp("out_mat_hs", word) == 0) { read_bool(ifs, out_mat_hs); + Para_Json::set_json_value(Para_Json::out_mat_hs,&out_mat_hs); } // LiuXh add 2019-07-15 else if (strcmp("out_mat_hs2", word) == 0) { read_bool(ifs, out_mat_hs2); + Para_Json::set_json_value(Para_Json::out_mat_hs2,&out_mat_hs2); } else if (strcmp("out_mat_t", word) == 0) { read_bool(ifs, out_mat_t); + Para_Json::set_json_value(Para_Json::out_mat_t,&out_mat_t); } else if (strcmp("out_mat_dh", word) == 0) { read_bool(ifs, out_mat_dh); + Para_Json::set_json_value(Para_Json::out_mat_dh,&out_mat_dh); } else if (strcmp("out_interval", word) == 0) { read_value(ifs, out_interval); + Para_Json::set_json_value(Para_Json::out_interval,&out_interval); } else if (strcmp("out_app_flag", word) == 0) { read_bool(ifs, out_app_flag); + Para_Json::set_json_value(Para_Json::out_app_flag,&out_app_flag); } else if (strcmp("out_mat_r", word) == 0) { read_bool(ifs, out_mat_r); + Para_Json::set_json_value(Para_Json::out_mat_r,&out_mat_r); } else if (strcmp("out_wfc_lcao", word) == 0) { read_value(ifs, out_wfc_lcao); + Para_Json::set_json_value(Para_Json::out_wfc_lcao,&out_wfc_lcao); } else if (strcmp("out_alllog", word) == 0) { read_bool(ifs, out_alllog); + Para_Json::set_json_value(Para_Json::out_alllog,&out_alllog); } else if (strcmp("out_element_info", word) == 0) { read_bool(ifs, out_element_info); + Para_Json::set_json_value(Para_Json::out_element_info,&out_element_info); } else if (strcmp("dos_emin_ev", word) == 0) { read_value(ifs, dos_emin_ev); dos_setemin = true; + Para_Json::set_json_value(Para_Json::dos_emin_ev,&dos_emin_ev); } else if (strcmp("dos_emax_ev", word) == 0) { read_value(ifs, dos_emax_ev); + Para_Json::set_json_value(Para_Json::dos_emax_ev,&dos_emax_ev); dos_setemax = true; } else if (strcmp("dos_edelta_ev", word) == 0) { read_value(ifs, dos_edelta_ev); + Para_Json::set_json_value(Para_Json::dos_edelta_ev,&dos_edelta_ev); } else if (strcmp("dos_scale", word) == 0) { read_value(ifs, dos_scale); + Para_Json::set_json_value(Para_Json::dos_scale,&dos_scale); } else if (strcmp("dos_sigma", word) == 0) { read_value(ifs, dos_sigma); + Para_Json::set_json_value(Para_Json::dos_sigma,&dos_sigma); } else if (strcmp("dos_nche", word) == 0) { read_value(ifs, dos_nche); + Para_Json::set_json_value(Para_Json::dos_nche,&dos_nche); } //---------------------------------------------------------- @@ -1414,18 +1582,22 @@ bool Input::Read(const std::string &fn) else if (strcmp("lcao_ecut", word) == 0) { read_value(ifs, lcao_ecut); + Para_Json::set_json_value(Para_Json::lcao_ecut,&lcao_ecut); } else if (strcmp("lcao_dk", word) == 0) { read_value(ifs, lcao_dk); + Para_Json::set_json_value(Para_Json::lcao_dk,&lcao_dk); } else if (strcmp("lcao_dr", word) == 0) { read_value(ifs, lcao_dr); + Para_Json::set_json_value(Para_Json::lcao_dr,&lcao_dr); } else if (strcmp("lcao_rmax", word) == 0) { read_value(ifs, lcao_rmax); + Para_Json::set_json_value(Para_Json::lcao_rmax,&lcao_rmax); } //---------------------------------------------------------- // Molecule Dynamics @@ -1434,146 +1606,183 @@ bool Input::Read(const std::string &fn) else if (strcmp("md_type", word) == 0) { read_value(ifs, mdp.md_type); + Para_Json::set_json_value(Para_Json::md_type,&mdp.md_type); + } else if (strcmp("md_thermostat", word) == 0) { read_value(ifs, mdp.md_thermostat); + Para_Json::set_json_value(Para_Json::md_thermostat,&mdp.md_thermostat); } else if (strcmp("md_nraise", word) == 0) { read_value(ifs, mdp.md_nraise); + Para_Json::set_json_value(Para_Json::md_nraise,&mdp.md_nraise); } else if (strcmp("cal_syns", word) == 0) { read_value(ifs, cal_syns); + Para_Json::set_json_value(Para_Json::cal_syns,&cal_syns); } else if (strcmp("dmax", word) == 0) { read_value(ifs, dmax); + Para_Json::set_json_value(Para_Json::dmax,&dmax); } else if (strcmp("md_tolerance", word) == 0) { read_value(ifs, mdp.md_tolerance); + Para_Json::set_json_value(Para_Json::md_tolerance,&mdp.md_tolerance); } else if (strcmp("md_nstep", word) == 0) { read_value(ifs, mdp.md_nstep); + Para_Json::set_json_value(Para_Json::md_nstep,&mdp.md_nstep); } else if (strcmp("md_dt", word) == 0) { read_value(ifs, mdp.md_dt); + Para_Json::set_json_value(Para_Json::md_dt,&mdp.md_dt); } else if (strcmp("md_tchain", word) == 0) { read_value(ifs, mdp.md_tchain); + Para_Json::set_json_value(Para_Json::md_tchain,&mdp.md_tchain); } else if (strcmp("md_tfirst", word) == 0) { read_value(ifs, mdp.md_tfirst); + Para_Json::set_json_value(Para_Json::md_tfirst,&mdp.md_tfirst); } else if (strcmp("md_tlast", word) == 0) { read_value(ifs, mdp.md_tlast); + Para_Json::set_json_value(Para_Json::md_tlast,&mdp.md_tlast); } else if (strcmp("md_dumpfreq", word) == 0) { read_value(ifs, mdp.md_dumpfreq); + Para_Json::set_json_value(Para_Json::md_dumpfreq,&mdp.md_dumpfreq); } else if (strcmp("md_restartfreq", word) == 0) { read_value(ifs, mdp.md_restartfreq); + Para_Json::set_json_value(Para_Json::md_restartfreq,&mdp.md_restartfreq); } else if (strcmp("md_seed", word) == 0) { read_value(ifs, mdp.md_seed); + Para_Json::set_json_value(Para_Json::md_seed,&mdp.md_seed); } else if (strcmp("md_prec_level", word) == 0) { read_value(ifs, mdp.md_prec_level); + Para_Json::set_json_value(Para_Json::md_prec_level,&mdp.md_prec_level); } else if (strcmp("md_restart", word) == 0) { read_bool(ifs, mdp.md_restart); + Para_Json::set_json_value(Para_Json::md_restart,&mdp.md_restart); } else if (strcmp("md_pmode", word) == 0) { read_value(ifs, mdp.md_pmode); + Para_Json::set_json_value(Para_Json::md_pmode,&mdp.md_pmode); } else if (strcmp("md_pcouple", word) == 0) { read_value(ifs, mdp.md_pcouple); + Para_Json::set_json_value(Para_Json::md_pcouple,&mdp.md_pcouple); } else if (strcmp("md_pchain", word) == 0) { read_value(ifs, mdp.md_pchain); + Para_Json::set_json_value(Para_Json::md_pchain,&mdp.md_pchain); } else if (strcmp("md_pfirst", word) == 0) { read_value(ifs, mdp.md_pfirst); + Para_Json::set_json_value(Para_Json::md_pfirst,&mdp.md_pfirst); } else if (strcmp("md_plast", word) == 0) { read_value(ifs, mdp.md_plast); + Para_Json::set_json_value(Para_Json::md_plast,&mdp.md_plast); } else if (strcmp("md_pfreq", word) == 0) { read_value(ifs, mdp.md_pfreq); + Para_Json::set_json_value(Para_Json::md_pfreq,&mdp.md_pfreq); } else if (strcmp("lj_rcut", word) == 0) { read_value(ifs, mdp.lj_rcut); + Para_Json::set_json_value(Para_Json::lj_rcut,&mdp.lj_rcut); } else if (strcmp("lj_epsilon", word) == 0) { read_value(ifs, mdp.lj_epsilon); + Para_Json::set_json_value(Para_Json::lj_epsilon,&mdp.lj_epsilon); } else if (strcmp("lj_sigma", word) == 0) { read_value(ifs, mdp.lj_sigma); + Para_Json::set_json_value(Para_Json::lj_sigma,&mdp.lj_sigma); } else if (strcmp("msst_direction", word) == 0) { read_value(ifs, mdp.msst_direction); + Para_Json::set_json_value(Para_Json::msst_direction,&mdp.msst_direction); } else if (strcmp("msst_vel", word) == 0) { read_value(ifs, mdp.msst_vel); + Para_Json::set_json_value(Para_Json::msst_vel,&mdp.msst_vel); } else if (strcmp("msst_vis", word) == 0) { read_value(ifs, mdp.msst_vis); + Para_Json::set_json_value(Para_Json::msst_vis,&mdp.msst_vis); } else if (strcmp("msst_tscale", word) == 0) { read_value(ifs, mdp.msst_tscale); + Para_Json::set_json_value(Para_Json::msst_tscale,&mdp.msst_tscale); } else if (strcmp("msst_qmass", word) == 0) { read_value(ifs, mdp.msst_qmass); + Para_Json::set_json_value(Para_Json::msst_qmass,&mdp.msst_qmass); } else if (strcmp("md_tfreq", word) == 0) { read_value(ifs, mdp.md_tfreq); + Para_Json::set_json_value(Para_Json::md_tfreq,&mdp.md_tfreq); } else if (strcmp("md_damp", word) == 0) { read_value(ifs, mdp.md_damp); + Para_Json::set_json_value(Para_Json::md_damp,&mdp.md_damp); } else if (strcmp("pot_file", word) == 0) { read_value(ifs, mdp.pot_file); + Para_Json::set_json_value(Para_Json::pot_file,&mdp.pot_file); } else if (strcmp("dump_force", word) == 0) { read_bool(ifs, mdp.dump_force); + Para_Json::set_json_value(Para_Json::dump_force,&mdp.dump_force); } else if (strcmp("dump_vel", word) == 0) { read_bool(ifs, mdp.dump_vel); + Para_Json::set_json_value(Para_Json::dump_vel,&mdp.dump_vel); } else if (strcmp("dump_virial", word) == 0) { read_bool(ifs, mdp.dump_virial); + Para_Json::set_json_value(Para_Json::dump_virial,&mdp.dump_virial); } //---------------------------------------------------------- // efield and dipole correction @@ -1582,26 +1791,32 @@ bool Input::Read(const std::string &fn) else if (strcmp("efield_flag", word) == 0) { read_bool(ifs, efield_flag); + Para_Json::set_json_value(Para_Json::efield_flag,&efield_flag); } else if (strcmp("dip_cor_flag", word) == 0) { read_bool(ifs, dip_cor_flag); + Para_Json::set_json_value(Para_Json::dip_cor_flag,&dip_cor_flag); } else if (strcmp("efield_dir", word) == 0) { read_value(ifs, efield_dir); + Para_Json::set_json_value(Para_Json::efield_dir,&efield_dir); } else if (strcmp("efield_pos_max", word) == 0) { read_value(ifs, efield_pos_max); + Para_Json::set_json_value(Para_Json::efield_pos_max,&efield_pos_max); } else if (strcmp("efield_pos_dec", word) == 0) { read_value(ifs, efield_pos_dec); + Para_Json::set_json_value(Para_Json::efield_pos_dec,&efield_pos_dec); } else if (strcmp("efield_amp", word) == 0) { read_value(ifs, efield_amp); + Para_Json::set_json_value(Para_Json::efield_amp,&efield_amp); } //---------------------------------------------------------- // gatefield (compensating charge) @@ -1610,30 +1825,37 @@ bool Input::Read(const std::string &fn) else if (strcmp("gate_flag", word) == 0) { read_bool(ifs, gate_flag); + Para_Json::set_json_value(Para_Json::gate_flag,&gate_flag); } else if (strcmp("zgate", word) == 0) { read_value(ifs, zgate); + Para_Json::set_json_value(Para_Json::zgate,&zgate); } else if (strcmp("relax", word) == 0) { read_bool(ifs, relax); + //Para_Json::set_json_value(Para_Json::relax,&relax); } else if (strcmp("block", word) == 0) { read_bool(ifs, block); + Para_Json::set_json_value(Para_Json::block,&block); } else if (strcmp("block_down", word) == 0) { read_value(ifs, block_down); + Para_Json::set_json_value(Para_Json::block_down,&block_down); } else if (strcmp("block_up", word) == 0) { read_value(ifs, block_up); + Para_Json::set_json_value(Para_Json::block_up,&block_up); } else if (strcmp("block_height", word) == 0) { read_value(ifs, block_height); + Para_Json::set_json_value(Para_Json::block_height,&block_height); } //---------------------------------------------------------- // tddft @@ -1642,130 +1864,162 @@ bool Input::Read(const std::string &fn) else if (strcmp("td_force_dt", word) == 0) { read_value(ifs, td_force_dt); + //Para_Json::set_json_value(Para_Json::td_force_dt,&td_force_dt); } else if (strcmp("td_vext", word) == 0) { read_value(ifs, td_vext); + Para_Json::set_json_value(Para_Json::td_vext,&td_vext); } else if (strcmp("td_vext_dire", word) == 0) { getline(ifs, td_vext_dire); + Para_Json::set_json_value(Para_Json::td_vext_dire,&td_vext_dire); } else if (strcmp("out_dipole", word) == 0) { read_value(ifs, out_dipole); + Para_Json::set_json_value(Para_Json::td_out_dipole,&out_dipole); } else if (strcmp("out_efield", word) == 0) { read_value(ifs, out_efield); + Para_Json::set_json_value(Para_Json::td_out_efield,&out_efield); } else if (strcmp("td_print_eij", word) == 0) { read_value(ifs, td_print_eij); + Para_Json::set_json_value(Para_Json::td_print_eij,&td_print_eij); } else if (strcmp("td_edm", word) == 0) { read_value(ifs, td_edm); + Para_Json::set_json_value(Para_Json::td_edm,&td_edm); } else if (strcmp("td_propagator", word) == 0) { read_value(ifs, propagator); + Para_Json::set_json_value(Para_Json::td_propagator,&propagator); } else if (strcmp("td_stype", word) == 0) { read_value(ifs, td_stype); + Para_Json::set_json_value(Para_Json::td_stype,&td_stype); } else if (strcmp("td_ttype", word) == 0) { getline(ifs, td_ttype); + Para_Json::set_json_value(Para_Json::td_ttype,&td_ttype); } else if (strcmp("td_tstart", word) == 0) { read_value(ifs, td_tstart); + Para_Json::set_json_value(Para_Json::td_tstart,&td_tstart); } else if (strcmp("td_tend", word) == 0) { read_value(ifs, td_tend); + Para_Json::set_json_value(Para_Json::td_tend,&td_tend); } else if (strcmp("td_lcut1", word) == 0) { read_value(ifs, td_lcut1); + Para_Json::set_json_value(Para_Json::td_lcut1,&td_lcut1); } else if (strcmp("td_lcut2", word) == 0) { read_value(ifs, td_lcut2); + Para_Json::set_json_value(Para_Json::td_lcut2,&td_lcut2); } else if (strcmp("td_gauss_freq", word) == 0) { getline(ifs, td_gauss_freq); + Para_Json::set_json_value(Para_Json::td_gauss_freq,&td_gauss_freq); } else if (strcmp("td_gauss_phase", word) == 0) { getline(ifs, td_gauss_phase); + Para_Json::set_json_value(Para_Json::td_gauss_phase,&td_gauss_phase); } else if (strcmp("td_gauss_sigma", word) == 0) { getline(ifs, td_gauss_sigma); + Para_Json::set_json_value(Para_Json::td_gauss_sigma,&td_gauss_sigma); } else if (strcmp("td_gauss_t0", word) == 0) { getline(ifs, td_gauss_t0); + Para_Json::set_json_value(Para_Json::td_gauss_t0,&td_gauss_t0); } else if (strcmp("td_gauss_amp", word) == 0) { getline(ifs, td_gauss_amp); + Para_Json::set_json_value(Para_Json::td_gauss_amp,&td_gauss_amp); } else if (strcmp("td_trape_freq", word) == 0) { getline(ifs, td_trape_freq); + Para_Json::set_json_value(Para_Json::td_trape_freq,&td_gauss_freq); } else if (strcmp("td_trape_phase", word) == 0) { getline(ifs, td_trape_phase); + Para_Json::set_json_value(Para_Json::td_trape_phase,&td_trape_phase); } else if (strcmp("td_trape_t1", word) == 0) { getline(ifs, td_trape_t1); + Para_Json::set_json_value(Para_Json::td_trape_t1,&td_trape_t1); } else if (strcmp("td_trape_t2", word) == 0) { getline(ifs, td_trape_t2); + Para_Json::set_json_value(Para_Json::td_trape_t2,&td_trape_t2); } else if (strcmp("td_trape_t3", word) == 0) { getline(ifs, td_trape_t3); + Para_Json::set_json_value(Para_Json::td_trape_t3,&td_trape_t3); } else if (strcmp("td_trape_amp", word) == 0) { getline(ifs, td_trape_amp); + Para_Json::set_json_value(Para_Json::td_trape_amp,&td_trape_amp); } else if (strcmp("td_trigo_freq1", word) == 0) { getline(ifs, td_trigo_freq1); + Para_Json::set_json_value(Para_Json::td_trigo_freq1,&td_trigo_freq1); } else if (strcmp("td_trigo_freq2", word) == 0) { getline(ifs, td_trigo_freq2); + Para_Json::set_json_value(Para_Json::td_trigo_freq2,&td_trigo_freq2); } else if (strcmp("td_trigo_phase1", word) == 0) { getline(ifs, td_trigo_phase1); + Para_Json::set_json_value(Para_Json::td_trigo_phase1,&td_trigo_phase1); } else if (strcmp("td_trigo_phase2", word) == 0) { getline(ifs, td_trigo_phase2); + Para_Json::set_json_value(Para_Json::td_trigo_phase2,&td_trigo_phase2); } else if (strcmp("td_trigo_amp", word) == 0) { getline(ifs, td_trigo_amp); + Para_Json::set_json_value(Para_Json::td_trigo_amp,&td_trigo_amp); } else if (strcmp("td_heavi_t0", word) == 0) { getline(ifs, td_heavi_t0); + Para_Json::set_json_value(Para_Json::td_heavi_t0,&td_heavi_t0); } else if (strcmp("td_heavi_amp", word) == 0) { getline(ifs, td_heavi_amp); + Para_Json::set_json_value(Para_Json::td_heavi_amp,&td_heavi_amp); } // else if (strcmp("td_hhg_amp1", word) == 0) // { @@ -1806,71 +2060,91 @@ bool Input::Read(const std::string &fn) else if (strcmp("vdw_method", word) == 0) { read_value(ifs, vdw_method); + Para_Json::set_json_value(Para_Json::vdw_method,&vdw_method); } else if (strcmp("vdw_s6", word) == 0) { read_value(ifs, vdw_s6); + Para_Json::set_json_value(Para_Json::vdw_s6,&vdw_s6); } else if (strcmp("vdw_s8", word) == 0) { read_value(ifs, vdw_s8); + Para_Json::set_json_value(Para_Json::vdw_s8,&vdw_s8); } else if (strcmp("vdw_a1", word) == 0) { read_value(ifs, vdw_a1); + Para_Json::set_json_value(Para_Json::vdw_a1,&vdw_a1); } else if (strcmp("vdw_a2", word) == 0) { read_value(ifs, vdw_a2); + Para_Json::set_json_value(Para_Json::vdw_a2,&vdw_a2); } else if (strcmp("vdw_d", word) == 0) { read_value(ifs, vdw_d); + Para_Json::set_json_value(Para_Json::vdw_d,&vdw_d); } else if (strcmp("vdw_abc", word) == 0) { read_bool(ifs, vdw_abc); + Para_Json::set_json_value(Para_Json::vdw_abc,&vdw_abc); } else if (strcmp("vdw_cutoff_radius", word) == 0) { read_value(ifs, vdw_cutoff_radius); + Para_Json::set_json_value(Para_Json::vdw_cutoff_radius,&vdw_cutoff_radius); } else if (strcmp("vdw_radius_unit", word) == 0) { read_value(ifs, vdw_radius_unit); + Para_Json::set_json_value(Para_Json::vdw_radius_unit,&vdw_radius_unit); } else if (strcmp("vdw_cn_thr", word) == 0) { read_value(ifs, vdw_cn_thr); + Para_Json::set_json_value(Para_Json::vdw_cn_thr,&vdw_cn_thr); } else if (strcmp("vdw_cn_thr_unit", word) == 0) { read_value(ifs, vdw_cn_thr_unit); + Para_Json::set_json_value(Para_Json::vdw_cn_thr_unit,&vdw_cn_thr_unit); } else if (strcmp("vdw_c6_file", word) == 0) { read_value(ifs, vdw_C6_file); + Para_Json::set_json_value(Para_Json::vdw_C6_file,&vdw_C6_file); } else if (strcmp("vdw_c6_unit", word) == 0) { read_value(ifs, vdw_C6_unit); + Para_Json::set_json_value(Para_Json::vdw_C6_unit,&vdw_C6_unit); } else if (strcmp("vdw_r0_file", word) == 0) { read_value(ifs, vdw_R0_file); + Para_Json::set_json_value(Para_Json::vdw_R0_file,&vdw_R0_file); } else if (strcmp("vdw_r0_unit", word) == 0) { read_value(ifs, vdw_R0_unit); + Para_Json::set_json_value(Para_Json::vdw_R0_unit,&vdw_R0_unit); } else if (strcmp("vdw_cutoff_type", word) == 0) { read_value(ifs, vdw_cutoff_type); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("vdw_cutoff_period", word) == 0) { ifs >> vdw_cutoff_period.x >> vdw_cutoff_period.y; read_value(ifs, vdw_cutoff_period.z); + + Para_Json::vdw_cutoff_period.PushBack(vdw_cutoff_period.x,Para_Json::doc.GetAllocator()); + Para_Json::vdw_cutoff_period.PushBack(vdw_cutoff_period.y,Para_Json::doc.GetAllocator()); + Para_Json::vdw_cutoff_period.PushBack(vdw_cutoff_period.z,Para_Json::doc.GetAllocator()); } //-------------------------------------------------------- // restart Peize Lin 2020-04-04 @@ -1878,23 +2152,28 @@ bool Input::Read(const std::string &fn) else if (strcmp("restart_save", word) == 0) { read_bool(ifs, restart_save); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("restart_load", word) == 0) { read_bool(ifs, restart_load); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("ocp", word) == 0) { read_bool(ifs, ocp); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("ocp_set", word) == 0) { getline(ifs, ocp_set); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); // ifs.ignore(150, '\n'); } else if (strcmp("out_mul", word) == 0) { read_bool(ifs, out_mul); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } // qifeng add 2019/9/10 //---------------------------------------------------------- // exx @@ -1903,114 +2182,143 @@ bool Input::Read(const std::string &fn) else if (strcmp("exx_hybrid_alpha", word) == 0) { read_value(ifs, exx_hybrid_alpha); + Para_Json::set_json_value(Para_Json::exx_hybrid_alpha,&exx_hybrid_alpha); } else if (strcmp("exx_hse_omega", word) == 0) { read_value(ifs, exx_hse_omega); + Para_Json::set_json_value(Para_Json::exx_hse_omega,&exx_hse_omega); } else if (strcmp("exx_separate_loop", word) == 0) { read_bool(ifs, exx_separate_loop); + Para_Json::set_json_value(Para_Json::exx_separate_loop,&exx_separate_loop); } else if (strcmp("exx_hybrid_step", word) == 0) { read_value(ifs, exx_hybrid_step); + Para_Json::set_json_value(Para_Json::exx_hybrid_step,&exx_hybrid_step); } else if (strcmp("exx_mixing_beta", word) == 0) { read_value(ifs, exx_mixing_beta); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("exx_lambda", word) == 0) { read_value(ifs, exx_lambda); + Para_Json::set_json_value(Para_Json::vdw_cutoff_type,&vdw_cutoff_type); } else if (strcmp("exx_real_number", word) == 0) { read_value(ifs, exx_real_number); + // printf("exx_real_number = %s\n",exx_real_number.c_str()); + Para_Json::set_json_value(Para_Json::exx_real_number,&exx_real_number); } else if (strcmp("exx_pca_threshold", word) == 0) { read_value(ifs, exx_pca_threshold); + Para_Json::set_json_value(Para_Json::exx_pca_threshold,&exx_pca_threshold); } else if (strcmp("exx_c_threshold", word) == 0) { read_value(ifs, exx_c_threshold); + Para_Json::set_json_value(Para_Json::exx_c_threshold,&exx_c_threshold); } else if (strcmp("exx_v_threshold", word) == 0) { read_value(ifs, exx_v_threshold); + Para_Json::set_json_value(Para_Json::exx_v_threshold,&exx_v_threshold); } else if (strcmp("exx_dm_threshold", word) == 0) { read_value(ifs, exx_dm_threshold); + Para_Json::set_json_value(Para_Json::exx_dm_threshold,&exx_dm_threshold); } else if (strcmp("exx_schwarz_threshold", word) == 0) { read_value(ifs, exx_schwarz_threshold); + Para_Json::set_json_value(Para_Json::exx_schwarz_threshold,&exx_schwarz_threshold); } else if (strcmp("exx_cauchy_threshold", word) == 0) { read_value(ifs, exx_cauchy_threshold); + Para_Json::set_json_value(Para_Json::exx_cauchy_threshold,&exx_cauchy_threshold); } else if (strcmp("exx_c_grad_threshold", word) == 0) { read_value(ifs, exx_c_grad_threshold); + Para_Json::set_json_value(Para_Json::exx_c_grad_threshold,&exx_c_grad_threshold); } else if (strcmp("exx_v_grad_threshold", word) == 0) { read_value(ifs, exx_v_grad_threshold); + Para_Json::set_json_value(Para_Json::exx_v_grad_threshold,&exx_v_grad_threshold); } else if (strcmp("exx_cauchy_force_threshold", word) == 0) { read_value(ifs, exx_cauchy_force_threshold); + Para_Json::set_json_value(Para_Json::exx_cauchy_force_threshold,&exx_cauchy_force_threshold); } else if (strcmp("exx_cauchy_stress_threshold", word) == 0) { read_value(ifs, exx_cauchy_stress_threshold); + Para_Json::set_json_value(Para_Json::exx_cauchy_stress_threshold,&exx_cauchy_stress_threshold); } else if (strcmp("exx_ccp_threshold", word) == 0) { read_value(ifs, exx_ccp_threshold); + Para_Json::set_json_value(Para_Json::exx_ccp_threshold,&exx_ccp_threshold); } else if (strcmp("exx_ccp_rmesh_times", word) == 0) { read_value(ifs, exx_ccp_rmesh_times); + Para_Json::set_json_value(Para_Json::exx_ccp_rmesh_times,&exx_ccp_rmesh_times); } else if (strcmp("exx_distribute_type", word) == 0) { read_value(ifs, exx_distribute_type); + Para_Json::set_json_value(Para_Json::exx_distribute_type,&exx_distribute_type); } else if (strcmp("exx_opt_orb_lmax", word) == 0) { read_value(ifs, exx_opt_orb_lmax); + Para_Json::set_json_value(Para_Json::exx_opt_orb_lmax,&exx_opt_orb_lmax); } else if (strcmp("exx_opt_orb_ecut", word) == 0) { read_value(ifs, exx_opt_orb_ecut); + Para_Json::set_json_value(Para_Json::exx_opt_orb_ecut,&exx_opt_orb_ecut); } else if (strcmp("exx_opt_orb_tolerence", word) == 0) { read_value(ifs, exx_opt_orb_tolerence); + Para_Json::set_json_value(Para_Json::exx_opt_orb_tolerence,&exx_opt_orb_tolerence); } else if (strcmp("noncolin", word) == 0) { read_bool(ifs, noncolin); + Para_Json::set_json_value(Para_Json::noncolin,&noncolin); } else if (strcmp("lspinorb", word) == 0) { read_bool(ifs, lspinorb); + Para_Json::set_json_value(Para_Json::lspinorb,&lspinorb); } else if (strcmp("soc_lambda", word) == 0) { read_value(ifs, soc_lambda); + Para_Json::set_json_value(Para_Json::soc_lambda,&soc_lambda); } else if (strcmp("cell_factor", word) == 0) { read_value(ifs, cell_factor); + Para_Json::set_json_value(Para_Json::cell_factor,&cell_factor); } else if (strcmp("test_skip_ewald", word) == 0) { read_bool(ifs, test_skip_ewald); + Para_Json::set_json_value(Para_Json::test_skip_ewald,&test_skip_ewald); } //-------------- //---------------------------------------------------------------------------------- @@ -2019,6 +2327,7 @@ bool Input::Read(const std::string &fn) else if (strcmp("dft_plus_u", word) == 0) { read_bool(ifs, dft_plus_u); + //Para_Json::set_json_value(Para_Json::dft_plus_u,&dft_plus_u); } else if (strcmp("yukawa_potential", word) == 0) ifs.ignore(150, '\n'); @@ -2036,6 +2345,7 @@ bool Input::Read(const std::string &fn) else if (strcmp("dft_plus_dmft", word) == 0) { read_bool(ifs, dft_plus_dmft); + //Para_Json::set_json_value(Para_Json::dft_plus_dmft,&dft_plus_dmft); } //---------------------------------------------------------------------------------- // Rong Shi added for RPA @@ -2043,6 +2353,7 @@ bool Input::Read(const std::string &fn) else if (strcmp("rpa", word) == 0) { read_bool(ifs, rpa); + Para_Json::set_json_value(Para_Json::rpa,&rpa); if (rpa) GlobalV::rpa_setorb = true; } @@ -2052,22 +2363,27 @@ bool Input::Read(const std::string &fn) else if (strcmp("imp_sol", word) == 0) { read_bool(ifs, imp_sol); + Para_Json::set_json_value(Para_Json::imp_sol,&imp_sol); } else if (strcmp("eb_k", word) == 0) { read_value(ifs, eb_k); + Para_Json::set_json_value(Para_Json::eb_k,&eb_k); } else if (strcmp("tau", word) == 0) { read_value(ifs, tau); + Para_Json::set_json_value(Para_Json::tau,&tau); } else if (strcmp("sigma_k", word) == 0) { read_value(ifs, sigma_k); + Para_Json::set_json_value(Para_Json::sigma_k,&sigma_k); } else if (strcmp("nc_k", word) == 0) { read_value(ifs, nc_k); + Para_Json::set_json_value(Para_Json::nc_k,&nc_k); } //---------------------------------------------------------------------------------- // OFDFT sunliang added on 2022-05-05 @@ -2075,110 +2391,137 @@ bool Input::Read(const std::string &fn) else if (strcmp("of_kinetic", word) == 0) { read_value(ifs, of_kinetic); + Para_Json::set_json_value(Para_Json::of_kinetic,&of_kinetic); } else if (strcmp("of_method", word) == 0) { read_value(ifs, of_method); + Para_Json::set_json_value(Para_Json::of_method,&of_method); } else if (strcmp("of_conv", word) == 0) { read_value(ifs, of_conv); + Para_Json::set_json_value(Para_Json::of_conv,&of_conv); } else if (strcmp("of_tole", word) == 0) { read_value(ifs, of_tole); + Para_Json::set_json_value(Para_Json::of_tole,&of_tole); } else if (strcmp("of_tolp", word) == 0) { read_value(ifs, of_tolp); + Para_Json::set_json_value(Para_Json::of_tolp,&of_tolp); } else if (strcmp("of_tf_weight", word) == 0) { read_value(ifs, of_tf_weight); + Para_Json::set_json_value(Para_Json::of_tf_weight,&of_tf_weight); } else if (strcmp("of_vw_weight", word) == 0) { read_value(ifs, of_vw_weight); + Para_Json::set_json_value(Para_Json::of_vw_weight,&of_vw_weight); } else if (strcmp("of_wt_alpha", word) == 0) { read_value(ifs, of_wt_alpha); + Para_Json::set_json_value(Para_Json::of_wt_alpha,&of_wt_alpha); } else if (strcmp("of_wt_beta", word) == 0) { read_value(ifs, of_wt_beta); + Para_Json::set_json_value(Para_Json::of_wt_beta,&of_wt_beta); } else if (strcmp("of_wt_rho0", word) == 0) { read_value(ifs, of_wt_rho0); + Para_Json::set_json_value(Para_Json::of_wt_rho0,&of_wt_rho0); } else if (strcmp("of_hold_rho0", word) == 0) { read_bool(ifs, of_hold_rho0); + Para_Json::set_json_value(Para_Json::of_hold_rho0,&of_hold_rho0); } else if (strcmp("of_lkt_a", word) == 0) { read_value(ifs, of_lkt_a); + Para_Json::set_json_value(Para_Json::of_lkt_a,&of_lkt_a); } else if (strcmp("of_full_pw", word) == 0) { read_bool(ifs, of_full_pw); + Para_Json::set_json_value(Para_Json::of_full_pw,&of_full_pw); } else if (strcmp("of_full_pw_dim", word) == 0) { read_value(ifs, of_full_pw_dim); + Para_Json::set_json_value(Para_Json::of_full_pw_dim,&of_full_pw_dim); } else if (strcmp("of_read_kernel", word) == 0) { read_bool(ifs, of_read_kernel); + Para_Json::set_json_value(Para_Json::of_read_kernel,&of_read_kernel); } else if (strcmp("of_kernel_file", word) == 0) { read_value(ifs, of_kernel_file); + Para_Json::set_json_value(Para_Json::of_kernel_file,&of_kernel_file); } else if (strcmp("bessel_nao_smooth", word) == 0) { read_value(ifs, bessel_nao_smooth); + Para_Json::set_json_value(Para_Json::bessel_nao_smooth,&bessel_nao_smooth); } else if (strcmp("bessel_nao_sigma", word) == 0) { read_value(ifs, bessel_nao_sigma); + Para_Json::set_json_value(Para_Json::bessel_nao_sigma,&bessel_nao_sigma); } else if (strcmp("bessel_nao_ecut", word) == 0) { read_value(ifs, bessel_nao_ecut); + Para_Json::set_json_value(Para_Json::bessel_nao_ecut,&bessel_nao_ecut); } else if (strcmp("bessel_nao_rcut", word) == 0) { read_value(ifs, bessel_nao_rcut); + Para_Json::set_json_value(Para_Json::bessel_nao_rcut,&bessel_nao_rcut); } else if (strcmp("bessel_nao_tolerence", word) == 0) { read_value(ifs, bessel_nao_tolerence); + Para_Json::set_json_value(Para_Json::bessel_nao_tolerence,&bessel_nao_tolerence); } else if (strcmp("bessel_descriptor_lmax", word) == 0) { read_value(ifs, bessel_descriptor_lmax); + Para_Json::set_json_value(Para_Json::bessel_descriptor_lmax,&bessel_descriptor_lmax); } else if (strcmp("bessel_descriptor_smooth", word) == 0) { read_value(ifs, bessel_descriptor_smooth); + Para_Json::set_json_value(Para_Json::bessel_descriptor_smooth,&bessel_descriptor_smooth); } else if (strcmp("bessel_descriptor_sigma", word) == 0) { read_value(ifs, bessel_descriptor_sigma); + Para_Json::set_json_value(Para_Json::bessel_descriptor_sigma,&bessel_descriptor_sigma); } else if (strcmp("bessel_descriptor_ecut", word) == 0) { read_value(ifs, bessel_descriptor_ecut); + Para_Json::set_json_value(Para_Json::bessel_descriptor_ecut,&bessel_descriptor_ecut); } else if (strcmp("bessel_descriptor_rcut", word) == 0) { read_value(ifs, bessel_descriptor_rcut); + Para_Json::set_json_value(Para_Json::bessel_descriptor_rcut,&bessel_descriptor_rcut); } else if (strcmp("bessel_descriptor_tolerence", word) == 0) { read_value(ifs, bessel_descriptor_tolerence); + Para_Json::set_json_value(Para_Json::bessel_descriptor_tolerence,&bessel_descriptor_tolerence); } //---------------------------------------------------------------------------------- // device control denghui added on 2022-11-05 @@ -2186,14 +2529,16 @@ bool Input::Read(const std::string &fn) else if (strcmp("device", word) == 0) { read_value(ifs, device); + Para_Json::set_json_value(Para_Json::device,&device); } //---------------------------------------------------------------------------------- // precision control denghui added on 2023-01-01 //---------------------------------------------------------------------------------- else if (strcmp("precision", word) == 0) { read_value(ifs, precision); + //Para_Json::set_json_value(Para_Json::precision,&precision); } - //---------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------- // Deltaspin //---------------------------------------------------------------------------------- else if (strcmp("sc_mag_switch", word) == 0){ @@ -2314,16 +2659,19 @@ bool Input::Read(const std::string &fn) if (strcmp("yukawa_potential", word) == 0) { read_bool(ifs, yukawa_potential); + Para_Json::set_json_value(Para_Json::yukawa_potential,&yukawa_potential); } else if (strcmp("yukawa_lambda", word) == 0) { ifs >> yukawa_lambda; + Para_Json::set_json_value(Para_Json::yukawa_lambda,&yukawa_lambda); } else if (strcmp("hubbard_u", word) == 0) { for (int i = 0; i < ntype; i++) { ifs >> hubbard_u[i]; + Para_Json::hubbard_u.PushBack(hubbard_u[i],Para_Json::doc.GetAllocator()); hubbard_u[i] /= ModuleBase::Ry_to_eV; } } @@ -2332,6 +2680,7 @@ bool Input::Read(const std::string &fn) for (int i = 0; i < ntype; i++) { ifs >> orbital_corr[i]; + Para_Json::orbital_corr.PushBack(orbital_corr[i],Para_Json::doc.GetAllocator()); } } else if (strcmp("omc", word) == 0) @@ -2406,6 +2755,7 @@ bool Input::Read(const std::string &fn) for (int i = 0; i < ntype; i++) { ifs >> hubbard_u[i]; + Para_Json::hubbard_u.PushBack(hubbard_u[i],Para_Json::doc.GetAllocator()); hubbard_u[i] /= ModuleBase::Ry_to_eV; } } @@ -2414,6 +2764,7 @@ bool Input::Read(const std::string &fn) for (int i = 0; i < ntype; i++) { ifs >> orbital_corr[i]; + Para_Json::orbital_corr.PushBack(orbital_corr[i],Para_Json::doc.GetAllocator()); } } else @@ -2510,6 +2861,7 @@ bool Input::Read(const std::string &fn) return true; } // end read_parameters + void Input::Default_2(void) // jiyy add 2019-08-04 { if (GlobalV::MY_RANK != 0) diff --git a/source/module_io/input.h b/source/module_io/input.h index 252d161bc1..1c4ef2b5fe 100644 --- a/source/module_io/input.h +++ b/source/module_io/input.h @@ -8,6 +8,7 @@ #include "module_base/vector3.h" #include "module_md/md_para.h" +#include "module_base/para_json.h" class Input { diff --git a/source/module_io/test/CMakeLists.txt b/source/module_io/test/CMakeLists.txt index cafe897eb8..5d69acef49 100644 --- a/source/module_io/test/CMakeLists.txt +++ b/source/module_io/test/CMakeLists.txt @@ -142,4 +142,9 @@ AddTest( SOURCES csr_reader_test.cpp ../csr_reader.cpp ../file_reader.cpp ../sparse_matrix.cpp ) +AddTest( + TARGET io_para_json_test + LIBS ${math_libs} base device + SOURCES para_json_test.cpp ../input.cpp +) From f0f9bb90291f429b1e18faa4af19c9bafdbc74bc Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Mon, 20 Nov 2023 11:27:49 +0800 Subject: [PATCH 05/27] fix bugs --- source/module_base/test/CMakeLists.txt | 6 ++++++ source/module_io/test/CMakeLists.txt | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/module_base/test/CMakeLists.txt b/source/module_base/test/CMakeLists.txt index 8b0c62dbb5..0b60b36e1d 100644 --- a/source/module_base/test/CMakeLists.txt +++ b/source/module_base/test/CMakeLists.txt @@ -208,4 +208,10 @@ AddTest( ../math_ylmreal.cpp ../global_variable.cpp ../ylm.cpp ../timer.cpp ../vector3.h ../parallel_reduce.cpp ../parallel_global.cpp ../parallel_common.cpp ../memory.cpp ../libm/branred.cpp ../libm/sincos.cpp ../inverse_matrix.cpp ../lapack_connector.h LIBS ${math_libs} formatter device +) + +AddTest( + TARGET io_para_json_test + LIBS ${math_libs} base device + SOURCES para_json_test.cpp ../input.cpp ) \ No newline at end of file diff --git a/source/module_io/test/CMakeLists.txt b/source/module_io/test/CMakeLists.txt index 5d69acef49..e89cdc9de1 100644 --- a/source/module_io/test/CMakeLists.txt +++ b/source/module_io/test/CMakeLists.txt @@ -142,9 +142,3 @@ AddTest( SOURCES csr_reader_test.cpp ../csr_reader.cpp ../file_reader.cpp ../sparse_matrix.cpp ) -AddTest( - TARGET io_para_json_test - LIBS ${math_libs} base device - SOURCES para_json_test.cpp ../input.cpp -) - From 8ab01a8962d1f28de1406756c7e21d5ff3a38780 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Mon, 20 Nov 2023 11:34:36 +0800 Subject: [PATCH 06/27] fix bugs --- source/module_base/test/CMakeLists.txt | 5 ----- source/module_io/test/CMakeLists.txt | 5 +++++ source/{module_base => module_io}/test/para_json_test.cpp | 0 3 files changed, 5 insertions(+), 5 deletions(-) rename source/{module_base => module_io}/test/para_json_test.cpp (100%) diff --git a/source/module_base/test/CMakeLists.txt b/source/module_base/test/CMakeLists.txt index 0b60b36e1d..24cd03ed96 100644 --- a/source/module_base/test/CMakeLists.txt +++ b/source/module_base/test/CMakeLists.txt @@ -210,8 +210,3 @@ AddTest( LIBS ${math_libs} formatter device ) -AddTest( - TARGET io_para_json_test - LIBS ${math_libs} base device - SOURCES para_json_test.cpp ../input.cpp -) \ No newline at end of file diff --git a/source/module_io/test/CMakeLists.txt b/source/module_io/test/CMakeLists.txt index e89cdc9de1..5ddbf22357 100644 --- a/source/module_io/test/CMakeLists.txt +++ b/source/module_io/test/CMakeLists.txt @@ -142,3 +142,8 @@ AddTest( SOURCES csr_reader_test.cpp ../csr_reader.cpp ../file_reader.cpp ../sparse_matrix.cpp ) +AddTest( + TARGET io_para_json_test + LIBS ${math_libs} base device + SOURCES para_json_test.cpp ../input.cpp +) \ No newline at end of file diff --git a/source/module_base/test/para_json_test.cpp b/source/module_io/test/para_json_test.cpp similarity index 100% rename from source/module_base/test/para_json_test.cpp rename to source/module_io/test/para_json_test.cpp From ca6c4474ca0d379389ab75daf611fe9e23159c0f Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Tue, 21 Nov 2023 11:44:18 +0800 Subject: [PATCH 07/27] fix some bug --- source/module_io/input.cpp | 1 + source/module_io/input.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index 0bbe6cfb77..3e494f27b3 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -22,6 +22,7 @@ #include "module_base/global_variable.h" #include "module_base/parallel_common.h" #include "module_base/timer.h" +#include "module_base/para_json.h" #include "version.h" Input INPUT; diff --git a/source/module_io/input.h b/source/module_io/input.h index 1c4ef2b5fe..252d161bc1 100644 --- a/source/module_io/input.h +++ b/source/module_io/input.h @@ -8,7 +8,6 @@ #include "module_base/vector3.h" #include "module_md/md_para.h" -#include "module_base/para_json.h" class Input { From 72527f81c07901d159b6147503d0cb756528d354 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Tue, 21 Nov 2023 12:02:01 +0800 Subject: [PATCH 08/27] add obj --- source/Makefile.Objects | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Makefile.Objects b/source/Makefile.Objects index 84b4f6fe17..0c3cd484d8 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -147,6 +147,7 @@ OBJS_BASE=abfs-vector3_order.o\ cubic_spline.o\ spherical_bessel_transformer.o\ mixing_data.o\ + para_json.o\ OBJS_CELL=atom_pseudo.o\ From b7dec09b0ca67176e25376aa6d02404015ac3e81 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Tue, 21 Nov 2023 12:02:14 +0800 Subject: [PATCH 09/27] adjust --- source/module_base/para_json.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/module_base/para_json.cpp b/source/module_base/para_json.cpp index 721c236124..5c794bce92 100644 --- a/source/module_base/para_json.cpp +++ b/source/module_base/para_json.cpp @@ -1,5 +1,5 @@ -#include "module_base/para_json.h" +#include "para_json.h" #include "module_base/global_variable.h" From 09e336506c1136012fb6d0978968c6ccabaa2d91 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Tue, 21 Nov 2023 12:26:59 +0800 Subject: [PATCH 10/27] add namespace in module_md-test --- source/module_md/test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/module_md/test/CMakeLists.txt b/source/module_md/test/CMakeLists.txt index 6797bf63b5..0f5564d26f 100644 --- a/source/module_md/test/CMakeLists.txt +++ b/source/module_md/test/CMakeLists.txt @@ -45,6 +45,7 @@ list(APPEND depend_files ../../module_esolver/esolver_lj.cpp ../../module_base/parallel_reduce.cpp ../../module_base/parallel_global.cpp + ../../module_base/para_json.cpp ) AddTest( From 902d6b17de2e6cbaacfe8b6a8963726cbf8ce7e9 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Tue, 21 Nov 2023 12:45:52 +0800 Subject: [PATCH 11/27] add app in module_relax test --- source/module_relax/relax_new/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/module_relax/relax_new/test/CMakeLists.txt b/source/module_relax/relax_new/test/CMakeLists.txt index 446d868f21..41593aec9b 100644 --- a/source/module_relax/relax_new/test/CMakeLists.txt +++ b/source/module_relax/relax_new/test/CMakeLists.txt @@ -15,7 +15,7 @@ AddTest( AddTest( TARGET relax_new_relax SOURCES relax_test.cpp ../relax.cpp ../line_search.cpp ../../../module_base/tool_quit.cpp ../../../module_base/global_variable.cpp ../../../module_base/global_file.cpp ../../../module_base/memory.cpp ../../../module_base/timer.cpp - ../../../module_base/matrix3.cpp ../../../module_base/intarray.cpp ../../../module_base/tool_title.cpp ../../../module_io/input.cpp + ../../../module_base/matrix3.cpp ../../../module_base/intarray.cpp ../../../module_base/tool_title.cpp ../../../module_base/para_json.cpp ../../../module_io/input.cpp ../../../module_base/global_function.cpp ../../../module_base/complexmatrix.cpp ../../../module_base/matrix.cpp ../../../module_base/complexarray.cpp ../../../module_base/tool_quit.cpp ../../../module_base/realarray.cpp LIBS ${math_libs} formatter From c932511ef9d6c3874b3669e5c5b3499f3415576b Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Tue, 21 Nov 2023 13:55:01 +0800 Subject: [PATCH 12/27] modify Input file path --- source/module_base/test/data/INPUT | 382 ----------------------- source/module_io/test/para_json_test.cpp | 2 +- 2 files changed, 1 insertion(+), 383 deletions(-) delete mode 100644 source/module_base/test/data/INPUT diff --git a/source/module_base/test/data/INPUT b/source/module_base/test/data/INPUT deleted file mode 100644 index 5a62b2416e..0000000000 --- a/source/module_base/test/data/INPUT +++ /dev/null @@ -1,382 +0,0 @@ -INPUT_PARAMETERS -#Parameters (1.General) -suffix autotest #the name of main output directory -latname none #the name of lattice name -stru_file ./support/STRU #the filename of file containing atom positions -kpoint_file KPT #the name of file containing k points -pseudo_dir ../../PP_ORB/ #the directory containing pseudo files -orbital_dir ../../PP_ORB/ #the directory containing orbital files -pseudo_rcut 15 #cut-off radius for radial integration -pseudo_mesh 0 #0: use our own mesh to do radial renormalization; 1: use mesh as in QE -lmaxmax 2 #maximum of l channels used -dft_functional hse #exchange correlation functional -xc_temperature 0 #temperature for finite temperature functionals -calculation scf #test; scf; relax; nscf; get_wf; get_pchg -esolver_type ksdft #the energy solver: ksdft, sdft, ofdft, tddft, lj, dp -ntype 1 #atom species number -nspin 1 #1: single spin; 2: up and down spin; 4: noncollinear spin -kspacing 0 #unit in 1/bohr, should be > 0, default is 0 which means read KPT file -min_dist_coef 0.2 #factor related to the allowed minimum distance between two atoms -nbands 8 #number of bands -nbands_sto 256 #number of stochastic bands -nbands_istate 5 #number of bands around Fermi level for get_pchg calulation -symmetry 1 #the control of symmetry -init_vel False #read velocity from STRU or not -symmetry_prec 1e-06 #accuracy for symmetry -nelec 0 #input number of electrons -out_mul 0 # mulliken charge or not -noncolin 0 #using non-collinear-spin -lspinorb 0 #consider the spin-orbit interaction -kpar 1 #devide all processors into kpar groups and k points will be distributed among each group -bndpar 1 #devide all processors into bndpar groups and bands will be distributed among each group -out_freq_elec 0 #the frequency ( >= 0) of electronic iter to output charge density and wavefunction. 0: output only when converged -dft_plus_dmft 0 #true:DFT+DMFT; false: standard DFT calcullation(default) -rpa 0 #true:generate output files used in rpa calculation; false:(default) -printe 100 #Print out energy for each band for every printe steps -mem_saver 0 #Only for nscf calculations. if set to 1, then a memory saving technique will be used for many k point calculations. -diago_proc 4 #the number of procs used to do diagonalization -nbspline -1 #the order of B-spline basis -wannier_card none #input card for wannier functions -soc_lambda 1 #The fraction of averaged SOC pseudopotential is given by (1-soc_lambda) -cal_force 0 #if calculate the force at the end of the electronic iteration -out_freq_ion 0 #the frequency ( >= 0 ) of ionic step to output charge density and wavefunction. 0: output only when ion steps are finished -device cpu #the computing device for ABACUS - -#Parameters (2.PW) -ecutwfc 20 ##energy cutoff for wave functions -erf_ecut 20 #the value of the constant energy cutoff -erf_height 20 #the height of the energy step for reciprocal vectors -erf_sigma 4 #the width of the energy step for reciprocal vectors -fft_mode 0 #mode of FFTW -pw_diag_thr 0.01 #threshold for eigenvalues is cg electron iterations -scf_thr 1e-08 #charge density error -scf_thr_type 2 #type of the criterion of scf_thr, 1: reci drho for pw, 2: real drho for lcao -init_wfc atomic #start wave functions are from 'atomic', 'atomic+random', 'random' or 'file' -init_chg atomic #start charge is from 'atomic' or file -chg_extrap atomic #atomic; first-order; second-order; dm:coefficients of SIA -out_chg FALSE #>0 output charge density for selected electron steps -out_pot 2 #output realspace potential -out_wfc_pw 0 #output wave functions -out_wfc_r 0 #output wave functions in realspace -out_dos 0 #output energy and dos -out_band false #output energy and band structure -out_proj_band FaLse #output projected band structure -restart_save f #print to disk every step for restart -restart_load F #restart from disk -read_file_dir auto #directory of files for reading -nx 0 #number of points along x axis for FFT grid -ny 0 #number of points along y axis for FFT grid -nz 0 #number of points along z axis for FFT grid -cell_factor 1.2 #used in the construction of the pseudopotential tables -pw_seed 1 #random seed for initializing wave functions - -#Parameters (3.Stochastic DFT) -method_sto 3 #1: slow and save memory, 2: fast and waste memory -npart_sto 1 #Reduce memory when calculating Stochastic DOS -nbands_sto 256 #number of stochstic orbitals -nche_sto 100 #Chebyshev expansion orders -emin_sto 0 #trial energy to guess the lower bound of eigen energies of the Hamitonian operator -emax_sto 0 #trial energy to guess the upper bound of eigen energies of the Hamitonian operator -seed_sto 0 #the random seed to generate stochastic orbitals -initsto_ecut 0 #maximum ecut to init stochastic bands -initsto_freq 0 #frequency to generate new stochastic orbitals when running md -cal_cond 0 #calculate electronic conductivities -cond_che_thr 1e-08 #control the error of Chebyshev expansions for conductivities -cond_dw 0.1 #frequency interval for conductivities -cond_wcut 10 #cutoff frequency (omega) for conductivities -cond_dt 0.07 #control the t interval -cond_dtbatch 2 #control dt batch -cond_fwhm 0.3 #FWHM for conductivities -cond_nonlocal 1 #Nonlocal effects for conductivities - -#Parameters (4.Relaxation) -ks_solver genelpa #cg; dav; lapack; genelpa; scalapack_gvx; cusolver -scf_nmax 50 ##number of electron iterations -relax_nmax 1 #number of ion iteration steps -out_stru 0 #output the structure files after each ion step -force_thr 0.001 #force threshold, unit: Ry/Bohr -force_thr_ev 0.0257112 #force threshold, unit: eV/Angstrom -force_thr_ev2 0 #force invalid threshold, unit: eV/Angstrom -relax_cg_thr 0.5 #threshold for switching from cg to bfgs, unit: eV/Angstrom -stress_thr 0.01 #stress threshold -press1 0 #target pressure, unit: KBar -press2 0 #target pressure, unit: KBar -press3 0 #target pressure, unit: KBar -relax_bfgs_w1 0.01 #wolfe condition 1 for bfgs -relax_bfgs_w2 0.5 #wolfe condition 2 for bfgs -relax_bfgs_rmax 0.8 #maximal trust radius, unit: Bohr -relax_bfgs_rmin 1e-05 #minimal trust radius, unit: Bohr -relax_bfgs_init 0.5 #initial trust radius, unit: Bohr -cal_stress 0 #calculate the stress or not -fixed_axes None #which axes are fixed -fixed_ibrav 0 #whether to preseve lattice type during relaxation -fixed_atoms 0 #whether to preseve direct coordinates of atoms during relaxation -relax_method cg #bfgs; sd; cg; cg_bfgs; -relax_new TRUE #whether to use the new relaxation method -relax_scale_force 0.5 #controls the size of the first CG step if relax_new is true -out_level ie #ie(for electrons); i(for ions); -out_dm 0 #>0 output density matrix -deepks_out_labels 0 #>0 compute descriptor for deepks -deepks_scf 0 #>0 add V_delta to Hamiltonian -deepks_bandgap 0 #>0 for bandgap label -deepks_out_unittest 0 #if set 1, prints intermediate quantities that shall be used for making unit test -deepks_model #file dir of traced pytorch model: 'model.ptg - -#Parameters (5.LCAO) -basis_type lcao #PW; LCAO in pw; LCAO -nb2d 0 #2d distribution of atoms -gamma_only T #Only for localized orbitals set and gamma point. If set to 1, a fast algorithm is used -search_radius -1 #input search radius (Bohr) -search_pbc 1 #input periodic boundary condition -lcao_ecut 20 #energy cutoff for LCAO -lcao_dk 0.01 #delta k for 1D integration in LCAO -lcao_dr 0.01 #delta r for 1D integration in LCAO -lcao_rmax 30 #max R for 1D two-center integration table -out_mat_hs 0 #output H and S matrix -out_mat_hs2 0 #output H(R) and S(R) matrix -out_interval 1 #interval for printing H(R) and S(R) matrix during MD -out_app_flag 0 #whether output r(R), H(R), S(R), T(R), and dH(R) matrices in an append manner during MD -out_element_info 0 #output (projected) wavefunction of each element -out_mat_r 0 #output r(R) matrix -out_wfc_lcao 0 #ouput LCAO wave functions -bx 2 #division of an element grid in FFT grid along x -by 2 #division of an element grid in FFT grid along y -bz 2 #division of an element grid in FFT grid along z - -bessel_nao_smooth 1 -bessel_nao_sigma 0.1 -bessel_nao_ecut default -bessel_nao_rcut 6.0 #-1.0 for forcing manual setting -bessel_nao_tolerence 1E-12 - -bessel_descriptor_lmax 2 # -1 for forcing manual setting -bessel_descriptor_smooth 1 -bessel_descriptor_sigma 0.1 -bessel_descriptor_ecut default -bessel_descriptor_rcut 6.0 #-1.0 for forcing manual setting -bessel_descriptor_tolerence 1E-12 - -#Parameters (6.Smearing) -smearing_method gauss #type of smearing_method: gauss; fd; fixed; mp; mp2; mv -smearing_sigma 0.002 #energy range for smearing - -#Parameters (7.Charge Mixing) -mixing_type broyden #plain; pulay; broyden -mixing_beta 0.7 #mixing parameter: 0 means no new charge -mixing_ndim 8 #mixing dimension in pulay or broyden -mixing_gg0 0 #mixing parameter in kerker - -#Parameters (8.DOS) -dos_emin_ev -15 #minimal range for dos -dos_emax_ev 15 #maximal range for dos -dos_edelta_ev 0.01 #delta energy for dos -dos_scale 0.01 #scale dos range by -dos_sigma 0.07 #gauss b coefficeinet(default=0.07) -dos_nche 100 #orders of Chebyshev expansions for dos - -#Parameters (9.Molecular dynamics) -md_type nvt #choose ensemble -md_thermostat nhc #choose thermostat -md_nstep 10 #md steps -md_dt 1 #time step -md_tchain 1 #number of Nose-Hoover chains -md_tfirst -1 #temperature first -md_tlast -1 #temperature last -md_dumpfreq 1 #The period to dump MD information -md_restartfreq 5 #The period to output MD restart information -md_seed -1 #random seed for MD -md_prec_level 2 #precision level for vc-md -ref_cell_factor 1.2 #construct a reference cell bigger than the initial cell -md_restart 0 #whether restart -lj_rcut 8.5 #cutoff radius of LJ potential -lj_epsilon 0.01032 #the value of epsilon for LJ potential -lj_sigma 3.405 #the value of sigma for LJ potential -pot_file graph.pb #the filename of potential files for CMD such as DP -msst_direction 2 #the direction of shock wave -msst_vel 0 #the velocity of shock wave -msst_vis 0 #artificial viscosity -msst_tscale 0.01 #reduction in initial temperature -msst_qmass -1 #mass of thermostat -md_tfreq 0 #oscillation frequency, used to determine qmass of NHC -md_damp 1 #damping parameter (time units) used to add force in Langevin method -md_nraise 1 #parameters used when md_type=nvt -cal_syns 0 #calculate asynchronous overlap matrix to output for Hefei-NAMD -dmax 0.01 #maximum displacement of all atoms in one step (bohr) -md_tolerance 100 #tolerance for velocity rescaling (K) -md_pmode iso #NPT ensemble mode: iso, aniso, tri -md_pcouple none #whether couple different components: xyz, xy, yz, xz, none -md_pchain 1 #num of thermostats coupled with barostat -md_pfirst -1 #initial target pressure -md_plast -1 #final target pressure -md_pfreq 0 #oscillation frequency, used to determine qmass of thermostats coupled with barostat -dump_force 0 #output atomic forces into the file MD_dump or not. -dump_vel 0 #output atomic velocities into the file MD_dump or not -dump_virial 0 #output lattice virial into the file MD_dump or not - -#Parameters (10.Electric field and dipole correction) -efield_flag 0 #add electric field -dip_cor_flag 0 #dipole correction -efield_dir 2 #the direction of the electric field or dipole correction -efield_pos_max 0.5 #position of the maximum of the saw-like potential along crystal axis efield_dir -efield_pos_dec 0.1 #zone in the unit cell where the saw-like potential decreases -efield_amp 0 #amplitude of the electric field - -#Parameters (11.Gate field) -gate_flag 0 #compensating charge or not -zgate 0.5 #position of charged plate -relax 0 #allow relaxation along the specific direction -block 0 #add a block potential or not -block_down 0.45 #low bound of the block -block_up 0.55 #high bound of the block -block_height 0.1 #height of the block - -#Parameters (12.Test) -out_alllog F #output information for each processor, when parallel -nurse 0 #for coders -colour 0 #for coders, make their live colourful -t_in_h 1 #calculate the kinetic energy or not -vl_in_h 1 #calculate the local potential or not -vnl_in_h 1 #calculate the nonlocal potential or not -vh_in_h 1 #calculate the hartree potential or not -vion_in_h 1 #calculate the local ionic potential or not -test_force 0 #test the force -test_stress 0 #test the force -test_skip_ewald 0 #skip ewald energy - -#Parameters (13.vdW Correction) -vdw_method d2 #the method of calculating vdw (none ; d2 ; d3_0 ; d3_bj -vdw_s6 default #scale parameter of d2/d3_0/d3_bj -vdw_s8 default #scale parameter of d3_0/d3_bj -vdw_a1 default #damping parameter of d3_0/d3_bj -vdw_a2 default #damping parameter of d3_bj -vdw_d 20 #damping parameter of d2 -vdw_abc 0 #third-order term? -vdw_C6_file default #filename of C6 -vdw_C6_unit Jnm6/mol #unit of C6, Jnm6/mol or eVA6 -vdw_R0_file default #filename of R0 -vdw_R0_unit A #unit of R0, A or Bohr -vdw_cutoff_type radius #expression model of periodic structure, radius or period -vdw_cutoff_radius default #radius cutoff for periodic structure -vdw_radius_unit Bohr #unit of radius cutoff for periodic structure -vdw_cn_thr 40 #radius cutoff for cn -vdw_cn_thr_unit Bohr #unit of cn_thr, Bohr or Angstrom -vdw_cutoff_period 3 3 3 #periods of periodic structure - -#Parameters (14.exx) -exx_hybrid_alpha default # -exx_hse_omega 0.11 # -exx_separate_loop 1 #0 or 1 -exx_hybrid_step 100 # -exx_mixing_beta 1.0 # -exx_lambda 0.3 # -exx_real_number default #0 or 1 -exx_pca_threshold 0 # -exx_c_threshold 0 # -exx_v_threshold 0 # -exx_dm_threshold 0 # -exx_schwarz_threshold 0 # -exx_cauchy_threshold 0 # -exx_c_grad_threshold 0 # -exx_v_grad_threshold 0 # -exx_cauchy_force_threshold 0 # -exx_cauchy_stress_threshold 0 # -exx_ccp_threshold 1e-08 # -exx_ccp_rmesh_times default # -exx_distribute_type htime #htime or kmeans1 or kmeans2 -exx_opt_orb_lmax 0 # -exx_opt_orb_ecut 0 # -exx_opt_orb_tolerence 0 # - -#Parameters (16.tddft) -td_force_dt 0.02 #time of force change -td_vext 0 #add extern potential or not -td_vext_dire 1 #extern potential direction -td_propagator 0 # method of propagator -td_stype 0 #space domain type -td_ttype 0 #time domain type -td_tstart 1 #the start step of electric field -td_tend 1000 #the start step of electric field -td_lcut1 0.05 # separator in length gauge -td_lcut2 0.95 # separator in length gauge -# parameters of Gauss electric field -td_gauss_freq 22.13 # fs^-1 -td_gauss_phase 0.0 -td_gauss_sigma 30.0 # fs -td_gauss_t0 100.0 -td_gauss_amp 0.25 # V/A -# parameters of Trapezoid electric field -td_trape_freq 1.60 # fs^-1 -td_trape_phase 0.0 -td_trape_t1 1875 -td_trape_t2 5625 -td_trape_t3 7500 -td_trape_amp 2.74 # V/A -#parameters of Trigonometric electric field -td_trigo_freq1 1.164656 # fs^-1 -td_trigo_freq2 0.029116 # fs^-1 -td_trigo_phase1 0.0 -td_trigo_phase2 0.0 -td_trigo_amp 2.74 # V/A -#parameters of Heaviside electric field -td_heavi_t0 100 -td_heavi_amp 1.0 # V/A -td_print_eij -1.0 # threshold to output Eij elements -td_edm 0 # 0: new edm method 1: old edm method -out_dipole 0 #output dipole or not -out_efield 0 #output efield or not -ocp 0 #change occupation or not -ocp_set none #set occupation - -#Parameters (17.berry_wannier) -berry_phase 0 #calculate berry phase or not -gdir 3 #calculate the polarization in the direction of the lattice vector -towannier90 0 #use wannier90 code interface or not -nnkpfile seedname.nnkp #the wannier90 code nnkp file name -wannier_spin up #calculate spin in wannier90 code interface -out_wannier_mmn 1 #output .mmn file or not -out_wannier_amn 1 #output .amn file or not -out_wannier_unk 1 #output UNK. file or not -out_wannier_eig 1 #output .eig file or not -out_wannier_wvfn_formatted 1 #output UNK. file in text format or in binary format - -#Parameters (18.implicit_solvation) -imp_sol 0 #calculate implicit solvation correction or not -eb_k 80 #the relative permittivity of the bulk solvent -tau 1.0798e-05 #the effective surface tension parameter -sigma_k 0.6 # the width of the diffuse cavity -nc_k 0.00037 # the cut-off charge density - -#Parameters (19.orbital free density functional theory) -of_kinetic vw #kinetic energy functional, such as tf, vw, wt -of_method tn #optimization method used in OFDFT, including cg1, cg2, tn (default) -of_conv energy #the convergence criterion, potential, energy (default), or both -of_tole 1e-06 #tolerance of the energy change (in Ry) for determining the convergence, default=2e-6 Ry -of_tolp 1e-05 #tolerance of potential for determining the convergence, default=1e-5 in a.u. -of_tf_weight 1 #weight of TF KEDF -of_vw_weight 1 #weight of vW KEDF -of_wt_alpha 0.833333 #parameter alpha of WT KEDF -of_wt_beta 0.833333 #parameter beta of WT KEDF -of_wt_rho0 1 #the average density of system, used in WT KEDF, in Bohr^-3 -of_hold_rho0 0 #If set to 1, the rho0 will be fixed even if the volume of system has changed, it will be set to 1 automaticly if of_wt_rho0 is not zero -of_full_pw 0 #If set to 1, ecut will be ignored when collect planewaves, so that all planewaves will be used -of_full_pw_dim 0 #If of_full_pw = true, dimention of FFT is testricted to be (0) either odd or even; (1) odd only; (2) even only -of_read_kernel 0 #If set to 1, the kernel of WT KEDF will be filled from file of_kernel_file, not from formula. Only usable for WT KEDF -of_kernel_file WTkernel.txt #The name of WT kernel file. - -#Parameters (20.dft+u) -dft_plus_u 0 #true:DFT+U correction; false: standard DFT calcullation(default) -yukawa_lambda -1 #default:0.0 -yukawa_potential 0 #default: false -omc 0 #the mode of occupation matrix control -hubbard_u 0 #Hubbard Coulomb interaction parameter U(ev) -orbital_corr -1 #which correlated orbitals need corrected ; d:2 ,f:3, do not need correction:-1 - -#Parameters (22.non-collinear spin-constrained DFT) -sc_mag_switch 0 #0: no spin-constrained DFT; 1: constrain atomic magnetization via values at xyz; 3: via spin value and angles -decay_grad_switch 1 # -sc_thr 1e-04 #Convergence criterion of spin-constrained iteration (RMS) in uB -nsc 50 #Maximal number of spin-constrained iteration -nsc_min 4 #Minimum number of spin-constrained iteration -alpha_trial 0.02 #Initial trial step size for lambda in eV/uB^2 -sccut 4 #Maximal step size for lambda in eV/uB -sc_file sc.json #file name for parameters used in non-collinear spin-constrained DFT (json format) diff --git a/source/module_io/test/para_json_test.cpp b/source/module_io/test/para_json_test.cpp index f8ebe43e9b..d06369af0e 100644 --- a/source/module_io/test/para_json_test.cpp +++ b/source/module_io/test/para_json_test.cpp @@ -28,7 +28,7 @@ class ParaJsonTest : public ::testing::Test TEST_F(ParaJsonTest,Init) { - std::string input_file = "./data/INPUT"; + std::string input_file = "./support/INPUT"; Input input_tmp; EXPECT_NO_THROW(input_tmp.Init(input_file)); From e944d3c50324f9711bc039d478a4fd966c598f44 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Tue, 21 Nov 2023 16:59:26 +0800 Subject: [PATCH 13/27] Some suggestions in the comments have been revised --- source/module_base/CMakeLists.txt | 1 - source/module_base/para_json.cpp | 6 +++--- source/module_base/para_json.h | 2 +- source/module_io/input.cpp | 3 +-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/source/module_base/CMakeLists.txt b/source/module_base/CMakeLists.txt index c4e351bfdc..92aa6a59bc 100644 --- a/source/module_base/CMakeLists.txt +++ b/source/module_base/CMakeLists.txt @@ -54,7 +54,6 @@ add_library( formatter_table.cpp formatter_contextfmt.cpp module_mixing/mixing_data.cpp - para_json.cpp ${LIBM_SRC} ) diff --git a/source/module_base/para_json.cpp b/source/module_base/para_json.cpp index 5c794bce92..b81a5178b9 100644 --- a/source/module_base/para_json.cpp +++ b/source/module_base/para_json.cpp @@ -36,7 +36,7 @@ namespace Para_Json // @param reading_information -- input_para -- system_variables: rapidjson::Value system_variables(rapidjson::kObjectType); - rapidjson::Value suffix; + rapidjson::Value input_suffix; rapidjson::Value ntype; rapidjson::Value calculation; rapidjson::Value esolver_type; @@ -561,7 +561,7 @@ namespace Para_Json */ void Init_json_abacus_readinInfo(){ //add Third stage:parameter in system_variables: - system_variables.AddMember("suffix", suffix, doc.GetAllocator()); + system_variables.AddMember("suffix", input_suffix, doc.GetAllocator()); system_variables.AddMember("ntype", ntype, doc.GetAllocator()); system_variables.AddMember("calculation", calculation, doc.GetAllocator()); system_variables.AddMember("esolver_type", esolver_type, doc.GetAllocator()); @@ -973,7 +973,7 @@ namespace Para_Json // Output the json string to a file std::string json_path; - json_path.append(GlobalV::global_out_dir +"out_para.json"); + json_path.append(GlobalV::global_out_dir +"abacus.json"); std::ofstream ofs(json_path); ofs << buffer.GetString() << std::endl; diff --git a/source/module_base/para_json.h b/source/module_base/para_json.h index 0171e47186..769ff1b80d 100644 --- a/source/module_base/para_json.h +++ b/source/module_base/para_json.h @@ -50,7 +50,7 @@ namespace Para_Json // @param reading_information -- input_para -- system_variables: extern rapidjson::Value system_variables; - extern rapidjson::Value suffix; + extern rapidjson::Value input_suffix; extern rapidjson::Value ntype; extern rapidjson::Value calculation; extern rapidjson::Value esolver_type; diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index 3e494f27b3..dc250deb81 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -681,7 +681,7 @@ bool Input::Read(const std::string &fn) if (strcmp("suffix", word) == 0) // out dir { read_value(ifs, suffix); - Para_Json::set_json_value(Para_Json::suffix,&suffix); + Para_Json::set_json_value(Para_Json::input_suffix,&suffix); //Para_Json::set_json_value(Para_Json::suffix,&suffix); } else if (strcmp("stru_file", word) == 0) // xiaohui modify 2015-02-01 @@ -1133,7 +1133,6 @@ bool Input::Read(const std::string &fn) { read_value(ifs, ecutwfc); Para_Json::set_json_value(Para_Json::ecutwfc,&ecutwfc); - ecutrho = 4.0 * ecutwfc; } else if (strcmp("ecutrho", word) == 0) { From fe65054a1738f3d11707994ddff446b3dd146c88 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Tue, 21 Nov 2023 17:40:14 +0800 Subject: [PATCH 14/27] change device_g to device --- source/module_base/para_json.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/module_base/para_json.cpp b/source/module_base/para_json.cpp index b81a5178b9..237adf3e23 100644 --- a/source/module_base/para_json.cpp +++ b/source/module_base/para_json.cpp @@ -541,7 +541,7 @@ namespace Para_Json general_info.AddMember("begin_date", begin_date, doc.GetAllocator()); - general_info.AddMember("device_g", device_g, doc.GetAllocator()); + general_info.AddMember("device", device_g, doc.GetAllocator()); // add Third stage:parameter in parallel: general_info.AddMember("parallel", parallel, doc.GetAllocator()); From 4c9237bdfcc31b491f51b8bf4c2329ae6086df10 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Thu, 23 Nov 2023 18:27:22 +0800 Subject: [PATCH 15/27] adjust structure of read_in node, add delete null node in read_in_file --- source/module_base/para_json.cpp | 798 +++++++++++++++---------------- source/module_base/para_json.h | 39 +- 2 files changed, 409 insertions(+), 428 deletions(-) diff --git a/source/module_base/para_json.cpp b/source/module_base/para_json.cpp index 237adf3e23..62742b91ab 100644 --- a/source/module_base/para_json.cpp +++ b/source/module_base/para_json.cpp @@ -13,6 +13,7 @@ namespace Para_Json // @param general_info : rapidjson::Value general_info(rapidjson::kObjectType); rapidjson::Value version; + rapidjson::Value commit; rapidjson::Value begin_time; rapidjson::Value begin_date; @@ -32,10 +33,12 @@ namespace Para_Json // @param reading_information: rapidjson::Value readin_info(rapidjson::kObjectType); - // @param reading_information -- input_para: + // @param reading_information -- input_file: + rapidjson::Value input_file(rapidjson::kObjectType); - // @param reading_information -- input_para -- system_variables: - rapidjson::Value system_variables(rapidjson::kObjectType); + std::map input_file_map; + + // @param reading_information -- input_file -- system_variables: rapidjson::Value input_suffix; rapidjson::Value ntype; rapidjson::Value calculation; @@ -61,16 +64,15 @@ namespace Para_Json rapidjson::Value kspacing(rapidjson::kArrayType); rapidjson::Value min_dist_coef(rapidjson::kNumberType); rapidjson::Value device; - // @param reading_information -- input_para -- files_related - rapidjson::Value files_related(rapidjson::kObjectType); + // @param reading_information -- input_file -- files_related rapidjson::Value stru_file; rapidjson::Value kpoint_file; rapidjson::Value pseudo_dir; rapidjson::Value orbital_dir; rapidjson::Value read_file_dir; rapidjson::Value wannier_card; - // @param reading_information -- input_para -- planewave_related - rapidjson::Value planewave_related(rapidjson::kObjectType); + + // @param reading_information -- input_file -- planewave_related rapidjson::Value ecutwfc; rapidjson::Value nx; rapidjson::Value ny; @@ -79,8 +81,7 @@ namespace Para_Json rapidjson::Value pw_diag_thr; rapidjson::Value pw_diag_nmax; rapidjson::Value pw_diag_ndim; - // @param reading_information -- input_para -- numerical_atomic_orbitals_related - rapidjson::Value numerical_atomic_orbitals_related(rapidjson::kObjectType); + // @param reading_information -- input_file -- numerical_atomic_orbitals_related rapidjson::Value nb2d; rapidjson::Value lmaxmax; rapidjson::Value lcao_ecut; @@ -92,8 +93,7 @@ namespace Para_Json rapidjson::Value bx; rapidjson::Value by; rapidjson::Value bz; - // @param reading_information -- input_para -- electronic_structure - rapidjson::Value electronic_structure(rapidjson::kObjectType); + // @param reading_information -- input_file -- electronic_structure rapidjson::Value basis_type; rapidjson::Value ks_solver; rapidjson::Value nbands; @@ -117,8 +117,7 @@ namespace Para_Json rapidjson::Value lspinorb; rapidjson::Value noncolin; rapidjson::Value soc_lambda; - // @param reading_information -- input_para -- electronic_structure_SDFT - rapidjson::Value electronic_structure_SDFT(rapidjson::kObjectType); + // @param reading_information -- input_file -- electronic_structure_SDFT rapidjson::Value method_sto; rapidjson::Value nbands_sto; rapidjson::Value nche_sto(rapidjson::kNumberType); @@ -127,8 +126,7 @@ namespace Para_Json rapidjson::Value seed_sto; rapidjson::Value initsto_freq; rapidjson::Value npart_sto; - // @param reading_information -- input_para -- geometry_relaxation - rapidjson::Value geometry_relaxation(rapidjson::kObjectType); + // @param reading_information -- input_file -- geometry_relaxation rapidjson::Value relax_method; rapidjson::Value relax_new; rapidjson::Value relax_scale_force; @@ -153,8 +151,7 @@ namespace Para_Json rapidjson::Value fixed_atoms; rapidjson::Value cell_factor; - // @param reading_information -- input_para -- output_information_related - rapidjson::Value output_information_related(rapidjson::kObjectType); + // @param reading_information -- input_file -- output_information_related rapidjson::Value out_mul; rapidjson::Value out_freq_elec; rapidjson::Value out_freq_ion; @@ -184,36 +181,32 @@ namespace Para_Json rapidjson::Value restart_load; rapidjson::Value rpa; - // @param reading_information -- input_para -- density_of_states - rapidjson::Value density_of_states(rapidjson::kObjectType); + // @param reading_information -- input_file -- density_of_states rapidjson::Value dos_edelta_ev; rapidjson::Value dos_sigma; rapidjson::Value dos_scale; rapidjson::Value dos_emin_ev; rapidjson::Value dos_emax_ev; rapidjson::Value dos_nche; - // @param reading_information -- input_para -- naos - rapidjson::Value naos(rapidjson::kObjectType); + // @param reading_information -- input_file -- naos rapidjson::Value bessel_nao_ecut; rapidjson::Value bessel_nao_tolerence; rapidjson::Value bessel_nao_rcut; rapidjson::Value bessel_nao_smooth; rapidjson::Value bessel_nao_sigma; - // @param reading_information -- input_para -- deepks - rapidjson::Value deepks(rapidjson::kObjectType); - rapidjson::Value deepks_out_labels; - rapidjson::Value deepks_scf; - rapidjson::Value deepks_model; + // @param reading_information -- input_file -- deepks + rapidjson::Value input_file_out_labels; + rapidjson::Value input_file_scf; + rapidjson::Value input_file_model; rapidjson::Value bessel_descriptor_lmax; rapidjson::Value bessel_descriptor_ecut; rapidjson::Value bessel_descriptor_tolerence; rapidjson::Value bessel_descriptor_rcut; rapidjson::Value bessel_descriptor_smooth; rapidjson::Value bessel_descriptor_sigma; - rapidjson::Value deepks_bandgap; - rapidjson::Value deepks_out_unittest; - // @param reading_information -- input_para -- ofdft - rapidjson::Value ofdft(rapidjson::kObjectType); + rapidjson::Value input_file_bandgap; + rapidjson::Value input_file_out_unittest; + // @param reading_information -- input_file -- ofdft rapidjson::Value of_kinetic; rapidjson::Value of_method; rapidjson::Value of_conv; @@ -231,24 +224,21 @@ namespace Para_Json rapidjson::Value of_full_pw; rapidjson::Value of_full_pw_dim; - // @param reading_information -- input_para -- electric_field_and_dipole_correction - rapidjson::Value electric_field_and_dipole_correction(rapidjson::kObjectType); + // @param reading_information -- input_file -- electric_field_and_dipole_correction rapidjson::Value efield_flag; rapidjson::Value dip_cor_flag; rapidjson::Value efield_dir; rapidjson::Value efield_pos_max; rapidjson::Value efield_pos_dec; rapidjson::Value efield_amp; - // @param reading_information -- input_para -- gate_field - rapidjson::Value gate_field(rapidjson::kObjectType); + // @param reading_information -- input_file -- gate_field rapidjson::Value gate_flag; rapidjson::Value zgate; rapidjson::Value block; rapidjson::Value block_down; rapidjson::Value block_up; rapidjson::Value block_height; - // @param reading_information -- input_para -- exact_exchange - rapidjson::Value exact_exchange(rapidjson::kObjectType); + // @param reading_information -- input_file -- exact_exchange rapidjson::Value exx_hybrid_alpha; rapidjson::Value exx_hse_omega; rapidjson::Value exx_separate_loop; @@ -273,8 +263,7 @@ namespace Para_Json rapidjson::Value exx_opt_orb_tolerence; rapidjson::Value exx_real_number; - // @param reading_information -- input_para -- molecular_dynamics - rapidjson::Value molecular_dynamics(rapidjson::kObjectType); + // @param reading_information -- input_file -- molecular_dynamics rapidjson::Value md_type; rapidjson::Value md_nstep; rapidjson::Value md_dt; @@ -313,16 +302,14 @@ namespace Para_Json rapidjson::Value cal_syns; rapidjson::Value dmax; - // @param reading_information -- input_para -- dft_plus_u - rapidjson::Value dft_plus_u(rapidjson::kObjectType); + // @param reading_information -- input_file -- dft_plus_u rapidjson::Value orbital_corr(rapidjson::kArrayType); rapidjson::Value hubbard_u(rapidjson::kArrayType); rapidjson::Value yukawa_potential; rapidjson::Value yukawa_lambda; rapidjson::Value omc; - // @param reading_information -- input_para -- vdw_correction - rapidjson::Value vdw_correction(rapidjson::kObjectType); + // @param reading_information -- input_file -- vdw_correction rapidjson::Value vdw_method; rapidjson::Value vdw_s6; rapidjson::Value vdw_s8; @@ -341,16 +328,14 @@ namespace Para_Json rapidjson::Value vdw_cn_thr; rapidjson::Value vdw_cn_thr_unit; - // @param reading_information -- input_para -- berry_phase_and_wannier90_interface - rapidjson::Value berry_phase_and_wannier90_interface(rapidjson::kObjectType); + // @param reading_information -- input_file -- berry_phase_and_wannier90_interface rapidjson::Value berry_phase; rapidjson::Value gdir; rapidjson::Value towannier90; rapidjson::Value nnkpfile; rapidjson::Value wannier_spin; - // @param reading_information -- input_para -- tddft - rapidjson::Value tddft(rapidjson::kObjectType); + // @param reading_information -- input_file -- tddft rapidjson::Value td_edm; rapidjson::Value td_print_eij; rapidjson::Value td_propagator; @@ -385,8 +370,7 @@ namespace Para_Json rapidjson::Value ocp; rapidjson::Value ocp_set; - // @param reading_information -- input_para -- debuging_related - rapidjson::Value debuging_related(rapidjson::kObjectType); + // @param reading_information -- input_file -- debuging_related rapidjson::Value t_in_h; rapidjson::Value vl_in_h; rapidjson::Value vnl_in_h; @@ -397,8 +381,7 @@ namespace Para_Json rapidjson::Value colour; rapidjson::Value test_skip_ewald; - // @param reading_information -- input_para -- electronic_conductivities - rapidjson::Value electronic_conductivities(rapidjson::kObjectType); + // @param reading_information -- input_file -- electronic_conductivities rapidjson::Value cal_cond; rapidjson::Value cond_nche; rapidjson::Value cond_dw; @@ -407,9 +390,7 @@ namespace Para_Json rapidjson::Value cond_dtbatch; rapidjson::Value cond_fwhm; rapidjson::Value cond_nonlocal; - - // @param reading_information -- input_para -- implicit_solvation_model - rapidjson::Value implicit_solvation_model(rapidjson::kObjectType); + // @param reading_information -- input_file -- implicit_solvation_model rapidjson::Value imp_sol; rapidjson::Value eb_k; rapidjson::Value tau; @@ -490,7 +471,12 @@ namespace Para_Json rapidjson::Value coordinate; + void Add_notNull_value(rapidjson::Value father,std::string name, rapidjson::Value son,rapidjson::Document doc){ + if(son.IsNull() || son == "" || son.Empty()) return ; + father.AddMember(name.c_str(), son, doc.GetAllocator()); + return; + } /** * The functions below initialize the json output parameter @@ -553,415 +539,421 @@ namespace Para_Json parallel.AddMember("dcolor", dcolor, doc.GetAllocator()); } - - + /** + * @brief delete null node + */ + void RemoveNullValues(rapidjson::Value& parent) { + if (parent.IsObject()) { + for (rapidjson::Value::MemberIterator itr = parent.MemberBegin(); itr != parent.MemberEnd(); ) { + if (itr->value.IsNull()) { + itr = parent.EraseMember(itr); + } else { + // delet son null node + RemoveNullValues(itr->value); + ++itr; + } + } + } else if (parent.IsArray()) { + for (int i = 0; i < parent.Size(); ) { + if (parent[i].IsNull()) { + parent.Erase(parent.Begin() + i); + } else { + // delet son null node + RemoveNullValues(parent[i]); + ++i; + } + } + } + } /** * @brief add Second stage:parameter in Abacus - readin_info: */ void Init_json_abacus_readinInfo(){ //add Third stage:parameter in system_variables: - system_variables.AddMember("suffix", input_suffix, doc.GetAllocator()); - system_variables.AddMember("ntype", ntype, doc.GetAllocator()); - system_variables.AddMember("calculation", calculation, doc.GetAllocator()); - system_variables.AddMember("esolver_type", esolver_type, doc.GetAllocator()); - system_variables.AddMember("symmetry", symmetry, doc.GetAllocator()); - system_variables.AddMember("symmetry_precfield", symmetry_precfield, doc.GetAllocator()); - system_variables.AddMember("symmetry_autoclose", symmetry_autoclose, doc.GetAllocator()); - system_variables.AddMember("kpar", kpar, doc.GetAllocator()); - system_variables.AddMember("bndpar", bndpar, doc.GetAllocator()); - system_variables.AddMember("latname", latname, doc.GetAllocator()); - system_variables.AddMember("init_wfc", init_wfc, doc.GetAllocator()); - system_variables.AddMember("init_chg", init_chg, doc.GetAllocator()); - system_variables.AddMember("init_vel", init_vel, doc.GetAllocator()); - system_variables.AddMember("nelec", nelec, doc.GetAllocator()); - system_variables.AddMember("nupdown", nupdown, doc.GetAllocator()); - system_variables.AddMember("dft_functional", dft_functional, doc.GetAllocator()); - system_variables.AddMember("xc_temperature", xc_temperature, doc.GetAllocator()); - system_variables.AddMember("pseudo_rcut", pseudo_rcut, doc.GetAllocator()); - system_variables.AddMember("pseudo_mesh", pseudo_mesh, doc.GetAllocator()); - system_variables.AddMember("mem_saver", mem_saver, doc.GetAllocator()); - system_variables.AddMember("diago_proc", diago_proc, doc.GetAllocator()); - system_variables.AddMember("nbspline", nbspline, doc.GetAllocator()); - system_variables.AddMember("kspacing", kspacing, doc.GetAllocator()); - system_variables.AddMember("min_dist_coef", min_dist_coef, doc.GetAllocator()); - system_variables.AddMember("device", device, doc.GetAllocator()); + input_file.AddMember("suffix", input_suffix, doc.GetAllocator()); + input_file.AddMember("ntype", ntype, doc.GetAllocator()); + input_file.AddMember("calculation", calculation, doc.GetAllocator()); + input_file.AddMember("esolver_type", esolver_type, doc.GetAllocator()); + input_file.AddMember("symmetry", symmetry, doc.GetAllocator()); + input_file.AddMember("symmetry_precfield", symmetry_precfield, doc.GetAllocator()); + input_file.AddMember("symmetry_autoclose", symmetry_autoclose, doc.GetAllocator()); + input_file.AddMember("kpar", kpar, doc.GetAllocator()); + input_file.AddMember("bndpar", bndpar, doc.GetAllocator()); + input_file.AddMember("latname", latname, doc.GetAllocator()); + input_file.AddMember("init_wfc", init_wfc, doc.GetAllocator()); + input_file.AddMember("init_chg", init_chg, doc.GetAllocator()); + input_file.AddMember("init_vel", init_vel, doc.GetAllocator()); + input_file.AddMember("nelec", nelec, doc.GetAllocator()); + input_file.AddMember("nupdown", nupdown, doc.GetAllocator()); + input_file.AddMember("dft_functional", dft_functional, doc.GetAllocator()); + input_file.AddMember("xc_temperature", xc_temperature, doc.GetAllocator()); + input_file.AddMember("pseudo_rcut", pseudo_rcut, doc.GetAllocator()); + input_file.AddMember("pseudo_mesh", pseudo_mesh, doc.GetAllocator()); + input_file.AddMember("mem_saver", mem_saver, doc.GetAllocator()); + input_file.AddMember("diago_proc", diago_proc, doc.GetAllocator()); + input_file.AddMember("nbspline", nbspline, doc.GetAllocator()); + input_file.AddMember("kspacing", kspacing, doc.GetAllocator()); + input_file.AddMember("min_dist_coef", min_dist_coef, doc.GetAllocator()); + input_file.AddMember("device", device, doc.GetAllocator()); //add Third stage:parameter in files_related: - files_related.AddMember("stru_file", stru_file, doc.GetAllocator()); - files_related.AddMember("kpoint_file", kpoint_file, doc.GetAllocator()); - files_related.AddMember("pseudo_dir", pseudo_dir, doc.GetAllocator()); - files_related.AddMember("orbital_dir", orbital_dir, doc.GetAllocator()); - files_related.AddMember("read_file_dir", read_file_dir, doc.GetAllocator()); - files_related.AddMember("wannier_card", wannier_card, doc.GetAllocator()); + input_file.AddMember("stru_file", stru_file, doc.GetAllocator()); + input_file.AddMember("kpoint_file", kpoint_file, doc.GetAllocator()); + input_file.AddMember("pseudo_dir", pseudo_dir, doc.GetAllocator()); + input_file.AddMember("orbital_dir", orbital_dir, doc.GetAllocator()); + input_file.AddMember("read_file_dir", read_file_dir, doc.GetAllocator()); + input_file.AddMember("wannier_card", wannier_card, doc.GetAllocator()); //add Third stage:parameter in planewave_related: - planewave_related.AddMember("ecutwfc", ecutwfc, doc.GetAllocator()); - planewave_related.AddMember("nx", nx, doc.GetAllocator()); - planewave_related.AddMember("ny", ny, doc.GetAllocator()); - planewave_related.AddMember("nz", nz, doc.GetAllocator()); - planewave_related.AddMember("pw_seed", pw_seed, doc.GetAllocator()); - planewave_related.AddMember("pw_diag_thr", pw_diag_thr, doc.GetAllocator()); - planewave_related.AddMember("pw_diag_nmax", pw_diag_nmax, doc.GetAllocator()); - planewave_related.AddMember("pw_diag_ndim", pw_diag_ndim, doc.GetAllocator()); + input_file.AddMember("ecutwfc", ecutwfc, doc.GetAllocator()); + input_file.AddMember("nx", nx, doc.GetAllocator()); + input_file.AddMember("ny", ny, doc.GetAllocator()); + input_file.AddMember("nz", nz, doc.GetAllocator()); + input_file.AddMember("pw_seed", pw_seed, doc.GetAllocator()); + input_file.AddMember("pw_diag_thr", pw_diag_thr, doc.GetAllocator()); + input_file.AddMember("pw_diag_nmax", pw_diag_nmax, doc.GetAllocator()); + input_file.AddMember("pw_diag_ndim", pw_diag_ndim, doc.GetAllocator()); //add Third stage:parameter in numerical_atomic_orbitals_related: - numerical_atomic_orbitals_related.AddMember("nb2d", nb2d, doc.GetAllocator()); - numerical_atomic_orbitals_related.AddMember("lmaxmax", lmaxmax, doc.GetAllocator()); - numerical_atomic_orbitals_related.AddMember("lcao_ecut", lcao_ecut, doc.GetAllocator()); - numerical_atomic_orbitals_related.AddMember("lcao_dk", lcao_dk, doc.GetAllocator()); - numerical_atomic_orbitals_related.AddMember("lcao_dr", lcao_dr, doc.GetAllocator()); - numerical_atomic_orbitals_related.AddMember("lcao_rmax", lcao_rmax, doc.GetAllocator()); - numerical_atomic_orbitals_related.AddMember("search_radius", search_radius, doc.GetAllocator()); - numerical_atomic_orbitals_related.AddMember("search_pbc", search_pbc, doc.GetAllocator()); - numerical_atomic_orbitals_related.AddMember("bx", bx, doc.GetAllocator()); - numerical_atomic_orbitals_related.AddMember("by", by, doc.GetAllocator()); - numerical_atomic_orbitals_related.AddMember("bz", bz, doc.GetAllocator()); + input_file.AddMember("nb2d", nb2d, doc.GetAllocator()); + input_file.AddMember("lmaxmax", lmaxmax, doc.GetAllocator()); + input_file.AddMember("lcao_ecut", lcao_ecut, doc.GetAllocator()); + input_file.AddMember("lcao_dk", lcao_dk, doc.GetAllocator()); + input_file.AddMember("lcao_dr", lcao_dr, doc.GetAllocator()); + input_file.AddMember("lcao_rmax", lcao_rmax, doc.GetAllocator()); + input_file.AddMember("search_radius", search_radius, doc.GetAllocator()); + input_file.AddMember("search_pbc", search_pbc, doc.GetAllocator()); + input_file.AddMember("bx", bx, doc.GetAllocator()); + input_file.AddMember("by", by, doc.GetAllocator()); + input_file.AddMember("bz", bz, doc.GetAllocator()); //add Third stage:parameter in electronic_structure: - electronic_structure.AddMember("basis_type", basis_type, doc.GetAllocator()); - electronic_structure.AddMember("ks_solver", ks_solver, doc.GetAllocator()); - electronic_structure.AddMember("nbands", nbands, doc.GetAllocator()); - electronic_structure.AddMember("nbands_istate", nbands_istate, doc.GetAllocator()); - electronic_structure.AddMember("nspin", nspin, doc.GetAllocator()); - electronic_structure.AddMember("smearing_method", smearing_method, doc.GetAllocator()); - electronic_structure.AddMember("smearing_sigma", smearing_sigma, doc.GetAllocator()); - electronic_structure.AddMember("smearing_sigma_temp", smearing_sigma_temp, doc.GetAllocator()); - electronic_structure.AddMember("mixing_type", mixing_type, doc.GetAllocator()); - electronic_structure.AddMember("mixing_beta", mixing_beta, doc.GetAllocator()); - electronic_structure.AddMember("mixing_ndim", mixing_ndim, doc.GetAllocator()); - electronic_structure.AddMember("mixing_gg0", mixing_gg0, doc.GetAllocator()); - electronic_structure.AddMember("mixing_tau", mixing_tau, doc.GetAllocator()); - electronic_structure.AddMember("mixing_dftu", mixing_dftu, doc.GetAllocator()); - electronic_structure.AddMember("gamma_only", gamma_only, doc.GetAllocator()); - electronic_structure.AddMember("printe", printe, doc.GetAllocator()); - electronic_structure.AddMember("scf_nmax", scf_nmax, doc.GetAllocator()); - electronic_structure.AddMember("scf_thr", scf_thr, doc.GetAllocator()); - electronic_structure.AddMember("scf_thr_type", scf_thr_type, doc.GetAllocator()); - electronic_structure.AddMember("chg_extrap", chg_extrap, doc.GetAllocator()); - electronic_structure.AddMember("lspinorb", lspinorb, doc.GetAllocator()); - electronic_structure.AddMember("noncolin", noncolin, doc.GetAllocator()); - electronic_structure.AddMember("soc_lambda", soc_lambda, doc.GetAllocator()); + input_file.AddMember("basis_type", basis_type, doc.GetAllocator()); + input_file.AddMember("ks_solver", ks_solver, doc.GetAllocator()); + input_file.AddMember("nbands", nbands, doc.GetAllocator()); + input_file.AddMember("nbands_istate", nbands_istate, doc.GetAllocator()); + input_file.AddMember("nspin", nspin, doc.GetAllocator()); + input_file.AddMember("smearing_method", smearing_method, doc.GetAllocator()); + input_file.AddMember("smearing_sigma", smearing_sigma, doc.GetAllocator()); + input_file.AddMember("smearing_sigma_temp", smearing_sigma_temp, doc.GetAllocator()); + input_file.AddMember("mixing_type", mixing_type, doc.GetAllocator()); + input_file.AddMember("mixing_beta", mixing_beta, doc.GetAllocator()); + input_file.AddMember("mixing_ndim", mixing_ndim, doc.GetAllocator()); + input_file.AddMember("mixing_gg0", mixing_gg0, doc.GetAllocator()); + input_file.AddMember("mixing_tau", mixing_tau, doc.GetAllocator()); + input_file.AddMember("mixing_dftu", mixing_dftu, doc.GetAllocator()); + input_file.AddMember("gamma_only", gamma_only, doc.GetAllocator()); + input_file.AddMember("printe", printe, doc.GetAllocator()); + input_file.AddMember("scf_nmax", scf_nmax, doc.GetAllocator()); + input_file.AddMember("scf_thr", scf_thr, doc.GetAllocator()); + input_file.AddMember("scf_thr_type", scf_thr_type, doc.GetAllocator()); + input_file.AddMember("chg_extrap", chg_extrap, doc.GetAllocator()); + input_file.AddMember("lspinorb", lspinorb, doc.GetAllocator()); + input_file.AddMember("noncolin", noncolin, doc.GetAllocator()); + input_file.AddMember("soc_lambda", soc_lambda, doc.GetAllocator()); //add Third stage:parameter in electronic_structure_SDFT: - electronic_structure_SDFT.AddMember("method_sto", method_sto, doc.GetAllocator()); - electronic_structure_SDFT.AddMember("nbands_sto", nbands_sto, doc.GetAllocator()); - electronic_structure_SDFT.AddMember("nche_sto", nche_sto, doc.GetAllocator()); - electronic_structure_SDFT.AddMember("emin_sto", emin_sto, doc.GetAllocator()); - electronic_structure_SDFT.AddMember("emax_sto", emax_sto, doc.GetAllocator()); - electronic_structure_SDFT.AddMember("seed_sto", seed_sto, doc.GetAllocator()); - electronic_structure_SDFT.AddMember("initsto_freq", initsto_freq, doc.GetAllocator()); - electronic_structure_SDFT.AddMember("npart_sto", npart_sto, doc.GetAllocator()); + input_file.AddMember("method_sto", method_sto, doc.GetAllocator()); + input_file.AddMember("nbands_sto", nbands_sto, doc.GetAllocator()); + input_file.AddMember("nche_sto", nche_sto, doc.GetAllocator()); + input_file.AddMember("emin_sto", emin_sto, doc.GetAllocator()); + input_file.AddMember("emax_sto", emax_sto, doc.GetAllocator()); + input_file.AddMember("seed_sto", seed_sto, doc.GetAllocator()); + input_file.AddMember("initsto_freq", initsto_freq, doc.GetAllocator()); + input_file.AddMember("npart_sto", npart_sto, doc.GetAllocator()); //add Third stage:parameter in geometry_relaxation: - geometry_relaxation.AddMember("relax_method", relax_method, doc.GetAllocator()); - geometry_relaxation.AddMember("relax_new", relax_new, doc.GetAllocator()); - geometry_relaxation.AddMember("relax_scale_force", relax_scale_force, doc.GetAllocator()); - geometry_relaxation.AddMember("relax_nmax", relax_nmax, doc.GetAllocator()); - geometry_relaxation.AddMember("relax_cg_thr", relax_cg_thr, doc.GetAllocator()); - geometry_relaxation.AddMember("cal_force", cal_force, doc.GetAllocator()); - geometry_relaxation.AddMember("force_thr", force_thr, doc.GetAllocator()); - geometry_relaxation.AddMember("force_thr_ev", force_thr_ev, doc.GetAllocator()); - geometry_relaxation.AddMember("force_thr_ev2", force_thr_ev2, doc.GetAllocator()); - geometry_relaxation.AddMember("relax_bfgs_w1", relax_bfgs_w1, doc.GetAllocator()); - geometry_relaxation.AddMember("relax_bfgs_w2", relax_bfgs_w2, doc.GetAllocator()); - geometry_relaxation.AddMember("relax_bfgs_rmax", relax_bfgs_rmax, doc.GetAllocator()); - geometry_relaxation.AddMember("relax_bfgs_rmin", relax_bfgs_rmin, doc.GetAllocator()); - geometry_relaxation.AddMember("relax_bfgs_init", relax_bfgs_init, doc.GetAllocator()); - geometry_relaxation.AddMember("cal_stress", cal_stress, doc.GetAllocator()); - geometry_relaxation.AddMember("stress_thr", stress_thr, doc.GetAllocator()); - geometry_relaxation.AddMember("press1", press1, doc.GetAllocator()); - geometry_relaxation.AddMember("press2", press2, doc.GetAllocator()); - geometry_relaxation.AddMember("press3", press3, doc.GetAllocator()); - geometry_relaxation.AddMember("fixed_axes", fixed_axes, doc.GetAllocator()); - geometry_relaxation.AddMember("fixed_ibrav", fixed_ibrav, doc.GetAllocator()); - geometry_relaxation.AddMember("fixed_atoms", fixed_atoms, doc.GetAllocator()); - geometry_relaxation.AddMember("cell_factor", cell_factor, doc.GetAllocator()); + input_file.AddMember("relax_method", relax_method, doc.GetAllocator()); + input_file.AddMember("relax_new", relax_new, doc.GetAllocator()); + input_file.AddMember("relax_scale_force", relax_scale_force, doc.GetAllocator()); + input_file.AddMember("relax_nmax", relax_nmax, doc.GetAllocator()); + input_file.AddMember("relax_cg_thr", relax_cg_thr, doc.GetAllocator()); + input_file.AddMember("cal_force", cal_force, doc.GetAllocator()); + input_file.AddMember("force_thr", force_thr, doc.GetAllocator()); + input_file.AddMember("force_thr_ev", force_thr_ev, doc.GetAllocator()); + input_file.AddMember("force_thr_ev2", force_thr_ev2, doc.GetAllocator()); + input_file.AddMember("relax_bfgs_w1", relax_bfgs_w1, doc.GetAllocator()); + input_file.AddMember("relax_bfgs_w2", relax_bfgs_w2, doc.GetAllocator()); + input_file.AddMember("relax_bfgs_rmax", relax_bfgs_rmax, doc.GetAllocator()); + input_file.AddMember("relax_bfgs_rmin", relax_bfgs_rmin, doc.GetAllocator()); + input_file.AddMember("relax_bfgs_init", relax_bfgs_init, doc.GetAllocator()); + input_file.AddMember("cal_stress", cal_stress, doc.GetAllocator()); + input_file.AddMember("stress_thr", stress_thr, doc.GetAllocator()); + input_file.AddMember("press1", press1, doc.GetAllocator()); + input_file.AddMember("press2", press2, doc.GetAllocator()); + input_file.AddMember("press3", press3, doc.GetAllocator()); + input_file.AddMember("fixed_axes", fixed_axes, doc.GetAllocator()); + input_file.AddMember("fixed_ibrav", fixed_ibrav, doc.GetAllocator()); + input_file.AddMember("fixed_atoms", fixed_atoms, doc.GetAllocator()); + input_file.AddMember("cell_factor", cell_factor, doc.GetAllocator()); //add Third stage:parameter in output_information_related: - output_information_related.AddMember("out_mul", out_mul, doc.GetAllocator()); - output_information_related.AddMember("out_freq_elec", out_freq_elec, doc.GetAllocator()); - output_information_related.AddMember("out_freq_ion", out_freq_ion, doc.GetAllocator()); - output_information_related.AddMember("out_chg", out_chg, doc.GetAllocator()); - output_information_related.AddMember("out_pot", out_pot, doc.GetAllocator()); - output_information_related.AddMember("out_dm", out_dm, doc.GetAllocator()); - output_information_related.AddMember("out_dm1", out_dm1, doc.GetAllocator()); - output_information_related.AddMember("out_wfc_pw", out_wfc_pw, doc.GetAllocator()); - output_information_related.AddMember("out_wfc_r", out_wfc_r, doc.GetAllocator()); - output_information_related.AddMember("out_wfc_lcao", out_wfc_lcao, doc.GetAllocator()); - output_information_related.AddMember("out_dos", out_dos, doc.GetAllocator()); - output_information_related.AddMember("out_band", out_band, doc.GetAllocator()); - output_information_related.AddMember("out_proj_band", out_proj_band, doc.GetAllocator()); - output_information_related.AddMember("out_stru", out_stru, doc.GetAllocator()); - output_information_related.AddMember("out_bandgap", out_bandgap, doc.GetAllocator()); - output_information_related.AddMember("out_level", out_level, doc.GetAllocator()); - output_information_related.AddMember("out_alllog", out_alllog, doc.GetAllocator()); - output_information_related.AddMember("out_mat_hs", out_mat_hs, doc.GetAllocator()); - output_information_related.AddMember("out_mat_r", out_mat_r, doc.GetAllocator()); - output_information_related.AddMember("out_mat_hs2", out_mat_hs2, doc.GetAllocator()); - output_information_related.AddMember("out_mat_t", out_mat_t, doc.GetAllocator()); - output_information_related.AddMember("out_mat_dh", out_mat_dh, doc.GetAllocator()); - output_information_related.AddMember("out_app_flag", out_app_flag, doc.GetAllocator()); - output_information_related.AddMember("out_interval", out_interval, doc.GetAllocator()); - output_information_related.AddMember("out_element_info", out_element_info, doc.GetAllocator()); - output_information_related.AddMember("restart_save", restart_save, doc.GetAllocator()); - output_information_related.AddMember("restart_load", restart_load, doc.GetAllocator()); - output_information_related.AddMember("rpa", rpa, doc.GetAllocator()); + input_file.AddMember("out_mul", out_mul, doc.GetAllocator()); + input_file.AddMember("out_freq_elec", out_freq_elec, doc.GetAllocator()); + input_file.AddMember("out_freq_ion", out_freq_ion, doc.GetAllocator()); + input_file.AddMember("out_chg", out_chg, doc.GetAllocator()); + input_file.AddMember("out_pot", out_pot, doc.GetAllocator()); + input_file.AddMember("out_dm", out_dm, doc.GetAllocator()); + input_file.AddMember("out_dm1", out_dm1, doc.GetAllocator()); + input_file.AddMember("out_wfc_pw", out_wfc_pw, doc.GetAllocator()); + input_file.AddMember("out_wfc_r", out_wfc_r, doc.GetAllocator()); + input_file.AddMember("out_wfc_lcao", out_wfc_lcao, doc.GetAllocator()); + input_file.AddMember("out_dos", out_dos, doc.GetAllocator()); + input_file.AddMember("out_band", out_band, doc.GetAllocator()); + input_file.AddMember("out_proj_band", out_proj_band, doc.GetAllocator()); + input_file.AddMember("out_stru", out_stru, doc.GetAllocator()); + input_file.AddMember("out_bandgap", out_bandgap, doc.GetAllocator()); + input_file.AddMember("out_level", out_level, doc.GetAllocator()); + input_file.AddMember("out_alllog", out_alllog, doc.GetAllocator()); + input_file.AddMember("out_mat_hs", out_mat_hs, doc.GetAllocator()); + input_file.AddMember("out_mat_r", out_mat_r, doc.GetAllocator()); + input_file.AddMember("out_mat_hs2", out_mat_hs2, doc.GetAllocator()); + input_file.AddMember("out_mat_t", out_mat_t, doc.GetAllocator()); + input_file.AddMember("out_mat_dh", out_mat_dh, doc.GetAllocator()); + input_file.AddMember("out_app_flag", out_app_flag, doc.GetAllocator()); + input_file.AddMember("out_interval", out_interval, doc.GetAllocator()); + input_file.AddMember("out_element_info", out_element_info, doc.GetAllocator()); + input_file.AddMember("restart_save", restart_save, doc.GetAllocator()); + input_file.AddMember("restart_load", restart_load, doc.GetAllocator()); + input_file.AddMember("rpa", rpa, doc.GetAllocator()); //add Third stage:parameter in density_of_states: - density_of_states.AddMember("dos_edelta_ev", dos_edelta_ev, doc.GetAllocator()); - density_of_states.AddMember("dos_sigma", dos_sigma, doc.GetAllocator()); - density_of_states.AddMember("dos_scale", dos_scale, doc.GetAllocator()); - density_of_states.AddMember("dos_emin_ev", dos_emin_ev, doc.GetAllocator()); - density_of_states.AddMember("dos_emax_ev", dos_emax_ev, doc.GetAllocator()); - density_of_states.AddMember("dos_nche", dos_nche, doc.GetAllocator()); + input_file.AddMember("dos_edelta_ev", dos_edelta_ev, doc.GetAllocator()); + input_file.AddMember("dos_sigma", dos_sigma, doc.GetAllocator()); + input_file.AddMember("dos_scale", dos_scale, doc.GetAllocator()); + input_file.AddMember("dos_emin_ev", dos_emin_ev, doc.GetAllocator()); + input_file.AddMember("dos_emax_ev", dos_emax_ev, doc.GetAllocator()); + input_file.AddMember("dos_nche", dos_nche, doc.GetAllocator()); //add Third stage:parameter in naos: - naos.AddMember("bessel_nao_ecut", bessel_nao_ecut, doc.GetAllocator()); - naos.AddMember("bessel_nao_tolerence", bessel_nao_tolerence, doc.GetAllocator()); - naos.AddMember("bessel_nao_rcut", bessel_nao_rcut, doc.GetAllocator()); - naos.AddMember("bessel_nao_smooth", bessel_nao_smooth, doc.GetAllocator()); - naos.AddMember("bessel_nao_sigma", bessel_nao_sigma, doc.GetAllocator()); + input_file.AddMember("bessel_nao_ecut", bessel_nao_ecut, doc.GetAllocator()); + input_file.AddMember("bessel_nao_tolerence", bessel_nao_tolerence, doc.GetAllocator()); + input_file.AddMember("bessel_nao_rcut", bessel_nao_rcut, doc.GetAllocator()); + input_file.AddMember("bessel_nao_smooth", bessel_nao_smooth, doc.GetAllocator()); + input_file.AddMember("bessel_nao_sigma", bessel_nao_sigma, doc.GetAllocator()); //add Third stage:parameter in deepks: - deepks.AddMember("deepks_out_labels", deepks_out_labels, doc.GetAllocator()); - deepks.AddMember("deepks_scf", deepks_scf, doc.GetAllocator()); - deepks.AddMember("deepks_model", deepks_model, doc.GetAllocator()); - deepks.AddMember("bessel_descriptor_lmax", bessel_descriptor_lmax, doc.GetAllocator()); - deepks.AddMember("bessel_descriptor_ecut", bessel_descriptor_ecut, doc.GetAllocator()); - deepks.AddMember("bessel_descriptor_tolerence", bessel_descriptor_tolerence, doc.GetAllocator()); - deepks.AddMember("bessel_descriptor_rcut", bessel_descriptor_rcut, doc.GetAllocator()); - deepks.AddMember("bessel_descriptor_smooth", bessel_descriptor_smooth, doc.GetAllocator()); - deepks.AddMember("bessel_descriptor_sigma", bessel_descriptor_sigma, doc.GetAllocator()); - deepks.AddMember("deepks_bandgap", deepks_bandgap, doc.GetAllocator()); - deepks.AddMember("deepks_out_unittest", deepks_out_unittest, doc.GetAllocator()); + input_file.AddMember("input_file_out_labels", input_file_out_labels, doc.GetAllocator()); + input_file.AddMember("input_file_scf", input_file_scf, doc.GetAllocator()); + input_file.AddMember("input_file_model", input_file_model, doc.GetAllocator()); + input_file.AddMember("bessel_descriptor_lmax", bessel_descriptor_lmax, doc.GetAllocator()); + input_file.AddMember("bessel_descriptor_ecut", bessel_descriptor_ecut, doc.GetAllocator()); + input_file.AddMember("bessel_descriptor_tolerence", bessel_descriptor_tolerence, doc.GetAllocator()); + input_file.AddMember("bessel_descriptor_rcut", bessel_descriptor_rcut, doc.GetAllocator()); + input_file.AddMember("bessel_descriptor_smooth", bessel_descriptor_smooth, doc.GetAllocator()); + input_file.AddMember("bessel_descriptor_sigma", bessel_descriptor_sigma, doc.GetAllocator()); + input_file.AddMember("input_file_bandgap", input_file_bandgap, doc.GetAllocator()); + input_file.AddMember("input_file_out_unittest", input_file_out_unittest, doc.GetAllocator()); //add Third stage:parameter in ofdft: - ofdft.AddMember("of_kinetic", of_kinetic, doc.GetAllocator()); - ofdft.AddMember("of_method", of_method, doc.GetAllocator()); - ofdft.AddMember("of_conv", of_conv, doc.GetAllocator()); - ofdft.AddMember("of_tole", of_tole, doc.GetAllocator()); - ofdft.AddMember("of_tolp", of_tolp, doc.GetAllocator()); - ofdft.AddMember("of_tf_weight", of_tf_weight, doc.GetAllocator()); - ofdft.AddMember("of_vw_weight", of_vw_weight, doc.GetAllocator()); - ofdft.AddMember("of_wt_alpha", of_wt_alpha, doc.GetAllocator()); - ofdft.AddMember("of_wt_beta", of_wt_beta, doc.GetAllocator()); - ofdft.AddMember("of_wt_rho0", of_wt_rho0, doc.GetAllocator()); - ofdft.AddMember("of_hold_rho0", of_hold_rho0, doc.GetAllocator()); - ofdft.AddMember("of_lkt_a", of_lkt_a, doc.GetAllocator()); - ofdft.AddMember("of_read_kernel", of_read_kernel, doc.GetAllocator()); - ofdft.AddMember("of_kernel_file", of_kernel_file, doc.GetAllocator()); - ofdft.AddMember("of_full_pw", of_full_pw, doc.GetAllocator()); - ofdft.AddMember("of_full_pw_dim", of_full_pw_dim, doc.GetAllocator()); + input_file.AddMember("of_kinetic", of_kinetic, doc.GetAllocator()); + input_file.AddMember("of_method", of_method, doc.GetAllocator()); + input_file.AddMember("of_conv", of_conv, doc.GetAllocator()); + input_file.AddMember("of_tole", of_tole, doc.GetAllocator()); + input_file.AddMember("of_tolp", of_tolp, doc.GetAllocator()); + input_file.AddMember("of_tf_weight", of_tf_weight, doc.GetAllocator()); + input_file.AddMember("of_vw_weight", of_vw_weight, doc.GetAllocator()); + input_file.AddMember("of_wt_alpha", of_wt_alpha, doc.GetAllocator()); + input_file.AddMember("of_wt_beta", of_wt_beta, doc.GetAllocator()); + input_file.AddMember("of_wt_rho0", of_wt_rho0, doc.GetAllocator()); + input_file.AddMember("of_hold_rho0", of_hold_rho0, doc.GetAllocator()); + input_file.AddMember("of_lkt_a", of_lkt_a, doc.GetAllocator()); + input_file.AddMember("of_read_kernel", of_read_kernel, doc.GetAllocator()); + input_file.AddMember("of_kernel_file", of_kernel_file, doc.GetAllocator()); + input_file.AddMember("of_full_pw", of_full_pw, doc.GetAllocator()); + input_file.AddMember("of_full_pw_dim", of_full_pw_dim, doc.GetAllocator()); //add Third stage:parameter in electric_field_and_dipole_correction: - electric_field_and_dipole_correction.AddMember("efield_flag", efield_flag, doc.GetAllocator()); - electric_field_and_dipole_correction.AddMember("dip_cor_flag", dip_cor_flag, doc.GetAllocator()); - electric_field_and_dipole_correction.AddMember("efield_dir", efield_dir, doc.GetAllocator()); - electric_field_and_dipole_correction.AddMember("efield_pos_max", efield_pos_max, doc.GetAllocator()); - electric_field_and_dipole_correction.AddMember("efield_pos_dec", efield_pos_dec, doc.GetAllocator()); - electric_field_and_dipole_correction.AddMember("efield_amp", efield_amp, doc.GetAllocator()); + input_file.AddMember("efield_flag", efield_flag, doc.GetAllocator()); + input_file.AddMember("dip_cor_flag", dip_cor_flag, doc.GetAllocator()); + input_file.AddMember("efield_dir", efield_dir, doc.GetAllocator()); + input_file.AddMember("efield_pos_max", efield_pos_max, doc.GetAllocator()); + input_file.AddMember("efield_pos_dec", efield_pos_dec, doc.GetAllocator()); + input_file.AddMember("efield_amp", efield_amp, doc.GetAllocator()); //add Third stage:parameter in gate_field: - gate_field.AddMember("gate_flag", gate_flag, doc.GetAllocator()); - gate_field.AddMember("zgate", zgate, doc.GetAllocator()); - gate_field.AddMember("block", block, doc.GetAllocator()); - gate_field.AddMember("block_down", block_down, doc.GetAllocator()); - gate_field.AddMember("block_up", block_up, doc.GetAllocator()); - gate_field.AddMember("block_height", block_height, doc.GetAllocator()); + input_file.AddMember("gate_flag", gate_flag, doc.GetAllocator()); + input_file.AddMember("zgate", zgate, doc.GetAllocator()); + input_file.AddMember("block", block, doc.GetAllocator()); + input_file.AddMember("block_down", block_down, doc.GetAllocator()); + input_file.AddMember("block_up", block_up, doc.GetAllocator()); + input_file.AddMember("block_height", block_height, doc.GetAllocator()); //add Third stage:parameter in exact_exchange: - exact_exchange.AddMember("exx_hybrid_alpha", exx_hybrid_alpha, doc.GetAllocator()); - exact_exchange.AddMember("exx_hse_omega", exx_hse_omega, doc.GetAllocator()); - exact_exchange.AddMember("exx_separate_loop", exx_separate_loop, doc.GetAllocator()); - exact_exchange.AddMember("exx_hybrid_step", exx_hybrid_step, doc.GetAllocator()); - exact_exchange.AddMember("exx_mixing_beta", exx_mixing_beta, doc.GetAllocator()); - exact_exchange.AddMember("exx_lambda", exx_lambda, doc.GetAllocator()); - exact_exchange.AddMember("exx_pca_threshold", exx_pca_threshold, doc.GetAllocator()); - exact_exchange.AddMember("exx_c_threshold", exx_c_threshold, doc.GetAllocator()); - exact_exchange.AddMember("exx_v_threshold", exx_v_threshold, doc.GetAllocator()); - exact_exchange.AddMember("exx_dm_threshold", exx_dm_threshold, doc.GetAllocator()); - exact_exchange.AddMember("exx_c_grad_threshold", exx_c_grad_threshold, doc.GetAllocator()); - exact_exchange.AddMember("exx_v_grad_threshold", exx_v_grad_threshold, doc.GetAllocator()); - exact_exchange.AddMember("exx_schwarz_threshold", exx_schwarz_threshold, doc.GetAllocator()); - exact_exchange.AddMember("exx_cauchy_threshold", exx_cauchy_threshold, doc.GetAllocator()); - exact_exchange.AddMember("exx_cauchy_force_threshold", exx_cauchy_force_threshold, doc.GetAllocator()); - exact_exchange.AddMember("exx_cauchy_stress_threshold", exx_cauchy_stress_threshold, doc.GetAllocator()); - exact_exchange.AddMember("exx_ccp_threshold", exx_ccp_threshold, doc.GetAllocator()); - exact_exchange.AddMember("exx_ccp_rmesh_times", exx_ccp_rmesh_times, doc.GetAllocator()); - exact_exchange.AddMember("exx_distribute_type", exx_distribute_type, doc.GetAllocator()); - exact_exchange.AddMember("exx_opt_orb_lmax", exx_opt_orb_lmax, doc.GetAllocator()); - exact_exchange.AddMember("exx_opt_orb_ecut", exx_opt_orb_ecut, doc.GetAllocator()); - exact_exchange.AddMember("exx_opt_orb_tolerence", exx_opt_orb_tolerence, doc.GetAllocator()); - exact_exchange.AddMember("exx_real_number", exx_real_number, doc.GetAllocator()); + input_file.AddMember("exx_hybrid_alpha", exx_hybrid_alpha, doc.GetAllocator()); + input_file.AddMember("exx_hse_omega", exx_hse_omega, doc.GetAllocator()); + input_file.AddMember("exx_separate_loop", exx_separate_loop, doc.GetAllocator()); + input_file.AddMember("exx_hybrid_step", exx_hybrid_step, doc.GetAllocator()); + input_file.AddMember("exx_mixing_beta", exx_mixing_beta, doc.GetAllocator()); + input_file.AddMember("exx_lambda", exx_lambda, doc.GetAllocator()); + input_file.AddMember("exx_pca_threshold", exx_pca_threshold, doc.GetAllocator()); + input_file.AddMember("exx_c_threshold", exx_c_threshold, doc.GetAllocator()); + input_file.AddMember("exx_v_threshold", exx_v_threshold, doc.GetAllocator()); + input_file.AddMember("exx_dm_threshold", exx_dm_threshold, doc.GetAllocator()); + input_file.AddMember("exx_c_grad_threshold", exx_c_grad_threshold, doc.GetAllocator()); + input_file.AddMember("exx_v_grad_threshold", exx_v_grad_threshold, doc.GetAllocator()); + input_file.AddMember("exx_schwarz_threshold", exx_schwarz_threshold, doc.GetAllocator()); + input_file.AddMember("exx_cauchy_threshold", exx_cauchy_threshold, doc.GetAllocator()); + input_file.AddMember("exx_cauchy_force_threshold", exx_cauchy_force_threshold, doc.GetAllocator()); + input_file.AddMember("exx_cauchy_stress_threshold", exx_cauchy_stress_threshold, doc.GetAllocator()); + input_file.AddMember("exx_ccp_threshold", exx_ccp_threshold, doc.GetAllocator()); + input_file.AddMember("exx_ccp_rmesh_times", exx_ccp_rmesh_times, doc.GetAllocator()); + input_file.AddMember("exx_distribute_type", exx_distribute_type, doc.GetAllocator()); + input_file.AddMember("exx_opt_orb_lmax", exx_opt_orb_lmax, doc.GetAllocator()); + input_file.AddMember("exx_opt_orb_ecut", exx_opt_orb_ecut, doc.GetAllocator()); + input_file.AddMember("exx_opt_orb_tolerence", exx_opt_orb_tolerence, doc.GetAllocator()); + input_file.AddMember("exx_real_number", exx_real_number, doc.GetAllocator()); //add Third stage:parameter in molecular_dynamics: - molecular_dynamics.AddMember("md_type", md_type, doc.GetAllocator()); - molecular_dynamics.AddMember("md_nstep", md_nstep, doc.GetAllocator()); - molecular_dynamics.AddMember("md_dt", md_dt, doc.GetAllocator()); - molecular_dynamics.AddMember("md_thermostat", md_thermostat, doc.GetAllocator()); - molecular_dynamics.AddMember("md_tlast", md_tlast, doc.GetAllocator()); - molecular_dynamics.AddMember("md_tfirst", md_tfirst, doc.GetAllocator()); - molecular_dynamics.AddMember("md_restart", md_restart, doc.GetAllocator()); - molecular_dynamics.AddMember("md_restartfreq", md_restartfreq, doc.GetAllocator()); - molecular_dynamics.AddMember("md_dumpfreq", md_dumpfreq, doc.GetAllocator()); - molecular_dynamics.AddMember("dump_force", dump_force, doc.GetAllocator()); - molecular_dynamics.AddMember("dump_vel", dump_vel, doc.GetAllocator()); - molecular_dynamics.AddMember("dump_virial", dump_virial, doc.GetAllocator()); - molecular_dynamics.AddMember("md_seed", md_seed, doc.GetAllocator()); - molecular_dynamics.AddMember("md_tfreq", md_tfreq, doc.GetAllocator()); - molecular_dynamics.AddMember("md_tchain", md_tchain, doc.GetAllocator()); - molecular_dynamics.AddMember("md_pmode", md_pmode, doc.GetAllocator()); - molecular_dynamics.AddMember("md_prec_level", md_prec_level, doc.GetAllocator()); - molecular_dynamics.AddMember("ref_cell_factor", ref_cell_factor, doc.GetAllocator()); - molecular_dynamics.AddMember("md_pcouple", md_pcouple, doc.GetAllocator()); - molecular_dynamics.AddMember("md_pfirst", md_pfirst, doc.GetAllocator()); - molecular_dynamics.AddMember("md_plast", md_plast, doc.GetAllocator()); - molecular_dynamics.AddMember("md_pfreq", md_pfreq, doc.GetAllocator()); - molecular_dynamics.AddMember("md_pchain", md_pchain, doc.GetAllocator()); - molecular_dynamics.AddMember("lj_rcut", lj_rcut, doc.GetAllocator()); - molecular_dynamics.AddMember("lj_epsilon", lj_epsilon, doc.GetAllocator()); - molecular_dynamics.AddMember("lj_sigma", lj_sigma, doc.GetAllocator()); - molecular_dynamics.AddMember("pot_file", pot_file, doc.GetAllocator()); - molecular_dynamics.AddMember("msst_direction", msst_direction, doc.GetAllocator()); - molecular_dynamics.AddMember("msst_vel", msst_vel, doc.GetAllocator()); - molecular_dynamics.AddMember("msst_vis", msst_vis, doc.GetAllocator()); - molecular_dynamics.AddMember("msst_tscale", msst_tscale, doc.GetAllocator()); - molecular_dynamics.AddMember("msst_qmass", msst_qmass, doc.GetAllocator()); - molecular_dynamics.AddMember("md_damp", md_damp, doc.GetAllocator()); - molecular_dynamics.AddMember("md_tolerance", md_tolerance, doc.GetAllocator()); - molecular_dynamics.AddMember("md_nraise", md_nraise, doc.GetAllocator()); - molecular_dynamics.AddMember("cal_syns", cal_syns, doc.GetAllocator()); - molecular_dynamics.AddMember("dmax", dmax, doc.GetAllocator()); + input_file.AddMember("md_type", md_type, doc.GetAllocator()); + input_file.AddMember("md_nstep", md_nstep, doc.GetAllocator()); + input_file.AddMember("md_dt", md_dt, doc.GetAllocator()); + input_file.AddMember("md_thermostat", md_thermostat, doc.GetAllocator()); + input_file.AddMember("md_tlast", md_tlast, doc.GetAllocator()); + input_file.AddMember("md_tfirst", md_tfirst, doc.GetAllocator()); + input_file.AddMember("md_restart", md_restart, doc.GetAllocator()); + input_file.AddMember("md_restartfreq", md_restartfreq, doc.GetAllocator()); + input_file.AddMember("md_dumpfreq", md_dumpfreq, doc.GetAllocator()); + input_file.AddMember("dump_force", dump_force, doc.GetAllocator()); + input_file.AddMember("dump_vel", dump_vel, doc.GetAllocator()); + input_file.AddMember("dump_virial", dump_virial, doc.GetAllocator()); + input_file.AddMember("md_seed", md_seed, doc.GetAllocator()); + input_file.AddMember("md_tfreq", md_tfreq, doc.GetAllocator()); + input_file.AddMember("md_tchain", md_tchain, doc.GetAllocator()); + input_file.AddMember("md_pmode", md_pmode, doc.GetAllocator()); + input_file.AddMember("md_prec_level", md_prec_level, doc.GetAllocator()); + input_file.AddMember("ref_cell_factor", ref_cell_factor, doc.GetAllocator()); + input_file.AddMember("md_pcouple", md_pcouple, doc.GetAllocator()); + input_file.AddMember("md_pfirst", md_pfirst, doc.GetAllocator()); + input_file.AddMember("md_plast", md_plast, doc.GetAllocator()); + input_file.AddMember("md_pfreq", md_pfreq, doc.GetAllocator()); + input_file.AddMember("md_pchain", md_pchain, doc.GetAllocator()); + input_file.AddMember("lj_rcut", lj_rcut, doc.GetAllocator()); + input_file.AddMember("lj_epsilon", lj_epsilon, doc.GetAllocator()); + input_file.AddMember("lj_sigma", lj_sigma, doc.GetAllocator()); + input_file.AddMember("pot_file", pot_file, doc.GetAllocator()); + input_file.AddMember("msst_direction", msst_direction, doc.GetAllocator()); + input_file.AddMember("msst_vel", msst_vel, doc.GetAllocator()); + input_file.AddMember("msst_vis", msst_vis, doc.GetAllocator()); + input_file.AddMember("msst_tscale", msst_tscale, doc.GetAllocator()); + input_file.AddMember("msst_qmass", msst_qmass, doc.GetAllocator()); + input_file.AddMember("md_damp", md_damp, doc.GetAllocator()); + input_file.AddMember("md_tolerance", md_tolerance, doc.GetAllocator()); + input_file.AddMember("md_nraise", md_nraise, doc.GetAllocator()); + input_file.AddMember("cal_syns", cal_syns, doc.GetAllocator()); + input_file.AddMember("dmax", dmax, doc.GetAllocator()); //add Third stage:parameter in dft_plus_u: - dft_plus_u.AddMember("orbital_corr", orbital_corr, doc.GetAllocator()); - dft_plus_u.AddMember("hubbard_u", hubbard_u, doc.GetAllocator()); - dft_plus_u.AddMember("yukawa_potential", yukawa_potential, doc.GetAllocator()); - dft_plus_u.AddMember("yukawa_lambda", yukawa_lambda, doc.GetAllocator()); - dft_plus_u.AddMember("omc", omc, doc.GetAllocator()); + input_file.AddMember("orbital_corr", orbital_corr, doc.GetAllocator()); + input_file.AddMember("hubbard_u", hubbard_u, doc.GetAllocator()); + input_file.AddMember("yukawa_potential", yukawa_potential, doc.GetAllocator()); + input_file.AddMember("yukawa_lambda", yukawa_lambda, doc.GetAllocator()); + input_file.AddMember("omc", omc, doc.GetAllocator()); //add Third stage:parameter in vdw_correction: - vdw_correction.AddMember("vdw_method", vdw_method, doc.GetAllocator()); - vdw_correction.AddMember("vdw_s6", vdw_s6, doc.GetAllocator()); - vdw_correction.AddMember("vdw_s8", vdw_s8, doc.GetAllocator()); - vdw_correction.AddMember("vdw_a1", vdw_a1, doc.GetAllocator()); - vdw_correction.AddMember("vdw_a2", vdw_a2, doc.GetAllocator()); - vdw_correction.AddMember("vdw_d", vdw_d, doc.GetAllocator()); - vdw_correction.AddMember("vdw_abc", vdw_abc, doc.GetAllocator()); - vdw_correction.AddMember("vdw_C6_file", vdw_C6_file, doc.GetAllocator()); - vdw_correction.AddMember("vdw_C6_unit", vdw_C6_unit, doc.GetAllocator()); - vdw_correction.AddMember("vdw_R0_file", vdw_R0_file, doc.GetAllocator()); - vdw_correction.AddMember("vdw_R0_unit", vdw_R0_unit, doc.GetAllocator()); - vdw_correction.AddMember("vdw_cutoff_type", vdw_cutoff_type, doc.GetAllocator()); - vdw_correction.AddMember("vdw_cutoff_radius", vdw_cutoff_radius, doc.GetAllocator()); - vdw_correction.AddMember("vdw_radius_unit", vdw_radius_unit, doc.GetAllocator()); - vdw_correction.AddMember("vdw_cutoff_period", vdw_cutoff_period, doc.GetAllocator()); - vdw_correction.AddMember("vdw_cn_thr", vdw_cn_thr, doc.GetAllocator()); - vdw_correction.AddMember("vdw_cn_thr_unit", vdw_cn_thr_unit, doc.GetAllocator()); + input_file.AddMember("vdw_method", vdw_method, doc.GetAllocator()); + input_file.AddMember("vdw_s6", vdw_s6, doc.GetAllocator()); + input_file.AddMember("vdw_s8", vdw_s8, doc.GetAllocator()); + input_file.AddMember("vdw_a1", vdw_a1, doc.GetAllocator()); + input_file.AddMember("vdw_a2", vdw_a2, doc.GetAllocator()); + input_file.AddMember("vdw_d", vdw_d, doc.GetAllocator()); + input_file.AddMember("vdw_abc", vdw_abc, doc.GetAllocator()); + input_file.AddMember("vdw_C6_file", vdw_C6_file, doc.GetAllocator()); + input_file.AddMember("vdw_C6_unit", vdw_C6_unit, doc.GetAllocator()); + input_file.AddMember("vdw_R0_file", vdw_R0_file, doc.GetAllocator()); + input_file.AddMember("vdw_R0_unit", vdw_R0_unit, doc.GetAllocator()); + input_file.AddMember("vdw_cutoff_type", vdw_cutoff_type, doc.GetAllocator()); + input_file.AddMember("vdw_cutoff_radius", vdw_cutoff_radius, doc.GetAllocator()); + input_file.AddMember("vdw_radius_unit", vdw_radius_unit, doc.GetAllocator()); + input_file.AddMember("vdw_cutoff_period", vdw_cutoff_period, doc.GetAllocator()); + input_file.AddMember("vdw_cn_thr", vdw_cn_thr, doc.GetAllocator()); + input_file.AddMember("vdw_cn_thr_unit", vdw_cn_thr_unit, doc.GetAllocator()); //add Third stage:parameter in berry_phase_and_wannier90_interface: - berry_phase_and_wannier90_interface.AddMember("berry_phase", berry_phase, doc.GetAllocator()); - berry_phase_and_wannier90_interface.AddMember("gdir", gdir, doc.GetAllocator()); - berry_phase_and_wannier90_interface.AddMember("towannier90", towannier90, doc.GetAllocator()); - berry_phase_and_wannier90_interface.AddMember("nnkpfile", nnkpfile, doc.GetAllocator()); - berry_phase_and_wannier90_interface.AddMember("wannier_spin", wannier_spin, doc.GetAllocator()); + input_file.AddMember("berry_phase", berry_phase, doc.GetAllocator()); + input_file.AddMember("gdir", gdir, doc.GetAllocator()); + input_file.AddMember("towannier90", towannier90, doc.GetAllocator()); + input_file.AddMember("nnkpfile", nnkpfile, doc.GetAllocator()); + input_file.AddMember("wannier_spin", wannier_spin, doc.GetAllocator()); //add Third stage:parameter in tddft: - tddft.AddMember("td_edm", td_edm, doc.GetAllocator()); - tddft.AddMember("td_print_eij", td_print_eij, doc.GetAllocator()); - tddft.AddMember("td_propagator", td_propagator, doc.GetAllocator()); - tddft.AddMember("td_vext", td_vext, doc.GetAllocator()); - tddft.AddMember("td_vext_dire", td_vext_dire, doc.GetAllocator()); - tddft.AddMember("td_stype", td_stype, doc.GetAllocator()); - tddft.AddMember("td_ttype", td_ttype, doc.GetAllocator()); - tddft.AddMember("td_tstart", td_tstart, doc.GetAllocator()); - tddft.AddMember("td_tend", td_tend, doc.GetAllocator()); - tddft.AddMember("td_lcut1", td_lcut1, doc.GetAllocator()); - tddft.AddMember("td_lcut2", td_lcut2, doc.GetAllocator()); - tddft.AddMember("td_gauss_freq", td_gauss_freq, doc.GetAllocator()); - tddft.AddMember("td_gauss_phase", td_gauss_phase, doc.GetAllocator()); - tddft.AddMember("td_gauss_sigma", td_gauss_sigma, doc.GetAllocator()); - tddft.AddMember("td_gauss_t0", td_gauss_t0, doc.GetAllocator()); - tddft.AddMember("td_gauss_amp", td_gauss_amp, doc.GetAllocator()); - tddft.AddMember("td_trape_freq", td_trape_freq, doc.GetAllocator()); - tddft.AddMember("td_trape_phase", td_trape_phase, doc.GetAllocator()); - tddft.AddMember("td_trape_t1", td_trape_t1, doc.GetAllocator()); - tddft.AddMember("td_trape_t2", td_trape_t2, doc.GetAllocator()); - tddft.AddMember("td_trape_t3", td_trape_t3, doc.GetAllocator()); - tddft.AddMember("td_trape_amp", td_trape_amp, doc.GetAllocator()); - tddft.AddMember("td_trigo_freq1", td_trigo_freq1, doc.GetAllocator()); - tddft.AddMember("td_trigo_freq2", td_trigo_freq2, doc.GetAllocator()); - tddft.AddMember("td_trigo_phase1", td_trigo_phase1, doc.GetAllocator()); - tddft.AddMember("td_trigo_phase2", td_trigo_phase2, doc.GetAllocator()); - tddft.AddMember("td_trigo_amp", td_trigo_amp, doc.GetAllocator()); - tddft.AddMember("td_heavi_t0", td_heavi_t0, doc.GetAllocator()); - tddft.AddMember("td_heavi_amp", td_heavi_amp, doc.GetAllocator()); - tddft.AddMember("td_out_dipole", td_out_dipole, doc.GetAllocator()); - tddft.AddMember("td_out_efield", td_out_efield, doc.GetAllocator()); - tddft.AddMember("ocp", ocp, doc.GetAllocator()); - tddft.AddMember("ocp_set", ocp_set, doc.GetAllocator()); + input_file.AddMember("td_edm", td_edm, doc.GetAllocator()); + input_file.AddMember("td_print_eij", td_print_eij, doc.GetAllocator()); + input_file.AddMember("td_propagator", td_propagator, doc.GetAllocator()); + input_file.AddMember("td_vext", td_vext, doc.GetAllocator()); + input_file.AddMember("td_vext_dire", td_vext_dire, doc.GetAllocator()); + input_file.AddMember("td_stype", td_stype, doc.GetAllocator()); + input_file.AddMember("td_ttype", td_ttype, doc.GetAllocator()); + input_file.AddMember("td_tstart", td_tstart, doc.GetAllocator()); + input_file.AddMember("td_tend", td_tend, doc.GetAllocator()); + input_file.AddMember("td_lcut1", td_lcut1, doc.GetAllocator()); + input_file.AddMember("td_lcut2", td_lcut2, doc.GetAllocator()); + input_file.AddMember("td_gauss_freq", td_gauss_freq, doc.GetAllocator()); + input_file.AddMember("td_gauss_phase", td_gauss_phase, doc.GetAllocator()); + input_file.AddMember("td_gauss_sigma", td_gauss_sigma, doc.GetAllocator()); + input_file.AddMember("td_gauss_t0", td_gauss_t0, doc.GetAllocator()); + input_file.AddMember("td_gauss_amp", td_gauss_amp, doc.GetAllocator()); + input_file.AddMember("td_trape_freq", td_trape_freq, doc.GetAllocator()); + input_file.AddMember("td_trape_phase", td_trape_phase, doc.GetAllocator()); + input_file.AddMember("td_trape_t1", td_trape_t1, doc.GetAllocator()); + input_file.AddMember("td_trape_t2", td_trape_t2, doc.GetAllocator()); + input_file.AddMember("td_trape_t3", td_trape_t3, doc.GetAllocator()); + input_file.AddMember("td_trape_amp", td_trape_amp, doc.GetAllocator()); + input_file.AddMember("td_trigo_freq1", td_trigo_freq1, doc.GetAllocator()); + input_file.AddMember("td_trigo_freq2", td_trigo_freq2, doc.GetAllocator()); + input_file.AddMember("td_trigo_phase1", td_trigo_phase1, doc.GetAllocator()); + input_file.AddMember("td_trigo_phase2", td_trigo_phase2, doc.GetAllocator()); + input_file.AddMember("td_trigo_amp", td_trigo_amp, doc.GetAllocator()); + input_file.AddMember("td_heavi_t0", td_heavi_t0, doc.GetAllocator()); + input_file.AddMember("td_heavi_amp", td_heavi_amp, doc.GetAllocator()); + input_file.AddMember("td_out_dipole", td_out_dipole, doc.GetAllocator()); + input_file.AddMember("td_out_efield", td_out_efield, doc.GetAllocator()); + input_file.AddMember("ocp", ocp, doc.GetAllocator()); + input_file.AddMember("ocp_set", ocp_set, doc.GetAllocator()); //add Third stage:parameter in debuging_related: - debuging_related.AddMember("t_in_h", t_in_h, doc.GetAllocator()); - debuging_related.AddMember("vl_in_h", vl_in_h, doc.GetAllocator()); - debuging_related.AddMember("vnl_in_h", vnl_in_h, doc.GetAllocator()); - debuging_related.AddMember("vh_in_h", vh_in_h, doc.GetAllocator()); - debuging_related.AddMember("vion_in_h", vion_in_h, doc.GetAllocator()); - debuging_related.AddMember("test_force", test_force, doc.GetAllocator()); - debuging_related.AddMember("test_stress", test_stress, doc.GetAllocator()); - debuging_related.AddMember("colour", colour, doc.GetAllocator()); - debuging_related.AddMember("test_skip_ewald", test_skip_ewald, doc.GetAllocator()); + input_file.AddMember("t_in_h", t_in_h, doc.GetAllocator()); + input_file.AddMember("vl_in_h", vl_in_h, doc.GetAllocator()); + input_file.AddMember("vnl_in_h", vnl_in_h, doc.GetAllocator()); + input_file.AddMember("vh_in_h", vh_in_h, doc.GetAllocator()); + input_file.AddMember("vion_in_h", vion_in_h, doc.GetAllocator()); + input_file.AddMember("test_force", test_force, doc.GetAllocator()); + input_file.AddMember("test_stress", test_stress, doc.GetAllocator()); + input_file.AddMember("colour", colour, doc.GetAllocator()); + input_file.AddMember("test_skip_ewald", test_skip_ewald, doc.GetAllocator()); //add Third stage:parameter in electronic_conductivities: - electronic_conductivities.AddMember("cal_cond", cal_cond, doc.GetAllocator()); - electronic_conductivities.AddMember("cond_nche", cond_nche, doc.GetAllocator()); - electronic_conductivities.AddMember("cond_dw", cond_dw, doc.GetAllocator()); - electronic_conductivities.AddMember("cond_wcut", cond_wcut, doc.GetAllocator()); - electronic_conductivities.AddMember("cond_dt", cond_dt, doc.GetAllocator()); - electronic_conductivities.AddMember("cond_dtbatch", cond_dtbatch, doc.GetAllocator()); - electronic_conductivities.AddMember("cond_fwhm", cond_fwhm, doc.GetAllocator()); - electronic_conductivities.AddMember("cond_nonlocal", cond_nonlocal, doc.GetAllocator()); + input_file.AddMember("cal_cond", cal_cond, doc.GetAllocator()); + input_file.AddMember("cond_nche", cond_nche, doc.GetAllocator()); + input_file.AddMember("cond_dw", cond_dw, doc.GetAllocator()); + input_file.AddMember("cond_wcut", cond_wcut, doc.GetAllocator()); + input_file.AddMember("cond_dt", cond_dt, doc.GetAllocator()); + input_file.AddMember("cond_dtbatch", cond_dtbatch, doc.GetAllocator()); + input_file.AddMember("cond_fwhm", cond_fwhm, doc.GetAllocator()); + input_file.AddMember("cond_nonlocal", cond_nonlocal, doc.GetAllocator()); //add Third stage:parameter in implicit_solvation_model: - implicit_solvation_model.AddMember("imp_sol", imp_sol, doc.GetAllocator()); - implicit_solvation_model.AddMember("eb_k", eb_k, doc.GetAllocator()); - implicit_solvation_model.AddMember("tau", tau, doc.GetAllocator()); - implicit_solvation_model.AddMember("sigma_k", sigma_k, doc.GetAllocator()); - implicit_solvation_model.AddMember("nc_k", nc_k, doc.GetAllocator()); + input_file.AddMember("imp_sol", imp_sol, doc.GetAllocator()); + input_file.AddMember("eb_k", eb_k, doc.GetAllocator()); + input_file.AddMember("tau", tau, doc.GetAllocator()); + input_file.AddMember("sigma_k", sigma_k, doc.GetAllocator()); + input_file.AddMember("nc_k", nc_k, doc.GetAllocator()); + + + RemoveNullValues(input_file); // after add child_node's node in readin_info, add child node // add parameters in readin_info: - readin_info.AddMember("system_variables", system_variables, doc.GetAllocator()); - readin_info.AddMember("files_related", files_related, doc.GetAllocator()); - readin_info.AddMember("planewave_related", planewave_related, doc.GetAllocator()); - readin_info.AddMember("numerical_atomic_orbitals_related", numerical_atomic_orbitals_related, doc.GetAllocator()); - readin_info.AddMember("electronic_structure", electronic_structure, doc.GetAllocator()); - readin_info.AddMember("electronic_structure_SDFT", electronic_structure_SDFT, doc.GetAllocator()); - readin_info.AddMember("geometry_relaxation", geometry_relaxation, doc.GetAllocator()); - readin_info.AddMember("output_information_related", output_information_related, doc.GetAllocator()); - readin_info.AddMember("density_of_states", density_of_states, doc.GetAllocator()); - readin_info.AddMember("naos", naos, doc.GetAllocator()); - readin_info.AddMember("deepks", deepks, doc.GetAllocator()); - readin_info.AddMember("ofdft", ofdft, doc.GetAllocator()); - readin_info.AddMember("electric_field_and_dipole_correction", electric_field_and_dipole_correction, doc.GetAllocator()); - readin_info.AddMember("gate_field", gate_field, doc.GetAllocator()); - readin_info.AddMember("exact_exchange", exact_exchange, doc.GetAllocator()); - readin_info.AddMember("molecular_dynamics", molecular_dynamics, doc.GetAllocator()); - readin_info.AddMember("dft_plus_u", dft_plus_u, doc.GetAllocator()); - readin_info.AddMember("vdw_correction", vdw_correction, doc.GetAllocator()); - readin_info.AddMember("berry_phase_and_wannier90_interface", berry_phase_and_wannier90_interface, doc.GetAllocator()); - readin_info.AddMember("tddft", tddft, doc.GetAllocator()); - readin_info.AddMember("debuging_related", debuging_related, doc.GetAllocator()); - readin_info.AddMember("electronic_conductivities", electronic_conductivities, doc.GetAllocator()); - readin_info.AddMember("implicit_solvation_model", implicit_solvation_model, doc.GetAllocator()); + readin_info.AddMember("input_file", input_file, doc.GetAllocator()); + } @@ -973,7 +965,7 @@ namespace Para_Json // Output the json string to a file std::string json_path; - json_path.append(GlobalV::global_out_dir +"abacus.json"); + json_path.append("abacus.json"); std::ofstream ofs(json_path); ofs << buffer.GetString() << std::endl; diff --git a/source/module_base/para_json.h b/source/module_base/para_json.h index 769ff1b80d..397d7cf64a 100644 --- a/source/module_base/para_json.h +++ b/source/module_base/para_json.h @@ -47,9 +47,11 @@ namespace Para_Json // @param reading_information: extern rapidjson::Value readin_info; // @param reading_information -- input_para: - + extern std::map input_file_map; // @param reading_information -- input_para -- system_variables: extern rapidjson::Value system_variables; + + extern rapidjson::Value input_file; extern rapidjson::Value input_suffix; extern rapidjson::Value ntype; extern rapidjson::Value calculation; @@ -76,7 +78,7 @@ namespace Para_Json extern rapidjson::Value min_dist_coef; extern rapidjson::Value device; // @param reading_information -- input_para -- files_related - extern rapidjson::Value files_related; + extern rapidjson::Value stru_file; extern rapidjson::Value kpoint_file; extern rapidjson::Value pseudo_dir; @@ -84,7 +86,7 @@ namespace Para_Json extern rapidjson::Value read_file_dir; extern rapidjson::Value wannier_card; // @param reading_information -- input_para -- planewave_related - extern rapidjson::Value planewave_related; + extern rapidjson::Value ecutwfc; extern rapidjson::Value nx; extern rapidjson::Value ny; @@ -94,7 +96,7 @@ namespace Para_Json extern rapidjson::Value pw_diag_nmax; extern rapidjson::Value pw_diag_ndim; // @param reading_information -- input_para -- numerical_atomic_orbitals_related - extern rapidjson::Value numerical_atomic_orbitals_related; + extern rapidjson::Value nb2d; extern rapidjson::Value lmaxmax; extern rapidjson::Value lcao_ecut; @@ -107,7 +109,7 @@ namespace Para_Json extern rapidjson::Value by; extern rapidjson::Value bz; // @param reading_information -- input_para -- electronic_structure - extern rapidjson::Value electronic_structure; + extern rapidjson::Value basis_type; extern rapidjson::Value ks_solver; extern rapidjson::Value nbands; @@ -132,7 +134,7 @@ namespace Para_Json extern rapidjson::Value noncolin; extern rapidjson::Value soc_lambda; // @param reading_information -- input_para -- electronic_structure_SDFT - extern rapidjson::Value electronic_structure_SDFT; + extern rapidjson::Value method_sto; extern rapidjson::Value nbands_sto; extern rapidjson::Value nche_sto; @@ -142,7 +144,7 @@ namespace Para_Json extern rapidjson::Value initsto_freq; extern rapidjson::Value npart_sto; // @param reading_information -- input_para -- geometry_relaxation - extern rapidjson::Value geometry_relaxation; + extern rapidjson::Value relax_method; extern rapidjson::Value relax_new; extern rapidjson::Value relax_scale_force; @@ -168,7 +170,7 @@ namespace Para_Json extern rapidjson::Value cell_factor; // @param reading_information -- input_para -- output_information_related - extern rapidjson::Value output_information_related; + extern rapidjson::Value out_mul; extern rapidjson::Value out_freq_elec; extern rapidjson::Value out_freq_ion; @@ -199,7 +201,7 @@ namespace Para_Json extern rapidjson::Value rpa; // @param reading_information -- input_para -- density_of_states - extern rapidjson::Value density_of_states; + extern rapidjson::Value dos_edelta_ev; extern rapidjson::Value dos_sigma; extern rapidjson::Value dos_scale; @@ -207,14 +209,13 @@ namespace Para_Json extern rapidjson::Value dos_emax_ev; extern rapidjson::Value dos_nche; // @param reading_information -- input_para -- naos - extern rapidjson::Value naos; extern rapidjson::Value bessel_nao_ecut; extern rapidjson::Value bessel_nao_tolerence; extern rapidjson::Value bessel_nao_rcut; extern rapidjson::Value bessel_nao_smooth; extern rapidjson::Value bessel_nao_sigma; // @param reading_information -- input_para -- deepks - extern rapidjson::Value deepks; + extern rapidjson::Value deepks_out_labels; extern rapidjson::Value deepks_scf; extern rapidjson::Value deepks_model; @@ -227,7 +228,6 @@ namespace Para_Json extern rapidjson::Value deepks_bandgap; extern rapidjson::Value deepks_out_unittest; // @param reading_information -- input_para -- ofdft - extern rapidjson::Value ofdft; extern rapidjson::Value of_kinetic; extern rapidjson::Value of_method; extern rapidjson::Value of_conv; @@ -246,7 +246,7 @@ namespace Para_Json extern rapidjson::Value of_full_pw_dim; // @param reading_information -- input_para -- electric_field_and_dipole_correction - extern rapidjson::Value electric_field_and_dipole_correction; + extern rapidjson::Value efield_flag; extern rapidjson::Value dip_cor_flag; extern rapidjson::Value efield_dir; @@ -254,7 +254,7 @@ namespace Para_Json extern rapidjson::Value efield_pos_dec; extern rapidjson::Value efield_amp; // @param reading_information -- input_para -- gate_field - extern rapidjson::Value gate_field; + extern rapidjson::Value gate_flag; extern rapidjson::Value zgate; extern rapidjson::Value block; @@ -262,7 +262,6 @@ namespace Para_Json extern rapidjson::Value block_up; extern rapidjson::Value block_height; // @param reading_information -- input_para -- exact_exchange - extern rapidjson::Value exact_exchange; extern rapidjson::Value exx_hybrid_alpha; extern rapidjson::Value exx_hse_omega; extern rapidjson::Value exx_separate_loop; @@ -288,7 +287,6 @@ namespace Para_Json extern rapidjson::Value exx_real_number; // @param reading_information -- input_para -- molecular_dynamics - extern rapidjson::Value molecular_dynamics; extern rapidjson::Value md_type; extern rapidjson::Value md_nstep; extern rapidjson::Value md_dt; @@ -328,7 +326,6 @@ namespace Para_Json extern rapidjson::Value dmax; // @param reading_information -- input_para -- dft_plus_u - extern rapidjson::Value dft_plus_u; extern rapidjson::Value orbital_corr; extern rapidjson::Value hubbard_u; extern rapidjson::Value yukawa_potential; @@ -336,7 +333,6 @@ namespace Para_Json extern rapidjson::Value omc; // @param reading_information -- input_para -- vdw_correction - extern rapidjson::Value vdw_correction; extern rapidjson::Value vdw_method; extern rapidjson::Value vdw_s6; extern rapidjson::Value vdw_s8; @@ -356,7 +352,6 @@ namespace Para_Json extern rapidjson::Value vdw_cn_thr_unit; // @param reading_information -- input_para -- berry_phase_and_wannier90_interface - extern rapidjson::Value berry_phase_and_wannier90_interface; extern rapidjson::Value berry_phase; extern rapidjson::Value gdir; extern rapidjson::Value towannier90; @@ -364,7 +359,6 @@ namespace Para_Json extern rapidjson::Value wannier_spin; // @param reading_information -- input_para -- tddft - extern rapidjson::Value tddft; extern rapidjson::Value td_edm; extern rapidjson::Value td_print_eij; extern rapidjson::Value td_propagator; @@ -400,7 +394,6 @@ namespace Para_Json extern rapidjson::Value ocp_set; // @param reading_information -- input_para -- debuging_related - extern rapidjson::Value debuging_related; extern rapidjson::Value t_in_h; extern rapidjson::Value vl_in_h; extern rapidjson::Value vnl_in_h; @@ -412,7 +405,6 @@ namespace Para_Json extern rapidjson::Value test_skip_ewald; // @param reading_information -- input_para -- electronic_conductivities - extern rapidjson::Value electronic_conductivities; extern rapidjson::Value cal_cond; extern rapidjson::Value cond_nche; extern rapidjson::Value cond_dw; @@ -423,7 +415,6 @@ namespace Para_Json extern rapidjson::Value cond_nonlocal; // @param reading_information -- input_para -- implicit_solvation_model - extern rapidjson::Value implicit_solvation_model; extern rapidjson::Value imp_sol; extern rapidjson::Value eb_k; extern rapidjson::Value tau; @@ -559,8 +550,6 @@ namespace Para_Json // json_v.SetString(rapidjson::StringRef((*reinterpret_cast(para)).c_str())); json_v.SetString((*reinterpret_cast(para)).c_str(), std::strlen((*reinterpret_cast(para)).c_str()), doc.GetAllocator()); - - //printf("exx_real_number = %s\n",(*reinterpret_cast(para)).c_str()); } } From f3ce691e938fe51aacb232bdfc1bf8ced8ebec58 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Thu, 23 Nov 2023 18:30:32 +0800 Subject: [PATCH 16/27] fix a bug --- source/module_base/para_json.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/module_base/para_json.h b/source/module_base/para_json.h index 397d7cf64a..c0b5533883 100644 --- a/source/module_base/para_json.h +++ b/source/module_base/para_json.h @@ -47,7 +47,7 @@ namespace Para_Json // @param reading_information: extern rapidjson::Value readin_info; // @param reading_information -- input_para: - extern std::map input_file_map; + // @param reading_information -- input_para -- system_variables: extern rapidjson::Value system_variables; From cb77a0237dbb479daaf89f47607c9626fe58befc Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Thu, 23 Nov 2023 18:36:45 +0800 Subject: [PATCH 17/27] fix bug --- source/module_base/para_json.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/source/module_base/para_json.cpp b/source/module_base/para_json.cpp index 62742b91ab..33acbc2b21 100644 --- a/source/module_base/para_json.cpp +++ b/source/module_base/para_json.cpp @@ -36,7 +36,6 @@ namespace Para_Json // @param reading_information -- input_file: rapidjson::Value input_file(rapidjson::kObjectType); - std::map input_file_map; // @param reading_information -- input_file -- system_variables: rapidjson::Value input_suffix; @@ -471,12 +470,6 @@ namespace Para_Json rapidjson::Value coordinate; - void Add_notNull_value(rapidjson::Value father,std::string name, rapidjson::Value son,rapidjson::Document doc){ - - if(son.IsNull() || son == "" || son.Empty()) return ; - father.AddMember(name.c_str(), son, doc.GetAllocator()); - return; - } /** * The functions below initialize the json output parameter From 67d674f5e09fc754da17828d064f51d136a0ba6d Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Thu, 23 Nov 2023 18:46:34 +0800 Subject: [PATCH 18/27] fix some bugs --- source/module_io/input.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index dc250deb81..2b435c5d46 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -1437,27 +1437,27 @@ bool Input::Read(const std::string &fn) else if (strcmp("deepks_out_labels", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_out_labels); - Para_Json::set_json_value(Para_Json::deepks_out_labels,&deepks_out_labels); + //Para_Json::set_json_value(Para_Json::deepks_out_labels,&deepks_out_labels); } else if (strcmp("deepks_scf", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_scf); - Para_Json::set_json_value(Para_Json::deepks_scf,&deepks_scf); + //Para_Json::set_json_value(Para_Json::deepks_scf,&deepks_scf); } else if (strcmp("deepks_bandgap", word) == 0) // caoyu added 2020-11-24, mohan modified 2021-01-03 { read_bool(ifs, deepks_bandgap); - Para_Json::set_json_value(Para_Json::deepks_bandgap,&deepks_bandgap); + //Para_Json::set_json_value(Para_Json::deepks_bandgap,&deepks_bandgap); } else if (strcmp("deepks_out_unittest", word) == 0) // mohan added 2021-01-03 { read_bool(ifs, deepks_out_unittest); - Para_Json::set_json_value(Para_Json::deepks_out_unittest,&deepks_out_unittest); + //Para_Json::set_json_value(Para_Json::deepks_out_unittest,&deepks_out_unittest); } else if (strcmp("deepks_model", word) == 0) // caoyu added 2021-06-03 { read_value(ifs, deepks_model); - Para_Json::set_json_value(Para_Json::deepks_model,&deepks_model); + //Para_Json::set_json_value(Para_Json::deepks_model,&deepks_model); } else if (strcmp("out_pot", word) == 0) { From 1a5a0de9509e172f0d18647500061b249a418694 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Sun, 26 Nov 2023 01:01:48 +0800 Subject: [PATCH 19/27] add json valid test and add para in general_info --- source/module_base/parallel_global.cpp | 6 ++++++ source/module_io/input.cpp | 18 ++++++++++++++++++ source/module_io/test/para_json_test.cpp | 21 ++++++++++++++++++--- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/source/module_base/parallel_global.cpp b/source/module_base/parallel_global.cpp index 3361d4b7f1..7e437221c4 100644 --- a/source/module_base/parallel_global.cpp +++ b/source/module_base/parallel_global.cpp @@ -17,6 +17,7 @@ #include "module_base/global_function.h" #include "module_base/parallel_common.h" #include "module_base/parallel_reduce.h" +#include "module_base/para_json.h" #include "version.h" #if defined __MPI @@ -95,6 +96,11 @@ void Parallel_Global::split_diag_world(const int &diag_np) GlobalV::DRANK=0; GlobalV::DSIZE=1; #endif + + Para_Json::set_json_value(Para_Json::drank,&GlobalV::DRANK); + Para_Json::set_json_value(Para_Json::dsize,&GlobalV::DSIZE); + Para_Json::set_json_value(Para_Json::dcolor,&GlobalV::DCOLOR); + return; } diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index 2b435c5d46..69b9e8e487 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -129,6 +129,24 @@ void Input::Init(const std::string &fn) // pseudo_type); // mohan add 2013-05-20 (xiaohui add 2013-06-23, GlobalV::global_pseudo_type -> pseudo_type) ModuleBase::timer::tick("Input", "Init"); + + std::string begin_time = ctime(&time_now); + if (!begin_time.empty() && begin_time.back() == '\n') { + begin_time.erase(begin_time.length() - 1); + } + std::string version_json = version; + std::string commit_json = commit; + std::string device_json = device; + printf("version = %s\n",device_json.c_str()); + Para_Json::set_json_value(Para_Json::version,&version_json); + Para_Json::set_json_value(Para_Json::commit,&commit_json); + Para_Json::set_json_value(Para_Json::device_g,&device_json); + Para_Json::set_json_value(Para_Json::begin_time,&begin_time); + + Para_Json::set_json_value(Para_Json::global_out_dir,&GlobalV::global_out_dir); + Para_Json::set_json_value(Para_Json::global_in_card,&GlobalV::global_in_card); + Para_Json::set_json_value(Para_Json::pseudo_dir_path,&GlobalV::global_pseudo_dir); + Para_Json::set_json_value(Para_Json::orbital_dir_path,&GlobalV::global_orbital_dir); return; } diff --git a/source/module_io/test/para_json_test.cpp b/source/module_io/test/para_json_test.cpp index d06369af0e..c3a4406a41 100644 --- a/source/module_io/test/para_json_test.cpp +++ b/source/module_io/test/para_json_test.cpp @@ -5,7 +5,7 @@ #include "mpi.h" #endif #include - +#include "rapidjson/document.h" /************************************************ * unit test of Input::bcast ***********************************************/ @@ -22,10 +22,21 @@ class ParaJsonTest : public ::testing::Test { protected: + std::string testString; }; #ifdef __MPI +// 在这里提供 isValidJSON 函数的定义 +bool isValidJSON(const std::string& jsonString) { + rapidjson::Document document; + document.Parse(jsonString.c_str()); + + return !document.HasParseError(); +} + + + TEST_F(ParaJsonTest,Init) { std::string input_file = "./support/INPUT"; @@ -39,6 +50,7 @@ TEST_F(ParaJsonTest,Init) // int status = system("rm -r ./OUT.autotest/"); // EXPECT_EQ(status,0); Para_Json::Init_json_abacus_readinInfo(); + Para_Json::Init_json_abacus_generalInfo(); Para_Json::Init_json_abacus(); Para_Json::Finish_json_tree(); @@ -47,14 +59,17 @@ TEST_F(ParaJsonTest,Init) rapidjson::Writer writer(buffer); Para_Json::doc.Accept(writer); - printf("%s\n",buffer.GetString()); + + std::string json = buffer.GetString(); + printf("%s\n",json.c_str()); + + EXPECT_EQ(isValidJSON(json),true); } } - int main(int argc, char **argv) { MPI_Init(&argc, &argv); From 83c6ee9dc41b962143c820a5ea15b70c20658021 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Sun, 26 Nov 2023 01:05:37 +0800 Subject: [PATCH 20/27] fix conflict --- source/module_io/test/para_json_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/module_io/test/para_json_test.cpp b/source/module_io/test/para_json_test.cpp index c3a4406a41..657ff731e5 100644 --- a/source/module_io/test/para_json_test.cpp +++ b/source/module_io/test/para_json_test.cpp @@ -43,7 +43,7 @@ TEST_F(ParaJsonTest,Init) Input input_tmp; EXPECT_NO_THROW(input_tmp.Init(input_file)); - + if(GlobalV::MY_RANK==0) { From fd279ecc59a9073ec9e2277be852df1bb0b28cad Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Sun, 26 Nov 2023 01:19:30 +0800 Subject: [PATCH 21/27] fix a bug --- source/module_base/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/module_base/test/CMakeLists.txt b/source/module_base/test/CMakeLists.txt index 24cd03ed96..2ad252fb00 100644 --- a/source/module_base/test/CMakeLists.txt +++ b/source/module_base/test/CMakeLists.txt @@ -82,7 +82,7 @@ AddTest( TARGET base_ylmreal LIBS ${math_libs} device formatter SOURCES math_ylmreal_test.cpp ../math_ylmreal.cpp ../complexmatrix.cpp ../global_variable.cpp ../ylm.cpp ../realarray.cpp ../timer.cpp ../matrix.cpp ../vector3.h - ../parallel_reduce.cpp ../parallel_global.cpp ../parallel_common.cpp + ../parallel_reduce.cpp ../parallel_global.cpp ../para_json.cpp ../parallel_common.cpp ../memory.cpp ../libm/branred.cpp ../libm/sincos.cpp ) AddTest( From 4ea82dac1f620bd65ca39a2ac7c8011d329c2e26 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Sun, 26 Nov 2023 01:20:31 +0800 Subject: [PATCH 22/27] fix a bug --- source/module_base/test/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/module_base/test/CMakeLists.txt b/source/module_base/test/CMakeLists.txt index 2ad252fb00..2d9ca3614c 100644 --- a/source/module_base/test/CMakeLists.txt +++ b/source/module_base/test/CMakeLists.txt @@ -82,7 +82,7 @@ AddTest( TARGET base_ylmreal LIBS ${math_libs} device formatter SOURCES math_ylmreal_test.cpp ../math_ylmreal.cpp ../complexmatrix.cpp ../global_variable.cpp ../ylm.cpp ../realarray.cpp ../timer.cpp ../matrix.cpp ../vector3.h - ../parallel_reduce.cpp ../parallel_global.cpp ../para_json.cpp ../parallel_common.cpp + ../parallel_reduce.cpp ../para_json.cpp ../parallel_global.cpp ../parallel_common.cpp ../memory.cpp ../libm/branred.cpp ../libm/sincos.cpp ) AddTest( @@ -205,7 +205,7 @@ AddTest( AddTest( TARGET clebsch_gordan_coeff_test SOURCES clebsch_gordan_coeff_test.cpp ../clebsch_gordan_coeff.cpp ../intarray.cpp ../realarray.cpp ../complexmatrix.cpp ../matrix.cpp ../timer.cpp - ../math_ylmreal.cpp ../global_variable.cpp ../ylm.cpp ../timer.cpp ../vector3.h ../parallel_reduce.cpp ../parallel_global.cpp ../parallel_common.cpp + ../math_ylmreal.cpp ../global_variable.cpp ../ylm.cpp ../timer.cpp ../vector3.h ../parallel_reduce.cpp ../para_json.cpp ../parallel_global.cpp ../parallel_common.cpp ../memory.cpp ../libm/branred.cpp ../libm/sincos.cpp ../inverse_matrix.cpp ../lapack_connector.h LIBS ${math_libs} formatter device ) From 9806d90d6b184706057103f7dbdd43a374e4f482 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Sun, 26 Nov 2023 01:23:32 +0800 Subject: [PATCH 23/27] fix test rely bugs --- source/module_base/test_parallel/CMakeLists.txt | 4 ++-- source/module_basis/module_ao/test/CMakeLists.txt | 2 +- source/module_basis/module_pw/kernels/test/CMakeLists.txt | 1 + source/module_cell/test/CMakeLists.txt | 2 +- source/module_hamilt_pw/hamilt_pwdft/test/CMakeLists.txt | 1 + source/module_io/test/CMakeLists.txt | 1 + source/module_md/test/CMakeLists.txt | 1 + 7 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/module_base/test_parallel/CMakeLists.txt b/source/module_base/test_parallel/CMakeLists.txt index 3ef9779fa6..328bfd8d88 100644 --- a/source/module_base/test_parallel/CMakeLists.txt +++ b/source/module_base/test_parallel/CMakeLists.txt @@ -7,13 +7,13 @@ AddTest( AddTest( TARGET base_ParaGlobal LIBS MPI::MPI_CXX - SOURCES parallel_global_test.cpp ../global_variable.cpp ../parallel_global.cpp + SOURCES parallel_global_test.cpp ../global_variable.cpp ../para_json.cpp ../parallel_global.cpp ) AddTest( TARGET base_ParaReduce LIBS MPI::MPI_CXX - SOURCES parallel_reduce_test.cpp ../global_variable.cpp ../parallel_global.cpp ../parallel_common.cpp ../parallel_reduce.cpp + SOURCES parallel_reduce_test.cpp ../global_variable.cpp ../para_json.cpp ../parallel_global.cpp ../parallel_common.cpp ../parallel_reduce.cpp ) install(FILES parallel_common_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/source/module_basis/module_ao/test/CMakeLists.txt b/source/module_basis/module_ao/test/CMakeLists.txt index 86bed2bd7c..02fe6bed89 100644 --- a/source/module_basis/module_ao/test/CMakeLists.txt +++ b/source/module_basis/module_ao/test/CMakeLists.txt @@ -45,7 +45,7 @@ AddTest( TARGET orbital_equal_test LIBS ${math_libs} device numerical_atomic_orbitals container formatter SOURCES 1_snap_equal_test.cpp ORB_unittest.cpp - ../../../module_base/parallel_reduce.cpp ../../../module_base/parallel_global.cpp ../../../module_base/parallel_common.cpp + ../../../module_base/parallel_reduce.cpp ../../../module_base/para_json.cpp ../../../module_base/parallel_global.cpp ../../../module_base/parallel_common.cpp ${depend_files} ) install(DIRECTORY GaAs DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/../../../tests) diff --git a/source/module_basis/module_pw/kernels/test/CMakeLists.txt b/source/module_basis/module_pw/kernels/test/CMakeLists.txt index ab9869eafa..bc334a44da 100644 --- a/source/module_basis/module_pw/kernels/test/CMakeLists.txt +++ b/source/module_basis/module_pw/kernels/test/CMakeLists.txt @@ -5,6 +5,7 @@ AddTest( LIBS ${math_libs} psi device SOURCES pw_op_test.cpp ../../../../module_base/tool_quit.cpp ../../../../module_base/global_variable.cpp + ../../../module_base/para_json.cpp ../../../../module_base/parallel_global.cpp ../../../../module_base/parallel_reduce.cpp ../../../../module_base/complexmatrix.cpp ../../../../module_base/matrix.cpp ../../../../module_base/memory.cpp ../../../../module_base/libm/branred.cpp ../../../../module_base/libm/sincos.cpp diff --git a/source/module_cell/test/CMakeLists.txt b/source/module_cell/test/CMakeLists.txt index 2b1d75ffae..22675ff0bb 100644 --- a/source/module_cell/test/CMakeLists.txt +++ b/source/module_cell/test/CMakeLists.txt @@ -76,7 +76,7 @@ add_test(NAME cell_klist_test_para4 AddTest( TARGET cell_ParaKpoints LIBS MPI::MPI_CXX - SOURCES parallel_kpoints_test.cpp ../../module_base/global_variable.cpp ../../module_base/parallel_global.cpp + SOURCES parallel_kpoints_test.cpp ../../module_base/global_variable.cpp ../../../module_base/para_json.cpp ../../module_base/parallel_global.cpp ../../module_base/parallel_common.cpp ../parallel_kpoints.cpp ) diff --git a/source/module_hamilt_pw/hamilt_pwdft/test/CMakeLists.txt b/source/module_hamilt_pw/hamilt_pwdft/test/CMakeLists.txt index 3adf260d44..9ad923c170 100644 --- a/source/module_hamilt_pw/hamilt_pwdft/test/CMakeLists.txt +++ b/source/module_hamilt_pw/hamilt_pwdft/test/CMakeLists.txt @@ -15,6 +15,7 @@ AddTest( ../../../module_base/global_file.cpp ../../../module_base/memory.cpp ../../../module_base/timer.cpp + ../../../module_base/para_json.cpp ../../../module_base/parallel_global.cpp ../../../module_base/parallel_common.cpp ../../../module_base/parallel_reduce.cpp diff --git a/source/module_io/test/CMakeLists.txt b/source/module_io/test/CMakeLists.txt index 5ddbf22357..ad6afc24f6 100644 --- a/source/module_io/test/CMakeLists.txt +++ b/source/module_io/test/CMakeLists.txt @@ -86,6 +86,7 @@ AddTest( ../../module_base/global_variable.cpp ../../module_base/parallel_reduce.cpp ../../module_base/parallel_common.cpp + ../../module_base/para_json.cpp ../../module_base/parallel_global.cpp ) diff --git a/source/module_md/test/CMakeLists.txt b/source/module_md/test/CMakeLists.txt index 0f5564d26f..b2e0bc9432 100644 --- a/source/module_md/test/CMakeLists.txt +++ b/source/module_md/test/CMakeLists.txt @@ -44,6 +44,7 @@ list(APPEND depend_files ../../module_io/print_info.cpp ../../module_esolver/esolver_lj.cpp ../../module_base/parallel_reduce.cpp + ../../module_base/para_json.cpp ../../module_base/parallel_global.cpp ../../module_base/para_json.cpp ) From 4e9cc743b0067b5fbd9b630a655c7668b22cbfbf Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Sun, 26 Nov 2023 15:40:22 +0800 Subject: [PATCH 24/27] fix 2 bugs --- source/module_basis/module_pw/kernels/test/CMakeLists.txt | 2 +- source/module_cell/test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/module_basis/module_pw/kernels/test/CMakeLists.txt b/source/module_basis/module_pw/kernels/test/CMakeLists.txt index bc334a44da..8f5d9fb09b 100644 --- a/source/module_basis/module_pw/kernels/test/CMakeLists.txt +++ b/source/module_basis/module_pw/kernels/test/CMakeLists.txt @@ -5,7 +5,7 @@ AddTest( LIBS ${math_libs} psi device SOURCES pw_op_test.cpp ../../../../module_base/tool_quit.cpp ../../../../module_base/global_variable.cpp - ../../../module_base/para_json.cpp + ../../../../module_base/para_json.cpp ../../../../module_base/parallel_global.cpp ../../../../module_base/parallel_reduce.cpp ../../../../module_base/complexmatrix.cpp ../../../../module_base/matrix.cpp ../../../../module_base/memory.cpp ../../../../module_base/libm/branred.cpp ../../../../module_base/libm/sincos.cpp diff --git a/source/module_cell/test/CMakeLists.txt b/source/module_cell/test/CMakeLists.txt index 22675ff0bb..01db09f684 100644 --- a/source/module_cell/test/CMakeLists.txt +++ b/source/module_cell/test/CMakeLists.txt @@ -76,7 +76,7 @@ add_test(NAME cell_klist_test_para4 AddTest( TARGET cell_ParaKpoints LIBS MPI::MPI_CXX - SOURCES parallel_kpoints_test.cpp ../../module_base/global_variable.cpp ../../../module_base/para_json.cpp ../../module_base/parallel_global.cpp + SOURCES parallel_kpoints_test.cpp ../../module_base/global_variable.cpp ../../module_base/para_json.cpp ../../module_base/parallel_global.cpp ../../module_base/parallel_common.cpp ../parallel_kpoints.cpp ) From ccb836e5dae20f0781085bfaa1941543c6e5ac73 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Sun, 26 Nov 2023 15:45:28 +0800 Subject: [PATCH 25/27] fix conflict --- source/Makefile.Objects | 5 ++++- source/module_base/CMakeLists.txt | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source/Makefile.Objects b/source/Makefile.Objects index 0c3cd484d8..84a5b7cf58 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -148,7 +148,10 @@ OBJS_BASE=abfs-vector3_order.o\ spherical_bessel_transformer.o\ mixing_data.o\ para_json.o\ - + mixing.o\ + plain_mixing.o\ + pulay_mixing.o\ + broyden_mixing.o\ OBJS_CELL=atom_pseudo.o\ atom_spec.o\ diff --git a/source/module_base/CMakeLists.txt b/source/module_base/CMakeLists.txt index 92aa6a59bc..4ec79b2d47 100644 --- a/source/module_base/CMakeLists.txt +++ b/source/module_base/CMakeLists.txt @@ -55,6 +55,10 @@ add_library( formatter_contextfmt.cpp module_mixing/mixing_data.cpp para_json.cpp + module_mixing/mixing.cpp + module_mixing/plain_mixing.cpp + module_mixing/pulay_mixing.cpp + module_mixing/broyden_mixing.cpp ${LIBM_SRC} ) From f0fbbfe75c95bf618564d102568077cb4bdef4b6 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Sun, 26 Nov 2023 16:44:37 +0800 Subject: [PATCH 26/27] fix a bug --- source/module_base/para_json.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/module_base/para_json.cpp b/source/module_base/para_json.cpp index 33acbc2b21..c896c29c96 100644 --- a/source/module_base/para_json.cpp +++ b/source/module_base/para_json.cpp @@ -522,14 +522,17 @@ namespace Para_Json general_info.AddMember("device", device_g, doc.GetAllocator()); - // add Third stage:parameter in parallel: - general_info.AddMember("parallel", parallel, doc.GetAllocator()); + parallel.AddMember("drank", drank, doc.GetAllocator()); parallel.AddMember("dsize", dsize, doc.GetAllocator()); parallel.AddMember("dcolor", dcolor, doc.GetAllocator()); + + + // add Third stage:parameter in parallel: + general_info.AddMember("parallel", parallel, doc.GetAllocator()); } /** From d78a059158909196172fda990a976d18318ba9d0 Mon Sep 17 00:00:00 2001 From: StarGrys <771582678@qq.com> Date: Thu, 30 Nov 2023 15:56:26 +0800 Subject: [PATCH 27/27] adjust some comment and deleat KPT_infos and stru_infos nodes --- source/module_base/para_json.cpp | 14 +++++++------- source/module_base/para_json.h | 14 +++++++------- source/module_io/test/para_json_test.cpp | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/source/module_base/para_json.cpp b/source/module_base/para_json.cpp index c896c29c96..8fcbb85a32 100644 --- a/source/module_base/para_json.cpp +++ b/source/module_base/para_json.cpp @@ -398,16 +398,16 @@ namespace Para_Json // @param reading_information -- stru_infos: rapidjson::Value stru_infos(rapidjson::kObjectType); - rapidjson::Value ATOMIC_SPECIES(rapidjson::kArrayType); - rapidjson::Value NUMERICAL_ORBITAL; - rapidjson::Value LATTICE_CONSTANT(rapidjson::kArrayType); - rapidjson::Value ATOMIC_POSITIONS(rapidjson::kArrayType); + // rapidjson::Value ATOMIC_SPECIES(rapidjson::kArrayType); + // rapidjson::Value NUMERICAL_ORBITAL; + // rapidjson::Value LATTICE_CONSTANT(rapidjson::kArrayType); + // rapidjson::Value ATOMIC_POSITIONS(rapidjson::kArrayType); // @param reading_information -- KPT_infos rapidjson::Value KPT_infos(rapidjson::kObjectType); - rapidjson::Value total_number; - rapidjson::Value mode; - rapidjson::Value vectors(rapidjson::kArrayType); + // rapidjson::Value total_number; + // rapidjson::Value mode; + // rapidjson::Value vectors(rapidjson::kArrayType); // @param reading_information -- orb_infos rapidjson::Value orb_infos(rapidjson::kObjectType); diff --git a/source/module_base/para_json.h b/source/module_base/para_json.h index c0b5533883..b8a9be5b69 100644 --- a/source/module_base/para_json.h +++ b/source/module_base/para_json.h @@ -423,16 +423,16 @@ namespace Para_Json // @param reading_information -- stru_infos: extern rapidjson::Value stru_infos; - extern rapidjson::Value ATOMIC_SPECIES; - extern rapidjson::Value NUMERICAL_ORBITAL; - extern rapidjson::Value LATTICE_CONSTANT; - extern rapidjson::Value ATOMIC_POSITIONS; + // extern rapidjson::Value ATOMIC_SPECIES; + // extern rapidjson::Value NUMERICAL_ORBITAL; + // extern rapidjson::Value LATTICE_CONSTANT; + // extern rapidjson::Value ATOMIC_POSITIONS; // @param reading_information -- KPT_infos extern rapidjson::Value KPT_infos; - extern rapidjson::Value total_number; - extern rapidjson::Value mode; - extern rapidjson::Value vectors; + // extern rapidjson::Value total_number; + // extern rapidjson::Value mode; + // extern rapidjson::Value vectors; // @param reading_information -- orb_infos extern rapidjson::Value orb_infos; diff --git a/source/module_io/test/para_json_test.cpp b/source/module_io/test/para_json_test.cpp index 657ff731e5..cc36a18238 100644 --- a/source/module_io/test/para_json_test.cpp +++ b/source/module_io/test/para_json_test.cpp @@ -7,13 +7,13 @@ #include #include "rapidjson/document.h" /************************************************ - * unit test of Input::bcast + * unit test of Input::ParaJson ***********************************************/ /** * - Tested Functions: - * - bcast() - * - bcast input parameters to all processes + * - Init() + * - init json tree from input::Init and check if the json string is valid */ #define private public @@ -27,7 +27,7 @@ class ParaJsonTest : public ::testing::Test #ifdef __MPI -// 在这里提供 isValidJSON 函数的定义 +// check if a string is a valid JSON string bool isValidJSON(const std::string& jsonString) { rapidjson::Document document; document.Parse(jsonString.c_str());