Skip to content

Commit 6505705

Browse files
codexAroundPeking
authored andcommitted
feat(sternheimer): add analytic RPA head and wing
1 parent 79861a9 commit 6505705

9 files changed

Lines changed: 784 additions & 462 deletions

driver/main.cpp

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
#include "librpa.hpp"
2-
3-
#include "driver.h"
4-
#include "read_data.h"
5-
#include "inputfile.h"
6-
#include "task.h"
7-
81
#include <mpi.h>
92
#include <omp.h>
3+
104
#include <exception>
115
#include <stdexcept>
126
#include <string>
137

8+
#include "driver.h"
9+
#include "inputfile.h"
10+
#include "librpa.hpp"
11+
#include "read_data.h"
12+
#include "task.h"
13+
1414
// Internal headers, used here only for printing formation and some consistency check
1515
// May move to public API later
16+
#include "../src/io/fs.h"
1617
#include "../src/utils/profiler.h"
1718
#include "../src/utils/utils_mem.h"
18-
#include "../src/io/fs.h"
1919
// #include "task_qsgw.h"
2020
// #include "task_qsgwA.h"
2121
// #include "task_qsgw_band.h"
@@ -170,12 +170,16 @@ int main(int argc, char **argv)
170170
const string path_eigocc_scf = driver_params.input_dir + driver_params.fn_eigocc_scf;
171171

172172
profiler.start("driver_read_common_input_data", "Driver Read Task-Common Input Data");
173-
const bool needs_scf_eigenvalues = task != task_t::SternheimerRPA;
173+
const bool sternheimer_analytic_headwing =
174+
task == task_t::SternheimerRPA && driver::get_bool(driver::opts.replace_w_head) &&
175+
(driver::opts.option_dielect_func == 3 || driver::opts.option_dielect_func == 4);
176+
const bool needs_scf_eigenvalues =
177+
task != task_t::SternheimerRPA || sternheimer_analytic_headwing;
174178
const bool needs_standard_meanfield_data =
175-
task != task_t::print_minimax && task != task_t::SternheimerRPA;
179+
task != task_t::print_minimax &&
180+
(task != task_t::SternheimerRPA || sternheimer_analytic_headwing);
176181
const bool needs_sternheimer_symmetry_metadata =
177-
task == task_t::SternheimerRPA
178-
&& !driver_params.fn_sternheimer_partial_manifest.empty();
182+
task == task_t::SternheimerRPA && !driver_params.fn_sternheimer_partial_manifest.empty();
179183
const bool needs_structure_bz_basis =
180184
needs_standard_meanfield_data || needs_sternheimer_symmetry_metadata;
181185
if (needs_scf_eigenvalues)
@@ -224,14 +228,14 @@ int main(int argc, char **argv)
224228
{
225229
if (ret_eigenvec > 0)
226230
{
227-
lib_printf_root(LIBRPA_VERBOSE_CRITICAL, "Error in reading eigenvector files (retcode %d)\n", ret_eigenvec);
231+
lib_printf_root(LIBRPA_VERBOSE_CRITICAL,
232+
"Error in reading eigenvector files (retcode %d)\n", ret_eigenvec);
228233
}
229234
else
230235
{
231-
lib_printf_root(
232-
LIBRPA_VERBOSE_CRITICAL,
233-
"Error!!! No eigenvector files is found at directory, check if you "
234-
"have input files KS_eigenvector\n");
236+
lib_printf_root(LIBRPA_VERBOSE_CRITICAL,
237+
"Error!!! No eigenvector files is found at directory, check if you "
238+
"have input files KS_eigenvector\n");
235239
}
236240
finalize_librpa(false);
237241
return EXIT_FAILURE;
@@ -240,7 +244,8 @@ int main(int argc, char **argv)
240244

241245
profiler.start("driver_read_ri");
242246
read_ri(driver_params.input_dir, driver::opts.parallel_routing);
243-
lib_printf_root("Actual parallel routing used: %s\n", get_routing_string(driver::opts.parallel_routing).c_str());
247+
lib_printf_root("Actual parallel routing used: %s\n",
248+
get_routing_string(driver::opts.parallel_routing).c_str());
244249
profiler.stop("driver_read_ri");
245250

246251
// Vq distributed using the same strategy
@@ -253,8 +258,10 @@ int main(int argc, char **argv)
253258
if (mpi_comm_global_h.myid == 0)
254259
{
255260
const auto cputime = profiler.get_cpu_time_last("driver_read_common_input_data") / 60.0;
256-
const auto walltime = profiler.get_wall_time_last("driver_read_common_input_data") / 60.0;
257-
lib_printf("Initialization finished, Wall/CPU time [min]: %12.4f %12.4f\n", walltime, cputime);
261+
const auto walltime =
262+
profiler.get_wall_time_last("driver_read_common_input_data") / 60.0;
263+
lib_printf("Initialization finished, Wall/CPU time [min]: %12.4f %12.4f\n", walltime,
264+
cputime);
258265
}
259266
double freemem;
260267
auto flag = get_node_free_mem(freemem);

0 commit comments

Comments
 (0)