Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions source/source_lcao/module_rt/velocity_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,11 @@ void Velocity_op<TR>::calculate_vcomm_r()
std::complex<double>* tmp_c[3] = {nullptr, nullptr, nullptr};
for (int i = 0; i < 3; i++)
{
tmp_c[i] = this->current_term[i]->find_matrix(iat1, iat2, R_vector[0], R_vector[1], R_vector[2])->get_pointer();
hamilt::BaseMatrix<std::complex<double>>* matrix_ptr = this->current_term[i]->find_matrix(iat1, iat2, R_vector[0], R_vector[1], R_vector[2]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this line in front of line 296 for better performance?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this line in front of line 296 for better performance?

Ok,I'll do it in the next PR.

if (matrix_ptr != nullptr)
{
tmp_c[i] = matrix_ptr->get_pointer();
}
}
// if not found , skip this pair of atoms
if (tmp_c[0] != nullptr)
Expand Down Expand Up @@ -432,7 +436,11 @@ void Velocity_op<TR>::calculate_grad_term()
std::complex<double>* tmp_c[3] = {nullptr, nullptr, nullptr};
for (int i = 0; i < 3; i++)
{
tmp_c[i] = this->current_term[i]->find_matrix(iat1, iat2, R_index2)->get_pointer();
hamilt::BaseMatrix<std::complex<double>>* matrix_ptr = this->current_term[i]->find_matrix(iat1, iat2, R_index2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this line in front of line 437 for better performance?

if (matrix_ptr != nullptr)
{
tmp_c[i] = matrix_ptr->get_pointer();
}
}
if (tmp_c[0] != nullptr)
{
Expand Down
Loading