Skip to content

Commit

Permalink
print statements for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ahurta92 committed Oct 26, 2023
1 parent 4b93748 commit 7578d7c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/apps/molresponse/FrequencyResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,22 @@ auto FrequencyResponse::update_response(World &world, X_space &chi, XCOperator<d
X_space theta_X = compute_theta_X(world, x, rho_old, xc, r_params.calc_type());
X_space new_chi = bsh_update_response(world, theta_X, bsh_x_ops, bsh_y_ops, projector, x_shifts);

auto chi_norm=new_chi.norm2s();
if (world.rank()==0) {
print("new_chi_norm after bsh update: ",chi_norm);
}

inner_to_json(world, "x_new", response_context.inner(new_chi, new_chi), iter_function_data);

auto [new_res, bsh_norms] = update_residual(world, chi, new_chi, r_params.calc_type(), old_residuals, xres_old);
inner_to_json(world, "r_x", response_context.inner(new_res, new_res), iter_function_data);
X_space kain_chi;
if (iteration >= 0) {// & (iteration % 3 == 0)) {
new_chi = kain_x_space_update(world, chi, new_res, kain_x_space);
}
chi_norm=new_chi.norm2s();
if (world.rank()==0) {
print("new_chi_norm after kain update: ",chi_norm);
}

inner_to_json(world, "x_update", response_context.inner(new_chi, new_chi), iter_function_data);

Expand Down
7 changes: 6 additions & 1 deletion src/apps/molresponse/ResponseBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,6 @@ auto ResponseBase::kain_x_space_update(World &world, const X_space &chi, const X
size_t m = chi.num_states();
size_t n = chi.num_orbitals();
X_space kain_update = chi.copy();
kain_update.set_active(chi.active);
response_matrix update(m);

// compute the norm of the residuals
Expand All @@ -1205,6 +1204,12 @@ auto ResponseBase::kain_x_space_update(World &world, const X_space &chi, const X
truncate(world, kain_update.x[i]);
}
}

// print the norms of chi and chi + update




if (r_params.print_level() >= 1) { molresponse::end_timer(world, "kain_x_update", "kain_x_update", iter_timing); }
return kain_update;
}
Expand Down
2 changes: 1 addition & 1 deletion src/apps/molresponse/response_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ namespace madness {
// Mimicing standard madness calls with these 3
void zero() {
auto &world = x[0][0].world();
for (int i = 0; i < num_states; i++) { x[i] = zero_functions<double, 3>(world, num_orbitals, false); }
for (auto&i:active) { x[i] = zero_functions<double, 3>(world, num_orbitals, false); }
}

void compress_rf() {
Expand Down

0 comments on commit 7578d7c

Please sign in to comment.